diff -urN xc-clean/config/cf/linux.cf xc/config/cf/linux.cf
--- xc-clean/config/cf/linux.cf	Thu Dec 14 11:24:08 2000
+++ xc/config/cf/linux.cf	Tue Feb 20 16:08:57 2001
@@ -191,7 +191,7 @@
 #if LinuxCLibMajorVersion >= 6
 # define LinuxSourceDefines	-D_POSIX_C_SOURCE=199309L \
 				-D_POSIX_SOURCE -D_XOPEN_SOURCE \
-				-D_BSD_SOURCE -D_SVID_SOURCE \
+				-D_BSD_SOURCE -D_SVID_SOURCE -D__NO_STRING_INLINES \
 				LinuxAdditionalIncludes LinuxGnuSourceDefines \
 				LinuxLocaleDefines
 # define XawI18nDefines		-DHAS_WCHAR_H -DHAS_WCTYPE_H -DNO_WIDEC_H
@@ -209,7 +209,7 @@
 # endif
 #else
 # define LinuxSourceDefines	-D_POSIX_SOURCE -D_POSIX_C_SOURCE=2 \
-				-D_BSD_SOURCE -D_SVID_SOURCE \
+				-D_BSD_SOURCE -D_SVID_SOURCE -D__NO_STRING_INLINES \
 				LinuxGnuSourceDefines LinuxLocaleDefines
 # define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
 # ifndef HasLibCrypt
diff -urN xc-clean/config/cf/xf86site.def xc/config/cf/xf86site.def
--- xc-clean/config/cf/xf86site.def	Thu Dec 14 11:24:16 2000
+++ xc/config/cf/xf86site.def	Tue Feb 20 16:08:57 2001
@@ -256,7 +256,7 @@
 				cirrus tseng trident chips apm \
 				GlideDriver fbdev i128 \
 				ati AgpGartDrivers DevelDrivers ark cyrix \
-				siliconmotion \
+				siliconmotion vmware \
 				vesa vga XF86OSCardDrivers XF86ExtraCardDrivers
  */
 
diff -urN xc-clean/config/cf/xfree86.cf xc/config/cf/xfree86.cf
--- xc-clean/config/cf/xfree86.cf	Thu Dec 14 11:24:17 2000
+++ xc/config/cf/xfree86.cf	Tue Feb 20 16:08:57 2001
@@ -210,7 +210,7 @@
 # ifndef XF86CardDrivers
 #  define XF86CardDrivers	mga glint nv tga s3virge sis rendition \
 				neomagic i740 tdfx savage \
-				cirrus tseng trident chips apm \
+				cirrus vmware tseng trident chips apm \
 				GlideDriver fbdev i128 \
 				ati AgpGartDrivers DevelDrivers ark cyrix \
 				siliconmotion \
diff -urN xc-clean/programs/Xserver/hw/xfree86/Registry xc/programs/Xserver/hw/xfree86/Registry
--- xc-clean/programs/Xserver/hw/xfree86/Registry	Sat Sep 25 07:36:55 1999
+++ xc/programs/Xserver/hw/xfree86/Registry	Tue Feb 20 16:08:57 2001
@@ -29,6 +29,7 @@
 type1
 vga
 vgahw
+vmware
 xaa
 xf1bpp
 xf4bpp
@@ -52,6 +53,7 @@
 tseng
 vga
 vgahw
+vmware
 xaa
 xf1bpp
 xf4bpp
diff -urN xc-clean/programs/Xserver/hw/xfree86/XF86Config.cpp xc/programs/Xserver/hw/xfree86/XF86Config.cpp
--- xc-clean/programs/Xserver/hw/xfree86/XF86Config.cpp	Tue Dec 12 15:59:51 2000
+++ xc/programs/Xserver/hw/xfree86/XF86Config.cpp	Tue Feb 20 16:08:57 2001
@@ -1584,6 +1584,7 @@
 v4l(__drivermansuffix__),
 vesa(__drivermansuffix__),
 vga(__drivermansuffix__),
+vmware(__drivermansuffix__),
 .br
 README
 .IR <http://www.xfree86.org/current/README.html> ,
diff -urN xc-clean/programs/Xserver/hw/xfree86/XF86Config.cpp~ xc/programs/Xserver/hw/xfree86/XF86Config.cpp~
--- xc-clean/programs/Xserver/hw/xfree86/XF86Config.cpp~	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/XF86Config.cpp~	Tue Dec 12 15:59:51 2000
@@ -0,0 +1,1607 @@
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.13 2000/12/11 20:18:01 dawes Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH XF86Config __filemansuffix__ "Version 4.0.2"  "XFree86"
+.SH NAME
+XF86Config - Configuration File for XFree86
+.SH DESCRIPTION
+.I XFree86
+uses a configuration file called
+.B XF86Config
+for its initial setup.  This configuration file is searched for in the
+following places when the server is started as a normal user:
+.PP
+.RS 4
+.nf
+.RI /etc/X11/ <cmdline>
+.RI __projectroot__/etc/X11/ <cmdline>
+.RB /etc/X11/ $XF86CONFIG
+.RB __projectroot__/etc/X11/ $XF86CONFIG
+/etc/X11/XF86Config-4
+/etc/X11/XF86Config
+/etc/XF86Config
+.RI __projectroot__/etc/X11/XF86Config. <hostname>
+__projectroot__/etc/X11/XF86Config-4
+__projectroot__/etc/X11/XF86Config
+.RI __projectroot__/lib/X11/XF86Config. <hostname>
+__projectroot__/lib/X11/XF86Config-4
+__projectroot__/lib/X11/XF86Config
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is a relative path (with no ".." components) specified with the
+.B \-xf86config
+command line option,
+.B $XF86CONFIG
+is the relative path (with no ".." components) specified by that
+environment variable, and
+.I <hostname>
+is the machines 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 <cmdline>
+.RI /etc/X11/ <cmdline>
+.RI __projectroot__/etc/X11/ <cmdline>
+.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. <hostname>
+__projectroot__/etc/X11/XF86Config-4
+__projectroot__/etc/X11/XF86Config
+.RI __projectroot__/lib/X11/XF86Config. <hostname>
+__projectroot__/lib/X11/XF86Config-4
+__projectroot__/lib/X11/XF86Config
+.fi
+.RE
+.PP
+where
+.I <cmdline>
+is the path specified with the
+.B \-xf86config
+command line option (which may be absolute or relative),
+.B $XF86CONFIG
+is the path specified by that
+environment variable (absolute or relative),
+.B $HOME
+is the path specified by that environment variable (usually the home
+directory), and
+.I <hostname>
+is the machines hostname as reported by gethostname(3).
+.PP
+The
+.B XF86Config
+file is composed of a number of sections which may be present in any
+order.  Each section has
+the form:
+.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
+    ...
+.B EndSection
+.fi
+.RE
+.PP
+The section names are:
+.PP
+.RS 4
+.nf
+.BR "Files          " "File pathnames"
+.BR "ServerFlags    " "Server flags"
+.BR "Module         " "Dynamic module loading"
+.BR "InputDevice    " "Input device description"
+.BR "Device         " "Graphics device description"
+.BR "VideoAdaptor   " "Xv video adaptor description"
+.BR "Monitor        " "Monitor description"
+.BR "Modes          " "Video modes descriptions"
+.BR "Screen         " "Screen configuration"
+.BR "ServerLayout   " "Overall layout"
+.BR "DRI            " "DRI-specific configuration"
+.BR "Vendor         " "Vendor-specific configuration"
+.fi
+.RE
+.PP
+The following obsolete section names are still recognised for compatibility
+purposes.  In new config files, the
+.B InputDevice
+section should be used instead.
+.PP
+.RS 4
+.nf
+.BR "Keyboard       " "Keyboard configuration"
+.BR "Pointer        " "Pointer/mouse configuration"
+.fi
+.RE
+.PP
+The old
+.B XInput
+section is no longer recognised.
+.PP
+The
+.B ServerLayout
+sections are at the highest level.  They bind together the input and
+output devices that will be used in a session.  The input devices
+are described in the
+.B InputDevice
+sections.  Output devices usually consist of multiple independent
+components (e.g., and graphics board and a monitor).  These multiple
+components are bound together in the
+.B Screen
+sections, and it is these that are referenced by the
+.B ServerLayout
+section.  Each
+.B Screen
+section binds together a graphics board and a monitor.  The graphics
+boards are described in the
+.B Device
+sections, and the monitors are described in the
+.B Monitor
+sections.
+.PP
+Config file keywords are case-insensitive, and "_" characters are
+ignored.  Most strings (including
+.B Option
+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.
+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:
+.PP
+.RS 4
+.nf
+.BR "Integer     " "an integer number in decimal, hex or octal"
+.BR "Real        " "a floating point number"
+.BR "String      " "a string enclosed in double quote marks (\*q)"
+.fi
+.RE
+.PP
+Note: hex integer values must be prefixed with "0x", and octal values
+with "0".
+.PP
+A special keyword called
+.B Option
+may be used to provide free-form data to various components of the server.
+The
+.B Option
+keyword takes either one or two string arguments.  The first is the option
+name, and the optional second argument is the option value.  Some commonly
+used option value types include:
+.PP
+.RS 4
+.nf
+.BR "Integer     " "an integer number in decimal, hex or octal"
+.BR "Real        " "a floating point number"
+.BR "String      " "a sequence of characters"
+.BR "Boolean     " "a boolean value (see below)"
+.BR "Frequency   " "a frequency value (see below)"
+.fi
+.RE
+.PP
+Note that
+.I all
+.B Option
+values, not just strings, must be enclosed in quotes.
+.PP
+Boolean options may optionally have a value specified.  When no value
+is specified, the option's value is
+.BR TRUE .
+The following boolean option values are recognised as
+.BR TRUE :
+.PP
+.RS 4
+.BR 1 ,
+.BR on ,
+.BR true ,
+.B yes
+.RE
+.PP
+and the following boolean option values are recognised as
+.BR FALSE :
+.PP
+.RS 4
+.BR 0 ,
+.BR off ,
+.BR false ,
+.B no
+.RE
+.PP
+If an option name is prefixed with
+.RB \*q No \*q,
+then the option value is negated.
+.PP
+Example: the following option entries are equivalent:
+.PP
+.RS 4
+.nf
+.B "Option \*qAccel\*q   \*qOff\*q"
+.B "Option \*qNoAccel\*q"
+.B "Option \*qNoAccel\*q \*qOn\*q"
+.B "Option \*qAccel\*q   \*qfalse\*q"
+.B "Option \*qAccel\*q   \*qno\*q"
+.fi
+.RE
+.PP
+Frequency option values consist of a real number that is optionally
+followed by one of the following frequency units:
+.PP
+.RS 4
+.BR Hz ,
+.BR k ,
+.BR kHz ,
+.BR M ,
+.B MHz
+.RE
+.PP
+When the unit name is omitted, the correct units will be determined from
+the value and the expectations of the appropriate range of the value.
+It is recommended that the units always be specified when using frequency
+option values to avoid any errors in determining the value.
+.SH FILES SECTION
+The
+.B Files
+section is used to specify some path names required by the server.
+Some of these paths can also be set from the command line (see
+.I Xserver(1)
+and
+.IR XFree86(1) ).
+The command line settings override the values specified in the config
+file.
+The entries that can appear in this section are:
+.TP 7
+.BI "FontPath \*q" path \*q
+sets the search path for fonts.  This path is a comma separated
+list of font path elements which the X server searches for font databases.
+Multiple
+.B FontPath
+entries may be specified, and they will be
+concatenated to build up the fontpath used by the server.
+Font path elements may be either absolute directory paths, or
+a font server identifier.  Font server identifiers have the form:
+.PP
+.RS 11
+.IR <trans> / <hostname> : <port-number>
+.RE
+.PP
+.RS 7
+where
+.I <trans>
+is the transport type to use to connect to the font server (e.g.,
+.B unix
+for UNIX-domain sockets or
+.B tcp
+for a TCP/IP connection),
+.I <hostname>
+is the hostname of the machine running the font server, and
+.I <port-number>
+is the port number that the font server is listening on (usually 7100).
+.PP
+When this entry is not specified in the config file, the server falls back
+to the compiled-in default font path, which contains the following
+font path elements:
+.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/
+.fi
+.RE
+.PP
+The recommended font path contains the following font path elements:
+.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/
+.fi
+.RE
+.PP
+Font path elements that are found to be invalid are removed from the
+font path when the server starts up.
+.RE
+.TP 7
+.BI "RGBPath \*q" path \*q
+sets the path name for the RGB color database.
+When this entry is not specified in the config file, the server falls back
+to the compiled-in default RGB path, which is:
+.PP
+.RS 11
+__projectroot__/lib/X11/rgb
+.RE
+.TP 7
+.BI "ModulePath \*q" path \*q
+sets the search path for loadable X server modules.  This path is a
+comma separated list of directories which the X server searches for
+loadable modules loading in the order specified.  Multiple
+.B ModulePath
+entries may be specified, and they will be concatenated to build the
+module search path used by the server.
+.\" The LogFile keyword is not currently implemented
+.ig
+.TP 7
+.BI "LogFile \*q" path \*q
+sets the name of the X server log file.  The default log file name is
+.PP
+.RS 11
+.RI __logdir__/XFree86. <n> .log
+.RE
+.PP
+.RS 7
+where
+.I <n>
+is the display number for the X server.
+..
+.SH SERVERFLAGS SECTION
+The
+.B ServerFlags
+section is used to specify some global
+X server options.  All of the entries in this section are
+.BR Options ,
+although for compatibility purposes some of the old style entries are
+still recognised.  Those old style entries are not documented here, and
+using them is discouraged.
+.PP
+.B Options
+specified in this section may be overridden by
+.B Options
+specified in the active
+.B ServerLayout
+section.  Options with command line equivalents are overridden when their
+command line equivalent is used.  The options recognised by this section
+are:
+.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
+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 \*qDontZap\*q  \*q" boolean \*q
+This disallows the use of the
+.B Ctrl+Alt+Backspace
+sequence.  That sequence is normally used to terminate the X server.
+When this option is enabled, that key sequence has no special meaning
+and is passed to clients.  Default: off.
+.TP 7
+.BI "Option \*qDontZoom\*q  \*q" boolean \*q
+This disallows the use of the
+.B Ctrl+Alt+Keypad-Plus
+and
+.B Ctrl+Alt+Keypad-Minus
+sequences.  These sequences allows you to switch between video modes.
+When this option is enabled, those key sequences have no special meaning
+and are passed to clients.  Default: off.
+.TP 7
+.BI "Option \*qDisableVidModeExtension\*q  \*q" boolean \*q
+This disables the parts of the VidMode extension used by the xvidtune client
+that can be used to change the video modes.  Default: the VidMode extension
+is enabled.
+.TP 7
+.BI "Option \*qAllowNonLocalXvidtune\*q  \*q" boolean \*q
+This allows the xvidtune client (and other clients that use the VidMode
+extension) to connect from another host.  Default: off.
+.TP 7
+.BI "Option \*qDisableModInDev\*q  \*q" boolean \*q
+This disables the parts of the XFree86-Misc extension that can be used to
+modify the input device settings dynamically.  Default: that functionality
+is enabled.
+.TP 7
+.BI "Option \*qAllowNonLocalModInDev\*q  \*q" boolean \*q
+This allows a client to connect from another host and change keyboard
+and mouse settings in the running server.  Default: off.
+.TP 7
+.BI "Option \*qAllowMouseOpenFail\*q  \*q" boolean \*q
+This allows the server to start up even if the mouse device can't be
+opened/initialised.  Default: false.
+.TP 7
+.BI "Option \*qVTInit\*q  \*q" command \*q
+Runs
+.I command
+after the VT used by the server has been opened.
+The command string is passed to "/bin/sh -c", and is run with the
+real user's id with stdin and stdout set to the VT.  The purpose
+of this option is to allow system dependent VT initialisation
+commands to be run.  This option should rarely be needed.  Default: not set.
+.TP 7
+.BI "Option \*qVTSysReq\*q  \*q" boolean \*q
+enables the SYSV-style VT switch sequence for non-SYSV systems
+which support VT switching.  This sequence is
+.B Alt-SysRq
+followed
+by a function key
+.RB ( Fn ).
+This prevents the X server trapping the
+keys used for the default VT switch sequence, which means that clients can
+access them.  Default: off.
+.\" The following four options are "undocumented".
+.ig
+.TP 7
+.BI "Option \*qPciProbe1\*q"
+Use PCI probe method 1.  Default: set.
+.TP 7
+.BI "Option \*qPciProbe2\*q"
+Use PCI probe method 2.  Default: not set.
+.TP 7
+.BI "Option \*qPciForceConfig1\*q"
+Force the use PCI config type 1.  Default: not set.
+.TP 7
+.BI "Option \*qPciForceConfig2\*q"
+Force the use PCI config type 2.  Default: not set.
+..
+.TP 7
+.BI "Option \*qBlankTime\*q  \*q" time \*q
+sets the inactivity timeout for the blanking phase of the screensaver.
+.I time
+is in minutes.  This is equivalent to the Xserver's `-s' flag, and the
+value can be changed at run-time with \fIxset(1)\fP.  Default: 10 minutes.
+.TP 7
+.BI "Option \*qStandbyTime\*q  \*q" time \*q
+sets the inactivity timeout for the "standby" phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run-time with \fIxset(1)\fP.
+Default: 20 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.  It is only enabled for screens that
+have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below). 
+.TP 7
+.BI "Option \*qSuspendTime\*q  \*q" time \*q
+sets the inactivity timeout for the "suspend" phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run-time with \fIxset(1)\fP.
+Default: 30 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.  It is only enabled for screens that
+have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below). 
+.TP 7
+.BI "Option \*qOffTime\*q  \*q" time \*q
+sets the inactivity timeout for the "off" phase of DPMS mode.
+.I time
+is in minutes, and the value can be changed at run-time with \fIxset(1)\fP.
+Default: 40 minutes.
+This is only suitable for VESA DPMS compatible monitors, and may not be
+supported by all video drivers.  It is only enabled for screens that
+have the
+.B \*qDPMS\*q
+option set (see the MONITOR section below). 
+.TP 7
+.BI "Option \*qPixmap\*q  \*q" bpp \*q
+This sets the pixmap format to use for depth 24.  Allowed values for
+.I bpp
+are 24 and 32.  Default: 32 unless driver constraints don't allow this
+(which is rare).  Note: some clients don't behave well when
+this value is set to 24.
+.TP 7
+.BI "Option \*qPC98\*q  \*q" boolean \*q
+Specify that the machine is a Japanese PC-98 machine.  This should not
+be enabled for anything other than the Japanese-specific PC-98
+architecture.  Default: auto-detected.
+.\" Doubt this should be documented.
+.ig
+.TP 7
+.BI "Option \*qEstimateSizesAggressively\*q  \*q" value \*q
+This option affects the way that bus resource sizes are estimated.  Default: 0.
+..
+.TP 7
+.BI "Option \*qNoPM\*q  \*q" boolean \*q
+Disables something to do with power management events.  Default: PM enabled
+on platforms that support it.
+.TP 7
+.BI "Option \*qXinerama\*q  \*q" boolean \*q
+enable or disable XINERAMA extension. Default is disabled. 
+.SH MODULE SECTION
+The
+.B Module
+section is used to specify which X server modules should be loaded.
+This section is ignored when the X server is built in static form.
+The types of modules normally loaded in this section are X server
+extension modules, and font rasteriser modules.  Most other module types
+are loaded automatically when they are needed via other mechanisms.
+.PP
+Entries in this section may be in two forms.   The first and most commonly
+used form is an entry that uses the
+.B Load
+keyword, as described here:
+.TP 7
+.BI "Load  \*q" modulename \*q
+This instructs the server to load the module called
+.IR modulename .
+The module name given should be the module's standard name, not the
+module file name.  The standard name is case-sensitive, and does not
+include the "lib" prefix, or the ".a", ".o", or ".so" suffixes.
+.PP
+.RS 7
+Example: the Type 1 font rasteriser can be loaded with the following entry:
+.PP
+.RS 4
+.B "Load \*qtype1\*q"
+.RE
+.RE
+.PP
+The second form of entry is a
+.BR SubSection,
+with the subsection name being the module name, and the contents of the
+.B SubSection
+being
+.B Options
+that are passed to the module when it is loaded.
+.PP
+Example: the extmod module (which contains a miscellaneous group of
+server extensions) can be loaded, with the XFree86-DGA extension
+disabled by using the following entry:
+.PP
+.RS 4
+.nf
+.B "SubSection \*qextmod\*q"
+.B "   Option  \*qomit XFree86-DGA\*q"
+.B EndSubSection
+.fi
+.RE
+.PP
+Modules are searched for in each directory specified in the
+.B ModulePath
+search path, and in the drivers, input, extensions, fonts, and
+internal subdirectories of each of those directories.
+In addition to this, operating system specific subdirectories of all
+the above are searched first if they exist.
+.PP
+To see what font and extension modules are available, check the contents
+of the following directories:
+.PP
+.RS 4
+.nf
+__projectroot__/lib/modules/fonts
+__projectroot__/lib/modules/extensions
+.fi
+.RE
+.PP
+The "bitmap" font modules is loaded automatically.  It is recommended
+that at very least the "extmod" extension module be loaded.  If it isn't
+some commonly used server extensions (like the SHAPE extension) will not be
+available.
+.SH INPUTDEVICE SECTION
+The config file may have multiple
+.B InputDevice
+sections.  There will normally be at least two: one for the core (primary)
+keyboard, and one of the core pointer.
+.PP
+.B InputDevice
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qInputDevice\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Driver     \*q" inputdriver \*q
+.I  "    options"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this input device.  The
+.B Driver
+entry specifies the name of the driver to use for this input device.
+When using the loadable server, the input driver module
+.RI \*q inputdriver \*q
+will be loaded for each active
+.B InputDevice
+section.  An
+.B InputDevice
+section is considered active if it is referenced by an active
+.B ServerLayout
+section, or if it is referenced by the
+.B \-keyboard
+or
+.B \-pointer
+command line options.
+The most commonly used input drivers are "keyboard" and "mouse".
+.PP
+.B InputDevice
+sections recognise some driver-independent
+.BR Options ,
+which are described here.  See the individual input driver manual pages
+for a description of the device-specific options.
+.TP 7
+.BI "Option \*qCorePointer\*q"
+When this is set, the input device is installed as the core (primary)
+pointer device.  There must be exactly one core pointer.  If this option
+is not set here, or in the
+.B ServerLayout
+section, or from the
+.B \-pointer
+command line option, then the first input device that is capable of
+being used as a core pointer will be selected as the core pointer.
+This option is implicitly set when the obsolete
+.B Pointer
+section is used.
+.TP 7
+.BI "Option \*qCoreKeyboard\*q"
+When this is set, the input device is to be installed as the core
+(primary) keyboard device.  There must be exactly one core keyboard.  If
+this option is not set here, in the
+.B ServerLayout
+section, or from the
+.B \-keyboard
+command line option, then the first input device that is capable of
+being used as a core keyboard will be selected as the core keyboard.
+This option is implicitly set when the obsolete
+.B Keyboard
+section is used.
+.TP 7
+.BI "Option \*qAlwaysCore\*q  \*q" boolean \*q
+.TP 7
+.BI "Option \*qSendCoreEvents\*q  \*q" boolean \*q
+Both of these options are equivalent, and when enabled cause the
+input device to always report core events.  This can be used, for
+example, to allow an additional pointer device to generate core
+pointer events (like moving the cursor, etc).
+.TP 4
+.BI "Option \*qHistorySize\*q  \*q" number \*q
+Sets the motion history size.  Default: 0.
+.TP 7
+.BI "Option \*qSendDragEvents\*q  \*q" boolean \*q
+???
+.SH DEVICE SECTION
+The config file may have multiple
+.B Device
+sections.  There must be at least one, for the video card being used.
+.PP
+.B Device
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qDevice\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Driver     \*q" driver \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this graphics device.  The
+.B Driver
+entry specifies the name of the driver to use for this graphics device.
+When using the loadable server, the driver module
+.RI \*q driver \*q
+will be loaded for each active
+.B Device
+section.  A
+.B Device
+section is considered active if it is referenced by an active
+.B Screen
+section.
+.PP
+.B Device
+sections recognise some driver-independent entries and
+.BR Options ,
+which are described here.  Not all drivers make use of these
+driver-independent entries, and many of those that do don't require them
+to be specified because the information is auto-detected.  See the
+individual graphics driver manual pages for further information about
+this, and for a description of the device-specific options.
+Note that most of the
+.B Options
+listed here (but not the other entries) may be specified in the
+.B Screen
+section instead of here in the
+.B Device
+section.
+.TP 7
+.BI "BusID  \*q" bus-id \*q
+This specifies the bus location of the graphics card.  For PCI/AGP cards,
+the
+.I bus-id
+string has the form
+.BI PCI: bus : device : function
+(e.g., "PCI:1:0:0" might be appropriate for an AGP card).
+This field is usually optional in single-head configurations when using
+the primary graphics card.  In multi-head configurations, or when using
+a secondary graphics card in a single-head configuration, this entry is
+mandatory.  Its main purpose is to make an unambiguous connection between
+the device section and the hardware it is representing.  This information
+can usually be found by running the X server with the
+.B \-scanpci
+command line option.
+.TP 7
+.BI "Screen  " number
+This option is mandatory for cards where a single PCI entity can drive more
+than one display (i.e., multiple CRTCs sharing a single graphics accelerator
+and video memory).  One
+.B Device
+section is required for each head, and this
+parameter determines which head each of the
+.B Device
+sections applies to.  The legal values of
+.I number
+range from 0 to one less than the total number of heads per entity.
+Most drivers require that the primary screen (0) be present.
+.TP 7
+.BI "Chipset  \*q" chipset \*q
+This usually optional entry specifies the chipset used on the graphics
+board.  In most cases this entry is not required because the drivers
+will probe the hardware to determine the chipset type.  Don't
+specify it unless the driver-specific documentation recommends that you
+do.
+.TP 7
+.BI "Ramdac  \*q" ramdac-type \*q
+This optional entry specifies the type of RAMDAC used on the graphics
+board.  This is only used by a few of the drivers, and in most cases it
+is not required because the drivers will probe the hardware to determine
+the RAMDAC type where possible.  Don't specify it unless the
+driver-specific documentation recommends that you do.
+.TP 7
+.BI "DacSpeed  " speed
+.TP 7
+.BI "DacSpeed  " "speed-8 speed-16 speed-24 speed-32"
+This optional entry specifies the RAMDAC speed rating (which is usually
+printed on the RAMDAC chip).  The speed is in MHz.  When one value is
+given, it applies to all framebuffer pixel sizes.  When multiple values
+are give, they apply to the framebuffer pixel sizes 8, 16, 24 and 32
+respectively.  This is not used by many drivers, and only needs to be
+specified when the speed rating of the RAMDAC is different from the
+defaults built in to driver, or when the driver can't auto-detect the
+correct defaults.  Don't specify it unless the driver-specific
+documentation recommends that you do.
+.TP 7
+.BI "Clocks  " "clock ..."
+specifies the pixel that are on your graphics board.  The clocks are in
+MHz, and may be specified as a floating point number.  The value is
+stored internally to the nearest kHz.  The ordering of the clocks is
+important.  It must match the order in which they are selected on the
+graphics board.  Multiple
+.B Clocks
+lines may be specified, and each is concatenated to form the list.  Most
+drivers do not use this entry, and it is only required for some older
+boards with non-programmable clocks.  Don't specify this entry unless
+the driver-specific documentation explicitly recommends that you do.
+.TP
+.BI "ClockChip  \*q" clockchip-type \*q
+This optional entry is used to specify the clock chip type on
+graphics boards which have a programmable clock generator.  Only
+a few X servers support programmable clock chips.  For details,
+see the appropriate X server manual page.
+.TP 7
+.BI "VideoRam  " "mem"
+This optional entry specifies the amount of video ram that is installed
+on the graphics board. This is measured in kBytes.  In most cases this
+is not required because the X server probes the graphics board to
+determine this quantity.  The driver-specific documentation should
+indicate when it might be needed.
+.TP 7
+.BI "BiosBase  " "baseaddress"
+This optional entry specifies the base address of the video BIOS
+for the VGA board.  This address is normally auto-detected, and should
+only be specified if the driver-specific documentation recommends it.
+.TP 7
+.BI "MemBase  " "baseaddress"
+This optional entry specifies the memory base address of a graphics
+board's linear frame buffer.  This entry is not used by many drivers,
+and it should only be specified if the driver-specific documentation
+recommends it.
+.TP 7
+.BI "IOBase  " "baseaddress"
+This optional entry specifies the IO base address.  This entry is not
+used by many drivers, and it should only be specified if the
+driver-specific documentation recommends it.
+.TP 7
+.BI "ChipID  " "id"
+This optional entry specifies a numerical ID representing the chip type.
+For PCI cards, it is usually the device ID.  This can be used to override
+the auto-detection, but that should only be done when the driver-specific
+documentation recommends it.
+.TP 7
+.BI "ChipRev  " "rev"
+This optional entry specifies the chip revision number.  This can be
+used to override the auto-detection, but that should only be done when
+the driver-specific documentation recommends it.
+.TP 7
+.BI "TextClockFreq  " "freq"
+This optional entry specifies the pixel clock frequency that is used
+for the regular text mode.  The frequency is specified in MHz.  This is
+rarely used.
+.ig
+.TP 7
+This optional entry allows an IRQ number to be specified.
+..
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Device
+sections.  These include driver-specific options and driver-independent
+options.  The former are described in the driver-specific documentation.
+Some of the latter are described below in the section about the
+.B Screen
+section, and they may also be included here.
+
+.SH VIDEOADAPTOR SECTION
+Nobody wants to say how this works.  Maybe nobody knows ...
+
+.SH MONITOR SECTION
+The config file may have multiple
+.B Monitor
+sections.  There must be at least one, for the monitor being used.
+.PP
+.B Monitor
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qMonitor\*q"
+.BI "    Identifier \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this monitor.  The
+.B Monitor
+section provides information about the specifications of the monitor,
+monitor-specific
+.BR Options ,
+and information about the video modes to use with the monitor.  Specifying
+video modes is optional because the server now has a built-in list of
+VESA standard modes.  When modes are specified explicitly in the
+.B Monitor
+section (with the
+.BR Modes ,
+.BR ModeLine ,
+or
+.B UseModes
+keywords), built-in modes with the same names are not included.  Built-in
+modes with different names are, however, still implicitly included.
+.PP
+The entries that may be used in
+.B Monitor
+sections are described below.
+.TP 7
+.BI "VendorName  \*q" vendor \*q
+This optional entry specifies the monitor's manufacturer.
+.TP 7
+.BI "ModelName  \*q" model \*q
+This optional entry specifies the monitor's model.
+.TP 7
+.BI "HorizSync  " "horizsync-range"
+gives the range(s) of horizontal sync frequencies supported by the
+monitor.
+.I horizsync-range
+may be a comma separated list of either discrete values or ranges of
+values.  A range of values is two values separated by a dash.  By default
+the values are in units of kHz.  They may be specified in MHz or Hz if
+.B MHz
+or
+.B Hz
+is added to the end of the line.  The data given here is used by the X
+server to determine if video modes are within the specifications of the
+monitor.  This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 28\-33kHz is used.
+.TP 7
+.BI "VertRefresh  " "vertrefresh-range"
+gives the range(s) of vertical refresh frequencies supported by the
+monitor.
+.I vertrefresh-range
+may be a comma separated list of either discrete values or ranges of
+values.  A range of values is two values separated by a dash.  By default
+the values are in units of Hz.  They may be specified in MHz or kHz if
+.B MHz
+or
+.B kHz
+is added to the end of the line.  The data given here is used by the X
+server to determine if video modes are within the specifications of the
+monitor.  This information should be available in the monitor's handbook.
+If this entry is omitted, a default range of 43-72Hz is used.
+.TP 7
+.BI "Gamma  " "gamma-value"
+.TP 7
+.BI "Gamma  " "red-gamma green-gamma blue-gamma"
+This is an optional entry that can be used to specify the gamma
+correction for the monitor.  It may be specified as either a single
+value or as three separate RGB values.  The values should be in the range
+0.1 to 10.0, and the default is 1.0.  Not all drivers are capable
+of using this information.
+.TP 7
+.BI "UseModes  \*q" modesection-id \*q
+Include the set of modes listed in the
+.B Modes
+section called
+.IR modesection-id.
+This make all of the modes defined in that section available for use
+by this monitor.
+.TP 7
+.B Mode \fI"name"\fP
+This is an optional multi-line entry that can be used to provide
+definitions for video modes for the monitor.  In most cases this isn't
+necessary because the built-in set of VESA standard modes will be
+sufficient.  The
+.B Mode
+keyword indicates the start of a multi-line video mode description.
+The mode description is terminated with the
+.B EndMode
+keyword.  The mode description consists of the following entries:
+.RS 7
+.TP 4
+.BI "DotClock  " clock
+is the dot (pixel) clock rate to be used for the mode.
+.TP 4
+.BI "HTimings  " "hdisp hsyncstart hsyncend htotal"
+specifies the horizontal timings for the mode.
+.TP 4
+.BI "VTimings  " "vdisp vsyncstart vsyncend vtotal"
+specifies the vertical timings for the mode.
+.TP 4
+.BI "Flags  \*q" flag \*q " ..."
+specifies an optional set of mode flags, each of which is a separate
+string in double quotes.
+.B \*qInterlace\*q
+indicates that the mode is interlaced.
+.B \*qDoubleScan\*q
+indicates a mode where each scanline is doubled.
+.B \*q+HSync\*q
+and
+.B \*q\-HSync\*q
+can be used to select the polarity of the HSync signal.
+.B \*q+VSync\*q
+and
+.B \*q\-VSync\*q
+can be used to select the polarity of the VSync signal.
+.B \*qComposite\*q
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B \*q+CSync\*q
+and
+.B \*q\-CSync\*q
+may be used to select the composite sync polarity.
+.TP 4
+.BI "HSkew  " hskew
+specifies the number of pixels (towards the right edge of the screen)
+by which the display enable signal is to be skewed.  Not all drivers
+use this information.  This option might become necessary to override
+the default value supplied by the server (if any).  "Roving" horizontal
+lines indicate this value needs to be increased.  If the last few pixels
+on a scan line appear on the left of the screen, this value should be
+decreased.
+.TP 4
+.BI "VScan  " vscan
+specifies the number of times each scanline is painted on the screen.
+Not all drivers use this information.  Values less than 1 are treated
+as 1, which is the default.  Generally, the
+.B \*qDoubleScan\*q
+.B Flag
+mentioned above doubles this value.
+.RE
+.TP 7
+.BI "ModeLine  \*q" name \*q " mode-description"
+This entry is a more compact version of the
+.B Mode
+entry, and it also can be used to specify video modes for the monitor.
+is a single line format for specifying video modes.  In most cases this
+isn't necessary because the built-in set of VESA standard modes will be
+sufficient.
+.PP
+.RS 7
+The
+.I mode-description
+is in four sections, the first three of which are mandatory.  The first
+is the dot (pixel) clock.  This is a single number specifying the pixel
+clock rate for the mode in MHz.  The second section is a list of four
+numbers specifying the horizontal timings.  These numbers are the
+.IR hdisp ,
+.IR hsyncstart ,
+.IR hsyncend ,
+and
+.I htotal
+values.  The third section is a list of four numbers specifying the
+vertical timings.  These numbers are the
+.IR vdisp ,
+.IR vsyncstart ,
+.IR vsyncend ,
+and
+.I vtotal
+values.  The final section is a list of flags specifying other
+characteristics of the mode.
+.B Interlace
+indicates that the mode is interlaced.
+.B DoubleScan
+indicates a mode where each scanline is doubled.
+.B +HSync
+and
+.B \-HSync
+can be used to select the polarity of the HSync signal.
+.B +VSync
+and
+.B \-VSync
+can be used to select the polarity of the VSync signal.
+.B Composite
+can be used to specify composite sync on hardware where this is supported.
+Additionally, on some hardware,
+.B +CSync
+and
+.B \-CSync
+may be used to select the composite sync polarity.  The
+.B HSkew
+and
+.B VScan
+options mentioned above in the
+.B Modes
+entry description can also be used here.
+.RE
+.TP 7
+.B Options
+Some
+.B Option
+flags that may be useful to include in
+.B Monitor
+sections (when needed) include
+.BR \*qDPMS\*q ,
+and
+.BR \*qSyncOnGreen\*q .
+
+.SH MODES SECTION
+The config file may have multiple
+.B Modes
+sections, or none.  These sections provide a way of defining sets of
+video modes independently of the
+.B Monitor
+sections.
+.B Monitor
+sections may include the definitions provided in these sections by
+using the
+.B UseModes
+keyword.  In most cases the
+.B Modes
+sections are not necessary because the built-in set of VESA standard modes
+will be sufficient.
+.PP
+.B Modes
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qModes\*q"
+.BI "    Identifier \*q" name \*q
+.I  "    entries"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this set of mode descriptions.
+The other entries permitted in
+.B Modes
+sections are the
+.B Mode
+and
+.B ModeLine
+entries that are described above in the
+.B Monitor
+section.
+.SH SCREEN SECTION
+The config file may have multiple
+.B Screen
+sections.  There must be at least one, for the "screen" being used.
+A "screen" represents the binding of a graphics device
+.RB ( Device
+section) and a monitor
+.RB ( Monitor
+section).  A
+.B Screen
+section is considered "active" if it is referenced by an active
+.B ServerLayout
+section or by the
+.B \-screen
+command line option.  If neither of those is present, the first
+.B Screen
+section found in the config file is considered the active one.
+.PP
+.B Screen
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qScreen\*q"
+.BI "    Identifier \*q" name \*q
+.BI "    Device     \*q" devid \*q
+.BI "    Monitor    \*q" monid \*q
+.I  "    entries"
+.I  "    ..."
+.BI "    SubSection \*qDisplay\*q"
+.I  "       entries"
+.I  "       ...
+.B  "    EndSubSection"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this screen.  The
+.B Screen
+section provides information specific to the whole screen, including
+screen-specific
+.BR Options .
+In multi-head configurations, there will be multiple active
+.B Screen
+sections, one for each head.
+The entries available
+for this section are:
+.TP 7
+.BI "Device  \*q" device-id \*q
+This specifies the
+.B Device
+section to be used for this screen.  This is what ties a specific
+graphics card to a screen.  The
+.I device-id
+must match the
+.B Identifier
+of a
+.B Device
+section in the config file.
+.TP 7
+.BI "Monitor  \*q" monitor-id \*q
+specifies which monitor description is to be used for this screen.
+.TP 7
+.BI "VideoAdaptor  \*q" xv-id \*q
+specifies an optional Xv video adaptor description to be used with this
+screen.
+.TP 7
+.BI "DefaultDepth  " depth
+specifies which color depth the server should use by default.  The
+.B \-depth
+command line option can be used to override this.  If neither is specified,
+the default depth is driver-specific, but in most cases is 8.
+.TP 7
+.BI "DefaultFbBpp  " bpp
+specifies which framebuffer layout to use by default.  The
+.B \-fbbpp
+command line option can be used to override this.  In most cases the
+driver will chose the best default value for this.  The only case where
+there is even a choice in this value is for depth 24, where some hardware
+supports both a packed 24 bit framebuffer layout and a sparse 32 bit
+framebuffer layout.
+.TP 7
+.B Options
+Various
+.B Option
+flags may be specified in the
+.B Screen
+section.  Some are driver-specific and are described in the driver
+documentation.  Others are driver-independent, and will eventually be
+described here.
+.PP
+Each
+.B Screen
+section must contain one or more
+.B Display
+subsections.  Those subsections provide depth/fbbpp specific configuration
+information, and the one chosen depends on the depth and/or fbbpp that
+is being used for the screen.  The
+.B Display
+subsection format is described in the section below.
+
+.SH DISPLAY SUBSECTION
+Each
+.B Screen
+section may have multiple
+.B Display
+subsections.  There must be at least one, which matches the depth
+and/or fbbpp values that are being used for the screen.  The "active"
+.B Display
+subsection is the first that matches the depth and/or fbbpp values being
+used.
+.PP
+.B Display
+subsections have the following format:
+.PP
+.RS 4
+.nf
+.B  "    SubSection \*qDisplay\*q"
+.BI "        Depth  " depth
+.I  "        entries"
+.I  "        ..."
+.B  "    EndSubSection"
+.fi
+.RE
+.PP
+.TP 7
+.BI "Depth  " depth
+This entry specifies what colour depth the
+.B Display
+subsection is to be used for.  This entry is usually mandatory,
+but it may be omitted in some cases providing an
+.B FbBpp
+entry is present.  The range of
+.I depth
+values that are allowed depends on the driver.  Most driver support
+8, 15, 16 and 24.  Some also support 1 and/or 4, and some may support
+other values (like 30).  Note:
+.I depth
+means the number of bits in a pixel that are actually used to determine
+the pixel colour.  32 is not a valid
+.I depth
+value.  Most hardware that uses 32 bits per pixel only uses 24 of them
+to hold the colour information, which means that the colour depth is
+24, not 32.
+.TP 7
+.BI "FbBpp  " bpp
+This entry specifies the framebuffer format this
+.B Display
+subsection is to be used for.  This entry is only needed when providing
+depth 24 configurations that allow a choice between a 24 bpp packed
+framebuffer format and a 32bpp sparse framebuffer format.  In most cases
+this entry should not be used.
+.TP 7
+.BI "Weight  " "red-weight green-weight blue-weight"
+This optional entry specifies the relative RGB weighting to be used
+for a screen is being used at depth 16 for drivers that allow multiple
+formats.  This may also be specified from the command line with the
+.B \-weight
+option (see
+.IR XFree86(1) ).
+.TP 7
+.BI "Virtual  " "xdim ydim"
+This optional entry specifies the virtual screen resolution to be used.
+.I xdim
+must be a multiple of either 8 or 16 for most drivers, and a multiple
+of 32 when running in monochrome mode.  The given value will be rounded
+down if this is not the case.  Video modes which are too large for the
+specified virtual size will be rejected.  If this entry is not present,
+the virtual screen resolution will be set to accommodate all the valid
+video modes given in the
+.B Modes
+entry.  Some drivers/hardware combinations do not support virtual screens.
+Refer to the appropriate driver-specific documentation for details.
+.TP 7
+.BI "ViewPort  " "x0 y0"
+This optional entry sets the upper left corner of the initial display.
+This is only relevant when the virtual screen resolution is different
+from the resolution of the initial video mode.  If this entry is not
+given, then the initial display will be centered in the virtual display
+area.
+.TP 7
+.BI "Modes  \*q" mode-name \*q " ..."
+This entry is highly desirable for most drivers, and it specifies the list
+of video modes to use.  Each
+.I mode-name
+specified must be in double quotes.  They must correspond to those
+specified or referenced in the appropriate
+.B Monitor
+section (including implicitly referenced built-in VESA standard modes).
+The server will delete modes from this list which don't satisfy various
+requirements.  The first valid mode in this list will be the default
+display mode for startup.  The list of valid modes is converted internally
+into a circular list.  It is possible to switch to the next mode with
+.B Ctrl+Alt+Keypad-Plus
+and to the previous mode with
+.BR Ctrl+Alt+Keypad-Minus .
+When this entry is omitted, the largest valid mode referenced by the
+appropriate
+.B Monitor
+section will be used.
+.TP 7
+.BI "Visual  \*q" visual-name \*q
+This optional entry sets the default root visual type.  This may also
+be specified from the command line (see the
+.I Xserver(1)
+man page).  The visual types available for depth 8 are (default is
+.BR PseudoColor ):
+.PP
+.RS 11
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+.RS 7
+The visual type available for the depths 15, 16 and 24 are (default is
+.BR TrueColor ):
+.PP
+.RS 4
+.nf
+.B TrueColor
+.B DirectColor
+.fi
+.RE
+.PP
+Not all drivers support
+.B DirectColor
+at these depths.
+.PP
+The visual types available for the depth 4 are (default is
+.BR StaticColor ):
+.PP
+.RS 4
+.nf
+.B StaticGray
+.B GrayScale
+.B StaticColor
+.B PseudoColor
+.fi
+.RE
+.PP
+The visual type available for the depth 1 (monochrome) is
+.BR StaticGray .
+.RE
+.TP 7
+.BI "Black  " "red green blue"
+This optional entry allows the "black" colour to be specified.  This
+.TP 7
+.BI "White  " "red green blue"
+This optional entry allows the "white" colour to be specified.  This
+is only supported at depth 1.  The default is white.
+.TP 7
+.B Options
+Option flags may be specified in the
+.B Display
+subsections.  These may include driver-specific options and
+driver-independent options.  The former are described in the
+driver-specific documentation.  Some of the latter are described above
+in the section about the
+.B Screen
+section, and they may also be included here.
+.SH SERVERLAYOUT SECTION
+The config file may have multiple
+.B ServerLayout
+sections.  
+A "server layout" represents the binding of one or more screens
+.RB ( Screen
+sections) and one or more input devices
+.RB ( InputDevice
+sections) to form a complete configuration.  In multi-head configurations,
+it also specifies the relative layout of the heads.  A
+.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
+.B ServerLayout
+section found in the config file is considered the active one.  If no
+.B ServerLayout
+sections are present, the single active screen and two active (core)
+input devices are selected as described in the relevant sections above.
+.PP
+.B ServerLayout
+sections have the following format:
+.PP
+.RS 4
+.nf
+.B  "Section \*qServerLayout\*q"
+.BI "    Identifier   \*q" name \*q
+.BI "    Screen       \*q" screen-id \*q
+.I  "    ..."
+.BI "    InputDevice  \*q" idev-id \*q
+.I  "    ..."
+.I  "    options"
+.I  "    ..."
+.B  "EndSection"
+.fi
+.RE
+.PP
+The
+.B Identifier
+entry specifies the unique name for this server layout.  The
+.B ServerLayout
+section provides information specific to the whole session, including
+session-specific
+.BR Options .
+The
+.B ServerFlags
+options (described above) may be specified here, and ones given here
+override those given in the
+.B ServerFlags
+section.
+.PP
+The entries that may be used in this section are described here.
+.TP 7
+.BI "Screen  " "screen-num" " \*qscreen-id\*q " "position-information"
+One of these entries must be given for each screen being used in
+a session.  The
+.I screen-id
+field is mandatory, and specifies the
+.B Screen
+section being referenced.  The
+.I screen-num
+field is optional, and may be used to specify the screen number
+in multi-head configurations.  When this field is omitted, the
+screens will be numbered in the order that they are listed in.
+The numbering starts from 0, and must be consecutive.  The
+.I position-information
+field describes the way multiple screens are positioned.  There are
+a number of different ways that this information can be provided:
+.RS 7
+.TP 4
+.BI "Absolute  " "x y"
+This says 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.
+.TP 4
+.BI "RightOf   \*q" screen-id \*q
+.TP 4
+.BI "LeftOf    \*q" screen-id \*q
+.TP 4
+.BI "Above     \*q" screen-id \*q
+.TP 4
+.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.
+.RE
+.TP 7
+.BI "InputDevice  \*q" idev-id "\*q \*q" option \*q " ..."
+One of these entries must be given for each input device being used in
+a session.  Normally at least two are required, one each for the core
+pointer and keyboard devices.  The
+.I idev-id
+field is mandatory, and specifies the name of the
+.B InputDevice
+section being referenced.  Multiple
+.I option
+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:
+.PP
+.RS 11
+.nf
+.B \*qCorePointer\*q
+.B \*qCoreKeyboard\*q
+.B \*qSendCoreEvents\*q
+.fi
+.RE
+.PP
+.RS 7
+and the first two should normally be used to indicate the core pointer
+and core keyboard devices respectively.
+.RE
+.TP 7
+.B Options
+Any option permitted in the
+.B ServerFlags
+section may also be specified here.  When the same option appears in both
+places, the value given here overrides the one given in the
+.B ServerFlags
+section.
+.PP
+Here is an example of a
+.B ServerLayout
+section for a dual headed configuration with two mice:
+.PP
+.RS 4
+.nf
+.B "Section \*qServerLayout\*q"
+.B "    Identifier  \*qLayout 1\*q"
+.B "    Screen      \*qMGA 1\*q"
+.B "    Screen      \*qMGA 2\*q RightOf \*qMGA 1\*q"
+.B "    InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q"
+.B "    InputDevice \*qMouse 1\*q    \*qCorePointer\*q"
+.B "    InputDevice \*qMouse 2\*q    \*qSendCoreEvents\*q"
+.B "    Option      \*qBlankTime\*q  \*q5\*q"
+.B "EndSection"
+.fi
+.RE
+.SH DRI SECTION
+This optional section is used to provide some information for the
+Direct Rendering Infrastructure.  Details about the format of this section
+can be found in the README.DRI document, which is also available on-line
+at
+.IR <http://www.xfree86.org/current/DRI.html> .
+.SH VENDOR SECTION
+The optional
+.B Vendor
+section may be used to provide vendor-specific configuration information.
+Multiple
+.B Vendor
+sections may be present, and they may contain an
+.B Identifier
+entry and multiple
+.B Option
+flags.  The data therein is not used in this release.
+.PP
+.SH FILES
+For an example of an XF86Config file, see the file installed as
+__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__),
+.br
+README
+.IR <http://www.xfree86.org/current/README.html> ,
+.br
+RELNOTES
+.IR <http://www.xfree86.org/current/RELNOTES.html> ,
+.br
+README.mouse
+.IR <http://www.xfree86.org/current/mouse.html> ,
+.br
+README.DRI
+.IR <http://www.xfree86.org/current/DRI.html> ,
+.br
+Status
+.IR <http://www.xfree86.org/current/Status.html> ,
+.br
+Install
+.IR <http://www.xfree86.org/current/Install.html> .
+.SH AUTHORS
+This manual page was largely rewritten for XFree86 4.0 by David Dawes
+.IR <dawes@xfree86.org> .
diff -urN xc-clean/programs/Xserver/hw/xfree86/common/xf86PciInfo.h xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
--- xc-clean/programs/Xserver/hw/xfree86/common/xf86PciInfo.h	Fri Dec  8 19:58:36 2000
+++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h	Tue Feb 20 16:08:57 2001
@@ -150,6 +150,7 @@
 #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
@@ -590,6 +591,10 @@
 #define PCI_CHIP_SMI712		0x712
 #define PCI_CHIP_SMI720		0x720
 
+/* VMware */
+#define PCI_CHIP_VMWARE0405		0x0405
+#define PCI_CHIP_VMWARE0710		0x0710
+
 /*
  * first the VendorId - VendorName mapping
  */
@@ -710,6 +715,7 @@
     {PCI_VENDOR_ARK,	"ARK Logic"},
     {PCI_VENDOR_YAMAHA, "Yamaha"},
     {PCI_VENDOR_SMI,	"Silicon Motion Inc."},
+    {PCI_VENDOR_VMWARE,	"VMware"},
     {0,NULL}
 };
 #endif
@@ -1509,6 +1515,10 @@
 				{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}}},
 };
@@ -1712,6 +1722,10 @@
 			{ 0xf004, "FA310-TX Rev. D2",0, NF },
                         { 0x0000, (char *)NULL,0, NF } } },
 #endif
+	{ PCI_VENDOR_VMWARE, {
+    			{PCI_CHIP_VMWARE0405,	"PCI SVGA (FIFO)",0, NF },
+    			{PCI_CHIP_VMWARE0710,	"LEGACY SVGA",0, NF },
+			{0x0000,		NULL,0, NF } } },
 	{0x0000, {
 	  		{0x0000,  NULL,0, NF } } },
 };
diff -urN xc-clean/programs/Xserver/hw/xfree86/common/xf86PciInfo.h~ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h~
--- xc-clean/programs/Xserver/hw/xfree86/common/xf86PciInfo.h~	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h~	Fri Dec  8 19:58:36 2000
@@ -0,0 +1,1720 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.83 2000/12/07 21:34:20 mvojkovi Exp $ */
+/*
+ * PCI Probe
+ *
+ * Copyright 1995-2000 by The XFree86 Project, Inc.
+ *
+ * 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.
+ * 
+ */
+
+#ifndef _XF86_PCIINFO_H
+#define _XF86_PCIINFO_H
+
+#include "xf86str.h"
+
+/* PCI Pseudo Vendor */
+#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_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_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
+
+
+/* Generic */
+#define PCI_CHIP_VGA            0x0000
+#define PCI_CHIP_8514           0x0001
+
+/* Real 3D */
+#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
+
+/* ATI */
+#define PCI_CHIP_MACH32		0x4158
+#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_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_MACH64LR	0x4C52
+#define PCI_CHIP_MACH64LS	0x4C53
+#define PCI_CHIP_RAGE128MF	0x4D46
+#define PCI_CHIP_RAGE128ML	0x4D4C
+#define PCI_CHIP_RAGE128PF	0x5046
+#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_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_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
+
+/* Avance Logic */
+#define PCI_CHIP_ALG2064	0x2064
+#define PCI_CHIP_ALG2301	0x2301
+
+/* NS */
+#define PCI_CHIP_87415		0x0002
+#define PCI_CHIP_87410		0xD001
+
+/* 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
+
+/* Weitek */
+#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
+
+/* 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
+
+/* WD */
+#define PCI_CHIP_7197		0x3296
+
+/* AMD */
+#define PCI_CHIP_79C970		0x2000
+#define PCI_CHIP_53C974		0x2020
+
+/* 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_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
+
+/* ALI */
+#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_IMPRESSION	0x0D10
+#define PCI_CHIP_MGAG100_PCI	0x1000
+#define PCI_CHIP_MGAG100	0x1001
+
+#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
+
+/* Miro */
+#define PCI_CHIP_ZR36050	0x5601
+
+/* NEC */
+#define PCI_CHIP_POWER_VR	0x0046
+
+/* FD */
+#define PCI_CHIP_TMC_18C30	0x0000
+
+/* 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
+
+/* 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
+
+/* SGS */
+#define PCI_CHIP_STG2000	0x0008
+#define PCI_CHIP_STG1764	0x0009
+
+/* 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
+
+/* Oak */
+#define PCI_CHIP_OTI107		0x0107
+
+/* Winbond */
+#define PCI_CHIP_89C940		0x0940
+
+/* 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
+
+/* BrookTree */
+#define PCI_CHIP_BT848		0x0350
+#define PCI_CHIP_BT849		0x0351
+
+/* 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
+
+/* NVIDIA & SGS */
+#define PCI_CHIP_RIVA128	0x0018
+
+/* Alliance Semiconductor */
+#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
+
+/* Rendition */
+#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
+
+/* 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
+
+/* ARK Logic */
+#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
+
+/* 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
+
+/* Intel */
+#define PCI_CHIP_I815_BRIDGE		0x1130
+#define PCI_CHIP_I815			0x1132
+#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_I740_AGP		0x7800
+
+/* 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
+
+/*
+ * 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_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."},
+    {0,NULL}
+};
+#endif
+
+/* Increase this as required */
+#define MAX_DEV_PER_VENDOR 64
+
+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_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_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_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_RAGE128PF,	"Rage 128 Pro PF",0},
+				{PCI_CHIP_RAGE128PR,	"Rage 128 Pro PR",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_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_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},
+				{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_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},
+				{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
+    {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, {
+                                {0x1000,		"EBUS",0 },
+				{0x1001,		"Happy Meal",0 },
+				{0x5000,		"Advanced PCI bridge",0 },
+				{0x8000,		"PCI Bus Module",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",0},
+				{PCI_CHIP_UTNT2,	"Riva Ultra TNT2",0},
+				{PCI_CHIP_VTNT2,	"Riva Vanta",0},
+				{PCI_CHIP_UVTNT2,	"Riva Ultra 64",0},
+				{PCI_CHIP_ITNT2,	"Riva Integrated",0},
+				{PCI_CHIP_GEFORCE256,	"GeForce 256",0},
+				{PCI_CHIP_GEFORCEDDR,	"GeForce DDR",0},
+				{PCI_CHIP_QUADRO,	"Quadro",0},
+				{PCI_CHIP_GEFORCE2MX,	"GeForce2 MX",0},
+				{PCI_CHIP_GEFORCE2MXDDR,"GeForce2 MX DDR",0},
+				{PCI_CHIP_QUADRO2MXR,	"GeForce2 MXR",0},
+				{PCI_CHIP_GEFORCE2GTS,	"GeForce2 GTS",0},
+				{PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0},
+				{PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0},
+				{PCI_CHIP_QUADRO2PRO,	"Quadro 2 Pro",0},
+				{0x0000,		NULL,0}}},
+#ifdef VENDOR_INCLUDE_NONVIDEO
+    {PCI_VENDOR_IMS, {
+                                {0x8849, "8849",0 },
+				{0x0000,		NULL,0}}},
+    {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},
+				{0x0000,		NULL,0}}},
+    {PCI_VENDOR_AVANCE_2, {
+				{PCI_CHIP_ALG2064,	"ALG2064",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,{
+                                {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_I740_AGP,	"i740 (AGP)",0},
+				{PCI_CHIP_I815_BRIDGE,	"i815 Bridge",0},
+				{PCI_CHIP_I815,		"i815",0},
+				{PCI_CHIP_I810_BRIDGE,	"i810 Bridge",0},
+				{PCI_CHIP_I810,		"i810",0},
+				{PCI_CHIP_I810_DC100_BRIDGE,	"i810-dc100 Bridge",0},
+				{PCI_CHIP_I810_DC100,	"i810-dc100",0},
+				{PCI_CHIP_I810_E_BRIDGE,"i810e Bridge",0},
+				{PCI_CHIP_I810_E,	"i810e",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}}},
+    {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_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 },
+ 	  /* Seattle AL440BX is 0x8080, is anything else ? */
+                        { 0x8080, "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 },
+                        { 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
+	{0x0000, {
+	  		{0x0000,  NULL,0, NF } } },
+};
+#endif
+#endif
+#endif /* _XF86_PCIINFO_H */
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/Imakefile xc/programs/Xserver/hw/xfree86/drivers/Imakefile
--- xc-clean/programs/Xserver/hw/xfree86/drivers/Imakefile	Wed Nov 29 08:42:04 2000
+++ xc/programs/Xserver/hw/xfree86/drivers/Imakefile	Tue Feb 20 16:08:57 2001
@@ -15,7 +15,7 @@
        i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \
        nv/?*_drv.o rendition/?*_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
+       vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o vmware/?*_drv.o
 
 #endif
 
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile	Thu Jan 25 17:46:12 2001
@@ -0,0 +1,54 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.33 2000/06/17 00:03:19 martin Exp $
+XCOMM
+XCOMM This is an Imakefile for the VMware virtual SVGA driver.  
+XCOMM
+
+#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
+
+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
+
+#if defined(XF86DriverSDK)
+INCLUDES = -I. -Ipublic -Ivmx/public -I../../include
+#else
+INCLUDES = -I. -Ipublic -Ivmx/public -I$(XF86COMSRC) -I$(XF86OSSRC) \
+           -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(XF86SRC)/int10 \
+           -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \
+           -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \
+           -I$(XF86SRC)/ramdac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
+           -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)
+#endif
+
+DEFINES = -DPSZ=8 $(DRIDEFINES)
+
+#if MakeHasPosixVariableSubstitutions
+SubdirLibraryRule($(OBJS))
+#endif
+
+ModuleObjectRule()
+
+ObjectModuleTarget(vmware,$(OBJS))
+
+InstallObjectModule(vmware,$(MODULEDIR),drivers)
+
+#if !defined(XF86DriverSDK)
+CppManTarget(vmware,)
+InstallModuleManPage(vmware)
+#endif
+
+DependTarget()
+
+InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/vmware)
+
+InstallDriverSDKObjectModule(vmware,$(DRIVERSDKMODULEDIR),drivers)
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/README xc/programs/Xserver/hw/xfree86/drivers/vmware/README
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/README	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/README	Thu Feb 15 15:59:47 2001
@@ -0,0 +1,209 @@
+
+Copyright (C) 1999-2001 VMware, Inc.
+All Rights Reserved
+
+VMware Proprietary
+
+
+	VMware SVGA Device Interface and Programming Model
+	--------------------------------------------------
+
+
+Include Files
+-------------
+
+svga_reg.h
+    SVGA register definitions, SVGA capabilities, and FIFO command definitions.
+
+svga_limits.h
+    Included by svga_reg.h, defines maximum frame buffer and memory region
+    sizes.
+
+guest_os.h
+    Values for the GUEST_ID register.
+
+
+Programming the VMware SVGA Device
+----------------------------------
+
+1. Reading/writing a register:
+    To read a register:
+	Set the index port to the index of the register, using a dword OUT
+	Do a dword IN from the value port
+
+    To write a register:
+	Set the index port to the index of the register, using a dword OUT
+	Do a dword OUT to the value port
+
+2. Initialization
+    Check the version number
+     loop:
+      Write into SVGA_REG_ID the maximum SVGA_ID_* the driver supports.
+      Read from SVGA_REG_ID.
+       Check if it is the value you wrote.
+        If yes, VMware supports it
+        If no, decrement SVGA_ID_* and goto loop
+     This algorithm converges.
+
+    Map the frame buffer and the command FIFO
+	Read SVGA_REG_FB_START, SVGA_REG_FB_SIZE, SVGA_REG_MEM_START,
+	SVGA_REG_MEM_SIZE.
+	Map the frame buffer (FB) and the FIFO memory (MEM)
+
+    Get the frame buffer dimensions
+	Read SVGA_REG_MAX_WIDTH, SVGA_REG_MAX_HEIGHT, SVGA_REG_BITS_PER_PIXEL
+
+    SetMode
+	Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT
+	Read SVGA_REG_FB_OFFSET
+	(SVGA_REG_FB_OFFSET is the offset from SVGA_REG_FB_START of the
+	 visible portion of the frame buffer)
+	Read SVGA_REG_BYTES_PER_LINE, SVGA_REG_PSEUDOCOLOR, SVGA_REG_GREEN_MASK,
+	SVGA_REG_RED_MASK
+
+    Enable SVGA
+	Set SVGA_REG_ENABLE to 1
+	(to disable SVGA, set SVGA_REG_ENABLE to 0)
+
+    Initialize the command FIFO
+	The FIFO is exclusively dword (32-bit) aligned.  The first four
+	dwords define the portion of the MEM area that is used for the
+	command FIFO.  These are values are all in byte offsets from the
+	start of the MEM area.
+
+	A minimum sized FIFO would have these values:
+	    mem[SVGA_FIFO_MIN] = 16;
+	    mem[SVGA_FIFO_MAX] = 16 + (10 * 1024);
+	    mem[SVGA_FIFO_NEXT_CMD] = 16;
+	    mem[SVGA_FIFO_STOP] = 16;
+
+	Write SVGA_REG_CONFIG_DONE after these values have been set.
+
+3. SVGA command FIFO protocol
+    The FIFO is empty when SVGA_FIFO_NEXT_CMD == SVGA_FIFO_STOP.  The
+    driver writes commands to the FIFO starting at the offset specified
+    by SVGA_FIFO_NEXT_CMD, and then increments SVGA_FIFO_NEXT_CMD.
+
+    The FIFO is full when SVGA_FIFO_NEXT_CMD is one word before SVGA_FIFO_STOP.
+
+    When the FIFO becomes full, the FIFO should be sync'd
+
+    To sync the FIFO
+	Write SVGA_REG_SYNC
+	Read SVGA_REG_BUSY
+	Wait for the value in SVGA_REG_BUSY to be 0
+
+    The FIFO should be sync'd before the driver touches the frame buffer, to
+    guarantee that any outstanding BLT's are completed.
+
+4. Capabilities
+    The capabilities of the SVGA device can be queried by reading
+    SVGA_REG_CAPABILITIES.
+
+
+Drawing to the Screen
+---------------------
+
+After initialization, the driver can write directly to the frame buffer.
+The updated frame buffer is not displayed immediately, but only when
+an update command is sent.  The update command (SVGA_CMD_UPDATE) defines
+the rectangle in the frame buffer that has been modified by the driver,
+and causes that rectangle to be updated on the screen.
+
+A complete driver can be developed this way.  For increased performance,
+additional commands are available to accelerate common operations.  The
+two most useful are SVGA_CMD_RECT_FILL and SVGA_CMD_RECT_COPY.
+
+After issuing an accelerated command, the FIFO should be sync'd, as
+described above, before writing to the frame buffer.
+
+
+Addendum on 7/11/2000
+---------------------
+
+SVGA_REB_FB_OFFSET and SVGA_REG_BYTES_PER_LINE may change after
+SVGA_REG_WIDTH or SVGA_REG_HEIGHT is set.  Also the VGA registers must
+be written to after setting SVGA_REG_ENABLE to 0 to change the display
+to a VGA mode.
+
+
+Capabilities
+------------
+
+The capabilities register (SVGA_REG_CAPABILITIES) is an array of
+bits that indicates the capabilities of the SVGA emulation.
+This table shows what commands are available, depending on the
+capabilities:
+
+    Command				Capability
+    -------				----------
+
+    SVGA_CMD_RECT_FILL			SVGA_CAP_RECT_FILL
+    SVGA_CMD_RECT_COPY			SVGA_CAP_RECT_COPY
+    SVGA_CMD_DEFINE_BITMAP		SVGA_CAP_OFFSCREEN
+    SVGA_CMD_DEFINE_BITMAP_SCANLINE	SVGA_CAP_OFFSCREEN
+    SVGA_CMD_DEFINE_PIXMAP		SVGA_CAP_OFFSCREEN
+    SVGA_CMD_DEFINE_PIXMAP_SCANLINE	SVGA_CAP_OFFSCREEN
+    SVGA_CMD_RECT_BITMAP_FILL		SVGA_CAP_RECT_PAT_FILL
+    SVGA_CMD_RECT_PIXMAP_FILL		SVGA_CAP_RECT_PAT_FILL
+    SVGA_CMD_RECT_BITMAP_COPY		SVGA_CAP_RECT_PAT_FILL
+    SVGA_CMD_RECT_PIXMAP_COPY		SVGA_CAP_RECT_PAT_FILL
+    SVGA_CMD_FREE_OBJECT		SVGA_CAP_OFFSCREEN
+    SVGA_CMD_RECT_ROP_FILL		SVGA_CAP_RECT_FILL +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_RECT_ROP_COPY		SVGA_CAP_RECT_COPY +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_RECT_ROP_BITMAP_FILL	SVGA_CAP_RECT_PAT_FILL +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_RECT_ROP_PIXMAP_FILL	SVGA_CAP_RECT_PAT_FILL +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_RECT_ROP_BITMAP_COPY	SVGA_CAP_RECT_PAT_FILL +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_RECT_ROP_PIXMAP_COPY	SVGA_CAP_RECT_PAT_FILL +
+					    SVGA_CAP_RASTER_OP
+    SVGA_CMD_DEFINE_CURSOR		SVGA_CAP_CURSOR
+    SVGA_CMD_DISPLAY_CURSOR		SVGA_CAP_CURSOR
+    SVGA_CMD_MOVE_CURSOR		SVGA_CAP_CURSOR
+
+The ability to program the cursor directly through the registers
+(described in the next section) is indicated by the capability
+SVGA_CAP_CURSOR_BYPASS.
+
+
+Cursor Handling
+---------------
+
+Starting with GSX Server Beta 3 (after 11/15/2000), a new cursor interface
+was added that bypasses the FIFO.  This is programmed using the
+registers SVGA_REG_CURSOR_ID, SVGA_REG_CURSOR_X, SVGA_REG_CURSOR_Y,
+and SVGA_REG_CURSOR_ON.
+
+First, the cursor must be defined using the FIFO command
+SVGA_CMD_DEFINE_CURSOR.  This command allocates a cursor ID and
+associates two pixmaps with the cursor, the AND mask and the XOR mask.
+
+To display the cursor, the ID must be written to SVGA_REG_CURSOR_ID,
+the coordinates written to SVGA_REG_CURSOR_X and SVGA_REG_CURSOR_Y,
+then the value 1 must be written to SVGA_REG_CURSOR_ON.  No display
+occurs until SVGA_REG_CURSOR_ON is written.  The same sequence is used
+to move the cursor.
+
+To turn the cursor off, the ID must be written to SVGA_REG_CURSOR_ID,
+and the value 0 must be written to SVGA_REG_CURSOR_ON.
+
+NOTE:  The cursor must be turned off before touching the frame buffer,
+because it is actually drawn into the frame buffer memory in the case
+of direct graphics mode (e.g. full screen mode on Linux).  The cursor
+does not have to be turned off before issuing an accelerated command
+via the command FIFO, this case is handled by the SVGA device.
+
+
+Driver Version Numbers
+----------------------
+
+The SVGA drivers use the following convention for their version numbers:
+
+Version 10.0 - The first version that uses the FIFO
+Version 10.1 - The version that uses the hardware cursor emulation via the FIFO
+Version 10.2 - The version that uses the cursor that bypasses the FIFO
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c	Tue Jan 30 13:16:55 2001
@@ -0,0 +1,1418 @@
+/* **********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_bits2pixels[] = "$Id: bits2pixels.c,v 1.6 2001/01/26 23:32:15 yoel Exp $";
+#else
+#define FILECODE "F(814)"
+#endif
+
+/*
+ * bits2pixels.c --
+ *
+ *      Emulation routines to convert bitmaps to pixmaps
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "vm_basic_types.h"
+#include "bits2pixels.h"
+
+
+/*
+ *  Local functions
+ */
+
+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,
+			  uint8 *pix, uint32 pix_increment,
+			  uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+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,
+			  uint8 *pix, uint32 pix_increment,
+			  uint32 width, uint32 height, uint32 fg, uint32 bg);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Raster_BitsToPixels --
+ *
+ *	Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ *      color (fg) and 0 bits to the background color (bg).
+ *
+ * Results:
+ *      Pixmap filled with pixels
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+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)
+{
+   switch (bytes_per_pixel) {
+      case 1:
+	 RasterBitsToPixels8(bits, bits_increment, pix, pix_increment,
+			     width, height, fg, bg);
+	 break;
+
+      case 2:
+	 RasterBitsToPixels16(bits, bits_increment, pix, pix_increment,
+			      width, height, fg, bg);
+	 break;
+
+      case 3:
+	 RasterBitsToPixels24(bits, bits_increment, pix, pix_increment,
+			      width, height, fg, bg);
+	 break;
+
+      case 4:
+	 RasterBitsToPixels32(bits, bits_increment, pix, pix_increment,
+			      width, height, fg, bg);
+	 break;
+   }
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels8 --
+ *
+ *	Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ *      color (fg) and 0 bits to the background color (bg), for an 8-bit
+ *	pixmap
+ *
+ * Results:
+ *      Pixmap filled with pixels
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels8(uint8 *bits, uint32 bits_increment,
+		    uint8 *pix, uint32 pix_increment,
+		    uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+   uint8 *lpix, *lbits;
+   int i, j;
+   uint32 expbits = 0;		 /* Bits to be expanded */
+
+   for (i=0; i<height; i++) {
+      lpix = pix;
+      lbits = bits;
+      for (j = width ; j > 0; j -= 4) {
+	 expbits = (*lbits >> 4) & 0x0f;
+	 
+	 if (j < 4)
+	    break;
+	 
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+
+	 expbits = *lbits & 0x0f;
+
+	 j -= 4;
+	 if (j < 4) {
+	    break;
+	 }
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+	 lbits++;
+      }
+
+      if (j > 0) {
+	 *lpix++ = (expbits & 0x08) ? fg : bg;
+	 j--;
+	 if (j > 0) {
+	    *lpix++ = (expbits & 0x04) ? fg : bg;
+	    j--;
+	    if (j > 0) {
+	       *lpix++ = (expbits & 0x02) ? fg : bg;
+	       j--;
+	    }
+	 }
+      }
+
+      pix += pix_increment;
+      bits += bits_increment;
+   }
+   return;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels16 --
+ *
+ *	Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ *      color (fg) and 0 bits to the background color (bg), for a 16-bit
+ *	pixmap
+ *
+ * Results:
+ *      Pixmap filled with pixels
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels16(uint8 *bits, uint32 bits_increment,
+		     uint8 *pix, uint32 pix_increment,
+		     uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+   uint16 *lpix;
+   uint8 *lbits;
+   int i, j;
+   uint32 expbits = 0;		 /* Bits to be expanded */
+
+   for (i=0; i<height; i++) {
+      lpix = (uint16 *)pix;
+      lbits = bits;
+      for (j = width; j > 0; j -= 4) {
+	 expbits = (*lbits >> 4) & 0x0f;
+
+	 if (j < 4)
+	    break;
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+
+	 expbits = *lbits & 0x0f;
+
+	 j -= 4;
+	 if (j < 4) {
+	    break;
+	 }
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+	 lbits++;
+      }
+
+      if (j > 0) {
+	 *lpix++ = (expbits & 0x08) ? fg : bg;
+	 j--;
+	 if (j > 0) {
+	    *lpix++ = (expbits & 0x04) ? fg : bg;
+	    j--;
+	    if (j > 0) {
+	       *lpix++ = (expbits & 0x02) ? fg : bg;
+	       j--;
+	    }
+	 }
+      }
+
+      pix += pix_increment;
+      bits += bits_increment;
+   }
+   return;
+}
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels24 --
+ *
+ *	Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ *      color (fg) and 0 bits to the background color (bg), for a 24-bit
+ *	pixmap
+ *
+ * Results:
+ *      Pixmap filled with pixels
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels24(uint8 *bits, uint32 bits_increment,
+		     uint8 *pix, uint32 pix_increment,
+		     uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+   uint8 *lpix, *lbits;
+   uint32 fgColor1, fgColor2, fgColor3;
+   uint32 bgColor1, bgColor2, bgColor3;
+
+   int i, j;
+   uint32 expbits = 0;		 /* Bits to be expanded */
+
+   fgColor1 = fg & 0x000000ff;
+   fgColor2 = (fg >> 8) & 0x000000ff;
+   fgColor3 = (fg >> 16) & 0x000000ff;
+
+   bgColor1 = bg & 0x000000ff;
+   bgColor2 = (bg >> 8) & 0x000000ff;
+   bgColor3 = (bg >> 16) & 0x000000ff;
+
+   for (i=0; i<height; i++) {
+      lpix = pix;
+      lbits = bits;
+      for (j = width; j > 0; j -= 4) {
+	 expbits = (*lbits >> 4) & 0x0f;
+
+	 if (j < 4)
+	    break;
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 1:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 2:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 3:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 4:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 5:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 6:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 7:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 8:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 9:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 10:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 11:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 12:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 13:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 14:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 15:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 }
+
+	 expbits = *lbits & 0x0f;
+
+	 j -= 4;
+	 if (j < 4) {
+	    break;
+	 }
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 1:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 2:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 3:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 4:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 5:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 6:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 7:
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 8:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 9:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 10:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 11:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 12:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 13:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 case 14:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = bgColor1;
+	    *lpix++ = bgColor2;
+	    *lpix++ = bgColor3;
+	    break;
+	 case 15:
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    *lpix++ = fgColor1;
+	    *lpix++ = fgColor2;
+	    *lpix++ = fgColor3;
+	    break;
+	 }
+	 lbits++;
+      }
+
+      if (j > 0) {
+	 *lpix++ = (expbits & 0x08) ? fgColor1 : bgColor1;
+	 *lpix++ = (expbits & 0x08) ? fgColor2 : bgColor2;
+	 *lpix++ = (expbits & 0x08) ? fgColor3 : bgColor3;
+	 j--;
+	 if (j > 0) {
+	    *lpix++ = (expbits & 0x04) ? fgColor1 : bgColor1;
+	    *lpix++ = (expbits & 0x04) ? fgColor2 : bgColor2;
+	    *lpix++ = (expbits & 0x04) ? fgColor3 : bgColor3;
+	    j--;
+	    if (j > 0) {
+	       *lpix++ = (expbits & 0x02) ? fgColor1 : bgColor1;
+	       *lpix++ = (expbits & 0x02) ? fgColor2 : bgColor2;
+	       *lpix++ = (expbits & 0x02) ? fgColor3 : bgColor3;
+	       j--;
+	    }
+	 }
+      }
+
+      pix += pix_increment;
+      bits += bits_increment;
+   }
+   return;
+}
+
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RasterBitsToPixels32 --
+ *
+ *	Convert a bitmap to a pixmap, converting 1 bits to the foreground
+ *      color (fg) and 0 bits to the background color (bg), for a 32-bit
+ *	pixmap
+ *
+ * Results:
+ *      Pixmap filled with pixels
+ *
+ * Side effects:
+ *	None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RasterBitsToPixels32(uint8 *bits, uint32 bits_increment,
+		     uint8 *pix, uint32 pix_increment,
+		     uint32 width, uint32 height, uint32 fg, uint32 bg)
+{
+   uint32 *lpix;
+   uint8 *lbits;
+   int i, j;
+   uint32 expbits = 0;		 /* Bits to be expanded */
+
+   for (i=0; i<height; i++) {
+      lpix = (uint32 *)pix;
+      lbits = bits;
+      for (j = width; j > 0; j -= 4) {
+	 expbits = (*lbits >> 4) & 0x0f;
+	 
+	 if (j < 4)
+	    break;
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+
+	 expbits = *lbits & 0x0f;
+
+	 j -= 4;
+	 if (j < 4) {
+	    break;
+	 }
+
+	 switch (expbits) {
+	 case 0:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 1:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 2:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 3:
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 4:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 5:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 6:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 7:
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 8:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 9:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 10:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 11:
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 case 12:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = bg;
+	    break;
+	 case 13:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    *lpix++ = fg;
+	    break;
+	 case 14:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = bg;
+	    break;
+	 case 15:
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    *lpix++ = fg;
+	    break;
+	 }
+	 lbits++;
+      }
+
+      if (j > 0) {
+	 *lpix++ = (expbits & 0x08) ? fg : bg;
+	 j--;
+	 if (j > 0) {
+	    *lpix++ = (expbits & 0x04) ? fg : bg;
+	    j--;
+	    if (j > 0) {
+	       *lpix++ = (expbits & 0x02) ? fg : bg;
+	       j--;
+	    }
+	 }
+      }
+
+      pix += pix_increment;
+      bits += bits_increment;
+   }
+   return;
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h	Tue Jan 30 13:16:56 2001
@@ -0,0 +1,24 @@
+/* **********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: bits2pixels.h,v 1.4 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+/*
+ * bits2pixels.h --
+ *
+ *      Drawing emulation routines
+ */
+
+#ifndef _BITS2PIXELS_H_
+#define _BITS2PIXELS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#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);
+
+#endif /* _BITS4PIXELS_H_ */
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h	Tue Jan 30 13:16:56 2001
@@ -0,0 +1,29 @@
+/* *********************************************************
+ * Copyright (C) 1999-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: guest_os.h,v 1.5 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+#ifndef _GUEST_OS_H_
+#define _GUEST_OS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#include "includeCheck.h"
+
+#define GUEST_OS_BASE  0x5000
+
+#define GUEST_OS_DOS        (GUEST_OS_BASE+1)
+#define GUEST_OS_WIN31      (GUEST_OS_BASE+2)
+#define GUEST_OS_WINDOWS95  (GUEST_OS_BASE+3)
+#define GUEST_OS_WINDOWS98  (GUEST_OS_BASE+4)
+#define GUEST_OS_WINDOWSME  (GUEST_OS_BASE+5)
+#define GUEST_OS_NT         (GUEST_OS_BASE+6)
+#define GUEST_OS_WIN2000    (GUEST_OS_BASE+7)
+#define GUEST_OS_LINUX      (GUEST_OS_BASE+8)
+#define GUEST_OS_OS2        (GUEST_OS_BASE+9)
+#define GUEST_OS_OTHER      (GUEST_OS_BASE+10)
+#define GUEST_OS_FREEBSD    (GUEST_OS_BASE+11)
+#define GUEST_OS_WHISTLER   (GUEST_OS_BASE+12)
+
+
+#endif 
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h	Tue Feb 20 16:08:22 2001
@@ -0,0 +1 @@
+/* This space intentionally left blank. */
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h	Tue Jan 30 13:16:56 2001
@@ -0,0 +1,56 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: svga_limits.h,v 1.8 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+/*
+ * svga_reg.h --
+ *
+ * SVGA limits
+ */
+
+#ifndef _SVGA_LIMITS_H_
+#define _SVGA_LIMITS_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#include "includeCheck.h"
+
+/*
+ * Location and size of SVGA frame buffer.
+ */
+#define SVGA_FB_MAX_SIZE       (16*1024*1024)
+#define SVGA_MEM_SIZE          (256*1024)
+
+/*
+ * SVGA_FB_START is the default starting address of the SVGA frame
+ * buffer in the guest's physical address space.
+ * SVGA_FB_START_BIGMEM is the starting address of the SVGA frame
+ * buffer for VMs that have a large amount of physical memory.
+ *
+ * The address of SVGA_FB_START is set to 2GB - (SVGA_FB_MAX_SIZE + SVGA_MEM_SIZE), 
+ * thus the SVGA frame buffer sits at [SVGA_FB_START .. 2GB-1] in the
+ * physical address space.  Our older SVGA drivers for NT treat the
+ * address of the frame buffer as a signed integer.  For backwards
+ * compatibility, we keep the default location of the frame buffer
+ * at under 2GB in the address space.  This restricts VMs to have "only"
+ * up to ~2031MB (i.e., up to SVGA_FB_START) of physical memory.
+ *
+ * For VMs that want more memory than the ~2031MB, we place the SVGA
+ * frame buffer at SVGA_FB_START_BIGMEM.  This allows VMs to have up
+ * to 3584MB, at least as far as the SVGA frame buffer is concerned
+ * (note that there may be other issues that limit the VM memory
+ * size).  PCI devices use high memory addresses, so we have to put
+ * SVGA_FB_START_BIGMEM low enough so that it doesn't overlap with any
+ * of these devices.  Placing SVGA_FB_START_BIGMEM at 0xE0000000
+ * should leave plenty of room for the PCI devices.
+ *
+ * NOTE: All of that is only true for the 0710 chipset.  As of the 0405
+ * chipset, the framebuffer start is determined solely based on the value
+ * the guest BIOS or OS programs into the PCI base address registers.
+ */
+#define SVGA_FB_LEGACY_START		0x7EFC0000
+#define SVGA_FB_LEGACY_START_BIGMEM	0xE0000000
+
+#endif
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h	Tue Jan 30 13:16:56 2001
@@ -0,0 +1,274 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: svga_reg.h,v 1.7 2001/01/26 23:32:15 yoel Exp $
+ * **********************************************************/
+
+/*
+ * svga_reg.h --
+ *
+ * SVGA hardware definitions
+ */
+
+#ifndef _SVGA_REG_H_
+#define _SVGA_REG_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#include "includeCheck.h"
+
+#include "svga_limits.h"
+
+/*
+ * Memory and port addresses and fundamental constants
+ */
+
+#define SVGA_MAX_WIDTH			2364
+#define SVGA_MAX_HEIGHT			1773
+#define SVGA_MAX_BITS_PER_PIXEL		32
+#if SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * SVGA_MAX_BITS_PER_PIXEL / 8 > \
+    SVGA_FB_MAX_SIZE
+#error "Bad SVGA maximum sizes"
+#endif
+#define SVGA_MAX_PSEUDOCOLOR_DEPTH	8
+#define SVGA_MAX_PSEUDOCOLORS		(1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
+
+#define SVGA_MAGIC         0x900000
+#define SVGA_MAKE_ID(ver)  (SVGA_MAGIC << 8 | (ver))
+
+/* Version 2 let the address of the frame buffer be unsigned on Win32 */
+#define SVGA_VERSION_2     2
+#define SVGA_ID_2          SVGA_MAKE_ID(SVGA_VERSION_2)
+
+/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
+   PALETTE_BASE has moved */
+#define SVGA_VERSION_1     1
+#define SVGA_ID_1          SVGA_MAKE_ID(SVGA_VERSION_1)
+
+/* Version 0 is the initial version */
+#define SVGA_VERSION_0     0
+#define SVGA_ID_0          SVGA_MAKE_ID(SVGA_VERSION_0)
+
+/* Invalid SVGA_ID_ */
+#define SVGA_ID_INVALID    0xFFFFFFFF
+
+/* More backwards compatibility, old location of color map: */
+#define SVGA_OLD_PALETTE_BASE	 17
+
+/* Base and Offset gets us headed the right way for PCI Base Addr Registers */
+#define SVGA_LEGACY_BASE_PORT	0x4560
+#define SVGA_INDEX_PORT		0x0
+#define SVGA_VALUE_PORT		0x1
+#define SVGA_BIOS_PORT		0x2
+#define SVGA_NUM_PORTS		0x3
+
+/* This port is deprecated, but retained because of old drivers. */
+#define SVGA_LEGACY_ACCEL_PORT	0x3
+
+/*
+ * Registers
+ */
+
+enum {
+   SVGA_REG_ID = 0,
+   SVGA_REG_ENABLE = 1,
+   SVGA_REG_WIDTH = 2,
+   SVGA_REG_HEIGHT = 3,
+   SVGA_REG_MAX_WIDTH = 4,
+   SVGA_REG_MAX_HEIGHT = 5,
+   SVGA_REG_DEPTH = 6,
+   SVGA_REG_BITS_PER_PIXEL = 7,
+   SVGA_REG_PSEUDOCOLOR = 8,
+   SVGA_REG_RED_MASK = 9,
+   SVGA_REG_GREEN_MASK = 10,
+   SVGA_REG_BLUE_MASK = 11,
+   SVGA_REG_BYTES_PER_LINE = 12,
+   SVGA_REG_FB_START = 13,
+   SVGA_REG_FB_OFFSET = 14,
+   SVGA_REG_FB_MAX_SIZE = 15,
+   SVGA_REG_FB_SIZE = 16,
+
+   SVGA_REG_CAPABILITIES = 17,
+   SVGA_REG_MEM_START = 18,	   /* Memory for command FIFO and bitmaps */
+   SVGA_REG_MEM_SIZE = 19,
+   SVGA_REG_CONFIG_DONE = 20,      /* Set when memory area configured */
+   SVGA_REG_SYNC = 21,             /* Write to force synchronization */
+   SVGA_REG_BUSY = 22,             /* Read to check if sync is done */
+   SVGA_REG_GUEST_ID = 23,	   /* Set guest OS identifier */
+   SVGA_REG_CURSOR_ID = 24,	   /* ID of cursor */
+   SVGA_REG_CURSOR_X = 25,	   /* Set cursor X position */
+   SVGA_REG_CURSOR_Y = 26,	   /* Set cursor Y position */
+   SVGA_REG_CURSOR_ON = 27,	   /* Turn cursor on/off */
+
+   SVGA_REG_TOP = 28,		   /* Must be 1 greater than the last register */
+
+   SVGA_PALETTE_BASE = 1024	   /* Base of SVGA color map */
+};
+
+
+/*
+ *  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
+
+
+/*
+ *  Raster op codes (same encoding as X)
+ */
+
+#define	SVGA_ROP_CLEAR		0x00
+#define	SVGA_ROP_AND		0x01
+#define	SVGA_ROP_AND_REVERSE	0x02
+#define	SVGA_ROP_COPY		0x03
+#define	SVGA_ROP_AND_INVERTED	0x04
+#define	SVGA_ROP_NOOP		0x05
+#define	SVGA_ROP_XOR		0x06
+#define	SVGA_ROP_OR		0x07
+#define	SVGA_ROP_NOR		0x08
+#define	SVGA_ROP_EQUIV		0x09
+#define	SVGA_ROP_INVERT		0x0a
+#define	SVGA_ROP_OR_REVERSE	0x0b
+#define	SVGA_ROP_COPY_INVERTED	0x0c
+#define	SVGA_ROP_OR_INVERTED	0x0d
+#define	SVGA_ROP_NAND		0x0e
+#define	SVGA_ROP_SET		0x0f
+
+
+/*
+ *  Memory area offsets (viewed as an array of 32-bit words)
+ */
+
+/*
+ *  The distance from MIN to MAX must be at least 10K
+ */
+
+#define	 SVGA_FIFO_MIN	      0
+#define	 SVGA_FIFO_MAX	      1
+#define	 SVGA_FIFO_NEXT_CMD   2
+#define	 SVGA_FIFO_STOP	      3
+
+#define	 SVGA_FIFO_USER_DEFINED	    4
+
+/*
+ *  Drawing object ID's, in the range 0 to SVGA_MAX_ID
+ */
+
+#define	 SVGA_MAX_ID	      499
+
+/*
+ *  Macros to compute variable length items (sizes in 32-bit words)
+ */
+
+#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)
+
+/*
+ *  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))
+
+/*
+ *  Commands in the command FIFO
+ */
+
+#define	 SVGA_CMD_UPDATE		   1
+	 /* FIFO layout:
+	    X, Y, Width, Height */
+
+#define	 SVGA_CMD_RECT_FILL		   2
+	 /* FIFO layout:
+	    Color, X, Y, Width, Height */
+
+#define	 SVGA_CMD_RECT_COPY		   3
+	 /* FIFO layout:
+	    Source X, Source Y, Dest X, Dest Y, Width, Height */
+
+#define	 SVGA_CMD_DEFINE_BITMAP		   4
+	 /* FIFO layout:
+	    Pixmap ID, Width, Height, <scanlines> */
+
+#define	 SVGA_CMD_DEFINE_BITMAP_SCANLINE   5
+	 /* FIFO layout:
+	    Pixmap ID, Width, Height, Line #, scanline */
+
+#define	 SVGA_CMD_DEFINE_PIXMAP		   6
+	 /* FIFO layout:
+	    Pixmap ID, Width, Height, Depth, <scanlines> */
+
+#define	 SVGA_CMD_DEFINE_PIXMAP_SCANLINE   7
+	 /* FIFO layout:
+	    Pixmap ID, Width, Height, Depth, Line #, scanline */
+
+#define	 SVGA_CMD_RECT_BITMAP_FILL	   8
+	 /* FIFO layout:
+	    Bitmap ID, X, Y, Width, Height, Foreground, Background */
+
+#define	 SVGA_CMD_RECT_PIXMAP_FILL	   9
+	 /* FIFO layout:
+	    Pixmap ID, X, Y, Width, Height */
+
+#define	 SVGA_CMD_RECT_BITMAP_COPY	  10
+	 /* FIFO layout:
+	    Bitmap ID, Source X, Source Y, Dest X, Dest Y,
+	    Width, Height, Foreground, Background */
+
+#define	 SVGA_CMD_RECT_PIXMAP_COPY	  11
+	 /* FIFO layout:
+	    Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, Height */
+
+#define	 SVGA_CMD_FREE_OBJECT		  12
+	 /* FIFO layout:
+	    Object (pixmap, bitmap, ...) ID */
+
+#define	 SVGA_CMD_RECT_ROP_FILL           13
+         /* FIFO layout:
+            Color, X, Y, Width, Height, ROP */
+
+#define	 SVGA_CMD_RECT_ROP_COPY           14
+         /* FIFO layout:
+            Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
+
+#define	 SVGA_CMD_RECT_ROP_BITMAP_FILL    15
+         /* FIFO layout:
+            ID, X, Y, Width, Height, Foreground, Background, ROP */
+
+#define	 SVGA_CMD_RECT_ROP_PIXMAP_FILL    16
+         /* FIFO layout:
+            ID, X, Y, Width, Height, ROP */
+
+#define	 SVGA_CMD_RECT_ROP_BITMAP_COPY    17
+         /* FIFO layout:
+            ID, Source X, Source Y,
+            Dest X, Dest Y, Width, Height, Foreground, Background, ROP */
+
+#define	 SVGA_CMD_RECT_ROP_PIXMAP_COPY    18
+         /* FIFO layout:
+            ID, Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */
+
+#define	SVGA_CMD_DEFINE_CURSOR		  19
+	/* FIFO layout:
+	   ID, Hotspot X, Hotspot Y, Width, Height,
+	   Depth for AND mask, Depth for XOR mask,
+	   <scanlines for AND mask>, <scanlines for XOR mask> */
+
+#define	SVGA_CMD_DISPLAY_CURSOR		  20
+	/* FIFO layout:
+	   ID, On/Off (1 or 0) */
+
+#define	SVGA_CMD_MOVE_CURSOR		  21
+	/* FIFO layout:
+	   X, Y */
+
+#define	SVGA_CMD_MAX			  22
+
+#endif
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h	Tue Feb 20 11:39:13 2001
@@ -0,0 +1,166 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: vm_basic_types.h,v 1.9 2001/02/14 22:22:53 bennett Exp $
+ * **********************************************************/
+
+/*
+ *
+ * vm_basic_types.h -- 
+ *
+ *    basic data types.
+ */
+
+ 
+#ifndef _VM_BASIC_TYPES_H_
+#define _VM_BASIC_TYPES_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#include "includeCheck.h"
+
+/* STRICT ANSI means the Xserver build and X defines Bool differently. */
+#ifndef __STRICT_ANSI__
+typedef char           Bool;
+#endif
+
+#ifndef FALSE
+#define FALSE          0
+#endif
+
+#ifndef TRUE
+#define TRUE           1
+#endif
+
+#ifdef _MSC_VER
+typedef unsigned __int64 uint64;
+typedef signed __int64 int64;
+
+#pragma warning (disable :4018) // signed/unsigned mismatch
+#pragma warning (disable :4761) // integral size mismatch in argument; conversion supplied
+#pragma warning (disable :4305) // truncation from 'const int' to 'short'
+#pragma warning (disable :4244) // conversion from 'unsigned short' to 'unsigned char'
+//#pragma warning (disable :4101) // unreferenced local variable
+#pragma warning (disable :4133) // incompatible types - from 'struct VM *' to 'int *'
+#pragma warning (disable :4047) // differs in levels of indirection
+#pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned
+#pragma warning (disable :4142) // benign redefinition of type
+
+#elif __GNUC__
+/* The Xserver source compiles with -ansi -pendantic */
+#ifndef __STRICT_ANSI__
+typedef unsigned long long uint64;
+typedef long long int64;
+#endif
+#else
+#error - Need compiler define for int64/uint64
+#endif
+
+typedef unsigned int       uint32;
+typedef unsigned short     uint16;
+typedef unsigned char      uint8;
+
+typedef int       int32;
+typedef short     int16;
+typedef char      int8;
+
+
+/*
+ * Printf format for 64-bit number.  Use it like this:
+ *    printf("%"FMT64"d\n", big);
+ */
+
+#ifdef _MSC_VER
+#define FMT64   "I64"
+#elif __GNUC__
+#define FMT64   "L"
+#else
+#error - Need compiler define for FMT64
+#endif
+
+typedef uint32 VA;
+typedef uint32 VPN;
+
+typedef uint32 PA;
+typedef uint32 PPN;
+
+typedef uint32 MA;
+typedef uint32 MPN;
+
+#define INVALID_MPN ((MPN)-1)
+
+#define EXTERN        extern
+/*
+ * Right now our use of CONST is broken enough that it only works
+ * with GCC. XXX Need to fix this.
+ */
+#ifdef __GNUC__
+#define CONST         const
+#else
+#ifndef CONST
+#define CONST
+#endif
+#endif
+
+#ifdef _MSC_VER
+#ifndef INLINE
+#define INLINE        __inline
+#endif
+#else
+#ifndef INLINE
+#define INLINE        inline
+#endif
+#endif
+
+
+#if defined(WIN32) && !defined(VMX86_NO_THREADS)
+#define THREADSPECIFIC _declspec(thread) 
+#else
+#define THREADSPECIFIC
+#endif
+
+/* 
+ * Like "INLINE" but use this token to mark functions that are inline
+ * because they have only a single call site. In other words, if a second
+ * call site is introduced, the "INLINE_SINGLE_CALLER" token should be 
+ * removed. 
+ */
+#define INLINE_SINGLE_CALLER INLINE
+
+/*
+ * Attributes placed on function declarations to tell the compiler
+ * that the function never returns.
+ */
+#ifdef _MSC_VER
+#define NORETURN_DECL(_fndecl)    __declspec(noreturn) _fndecl
+#elif __GNUC__ >= 2 && __GNUC_MINOR__ >= 5
+#define NORETURN_DECL(_fndecl)    _fndecl __attribute__((__noreturn__))
+#else
+#define NORETURN_DECL(_fndecl)    _fndecl
+#endif
+
+
+/*
+ * GCC's argument checking for printf-like functions
+ * This is conditional until we have replaced all `"%x", void *'
+ * with `"0x%08x", (uint32) void *'. Note that %p prints different things
+ * on different platforms.
+ *
+ * fmtPos is the position of the format string argument, beginning at 1
+ * varPos is the position of the variable argument, beginning at 1
+ */
+#if defined(__GNUC__) && defined(notdef)
+# define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos)))
+#else
+# define PRINTF_DECL(fmtPos, varPos)
+#endif
+
+/*
+ * Used to silence compiler warnings that get generated when the
+ * compiler thinks that a function returns when it is marked noreturn.
+ */
+#define INFINITE_LOOP()           do { } while (1)
+
+#endif
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h	Tue Jan 30 13:16:56 2001
@@ -0,0 +1,63 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: vm_device_version.h,v 1.2 2001/01/26 21:53:27 yoel Exp $
+ * **********************************************************/
+
+
+#ifndef VM_DEVICE_VERSION_H
+#define VM_DEVICE_VERSION_H
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_MONITOR
+#define INCLUDE_ALLOW_MODULE
+#define INCLUDE_ALLOW_VMKERNEL
+#include "includeCheck.h"
+
+#define PCI_VENDOR_ID_VMWARE        0x15AD
+#define PCI_DEVICE_ID_VMWARE_SVGA2  0x0405
+#define PCI_DEVICE_ID_VMWARE_SVGA   0x0710
+#define PCI_DEVICE_ID_VMWARE_NET    0x0720
+#define PCI_DEVICE_ID_VMWARE_SCSI   0x0730
+#define PCI_DEVICE_ID_VMWARE_IDE    0x1729
+
+/*  From linux/pci.h.  We emulate an AMD ethernet controller */
+#define PCI_VENDOR_ID_AMD               0x1022
+#define PCI_DEVICE_ID_AMD_VLANCE        0x2000
+#define PCI_VENDOR_ID_BUSLOGIC			0x104B
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC	0x0140
+#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER	0x1040
+
+/* Intel Values for the chipset */
+#define PCI_VENDOR_ID_INTEL             0x8086
+#define PCI_DEVICE_ID_INTEL_82439TX     0x7100
+#define PCI_DEVICE_ID_INTEL_82371AB_0   0x7110
+#define PCI_DEVICE_ID_INTEL_82371AB_3   0x7113
+#define PCI_DEVICE_ID_INTEL_82371AB     0x7111
+#define PCI_DEVICE_ID_INTEL_82443BX     0x7192
+
+
+/************* Strings for IDE Identity Fields **************************/
+#define VIDE_ID_SERIAL_STR	"00000000000000000001"	/* Must be 20 Bytes */
+#define VIDE_ID_FIRMWARE_STR	"00000001"		/* Must be 8 Bytes */
+
+/* No longer than 40 Bytes and must be an even length. */
+#define VIDE_ATA_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE Hard Drive  "
+#define VIDE_ATAPI_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE CDROM Drive "
+
+#define ATAPI_VENDOR_ID	"NECVMWar"		/* Must be 8 Bytes */
+#define ATAPI_PRODUCT_ID PRODUCT_GENERIC_NAME " IDE CDROM"	/* Must be 16 Bytes */
+#define ATAPI_REV_LEVEL	"1.00"			/* Must be 4 Bytes */
+
+
+/************* Strings for SCSI Identity Fields **************************/
+#define SCSI_DISK_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI Hard Drive"
+#define SCSI_CDROM_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI CDROM Drive"
+
+/************* Strings for the VESA BIOS Identity Fields *****************/
+#define VBE_OEM_STRING COMPANY_NAME " SVGA"
+#define VBE_VENDOR_NAME COMPANY_NAME
+#define VBE_PRODUCT_NAME PRODUCT_GENERIC_NAME
+
+
+#endif /* VM_DEVICE_VERSION_H */
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c	Thu Feb 22 18:10:39 2001
@@ -0,0 +1,1427 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmware[] =
+
+    "$Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $";
+#endif
+/* $XFree86$ */
+/* $XConsortium$ */
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Resources.h"
+
+#include "compiler.h"	/* inb/outb */
+
+#include "xf86PciInfo.h"	/* pci vendor id */
+#include "xf86Pci.h"		/* pci */
+
+#include "mipointer.h"		/* sw cursor */
+#include "mibstore.h"		/* backing store */
+#include "micmap.h"		/* mi color map */
+#include "vgaHW.h"		/* VGA hardware */
+#define PSZ	8		/* 8bpp */
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h"		/* 16bpp */
+#include "cfb24.h"		/* 24bpp */
+#include "cfb32.h"		/* 32bpp */
+
+#include "xf86cmap.h"		/* xf86HandleColormaps */
+
+#include "vmware.h"
+#include "guest_os.h"
+#include "vm_device_version.h"
+
+/*
+ * Sanity check that xf86PciInfo.h has the correct values (which come from
+ * the VMware source tree in vm_device_version.h.
+ */
+#if PCI_CHIP_VMWARE0405 != PCI_DEVICE_ID_VMWARE_SVGA2
+#error "PCI_CHIP_VMWARE0405 is wrong, update it from vm_device_version.h"
+#endif
+#if PCI_CHIP_VMWARE0710 != PCI_DEVICE_ID_VMWARE_SVGA
+#error "PCI_CHIP_VMWARE0710 is wrong, update it from vm_device_version.h"
+#endif
+#if PCI_VENDOR_VMWARE != PCI_VENDOR_ID_VMWARE
+#error "PCI_VENDOR_VMWARE is wrong, update it from vm_device_version.h"
+#endif
+
+/*
+ * 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 VMWARE_NAME	"VMWARE"
+#define VMWARE_DRIVER_NAME	"vmware"
+#define VMWARE_MAJOR_VERSION	10
+#define VMWARE_MINOR_VERSION	4
+#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";
+
+static SymTabRec VMWAREChipsets[] = {
+	{ 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
+};
+
+/*
+ * Currently, even the PCI obedient 0405 chip still only obeys IOSE and
+ * MEMSE for the SVGA resources.  Thus, RES_EXCLUSIVE_VGA is required.
+ *
+ * The 0710 chip also uses hardcoded IO ports that aren't disablable.
+ */
+
+static PciChipsets VMWAREPciChipsets[] = {
+	{ PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA },
+	{ PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes },
+	{ -1,		       -1,		    RES_UNDEFINED }
+};
+
+#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}
+};
+#endif	/* XFree86LOADER */
+
+typedef enum {
+	OPTION_HW_CURSOR,
+	OPTION_NOACCEL
+} VMWAREOpts;
+
+static OptionInfoRec VMWAREOptions[] = {
+	{ OPTION_HW_CURSOR,	"HWcursor",	OPTV_BOOLEAN,	{0},	FALSE },
+	{ OPTION_NOACCEL,	"NoAccel",	OPTV_BOOLEAN,	{0},	FALSE },
+	{ -1,			NULL,		OPTV_NONE,	{0},	FALSE }
+};
+
+#define nVMWAREOptions (sizeof(VMWAREOptions) / sizeof(VMWAREOptions[0]))
+
+static Bool
+VMWAREGetRec(ScrnInfoPtr pScrn)
+{
+	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;
+	}
+}
+
+static void ScreenToPrivate(ScreenPtr, ScrnInfoPtr);
+static void ScreenFromPrivate(ScreenPtr, ScrnInfoPtr);
+
+/* VMware specific functions */
+
+static CARD32
+vmwareReadReg(VMWAREPtr pVMWARE, int index)
+{
+    outl(pVMWARE->indexReg, index);
+    return inl(pVMWARE->valueReg);
+}
+
+void
+vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value)
+{
+    outl(pVMWARE->indexReg, index);
+    outl(pVMWARE->valueReg, value);
+}
+
+void
+vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value)
+{
+    CARD32* vmwareFIFO = pVMWARE->vmwareFIFO;
+
+    /* Need to sync? */
+    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)) ;
+    }
+    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];
+    }
+}
+
+void
+vmwareWaitForFB(VMWAREPtr pVMWARE)
+{
+    if (pVMWARE->vmwareFIFOMarkSet) {
+	vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1);
+	while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ;
+	pVMWARE->vmwareFIFOMarkSet = FALSE;
+    }
+}
+
+void
+vmwareSendSVGACmdUpdate(VMWAREPtr pVMWARE, BoxPtr pBB)
+{
+    vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_UPDATE);
+    vmwareWriteWordToFIFO(pVMWARE, pBB->x1);
+    vmwareWriteWordToFIFO(pVMWARE, pBB->y1);
+    vmwareWriteWordToFIFO(pVMWARE, pBB->x2 - pBB->x1);
+    vmwareWriteWordToFIFO(pVMWARE, pBB->y2 - pBB->y1);
+}
+
+static void
+vmwareSendSVGACmdUpdateFullScreen(VMWAREPtr pVMWARE)
+{
+    BoxRec BB;
+
+    BB.x1 = 0;
+    BB.y1 = 0;
+    BB.x2 = pVMWARE->ModeReg.svga_reg_width;
+    BB.y2 = pVMWARE->ModeReg.svga_reg_height;
+    vmwareSendSVGACmdUpdate(pVMWARE, &BB);
+}
+
+static CARD32
+vmwareCalculateWeight(CARD32 mask)
+{
+    CARD32 weight;
+
+    for (weight = 0; mask; mask >>= 1) {
+	if (mask & 1) {
+	    weight++;
+	}
+    }
+    return weight;
+}
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * VMXGetVMwareSvgaId --
+ *
+ *    Retrieve the SVGA_ID of the VMware SVGA adapter.
+ *    This function should hide any backward compatibility mess.
+ *
+ * Results:
+ *    The SVGA_ID_* of the present VMware adapter.
+ *
+ * Side effects:
+ *    ins/outs
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static uint32
+VMXGetVMwareSvgaId(VMWAREPtr pVMWARE)
+{
+   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;
+   }
+
+   /* No supported VMware SVGA devices found */
+   return SVGA_ID_INVALID;
+}
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ *  RewriteTagString --
+ *
+ *      Rewrites the given string, removing the $Name:  $, and
+ *      replacing it with the contents.  The output string must
+ *      have enough room, or else.
+ *
+ * Results:
+ *
+ *      Output string updated.
+ *
+ * Side effects:
+ *      None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RewriteTagString(const char *istr, char *ostr, int osize)
+{
+    int chr;
+    Bool inTag = FALSE;
+    char *op = ostr;
+
+    do {
+	chr = *istr++;
+	if (chr == '$') {
+	    if (inTag) {
+		inTag = FALSE;
+		for (; op > ostr && op[-1] == ' '; op--) {
+		}
+		continue;
+	    }
+	    if (strncmp(istr, "Name:", 5) == 0) {
+		istr += 5;
+		istr += strspn(istr, " ");
+		inTag = TRUE;
+		continue;
+	    }
+	}
+	*op++ = chr;
+    } while (chr);
+}
+
+static void
+VMWAREIdentify(int flags)
+{
+	xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets);
+}
+
+static OptionInfoPtr
+VMWAREAvailableOptions(int chipid, int busid)
+{
+	return VMWAREOptions;
+}
+
+static Bool
+VMWAREPreInit(ScrnInfoPtr pScrn, int flags)
+{
+	MessageType from;
+	VMWAREPtr pVMWARE;
+	OptionInfoRec options[nVMWAREOptions];
+	int bpp24flags;
+	uint32 id;
+	int i;
+	const char* mod;
+	ClockRange* clockRanges;
+
+	if (pScrn->numEntities != 1) {
+		return FALSE;
+	}
+
+	if (!VMWAREGetRec(pScrn)) {
+		return FALSE;
+	}
+	pVMWARE = VMWAREPTR(pScrn);
+
+	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 (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;
+	}
+
+	if (!xf86LoadSubModule(pScrn, "vgahw")) {
+		return FALSE;
+	}
+
+/*	xf86LoaderReqSymLists(vgahwSymbols, NULL); */ /* FIXME */
+
+	if (!vgaHWGetHWRec(pScrn)) {
+		return FALSE;
+	}
+
+	pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device,
+				 pVMWARE->PciInfo->func);
+	pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo);
+
+	pScrn->monitor = pScrn->confScreen->monitor;
+
+	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->bitsPerPixel = vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL);
+	pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? PseudoColor : TrueColor;
+	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);
+#define ACCELERATE_OPS
+#ifdef ACCELERATE_OPS
+	pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES);
+#else
+	pVMWARE->vmwareCapability = 0;
+#endif
+	pVMWARE->cursorDefined = FALSE;
+	pVMWARE->mouseHidden = FALSE;
+
+	xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth);
+	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, "bpp:   %d\n", pVMWARE->bitsPerPixel);
+	xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vis:   %d\n", pVMWARE->defaultVisual);
+	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);
+	xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps:  0x%08X\n", pVMWARE->vmwareCapability);
+
+	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 (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) {
+		return FALSE;
+	}
+	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;
+	}
+	if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "Given bpp (%d) is not supported by this driver (%d is required)\n",
+			   pScrn->bitsPerPixel, pVMWARE->bitsPerPixel);
+		return FALSE;
+	}
+	xf86PrintDepthBpp(pScrn);
+
+#if 0
+	if (pScrn->depth == 24 && pix24bpp == 0) {
+		pix24bpp = xf86GetBppFromDepth(pScrn, 24);
+	}
+#endif
+
+	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 0
+	bytesPerPixel = pScrn->bitsPerPixel / 8;
+#endif
+	pScrn->progClock = TRUE;
+
+#if 0 /* MGA does not do this */
+	if (pScrn->visual != 0) {	/* FIXME */
+		/* print error message */
+		return FALSE;
+	}
+#endif
+
+	xf86CollectOptions(pScrn, NULL);
+	memcpy(options, VMWAREOptions, sizeof(VMWAREOptions));
+	xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+	if (pScrn->depth <= 8) {
+		pScrn->rgbBits = 8;
+	}
+
+	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;
+	}
+
+	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;
+
+	{
+		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);
+	switch (pScrn->bitsPerPixel) {
+		case 8:	mod = "cfb"; break;
+		case 16:mod = "cfb16"; break;
+		case 24:mod = "cfb24"; break;
+		case 32:mod = "cfb32"; break;
+		default:
+			xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unexpected bpp (%d)\n", pScrn->bitsPerPixel);
+			VMWAREFreeRec(pScrn);
+			return FALSE;
+	}
+	if (mod && !xf86LoadSubModule(pScrn, mod)) {
+		VMWAREFreeRec(pScrn);
+		return FALSE;
+	}
+	if (!pVMWARE->noAccel || pVMWARE->hwCursor) {
+		if (!xf86LoadSubModule(pScrn, "xaa")) {
+			VMWAREFreeRec(pScrn);
+			return FALSE;
+		}
+	}
+	return TRUE;
+}
+
+static Bool
+VMWAREMapMem(ScrnInfoPtr pScrn)
+{
+	VMWAREPtr pVMWARE;
+
+	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;
+}
+
+static Bool
+VMWAREUnmapMem(ScrnInfoPtr pScrn)
+{
+	VMWAREPtr pVMWARE;
+
+	pVMWARE = VMWAREPTR(pScrn);
+
+	VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->FbSize));
+
+	xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->FbSize);
+	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;
+
+	vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
+
+	vmwareReg->svga_reg_enable = 0;
+	/* FIXME: Save VMWARE state */
+}
+
+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);
+	}
+}
+
+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);
+}
+
+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;
+}
+
+static void
+VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+	/* FIXME */
+}
+
+static void
+VMWAREInitFIFO(ScrnInfoPtr pScrn)
+{
+	VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+	CARD32* vmwareFIFO;
+
+	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);
+}
+
+static void
+VMWAREStopFIFO(ScrnInfoPtr pScrn)
+{
+	VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+
+	/* ??? */
+	vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0);
+}
+
+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);
+}
+
+static Bool
+VMWARESaveScreen(ScreenPtr pScreen, int mode)
+{
+	return vgaHWSaveScreen(pScreen, mode);
+}
+
+static void
+VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices,
+		LOCO* colors, VisualPtr pVisual)
+{
+	VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
+	int i;
+
+	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++;
+	}
+
+	pVMWARE->checkCursorColor = TRUE;
+	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);
+
+        /*
+         * If using the vgahw module, its data structures and related
+         * things are typically initialised/mapped here.
+         */
+
+	hwp = VGAHWPTR(pScrn);
+	vgaHWGetIOBase(hwp);
+
+	/* Save the current video state */
+	VMWARESave(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 framebuffer.
+	 */
+
+	switch (pScrn->bitsPerPixel) {
+#if 0
+		case 1:
+			ret = xf1bppScreenInit(pScreen, pVMWARE->FbBase,
+					pScrn->virtualX, pScrn->virtualY,
+					pScrn->xDpi, pScrn->yDpi,
+					pScrn->displayWidth);
+			break;
+	        case 4:
+			ret = xf4bppScreenInit(pScreen, pVMWARE->FbBase,
+			                pScrn->virtualX, pScrn->virtualY,
+			                pScrn->xDpi, pScrn->yDpi,
+			                pScrn->displayWidth);
+		        break;
+#endif
+	case 8:
+			/*
+			 * In ScreenToPrivate, below, we register our own
+			 * CopyPlane proc (via mfbRegisterCopyPlaneProc).
+			 * But we can't handle all cases, so we have to stash
+			 * away a pointer to someone who can.
+			 */
+			pVMWARE->pcfbCopyPlane = cfbCopyPlane;
+	                ret = cfbScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+			                pScrn->virtualX, pScrn->virtualY,
+				        pScrn->xDpi, pScrn->yDpi,
+			                pScrn->displayWidth);
+	                break;
+                case 16:
+			pVMWARE->pcfbCopyPlane = cfb16CopyPlane;
+			ret = cfb16ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+			                pScrn->virtualX, pScrn->virtualY,
+			                pScrn->xDpi, pScrn->yDpi,
+			                pScrn->displayWidth);
+	                break;
+                case 24:
+			pVMWARE->pcfbCopyPlane = cfb24CopyPlane;
+		        ret = cfb24ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+				pScrn->virtualX, pScrn->virtualY,
+			                pScrn->xDpi, pScrn->yDpi,
+			                pScrn->displayWidth);
+                        break;
+                case 32:
+			pVMWARE->pcfbCopyPlane = cfb32CopyPlane;
+	                ret = cfb32ScreenInit(pScreen, pVMWARE->FbBase + pVMWARE->fbOffset,
+			                pScrn->virtualX, pScrn->virtualY,
+		                        pScrn->xDpi, pScrn->yDpi,
+		                        pScrn->displayWidth);
+	                break;
+                default:
+			xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in VMWAREScreenInit\n",
+				   pScrn->bitsPerPixel);
+	                ret = FALSE;
+	                break;
+	}
+	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;
+			}
+		}
+	}
+
+	/*
+	 * 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);
+
+        /*
+         * Set initial black & white colourmap indices.
+         */
+        xf86SetBlackWhitePixels(pScreen);
+
+        /*
+         * Install colourmap functions.  If using the vgahw module,
+         * vgaHandleColormaps would usually be called here.
+         */
+
+        /*
+         * Initialise cursor functions.  This example is for the mi
+         * software cursor.
+         */
+	if (pVMWARE->hwCursor) {
+		vmwareCursorInit(0, pScreen);
+	} else {
+	        miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+	}
+
+        /* Initialise the default colourmap */
+        switch (pScrn->depth) {
+#if 0
+		case 1:
+			if (!xf1bppCreateDefColormap(pScreen))
+				return FALSE;
+		        break;
+	        case 4:
+			if (!xf4bppCreateDefColormap(pScreen))
+				return FALSE;
+			break;
+#endif
+		default:
+			if (!cfbCreateDefColormap(pScreen))
+				return FALSE;
+			break;
+	}
+
+	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);
+	}
+
+	vmwareSendSVGACmdUpdateFullScreen(pVMWARE);
+	if (pVMWARE->hwCursor) {
+		vmwareRestoreCursor(pScreen);
+	}
+	/* Done */
+	return TRUE;
+}
+
+static Bool
+VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+	return VMWAREModeInit(xf86Screens[scrnIndex], mode);
+}
+
+static Bool
+VMWAREEnterVT(int scrnIndex, int flags)
+{
+	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+	return VMWAREModeInit(pScrn, pScrn->currentMode);
+}
+
+static void
+VMWARELeaveVT(int scrnIndex, int flags)
+{
+	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]);
+}
+
+static Bool
+VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+{
+	/* FIXME... possible */
+	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)];
+
+	RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr));
+	xf86DrvMsg(0, X_PROBED, "%s", buildString);
+
+	numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections);
+	if (numDevSections <= 0) {
+		xf86DrvMsg(0, X_ERROR, "No vmware driver section\n");
+		return FALSE;
+	}
+	if (xf86GetPciVideoInfo()) {
+		VmwareLog(("Some PCI Video Info Exists\n"));
+		numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE,
+				VMWAREChipsets, VMWAREPciChipsets, devSections,
+				numDevSections, drv, &usedChips);
+		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;
+			}
+		}
+		if (numUsed > 0) {
+			xfree(usedChips);
+		}
+	}
+	xfree(devSections);
+	return foundScreen;
+}
+
+DriverRec VMWARE = {
+	VERSION,
+	"Driver for VMware SVGA adapter",
+	VMWAREIdentify,
+	VMWAREProbe,
+	VMWAREAvailableOptions,
+	NULL,
+	0
+};
+
+#ifdef XFree86LOADER
+static MODULESETUPPROTO(vmwareSetup);
+
+XF86ModuleData vmwareModuleData = { &vmwareVersRec, vmwareSetup, NULL };
+
+static pointer
+vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+	static Bool setupDone = FALSE;
+
+	if (!setupDone) {
+		setupDone = TRUE;
+		xf86AddDriver(&VMWARE, module, 0);
+		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;
+
+#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
+
+    mfbRegisterCopyPlaneProc(pScreen, vmwareCopyPlane);
+    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;
+    }
+}
+
+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;
+}
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.cpp xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.cpp
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.cpp	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.cpp	Thu Feb 15 14:44:59 2001
@@ -0,0 +1,36 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH VMWARE __drivermansuffix__ "Version 4.0.2"  "XFree86"
+.SH NAME
+vmware \- VMware SVGA video driver
+.SH SYNOPSIS
+.nf
+.B "Section \*qDevice\*q"
+.BI "  Identifier \*q"  devname \*q
+.B  "  Driver \*qvmware\*q"
+\ \ ...
+.B EndSection
+.fi
+.SH DESCRIPTION
+.B vmware 
+is an XFree86 driver for VMware virtual video cards. 
+.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 version of any virtual VMware SVGA adapter.
+.PP
+The following driver
+.B Options
+are supported:
+.TP
+.BI "Option \*qHWCursor\*q \*q" boolean \*q
+Enable or disable the HW cursor.  Default: off.
+.TP
+.BI "Option \*qNoAccel\*q \*q" boolean \*q
+Disable or enable acceleration.  Default: acceleration is enabled.
+.SH "SEE ALSO"
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+.SH AUTHORS
+Copyright (c) 1999-2001 VMware, Inc.
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h	Tue Jan 30 12:08:50 2001
@@ -0,0 +1,757 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * $Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $
+ * **********************************************************/
+/* $XFree86$ */
+/* $XConsortium$ */
+
+#ifndef VMWARE_H
+#define VMWARE_H
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Resources.h"
+
+#include "compiler.h"	/* inb/outb */
+
+#include "xf86PciInfo.h"	/* pci vendor id */
+#include "xf86Pci.h"		/* pci */
+
+#include "mipointer.h"		/* sw cursor */
+#include "mibstore.h"		/* backing store */
+#include "micmap.h"		/* mi color map */
+#include "vgaHW.h"		/* VGA hardware */
+#define PSZ	8		/* 8bpp */
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h"		/* 16bpp */
+#include "cfb24.h"		/* 24bpp */
+#include "cfb32.h"		/* 32bpp */
+
+#include "xf86cmap.h"		/* xf86HandleColormaps */
+
+#include "vm_basic_types.h"
+#include "svga_reg.h"
+
+typedef struct {
+	CARD32		svga_reg_enable;
+	CARD32		svga_reg_width;
+	CARD32		svga_reg_height;
+} VMWARERegRec, *VMWARERegPtr;
+
+typedef struct {
+	DisplayModePtr	mode;
+} VMWAREFBLayout;
+
+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 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;
+
+	uint16		indexReg, valueReg;
+
+	RegionPtr (*pcfbCopyPlane) ();
+	ScreenRec	ScrnFuncs;
+	/* ... */
+} VMWARERec, *VMWAREPtr;
+
+#define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate))
+
+static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) {
+   return xf86Screens[s->myNum];
+}
+
+#include "gcstruct.h"
+
+#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, 0); \
+		} else { \
+		    vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+		    vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+		    vmwareWriteWordToFIFO(vmPtr, 0); \
+		    UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+		} \
+	} \
+    } \
+}
+
+#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 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, 1); \
+		} else { \
+		    vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \
+		    vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \
+		    vmwareWriteWordToFIFO(vmPtr, 1); \
+		    UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \
+		} \
+	} \
+    } \
+}
+
+/* Only use this for debugging */
+
+#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); \
+}
+
+#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"));
+#else
+#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
+#endif
+    );
+
+void vmwareWriteWordToFIFO(
+#if NeedFunctionPrototypes
+    VMWAREPtr pVMWARE, CARD32 value
+#endif
+    );
+
+void vmwareWaitForFB(
+#ifdef NeedFunctionPrototypes
+    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
+#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
+#endif
+    );
+
+Bool vmwareRealizeCursor(
+#if NeedFunctionPrototypes
+    ScreenPtr pScr, CursorPtr pCurs
+#endif
+    );
+
+Bool vmwareUnrealizeCursor(
+#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(
+#if NeedFunctionPrototypes
+    VMWAREPtr pVMWARE
+#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(
+#if NeedFunctionPrototypes
+    DrawablePtr pDrawable,
+    int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst
+#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(
+#if NeedFunctionPrototypes
+    WindowPtr pWin, RegionPtr prgnSave, int xorg, int yorg
+#endif
+    );
+
+RegionPtr vmwareRestoreAreas(
+#if NeedFunctionPrototypes
+    WindowPtr pWin,
+    RegionPtr prgnRestore
+#endif
+    );
+
+/* END Screen functions that draw */
+
+/* BEGIN GCOps */
+
+void vmwareFillSpans(
+#if NeedFunctionPrototypes
+    DrawablePtr pDrawable,
+    GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted
+#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,
+#if NeedFunctionPrototypes
+    DrawablePtr pDst,
+    int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane
+#endif
+    );
+
+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
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c	Fri Jan 26 16:54:55 2001
@@ -0,0 +1,284 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#include "X.h"
+#include "cfb.h"
+#include "vmware.h"
+
+void
+vmwareDoBitblt(DrawablePtr pSrc,
+    DrawablePtr pDst,
+    int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, unsigned long planemask, unsigned long bitplane)
+{
+    BoxPtr pbox;
+    int nbox;
+    BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+    DDXPointPtr pptTmp, pptNew1, pptNew2;
+    VMWAREPtr pVMWARE;
+
+    pVMWARE = VMWAREPTR(infoFromScreen(pSrc->pScreen));
+
+    pbox = REGION_RECTS(prgnDst);
+    nbox = REGION_NUM_RECTS(prgnDst);
+    pboxNew1 = NULL;
+    pptNew1 = NULL;
+    pboxNew2 = NULL;
+    pptNew2 = NULL;
+    if (pptSrc->y < pbox->y1) {
+	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);
+	    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;
+	    pptSrc = pptNew1;
+	}
+    }
+    if (pptSrc->x < pbox->x1) {
+	if (nbox > 1) {
+	    /* reverse order of rects in each band */
+	    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 (pboxNew1) {
+		    DEALLOCATE_LOCAL(pptNew1);
+		    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;
+	    pptSrc = pptNew2;
+	}
+    }
+    /* Send the commands */
+    while (nbox--) {
+	vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY);
+	vmwareWriteWordToFIFO(pVMWARE, pptSrc->x);
+	vmwareWriteWordToFIFO(pVMWARE, pptSrc->y);
+	vmwareWriteWordToFIFO(pVMWARE, pbox->x1);
+	vmwareWriteWordToFIFO(pVMWARE, pbox->y1);
+	vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1);
+	vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1);
+	vmwareWriteWordToFIFO(pVMWARE, alu);
+	pptSrc++;
+	pbox++;
+    }
+    if (pboxNew2) {
+	DEALLOCATE_LOCAL(pptNew2);
+	DEALLOCATE_LOCAL(pboxNew2);
+    }
+    if (pboxNew1) {
+	DEALLOCATE_LOCAL(pptNew1);
+	DEALLOCATE_LOCAL(pboxNew1);
+    }
+}
+
+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) {
+	void (*doBitBlt) (DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long, unsigned long);
+	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 =
+	    cfbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width,
+	    height, dstx, dsty, doBitBlt, 0L);
+	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 =
+		pVMWARE->pcfbCopyPlane(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 =
+		pVMWARE->pcfbCopyPlane(pSrcDrawable,
+		pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty,
+		bitPlane);
+	}
+    } else {
+	prgn =
+	    pVMWARE->pcfbCopyPlane(pSrcDrawable, pDstDrawable,
+	    pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+    }
+    return prgn;
+}
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,66 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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;
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c	Tue Jan 30 16:57:12 2001
@@ -0,0 +1,440 @@
+/* **********************************************************
+ * Copyright (C) 1998-2001 VMware, Inc.
+ * All Rights Reserved
+ * **********************************************************/
+#ifdef VMX86_DEVEL
+char rcsId_vmwarecurs[] =
+
+    "$Id: vmwarecurs.c,v 1.5 2001/01/30 23:33:02 bennett Exp $";
+#endif
+/* $XFree86$ */
+/* $XConsortium$ */
+
+#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,
+};
+
+Bool
+vmwareCursorInit(char *pm, 
+		 ScreenPtr pScr)
+{
+    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;
+    }
+}
+
+Bool
+vmwareRealizeCursor(ScreenPtr pScr, 
+		    CursorPtr pCurs)
+{
+    pointer *pPriv = &pCurs->bits->devPriv[pScr->myNum];
+    VMwareCursPriv *cursPriv;
+    int i;
+    uint8 *bits;
+    VMWAREPtr pVMWARE;
+
+    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;
+}
+
+Bool
+vmwareUnrealizeCursor(ScreenPtr pScr, 
+		      CursorPtr pCurs)
+{
+    VMwareCursPriv *cursPriv;
+
+    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;
+}
+
+static void
+vmwareLoadCursor(ScreenPtr pScr, 
+		 CursorPtr pCurs, 
+		 int x, 
+		 int y)
+{
+    VMWAREPtr pVMWARE;
+
+    TRACEPOINT
+
+    if (!pCurs)
+	return;
+
+    pVMWARE = VMWAREPTR(infoFromScreen(pScr));
+
+    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);
+
+    if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) {
+	vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR);
+	vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID);
+	vmwareWriteWordToFIFO(pVMWARE, 1);
+    }
+}
+
+void
+vmwareSetCursor(ScreenPtr pScr, 
+		CursorPtr pCurs, 
+		int x, 
+		int y)
+{
+    int index = pScr->myNum;
+
+    TRACEPOINT
+    
+    if (!pCurs)
+	return;
+
+    vmwareSaveCursors[index] = pCurs;
+    vmwareLoadCursor(pScr, pCurs, x, y);
+}
+
+void
+vmwareRestoreCursor(ScreenPtr pScr)
+{
+    int index = pScr->myNum;
+    int x, y;
+
+    TRACEPOINT
+    
+    miPointerPosition(&x, &y);
+    vmwareLoadCursor(pScr, vmwareSaveCursors[index], x, y);
+}
+
+void
+vmwareMoveCursor(ScreenPtr pScr,
+		 int x, 
+		 int y)
+{
+    VMWAREPtr pVMWARE;
+    
+    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, 1);
+	} else {
+	    vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR);
+	    vmwareWriteWordToFIFO(pVMWARE, x);
+	    vmwareWriteWordToFIFO(pVMWARE, y);
+	    UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box);
+	}
+    }
+}
+
+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;
+
+    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++;
+    }
+
+    /* 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); */
+    }
+    pVMWARE->checkCursorColor = FALSE;
+
+    /* 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;
+}
+
+void
+vmwareRenewCursorColor(ScreenPtr pScr)
+{
+    TRACEPOINT
+
+    if (vmwareSaveCursors[pScr->myNum])
+	vmwareRecolorCursor(pScr, vmwareSaveCursors[pScr->myNum], TRUE);
+}
+
+void
+vmwareBlockHandler(i, blockData, pTimeout, pReadmask)
+    int i;
+    pointer blockData;
+    pointer pTimeout;
+    pointer pReadmask;
+{
+    VMWAREPtr pVMWARE;
+
+    TRACEPOINT
+
+    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;
+{
+    TRACEPOINT
+
+    if (*pwidth > 0) {
+
+	switch (class) {
+
+	case CursorShape:
+	    if (*pwidth > 64)
+		*pwidth = 64;
+	    if (*pheight > 64)
+		*pheight = 64;
+	    break;
+	default:
+	    mfbQueryBestSize(class, pwidth, pheight, pScr);
+	    break;
+	}
+    }
+}
+
+void
+vmwareCursorOff(VMWAREPtr pVMWARE)
+{
+    TRACEPOINT
+
+    if (pVMWARE->cursorDefined) {
+	if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) {
+	    vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID);
+	    vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 0);
+	} else {
+	    vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR);
+	    vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID);
+	    vmwareWriteWordToFIFO(pVMWARE, 0);
+	    UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box);
+	}
+    }
+}
+
+void
+vmwareClearSavedCursor(int scr_index)
+{
+    TRACEPOINT
+
+    vmwareSaveCursors[scr_index] = NULL;
+}
+
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,63 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,64 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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)); 
+}
+
+
+
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,133 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#include "X.h"
+#include "cfb.h"
+#include "cfb16.h"
+#include "cfb24.h"
+#include "cfb32.h"
+#include "mi.h"
+#include "migc.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);
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,48 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,60 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
+
+
+
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,142 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,81 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
+
+
+
+
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,75 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,44 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,275 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#include "X.h"
+#include "cfb.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];
+    cfbPrivGC *priv;
+    int numRects;
+    int n;
+    int xorg, yorg;
+
+    priv = cfbGetGCPrivate(pGC);
+    prgnClip = cfbGetCompositeClip(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));
+}
+
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,181 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c	Fri Jan 26 16:54:55 2001
@@ -0,0 +1,146 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#include "vmware.h"
+
+void
+vmwareCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+{
+    DDXPointPtr pptSrc;
+    register DDXPointPtr ppt;
+    RegionRec rgnDst;
+    BoxPtr pbox;
+    int dx, dy;
+    int i, nbox;
+    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);
+    pbox = REGION_RECTS(&rgnDst);
+    nbox = REGION_NUM_RECTS(&rgnDst);
+    if (!nbox ||
+	!(pptSrc =
+   (DDXPointPtr) ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {
+	REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
+	return;
+    }
+    ppt = pptSrc;
+    for (i = nbox; --i >= 0; ppt++, pbox++) {
+	ppt->x = pbox->x1 + dx;
+	ppt->y = pbox->y1 + dy;
+    }
+    pBB = REGION_EXTENTS(pWin->drawable.pScreen, &rgnDst);
+    HIDE_CURSOR_ACCEL(pVMWARE, *pBB);
+    vmwareDoBitblt((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot,
+	GXcopy, &rgnDst, pptSrc, ~0L, 0);
+    SHOW_CURSOR(pVMWARE, *pBB);
+    UPDATE_ACCEL_AREA(pVMWARE, *pBB);
+    DEALLOCATE_LOCAL(pptSrc);
+    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);
+    }
+}
diff -urN xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c
--- xc-clean/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c	Wed Dec 31 16:00:00 1969
+++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c	Fri Jan 26 15:32:16 2001
@@ -0,0 +1,63 @@
+/* **********************************************************
+ * 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$ */
+/* $XConsortium$ */
+
+#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));
+}