From 990bc3f015a4f8fce2eb918375defcd44980a845 Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Fri, 8 Jun 2012 09:33:13 +0200
Subject: Used synchronise script to update files

---
 xorg-server/hw/xfree86/.gitignore                  |    4 +
 xorg-server/hw/xfree86/common/.gitignore           |    3 +
 xorg-server/hw/xfree86/common/extramodes           |   54 +-
 xorg-server/hw/xfree86/common/modeline2c.awk       |  186 +-
 xorg-server/hw/xfree86/common/vesamodes            |  222 +-
 xorg-server/hw/xfree86/common/xf86.h               |   10 +-
 xorg-server/hw/xfree86/common/xf86Build.h.in       |    4 +-
 xorg-server/hw/xfree86/common/xf86Bus.c            |    7 +-
 xorg-server/hw/xfree86/common/xf86Cursor.c         |   13 +-
 xorg-server/hw/xfree86/common/xf86DGA.c            |   20 +-
 xorg-server/hw/xfree86/common/xf86DPMS.c           |   14 +-
 xorg-server/hw/xfree86/common/xf86Events.c         |   12 +-
 xorg-server/hw/xfree86/common/xf86Helper.c         |   23 +-
 xorg-server/hw/xfree86/common/xf86Init.c           |    4 +-
 xorg-server/hw/xfree86/common/xf86Mode.c           |    4 +-
 xorg-server/hw/xfree86/common/xf86Module.h         |    2 +-
 xorg-server/hw/xfree86/common/xf86PM.c             |   14 +-
 xorg-server/hw/xfree86/common/xf86Priv.h           |    2 +-
 xorg-server/hw/xfree86/common/xf86RandR.c          |    8 +-
 xorg-server/hw/xfree86/common/xf86VGAarbiter.c     |   54 +-
 xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h |   26 +-
 xorg-server/hw/xfree86/common/xf86VidMode.c        |    8 +-
 xorg-server/hw/xfree86/common/xf86cmap.c           |   50 +-
 xorg-server/hw/xfree86/common/xf86fbman.c          |    4 +-
 xorg-server/hw/xfree86/common/xf86sbusBus.c        |    4 +-
 xorg-server/hw/xfree86/common/xf86str.h            |   24 +-
 xorg-server/hw/xfree86/common/xf86xv.c             |   35 +-
 xorg-server/hw/xfree86/common/xf86xvmc.c           |    4 +-
 xorg-server/hw/xfree86/common/xf86xvpriv.h         |    6 +-
 xorg-server/hw/xfree86/ddc/DDC.HOWTO               |  194 +-
 xorg-server/hw/xfree86/ddc/Makefile.am             |   22 +-
 xorg-server/hw/xfree86/ddc/ddc.c                   |   25 +-
 xorg-server/hw/xfree86/ddc/xf86DDC.h               |    8 +-
 xorg-server/hw/xfree86/doc/.gitignore              |    4 +
 xorg-server/hw/xfree86/doc/README.DRIcomp          | 1108 ++++----
 xorg-server/hw/xfree86/doc/README.modes            |  948 +++----
 xorg-server/hw/xfree86/doc/Registry                |  818 +++---
 xorg-server/hw/xfree86/doc/ddxDesign.xml           |   44 +-
 xorg-server/hw/xfree86/dri/dri.c                   |   19 +-
 xorg-server/hw/xfree86/dri/dri.h                   |   10 +-
 xorg-server/hw/xfree86/exa/examodule.c             |   16 +-
 xorg-server/hw/xfree86/fbdevhw/README              |   32 +-
 xorg-server/hw/xfree86/fbdevhw/fbdevhw.c           |   23 +-
 xorg-server/hw/xfree86/fbdevhw/fbdevhw.h           |   12 +-
 xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c       |   10 +-
 xorg-server/hw/xfree86/i2c/i2c_def.h               |   12 +-
 xorg-server/hw/xfree86/i2c/xf86i2c.c               |    1 +
 xorg-server/hw/xfree86/i2c/xf86i2c.h               |    2 +
 xorg-server/hw/xfree86/int10/INT10.HOWTO           |  688 ++---
 xorg-server/hw/xfree86/int10/generic.c             |   13 +-
 xorg-server/hw/xfree86/int10/helper_exec.c         |   18 +-
 xorg-server/hw/xfree86/int10/helper_mem.c          |    8 +-
 xorg-server/hw/xfree86/int10/x86emu.c              |   24 +-
 xorg-server/hw/xfree86/int10/xf86int10.c           |   42 +-
 xorg-server/hw/xfree86/int10/xf86int10.h           |    4 +-
 xorg-server/hw/xfree86/int10/xf86x86emu.h          |  108 +-
 xorg-server/hw/xfree86/modes/Makefile.am           |   70 +-
 xorg-server/hw/xfree86/modes/xf86Crtc.c            |    6 +-
 xorg-server/hw/xfree86/modes/xf86DiDGA.c           |    2 +-
 xorg-server/hw/xfree86/modes/xf86RandR12.c         |   23 +-
 xorg-server/hw/xfree86/modes/xf86Rotate.c          |    7 +-
 xorg-server/hw/xfree86/os-support/bsd/Makefile.am  |  152 +-
 xorg-server/hw/xfree86/os-support/hurd/Makefile.am |   30 +-
 xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c |   74 +-
 xorg-server/hw/xfree86/os-support/int10Defines.h   |  178 +-
 .../hw/xfree86/os-support/linux/int10/linux.c      |   29 +-
 .../os-support/linux/int10/vm86/linux_vm86.c       |   16 +-
 xorg-server/hw/xfree86/os-support/misc/Makefile.am |   24 +-
 .../hw/xfree86/os-support/solaris/Makefile.am      |   74 +-
 .../hw/xfree86/os-support/solaris/apSolaris.shar   | 1612 +++++------
 .../hw/xfree86/os-support/solaris/solaris-amd64.S  |  134 +-
 .../hw/xfree86/os-support/solaris/solaris-ia32.S   |  134 +-
 .../os-support/solaris/solaris-sparcv8plus.S       |  276 +-
 .../hw/xfree86/os-support/solaris/sun_inout.s      |  248 +-
 xorg-server/hw/xfree86/ramdac/.gitignore           |    2 +
 xorg-server/hw/xfree86/ramdac/CURSOR.NOTES         |  382 +--
 xorg-server/hw/xfree86/ramdac/Makefile.am          |   38 +-
 xorg-server/hw/xfree86/ramdac/xf86Cursor.c         |   22 +-
 xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h     |    2 +-
 xorg-server/hw/xfree86/shadowfb/shadow.c           |   26 +-
 xorg-server/hw/xfree86/utils/cvt/.gitignore        |    1 +
 xorg-server/hw/xfree86/utils/gtf/.gitignore        |    1 +
 xorg-server/hw/xfree86/vbe/vbe.c                   |   24 +-
 xorg-server/hw/xfree86/vbe/vbe.h                   |    2 +-
 xorg-server/hw/xfree86/vgahw/Makefile.am           |   18 +-
 xorg-server/hw/xfree86/x86emu/Makefile.am          |   58 +-
 xorg-server/hw/xfree86/xaa/.gitignore              |    4 +
 xorg-server/hw/xfree86/xaa/XAA.HOWTO               | 2854 ++++++++++----------
 xorg-server/hw/xfree86/xaa/xaaInit.c               |   40 +-
 xorg-server/hw/xfree86/xaa/xaalocal.h              |    8 +-
 90 files changed, 5789 insertions(+), 5816 deletions(-)
 create mode 100644 xorg-server/hw/xfree86/.gitignore
 create mode 100644 xorg-server/hw/xfree86/common/.gitignore
 create mode 100644 xorg-server/hw/xfree86/doc/.gitignore
 create mode 100644 xorg-server/hw/xfree86/ramdac/.gitignore
 create mode 100644 xorg-server/hw/xfree86/utils/cvt/.gitignore
 create mode 100644 xorg-server/hw/xfree86/utils/gtf/.gitignore
 create mode 100644 xorg-server/hw/xfree86/xaa/.gitignore

(limited to 'xorg-server/hw/xfree86')

diff --git a/xorg-server/hw/xfree86/.gitignore b/xorg-server/hw/xfree86/.gitignore
new file mode 100644
index 000000000..997a94efe
--- /dev/null
+++ b/xorg-server/hw/xfree86/.gitignore
@@ -0,0 +1,4 @@
+Xorg
+xorg.conf.example
+sdksyms.c
+sdksyms.dep
diff --git a/xorg-server/hw/xfree86/common/.gitignore b/xorg-server/hw/xfree86/common/.gitignore
new file mode 100644
index 000000000..3262e2f37
--- /dev/null
+++ b/xorg-server/hw/xfree86/common/.gitignore
@@ -0,0 +1,3 @@
+#		Add & Override for this directory and it's subdirectories
+xf86Build.h
+xf86DefModeSet.c
diff --git a/xorg-server/hw/xfree86/common/extramodes b/xorg-server/hw/xfree86/common/extramodes
index 450502670..fdabb709a 100644
--- a/xorg-server/hw/xfree86/common/extramodes
+++ b/xorg-server/hw/xfree86/common/extramodes
@@ -1,27 +1,27 @@
-//
-// Extra modes to include as default modes in the X server.
-//
-// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $
-//
-
-# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
-ModeLine "832x624" 57.284 832  864  928 1152  624  625  628  667 -Hsync -Vsync
-
-# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
-ModeLine "1400x1050" 122.0 1400 1488 1640 1880   1050 1052 1064 1082 +hsync +vsync
-
-# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
-ModeLine "1400x1050" 155.8 1400 1464 1784 1912   1050 1052 1064 1090 +hsync +vsync
-
-# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
-Modeline "1920x1440" 341.35  1920 2072 2288 2656  1440 1441 1444 1512 -hsync +vsync
-
-# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz
-Modeline "2048x1536" 266.95  2048 2200 2424 2800  1536 1537 1540 1589 -hsync +vsync
-
-# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz
-Modeline "2048x1536" 340.48  2048 2216 2440 2832  1536 1537 1540 1603 -hsync +vsync
-
-# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz
-Modeline "2048x1536" 388.04  2048 2216 2440 2832  1536 1537 1540 1612 -hsync +vsync
-
+//
+// Extra modes to include as default modes in the X server.
+//
+// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $
+//
+
+# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
+ModeLine "832x624" 57.284 832  864  928 1152  624  625  628  667 -Hsync -Vsync
+
+# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
+ModeLine "1400x1050" 122.0 1400 1488 1640 1880   1050 1052 1064 1082 +hsync +vsync
+
+# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
+ModeLine "1400x1050" 155.8 1400 1464 1784 1912   1050 1052 1064 1090 +hsync +vsync
+
+# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
+Modeline "1920x1440" 341.35  1920 2072 2288 2656  1440 1441 1444 1512 -hsync +vsync
+
+# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz
+Modeline "2048x1536" 266.95  2048 2200 2424 2800  1536 1537 1540 1589 -hsync +vsync
+
+# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz
+Modeline "2048x1536" 340.48  2048 2216 2440 2832  1536 1537 1540 1603 -hsync +vsync
+
+# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz
+Modeline "2048x1536" 388.04  2048 2216 2440 2832  1536 1537 1540 1612 -hsync +vsync
+
diff --git a/xorg-server/hw/xfree86/common/modeline2c.awk b/xorg-server/hw/xfree86/common/modeline2c.awk
index 038e7e935..a85d36c58 100644
--- a/xorg-server/hw/xfree86/common/modeline2c.awk
+++ b/xorg-server/hw/xfree86/common/modeline2c.awk
@@ -1,93 +1,93 @@
-#!/usr/bin/awk -f
-#
-# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
-# All rights reserved.
-#
-# Based on Perl script by Dirk Hohndel.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Usage: modeline2c.awk < modefile > xf86DefModeSet.c
-#
-
-BEGIN {
-	flagsdict[""] = "0"
-
-	flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
-	flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
-	flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
-	flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
-	flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
-	flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
-	flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
-	flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
-
-	print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
-	print " * modeline2c.awk */"
-	print ""
-	print "/*"
-	print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
-	print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
-	print " */"
-	print ""
-	print "#ifdef HAVE_XORG_CONFIG_H"
-	print "#include <xorg-config.h>"
-	print "#endif"
-	print ""
-	print "#include \"xf86.h\""
-	print "#include \"xf86Config.h\""
-	print "#include \"xf86Priv.h\""
-	print "#include \"xf86_OSlib.h\""
-	print ""
-	print "#include \"globals.h\""
-	print ""
-	print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
-	print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
-	print ""
-	print "const DisplayModeRec xf86DefaultModes [] = {"
-
-	modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
-	modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
-}
-
-/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
-	flags = $0
-	gsub(modeline_data, "", flags)
-	flags = tolower(flags)
-	printf(modeline, $3 * 1000, $4, $5, $6, $7,
-	       $8, $9, $10, $11, flagsdict[flags])
-	# Half-width double scanned modes
-	printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
-	       $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
-}
-
-/^#/ {
-	print "/*" substr($0, 2) " */"
-}
-
-END {
-	print "};"
-	printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"
-}
+#!/usr/bin/awk -f
+#
+# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+# All rights reserved.
+#
+# Based on Perl script by Dirk Hohndel.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# Usage: modeline2c.awk < modefile > xf86DefModeSet.c
+#
+
+BEGIN {
+	flagsdict[""] = "0"
+
+	flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
+	flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
+	flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
+	flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
+	flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
+	flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
+	flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
+	flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
+
+	print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
+	print " * modeline2c.awk */"
+	print ""
+	print "/*"
+	print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
+	print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
+	print " */"
+	print ""
+	print "#ifdef HAVE_XORG_CONFIG_H"
+	print "#include <xorg-config.h>"
+	print "#endif"
+	print ""
+	print "#include \"xf86.h\""
+	print "#include \"xf86Config.h\""
+	print "#include \"xf86Priv.h\""
+	print "#include \"xf86_OSlib.h\""
+	print ""
+	print "#include \"globals.h\""
+	print ""
+	print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
+	print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
+	print ""
+	print "const DisplayModeRec xf86DefaultModes [] = {"
+
+	modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
+	modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
+}
+
+/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
+	flags = $0
+	gsub(modeline_data, "", flags)
+	flags = tolower(flags)
+	printf(modeline, $3 * 1000, $4, $5, $6, $7,
+	       $8, $9, $10, $11, flagsdict[flags])
+	# Half-width double scanned modes
+	printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
+	       $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
+}
+
+/^#/ {
+	print "/*" substr($0, 2) " */"
+}
+
+END {
+	print "};"
+	printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);"
+}
diff --git a/xorg-server/hw/xfree86/common/vesamodes b/xorg-server/hw/xfree86/common/vesamodes
index 2bc886276..6644ee6ae 100644
--- a/xorg-server/hw/xfree86/common/vesamodes
+++ b/xorg-server/hw/xfree86/common/vesamodes
@@ -1,111 +1,111 @@
-//
-//  Default modes distilled from
-//      "VESA and Industry Standards and Guide for Computer Display Monitor
-//       Timing", version 1.0, revision 0.8, adopted September 17, 1998.
-//  
-//  $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $
-
-
-# 640x350 @ 85Hz (VESA) hsync: 37.9kHz
-ModeLine "640x350"    31.5  640  672  736  832    350  382  385  445 +hsync -vsync
-
-# 640x400 @ 85Hz (VESA) hsync: 37.9kHz
-ModeLine "640x400"    31.5  640  672  736  832    400  401  404  445 -hsync +vsync
-
-# 720x400 @ 85Hz (VESA) hsync: 37.9kHz
-ModeLine "720x400"    35.5  720  756  828  936    400  401  404  446 -hsync +vsync
-
-# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
-ModeLine "640x480"    25.175 640  656  752  800    480  490  492  525 -hsync -vsync
-
-# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
-ModeLine "640x480"    31.5  640  664  704  832    480  489  492  520 -hsync -vsync
-
-# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
-ModeLine "640x480"    31.5  640  656  720  840    480  481  484  500 -hsync -vsync
-
-# 640x480 @ 85Hz (VESA) hsync: 43.3kHz
-ModeLine "640x480"    36.0  640  696  752  832    480  481  484  509 -hsync -vsync
-
-# 800x600 @ 56Hz (VESA) hsync: 35.2kHz
-ModeLine "800x600"    36.0  800  824  896 1024    600  601  603  625 +hsync +vsync
-
-# 800x600 @ 60Hz (VESA) hsync: 37.9kHz
-ModeLine "800x600"    40.0  800  840  968 1056    600  601  605  628 +hsync +vsync
-
-# 800x600 @ 72Hz (VESA) hsync: 48.1kHz
-ModeLine "800x600"    50.0  800  856  976 1040    600  637  643  666 +hsync +vsync
-
-# 800x600 @ 75Hz (VESA) hsync: 46.9kHz
-ModeLine "800x600"    49.5  800  816  896 1056    600  601  604  625 +hsync +vsync
-
-# 800x600 @ 85Hz (VESA) hsync: 53.7kHz
-ModeLine "800x600"    56.3  800  832  896 1048    600  601  604  631 +hsync +vsync
-
-# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz
-ModeLine "1024x768"   44.9 1024 1032 1208 1264    768  768  776  817 +hsync +vsync Interlace
-
-# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz
-ModeLine "1024x768"   65.0 1024 1048 1184 1344    768  771  777  806 -hsync -vsync
-
-# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz
-ModeLine "1024x768"   75.0 1024 1048 1184 1328    768  771  777  806 -hsync -vsync
-
-# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
-ModeLine "1024x768"   78.75 1024 1040 1136 1312    768  769  772  800 +hsync +vsync
-
-# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
-ModeLine "1024x768"   94.5 1024 1072 1168 1376    768  769  772  808 +hsync +vsync
-
-# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz
-ModeLine "1152x864"  108.0 1152 1216 1344 1600    864  865  868  900 +hsync +vsync
-
-# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz
-ModeLine "1280x960"  108.0 1280 1376 1488 1800    960  961  964 1000 +hsync +vsync
-
-# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz
-ModeLine "1280x960"  148.5 1280 1344 1504 1728    960  961  964 1011 +hsync +vsync
-
-# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz
-ModeLine "1280x1024" 108.0 1280 1328 1440 1688   1024 1025 1028 1066 +hsync +vsync
-
-# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz
-ModeLine "1280x1024" 135.0 1280 1296 1440 1688   1024 1025 1028 1066 +hsync +vsync
-
-# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz
-ModeLine "1280x1024" 157.5 1280 1344 1504 1728   1024 1025 1028 1072 +hsync +vsync
-
-# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz
-ModeLine "1600x1200" 162.0 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
-
-# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz
-ModeLine "1600x1200" 175.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
-
-# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz
-ModeLine "1600x1200" 189.0 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
-
-# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz
-ModeLine "1600x1200" 202.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
-
-# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz
-ModeLine "1600x1200" 229.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
-
-# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz
-ModeLine "1792x1344" 204.8 1792 1920 2120 2448   1344 1345 1348 1394 -hsync +vsync
-
-# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz
-ModeLine "1792x1344" 261.0 1792 1888 2104 2456   1344 1345 1348 1417 -hsync +vsync
-
-# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz
-ModeLine "1856x1392" 218.3 1856 1952 2176 2528   1392 1393 1396 1439 -hsync +vsync
-
-# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz
-ModeLine "1856x1392" 288.0 1856 1984 2208 2560   1392 1393 1396 1500 -hsync +vsync
-
-# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz
-ModeLine "1920x1440" 234.0 1920 2048 2256 2600   1440 1441 1444 1500 -hsync +vsync
-
-# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz
-ModeLine "1920x1440" 297.0 1920 2064 2288 2640   1440 1441 1444 1500 -hsync +vsync
-
-
+//
+//  Default modes distilled from
+//      "VESA and Industry Standards and Guide for Computer Display Monitor
+//       Timing", version 1.0, revision 0.8, adopted September 17, 1998.
+//  
+//  $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $
+
+
+# 640x350 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "640x350"    31.5  640  672  736  832    350  382  385  445 +hsync -vsync
+
+# 640x400 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "640x400"    31.5  640  672  736  832    400  401  404  445 -hsync +vsync
+
+# 720x400 @ 85Hz (VESA) hsync: 37.9kHz
+ModeLine "720x400"    35.5  720  756  828  936    400  401  404  446 -hsync +vsync
+
+# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
+ModeLine "640x480"    25.175 640  656  752  800    480  490  492  525 -hsync -vsync
+
+# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
+ModeLine "640x480"    31.5  640  664  704  832    480  489  492  520 -hsync -vsync
+
+# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
+ModeLine "640x480"    31.5  640  656  720  840    480  481  484  500 -hsync -vsync
+
+# 640x480 @ 85Hz (VESA) hsync: 43.3kHz
+ModeLine "640x480"    36.0  640  696  752  832    480  481  484  509 -hsync -vsync
+
+# 800x600 @ 56Hz (VESA) hsync: 35.2kHz
+ModeLine "800x600"    36.0  800  824  896 1024    600  601  603  625 +hsync +vsync
+
+# 800x600 @ 60Hz (VESA) hsync: 37.9kHz
+ModeLine "800x600"    40.0  800  840  968 1056    600  601  605  628 +hsync +vsync
+
+# 800x600 @ 72Hz (VESA) hsync: 48.1kHz
+ModeLine "800x600"    50.0  800  856  976 1040    600  637  643  666 +hsync +vsync
+
+# 800x600 @ 75Hz (VESA) hsync: 46.9kHz
+ModeLine "800x600"    49.5  800  816  896 1056    600  601  604  625 +hsync +vsync
+
+# 800x600 @ 85Hz (VESA) hsync: 53.7kHz
+ModeLine "800x600"    56.3  800  832  896 1048    600  601  604  631 +hsync +vsync
+
+# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz
+ModeLine "1024x768"   44.9 1024 1032 1208 1264    768  768  776  817 +hsync +vsync Interlace
+
+# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz
+ModeLine "1024x768"   65.0 1024 1048 1184 1344    768  771  777  806 -hsync -vsync
+
+# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz
+ModeLine "1024x768"   75.0 1024 1048 1184 1328    768  771  777  806 -hsync -vsync
+
+# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
+ModeLine "1024x768"   78.75 1024 1040 1136 1312    768  769  772  800 +hsync +vsync
+
+# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
+ModeLine "1024x768"   94.5 1024 1072 1168 1376    768  769  772  808 +hsync +vsync
+
+# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz
+ModeLine "1152x864"  108.0 1152 1216 1344 1600    864  865  868  900 +hsync +vsync
+
+# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz
+ModeLine "1280x960"  108.0 1280 1376 1488 1800    960  961  964 1000 +hsync +vsync
+
+# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz
+ModeLine "1280x960"  148.5 1280 1344 1504 1728    960  961  964 1011 +hsync +vsync
+
+# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz
+ModeLine "1280x1024" 108.0 1280 1328 1440 1688   1024 1025 1028 1066 +hsync +vsync
+
+# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz
+ModeLine "1280x1024" 135.0 1280 1296 1440 1688   1024 1025 1028 1066 +hsync +vsync
+
+# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz
+ModeLine "1280x1024" 157.5 1280 1344 1504 1728   1024 1025 1028 1072 +hsync +vsync
+
+# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz
+ModeLine "1600x1200" 162.0 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz
+ModeLine "1600x1200" 175.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz
+ModeLine "1600x1200" 189.0 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz
+ModeLine "1600x1200" 202.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
+
+# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz
+ModeLine "1600x1200" 229.5 1600 1664 1856 2160   1200 1201 1204 1250 +hsync +vsync
+
+# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz
+ModeLine "1792x1344" 204.8 1792 1920 2120 2448   1344 1345 1348 1394 -hsync +vsync
+
+# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz
+ModeLine "1792x1344" 261.0 1792 1888 2104 2456   1344 1345 1348 1417 -hsync +vsync
+
+# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz
+ModeLine "1856x1392" 218.3 1856 1952 2176 2528   1392 1393 1396 1439 -hsync +vsync
+
+# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz
+ModeLine "1856x1392" 288.0 1856 1984 2208 2560   1392 1393 1396 1500 -hsync +vsync
+
+# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz
+ModeLine "1920x1440" 234.0 1920 2048 2256 2600   1440 1441 1444 1500 -hsync +vsync
+
+# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz
+ModeLine "1920x1440" 297.0 1920 2064 2288 2640   1440 1441 1444 1500 -hsync +vsync
+
+
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index 0eb000d41..129660d81 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -244,7 +244,7 @@ extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module,
                                     int flags);
 extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
 extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
-extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags);
+extern _X_EXPORT void xf86DeleteScreen(ScrnInfoPtr pScrn);
 extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
 extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp,
                                        int pad);
@@ -256,7 +256,7 @@ extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
 extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
 extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
 extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
-extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
+extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
 extern _X_EXPORT void
 xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
                 const char *format, va_list args)
@@ -347,7 +347,7 @@ xf86SetBackingStore(ScreenPtr pScreen);
 extern _X_EXPORT void
 xf86SetSilkenMouse(ScreenPtr pScreen);
 extern _X_EXPORT pointer
-xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
+xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, char *port_name,
                   char **adaptor_name, pointer *adaptor_options);
 extern _X_EXPORT void
 xf86GetOS(const char **name, int *major, int *minor, int *teeny);
@@ -357,7 +357,7 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
                    EntityProc enter, EntityProc leave, pointer private);
 
 extern _X_EXPORT Bool
-xf86IsScreenPrimary(int scrnIndex);
+xf86IsScreenPrimary(ScrnInfoPtr pScrn);
 extern _X_EXPORT int
 xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
                                int format, unsigned long len, pointer value);
@@ -458,4 +458,6 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
 
 #define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */
 
+#define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */
+
 #endif                          /* _XF86_H */
diff --git a/xorg-server/hw/xfree86/common/xf86Build.h.in b/xorg-server/hw/xfree86/common/xf86Build.h.in
index a4f56b0ae..f4af80637 100644
--- a/xorg-server/hw/xfree86/common/xf86Build.h.in
+++ b/xorg-server/hw/xfree86/common/xf86Build.h.in
@@ -1,2 +1,2 @@
-#define BUILD_DATE @BUILD_DATE@
-#define BUILD_TIME @BUILD_TIME@
+#define BUILD_DATE @BUILD_DATE@
+#define BUILD_TIME @BUILD_TIME@
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index b8764344b..6c86f5e26 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -179,7 +179,7 @@ xf86BusConfig(void)
             xf86Msg(X_ERROR,
                     "Screen %d deleted because of no matching config section.\n",
                     i);
-            xf86DeleteScreen(i--, 0);
+            xf86DeleteScreen(xf86Screens[i--]);
         }
     }
 
@@ -377,13 +377,12 @@ xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
 }
 
 /*
- * xf86ClearEntitiesForScreen() - called when a screen is deleted
+ * xf86ClearEntityListForScreen() - called when a screen is deleted
  * to mark it's entities unused. Called by xf86DeleteScreen().
  */
 void
-xf86ClearEntityListForScreen(int scrnIndex)
+xf86ClearEntityListForScreen(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     int i, entityIndex;
 
     if (pScrn->entityList == NULL || pScrn->numEntities == 0)
diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c
index 61cae6aa7..c01cfd138 100644
--- a/xorg-server/hw/xfree86/common/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/common/xf86Cursor.c
@@ -66,7 +66,7 @@ static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
 static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
 static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
 
-static void xf86PointerMoved(int scrnIndex, int x, int y);
+static void xf86PointerMoved(ScrnInfoPtr pScrn, int x, int y);
 
 static miPointerScreenFuncRec xf86PointerScreenFuncs = {
     xf86CursorOffScreen,
@@ -135,14 +135,13 @@ xf86SetViewport(ScreenPtr pScreen, int x, int y)
 {
     ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
 
-    (*pScr->PointerMoved) (pScreen->myNum, x, y);
+    (*pScr->PointerMoved) (pScr, x, y);
 }
 
 static void
-xf86PointerMoved(int scrnIndex, int x, int y)
+xf86PointerMoved(ScrnInfoPtr pScr, int x, int y)
 {
     Bool frameChanged = FALSE;
-    ScrnInfoPtr pScr = xf86Screens[scrnIndex];
 
     /*
      * check wether (x,y) belongs to the visual part of the screen
@@ -173,7 +172,7 @@ xf86PointerMoved(int scrnIndex, int x, int y)
     }
 
     if (frameChanged && pScr->AdjustFrame != NULL)
-        pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+        pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0);
 }
 
 /*
@@ -230,7 +229,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
         miPointerGetPosition(dev, &px, &py);
 
     was_blocked = xf86BlockSIGIO();
-    Switched = (*pScr->SwitchMode) (pScr->scrnIndex, mode, 0);
+    Switched = (*pScr->SwitchMode) (pScr, mode);
     if (Switched) {
         pScr->currentMode = mode;
 
@@ -271,7 +270,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
     xf86UnblockSIGIO(was_blocked);
 
     if (pScr->AdjustFrame)
-        (*pScr->AdjustFrame) (pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
+        (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0);
 
     /* The original code centered the frame around the cursor if possible.
      * Since this is hard to achieve with multiple cursors, we do the following:
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
index e0314d86e..64163721f 100644
--- a/xorg-server/hw/xfree86/common/xf86DGA.c
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -56,7 +56,7 @@ static DevPrivateKeyRec DGAScreenKeyRec;
 #define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
 static Bool mieq_installed;
 
-static Bool DGACloseScreen(int i, ScreenPtr pScreen);
+static Bool DGACloseScreen(ScreenPtr pScreen);
 static void DGADestroyColormap(ColormapPtr pmap);
 static void DGAInstallColormap(ColormapPtr pmap);
 static void DGAUninstallColormap(ColormapPtr pmap);
@@ -235,7 +235,7 @@ FreeMarkedVisuals(ScreenPtr pScreen)
 }
 
 static Bool
-DGACloseScreen(int i, ScreenPtr pScreen)
+DGACloseScreen(ScreenPtr pScreen)
 {
     DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 
@@ -256,7 +256,7 @@ DGACloseScreen(int i, ScreenPtr pScreen)
 
     free(pScreenPriv);
 
-    return ((*pScreen->CloseScreen) (i, pScreen));
+    return ((*pScreen->CloseScreen) (pScreen));
 }
 
 static void
@@ -323,11 +323,10 @@ DGAUninstallColormap(ColormapPtr pmap)
 }
 
 int
-xf86SetDGAMode(int index, int num, DGADevicePtr devRet)
+xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     DGAScreenPtr pScreenPriv;
-    ScrnInfoPtr pScrn;
     DGADevicePtr device;
     PixmapPtr pPix = NULL;
     DGAModePtr pMode = NULL;
@@ -338,7 +337,6 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet)
     pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
     if (!pScreenPriv)
         return BadValue;
-    pScrn = pScreenPriv->pScrn;
 
     if (!num) {
         if (pScreenPriv->current) {
@@ -359,7 +357,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet)
                 pScreenPriv->savedColormap = NULL;
             }
             pScreenPriv->dgaColormap = NULL;
-            (*pScrn->EnableDisableFBAccess) (index, TRUE);
+            (*pScrn->EnableDisableFBAccess) (pScrn, TRUE);
 
             FreeMarkedVisuals(pScreen);
         }
@@ -385,7 +383,7 @@ xf86SetDGAMode(int index, int num, DGADevicePtr devRet)
         Bool oldVTSema = pScrn->vtSema;
 
         pScrn->vtSema = FALSE;  /* kludge until we rewrite VT switching */
-        (*pScrn->EnableDisableFBAccess) (index, FALSE);
+        (*pScrn->EnableDisableFBAccess) (pScrn, FALSE);
         pScrn->vtSema = oldVTSema;
     }
 
@@ -564,7 +562,7 @@ DGAShutdown(void)
     for (i = 0; i < screenInfo.numScreens; i++) {
         pScrn = xf86Screens[i];
 
-        (void) (*pScrn->SetDGAMode) (pScrn->scrnIndex, 0, NULL);
+        (void) (*pScrn->SetDGAMode) (pScrn, 0, NULL);
     }
 }
 
@@ -579,7 +577,7 @@ DGASetMode(int index, int num, XDGAModePtr mode, PixmapPtr *pPix)
 
     /* We rely on the extension to check that DGA is available */
 
-    ret = (*pScrn->SetDGAMode) (index, num, &device);
+    ret = (*pScrn->SetDGAMode) (pScrn, num, &device);
     if ((ret == Success) && num) {
         DGACopyModeInfo(device.mode, mode);
         *pPix = device.pPix;
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 54ad84243..ef4a2c19b 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -49,7 +49,7 @@
 #ifdef DPMSExtension
 static DevPrivateKeyRec DPMSKeyRec;
 static DevPrivateKey DPMSKey;
-static Bool DPMSClose(int i, ScreenPtr pScreen);
+static Bool DPMSClose(ScreenPtr pScreen);
 static int DPMSCount = 0;
 #endif
 
@@ -99,10 +99,10 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
 #ifdef DPMSExtension
 
 static Bool
-DPMSClose(int i, ScreenPtr pScreen)
+DPMSClose(ScreenPtr pScreen)
 {
     DPMSPtr pDPMS;
-
+    ScrnInfoPtr pScrn;
     /* This shouldn't happen */
     if (DPMSKey == NULL)
         return FALSE;
@@ -114,20 +114,20 @@ DPMSClose(int i, ScreenPtr pScreen)
         return FALSE;
 
     pScreen->CloseScreen = pDPMS->CloseScreen;
-
+    pScrn = xf86ScreenToScrn(pScreen);
     /*
      * Turn on DPMS when shutting down. If this function can be used
      * depends on the order the driver wraps things. If this is called
      * after the driver has shut down everything the driver will have
      * to deal with this internally.
      */
-    if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) {
-        xf86Screens[i]->DPMSSet(xf86Screens[i], DPMSModeOn, 0);
+    if (pScrn->vtSema && pScrn->DPMSSet) {
+        pScrn->DPMSSet(pScrn, DPMSModeOn, 0);
     }
 
     if (--DPMSCount == 0)
         DPMSKey = NULL;
-    return pScreen->CloseScreen(i, pScreen);
+    return pScreen->CloseScreen(pScreen);
 }
 
 /*
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 5896f220c..4fcad4000 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -438,7 +438,7 @@ xf86VTSwitch(void)
         for (i = 0; i < xf86NumScreens; i++) {
             if (!(dispatchException & DE_TERMINATE))
                 if (xf86Screens[i]->EnableDisableFBAccess)
-                    (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+                    (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
         }
 
         /*
@@ -459,7 +459,7 @@ xf86VTSwitch(void)
 
         prevSIGIO = xf86BlockSIGIO();
         for (i = 0; i < xf86NumScreens; i++)
-            xf86Screens[i]->LeaveVT(i, 0);
+            xf86Screens[i]->LeaveVT(xf86Screens[i]);
 
         xf86AccessLeave();      /* We need this here, otherwise */
 
@@ -471,13 +471,13 @@ xf86VTSwitch(void)
             DebugF("xf86VTSwitch: Leave failed\n");
             xf86AccessEnter();
             for (i = 0; i < xf86NumScreens; i++) {
-                if (!xf86Screens[i]->EnterVT(i, 0))
+                if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                     FatalError("EnterVT failed for screen %d\n", i);
             }
             if (!(dispatchException & DE_TERMINATE)) {
                 for (i = 0; i < xf86NumScreens; i++) {
                     if (xf86Screens[i]->EnableDisableFBAccess)
-                        (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+                        (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
                 }
             }
             dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
@@ -527,12 +527,12 @@ xf86VTSwitch(void)
         xf86AccessEnter();
         for (i = 0; i < xf86NumScreens; i++) {
             xf86Screens[i]->vtSema = TRUE;
-            if (!xf86Screens[i]->EnterVT(i, 0))
+            if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
                 FatalError("EnterVT failed for screen %d\n", i);
         }
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->EnableDisableFBAccess)
-                (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+                (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
         }
 
         /* Turn screen saver off when switching back */
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index fb56a0b17..5ef1dabfb 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -198,24 +198,22 @@ xf86AllocateScreen(DriverPtr drv, int flags)
  */
 
 void
-xf86DeleteScreen(int scrnIndex, int flags)
+xf86DeleteScreen(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn;
     int i;
+    int scrnIndex;
 
     /* First check if the screen is valid */
     if (xf86NumScreens == 0 || xf86Screens == NULL)
         return;
 
-    if (scrnIndex > xf86NumScreens - 1)
-        return;
-
-    if (!(pScrn = xf86Screens[scrnIndex]))
+    if (!pScrn)
         return;
 
+    scrnIndex = pScrn->scrnIndex;
     /* If a FreeScreen function is defined, call it here */
     if (pScrn->FreeScreen != NULL)
-        pScrn->FreeScreen(scrnIndex, 0);
+        pScrn->FreeScreen(pScrn);
 
     while (pScrn->modes)
         xf86DeleteMode(&pScrn->modes, pScrn->modes);
@@ -233,7 +231,7 @@ xf86DeleteScreen(int scrnIndex, int flags)
 
     free(pScrn->privates);
 
-    xf86ClearEntityListForScreen(scrnIndex);
+    xf86ClearEntityListForScreen(pScrn);
 
     free(pScrn);
 
@@ -1027,9 +1025,8 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen)
  * private data, and therefore don't need to access pScrnInfo->vtSema.
  */
 void
-xf86EnableDisableFBAccess(int scrnIndex, Bool enable)
+xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable)
 {
-    ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex];
     ScreenPtr pScreen = pScrnInfo->pScreen;
     PixmapPtr pspix;
 
@@ -1651,10 +1648,9 @@ xf86SetSilkenMouse(ScreenPtr pScreen)
 /* Wrote this function for the PM2 Xv driver, preliminary. */
 
 pointer
-xf86FindXvOptions(int scrnIndex, int adaptor_index, char *port_name,
+xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name,
                   char **adaptor_name, pointer *adaptor_options)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     confXvAdaptorPtr adaptor;
     int i;
 
@@ -1726,9 +1722,8 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
 }
 
 Bool
-xf86IsScreenPrimary(int scrnIndex)
+xf86IsScreenPrimary(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     int i;
 
     for (i = 0; i < pScrn->numEntities; i++) {
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index ead47ccba..ca6efd44e 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -591,7 +591,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
         }
         for (i = 0; i < xf86NumScreens; i++)
             if (!xf86Screens[i]->configured)
-                xf86DeleteScreen(i--, 0);
+                xf86DeleteScreen(xf86Screens[i--]);
 
         /*
          * If no screens left, return now.
@@ -1040,7 +1040,7 @@ AbortDDX(enum ExitCode error)
                  * screen explicitely.
                  */
                 xf86VGAarbiterLock(xf86Screens[i]);
-                (xf86Screens[i]->LeaveVT) (i, 0);
+                (xf86Screens[i]->LeaveVT) (xf86Screens[i]);
                 xf86VGAarbiterUnlock(xf86Screens[i]);
             }
     }
diff --git a/xorg-server/hw/xfree86/common/xf86Mode.c b/xorg-server/hw/xfree86/common/xf86Mode.c
index ab4d595c7..d80dec892 100644
--- a/xorg-server/hw/xfree86/common/xf86Mode.c
+++ b/xorg-server/hw/xfree86/common/xf86Mode.c
@@ -950,7 +950,7 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
                 mode->SynthClock /= 2;
         }
 
-        status = (*scrp->ValidMode) (scrp->scrnIndex, mode, FALSE,
+        status = (*scrp->ValidMode) (scrp, mode, FALSE,
                                      MODECHECK_INITIAL);
         if (status != MODE_OK)
             return status;
@@ -1840,7 +1840,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
             scrp->virtualX = newVirtX;
             scrp->virtualY = newVirtY;
             scrp->displayWidth = newLinePitch;
-            p->status = (scrp->ValidMode) (scrp->scrnIndex, p, FALSE,
+            p->status = (scrp->ValidMode) (scrp, p, FALSE,
                                            MODECHECK_FINAL);
 
             if (p->status != MODE_OK) {
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 31f5c6a86..bf56acd05 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -82,7 +82,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(12, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(13, 0)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(17, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(6, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c
index f69fffa0e..1830640d5 100644
--- a/xorg-server/hw/xfree86/common/xf86PM.c
+++ b/xorg-server/hw/xfree86/common/xf86PM.c
@@ -102,7 +102,7 @@ suspend(pmEvent event, Bool undo)
 
     for (i = 0; i < xf86NumScreens; i++) {
         if (xf86Screens[i]->EnableDisableFBAccess)
-            (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
+            (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
     }
     pInfo = xf86InputDevs;
     while (pInfo) {
@@ -112,9 +112,9 @@ suspend(pmEvent event, Bool undo)
     sigio_blocked_for_suspend = xf86BlockSIGIO();
     for (i = 0; i < xf86NumScreens; i++) {
         if (xf86Screens[i]->PMEvent)
-            xf86Screens[i]->PMEvent(i, event, undo);
+            xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
         else {
-            xf86Screens[i]->LeaveVT(i, 0);
+            xf86Screens[i]->LeaveVT(xf86Screens[i]);
             xf86Screens[i]->vtSema = FALSE;
         }
     }
@@ -131,16 +131,16 @@ resume(pmEvent event, Bool undo)
     xf86AccessEnter();
     for (i = 0; i < xf86NumScreens; i++) {
         if (xf86Screens[i]->PMEvent)
-            xf86Screens[i]->PMEvent(i, event, undo);
+            xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
         else {
             xf86Screens[i]->vtSema = TRUE;
-            xf86Screens[i]->EnterVT(i, 0);
+            xf86Screens[i]->EnterVT(xf86Screens[i]);
         }
     }
     xf86UnblockSIGIO(sigio_blocked_for_suspend);
     for (i = 0; i < xf86NumScreens; i++) {
         if (xf86Screens[i]->EnableDisableFBAccess)
-            (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
+            (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
     }
     dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
     pInfo = xf86InputDevs;
@@ -187,7 +187,7 @@ DoApmEvent(pmEvent event, Bool undo)
         was_blocked = xf86BlockSIGIO();
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->PMEvent) {
-                xf86Screens[i]->PMEvent(i, event, undo);
+                xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
             }
         }
         xf86UnblockSIGIO(was_blocked);
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
index 6c5efeacc..42a3b30f0 100644
--- a/xorg-server/hw/xfree86/common/xf86Priv.h
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -114,7 +114,7 @@ extern _X_EXPORT void xf86BusProbe(void);
 extern _X_EXPORT void xf86AccessEnter(void);
 extern _X_EXPORT void xf86AccessLeave(void);
 extern _X_EXPORT void xf86PostProbe(void);
-extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
+extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
 extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
 extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev);
 
diff --git a/xorg-server/hw/xfree86/common/xf86RandR.c b/xorg-server/hw/xfree86/common/xf86RandR.c
index b17f601d1..5606bee4b 100644
--- a/xorg-server/hw/xfree86/common/xf86RandR.c
+++ b/xorg-server/hw/xfree86/common/xf86RandR.c
@@ -159,7 +159,7 @@ xf86RandRSetMode(ScreenPtr pScreen,
     Bool ret = TRUE;
 
     if (pRoot && scrp->vtSema)
-        (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+        (*scrp->EnableDisableFBAccess) (scrp, FALSE);
     if (useVirtual) {
         scrp->virtualX = randrp->virtualX;
         scrp->virtualY = randrp->virtualY;
@@ -220,7 +220,7 @@ xf86RandRSetMode(ScreenPtr pScreen,
     xf86SetViewport(pScreen, pScreen->width, pScreen->height);
     xf86SetViewport(pScreen, 0, 0);
     if (pRoot && scrp->vtSema)
-        (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+        (*scrp->EnableDisableFBAccess) (scrp, TRUE);
     return ret;
 }
 
@@ -365,7 +365,7 @@ xf86RandRCreateScreenResources(ScreenPtr pScreen)
  * Reset size back to original
  */
 static Bool
-xf86RandRCloseScreen(int index, ScreenPtr pScreen)
+xf86RandRCloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
     XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
@@ -376,7 +376,7 @@ xf86RandRCloseScreen(int index, ScreenPtr pScreen)
     pScreen->CloseScreen = randrp->CloseScreen;
     free(randrp);
     dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
-    return (*pScreen->CloseScreen) (index, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 Rotation
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
index b9b46f6cd..225fff06e 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiter.c
@@ -221,7 +221,7 @@ xf86VGAarbiterWrapFunctions(void)
 
 /* Screen funcs */
 static Bool
-VGAarbiterCloseScreen(int i, ScreenPtr pScreen)
+VGAarbiterCloseScreen(ScreenPtr pScreen)
 {
     Bool val;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -258,34 +258,30 @@ VGAarbiterCloseScreen(int i, ScreenPtr pScreen)
     UNWRAP_SPRITE;
 
     free((pointer) pScreenPriv);
-    xf86VGAarbiterLock(xf86Screens[i]);
-    val = (*pScreen->CloseScreen) (i, pScreen);
-    xf86VGAarbiterUnlock(xf86Screens[i]);
+    xf86VGAarbiterLock(xf86ScreenToScrn(pScreen));
+    val = (*pScreen->CloseScreen) (pScreen);
+    xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen));
     return val;
 }
 
 static void
-VGAarbiterBlockHandler(int i,
-                       pointer blockData, pointer pTimeout, pointer pReadmask)
+VGAarbiterBlockHandler(ScreenPtr pScreen,
+                       pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
-
     SCREEN_PROLOG(BlockHandler);
     VGAGet(pScreen);
-    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+    pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
     VGAPut();
     SCREEN_EPILOG(BlockHandler, VGAarbiterBlockHandler);
 }
 
 static void
-VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result,
+VGAarbiterWakeupHandler(ScreenPtr pScreen, unsigned long result,
                         pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
-
     SCREEN_PROLOG(WakeupHandler);
     VGAGet(pScreen);
-    pScreen->WakeupHandler(i, blockData, result, pReadmask);
+    pScreen->WakeupHandler(pScreen, result, pReadmask);
     VGAPut();
     SCREEN_EPILOG(WakeupHandler, VGAarbiterWakeupHandler);
 }
@@ -466,46 +462,45 @@ VGAarbiterSetCursorPosition(DeviceIntPtr pDev,
 }
 
 static void
-VGAarbiterAdjustFrame(int index, int x, int y, int flags)
+VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     VGAarbiterScreenPtr pScreenPriv =
         (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                VGAarbiterScreenKey);
 
     VGAGet(pScreen);
-    (*pScreenPriv->AdjustFrame) (index, x, y, flags);
+    (*pScreenPriv->AdjustFrame) (pScrn, x, y);
     VGAPut();
 }
 
 static Bool
-VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags)
+VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
     Bool val;
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     VGAarbiterScreenPtr pScreenPriv =
         (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                VGAarbiterScreenKey);
 
     VGAGet(pScreen);
-    val = (*pScreenPriv->SwitchMode) (index, mode, flags);
+    val = (*pScreenPriv->SwitchMode) (pScrn, mode);
     VGAPut();
     return val;
 }
 
 static Bool
-VGAarbiterEnterVT(int index, int flags)
+VGAarbiterEnterVT(ScrnInfoPtr pScrn)
 {
     Bool val;
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     VGAarbiterScreenPtr pScreenPriv =
         (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                VGAarbiterScreenKey);
 
     VGAGet(pScreen);
     pScrn->EnterVT = pScreenPriv->EnterVT;
-    val = (*pScrn->EnterVT) (index, flags);
+    val = (*pScrn->EnterVT) (pScrn);
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = VGAarbiterEnterVT;
     VGAPut();
@@ -513,32 +508,31 @@ VGAarbiterEnterVT(int index, int flags)
 }
 
 static void
-VGAarbiterLeaveVT(int index, int flags)
+VGAarbiterLeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     VGAarbiterScreenPtr pScreenPriv =
         (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                VGAarbiterScreenKey);
 
     VGAGet(pScreen);
     pScrn->LeaveVT = pScreenPriv->LeaveVT;
-    (*pScreenPriv->LeaveVT) (index, flags);
+    (*pScreenPriv->LeaveVT) (pScrn);
     pScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = VGAarbiterLeaveVT;
     VGAPut();
 }
 
 static void
-VGAarbiterFreeScreen(int index, int flags)
+VGAarbiterFreeScreen(ScrnInfoPtr pScrn)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     VGAarbiterScreenPtr pScreenPriv =
         (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                VGAarbiterScreenKey);
 
     VGAGet(pScreen);
-    (*pScreenPriv->FreeScreen) (index, flags);
+    (*pScreenPriv->FreeScreen) (pScrn);
     VGAPut();
 }
 
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index ebc8854d3..ba6edfcc3 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -125,11 +125,11 @@ typedef struct _VGAarbiterScreen {
     UnrealizeCursorProcPtr UnrealizeCursor;
     RecolorCursorProcPtr RecolorCursor;
     SetCursorPositionProcPtr SetCursorPosition;
-    void (*AdjustFrame) (int, int, int, int);
-    Bool (*SwitchMode) (int, DisplayModePtr, int);
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
-    void (*FreeScreen) (int, int);
+    void (*AdjustFrame) (ScrnInfoPtr, int, int);
+    Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr);
+    Bool (*EnterVT) (ScrnInfoPtr);
+    void (*LeaveVT) (ScrnInfoPtr);
+    void (*FreeScreen) (ScrnInfoPtr);
     miPointerSpriteFuncPtr miSprite;
     CompositeProcPtr Composite;
     GlyphsProcPtr Glyphs;
@@ -142,11 +142,11 @@ typedef struct _VGAarbiterGC {
 } VGAarbiterGCRec, *VGAarbiterGCPtr;
 
 /* Screen funcs */
-static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout,
+static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout,
                                    pointer pReadmask);
-static void VGAarbiterWakeupHandler(int i, pointer blockData,
+static void VGAarbiterWakeupHandler(ScreenPtr pScreen,
                                     unsigned long result, pointer pReadmask);
-static Bool VGAarbiterCloseScreen(int i, ScreenPtr pScreen);
+static Bool VGAarbiterCloseScreen(ScreenPtr pScreen);
 static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
                                int h, unsigned int format,
                                unsigned long planemask, char *pdstLine);
@@ -176,11 +176,11 @@ static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
 static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
                                         pScreen, int x, int y,
                                         Bool generateEvent);
-static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
-static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
-static Bool VGAarbiterEnterVT(int index, int flags);
-static void VGAarbiterLeaveVT(int index, int flags);
-static void VGAarbiterFreeScreen(int index, int flags);
+static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn);
+static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn);
+static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn);
 
 /* GC funcs */
 static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
diff --git a/xorg-server/hw/xfree86/common/xf86VidMode.c b/xorg-server/hw/xfree86/common/xf86VidMode.c
index 13ffe061c..a7d1c25bf 100644
--- a/xorg-server/hw/xfree86/common/xf86VidMode.c
+++ b/xorg-server/hw/xfree86/common/xf86VidMode.c
@@ -50,7 +50,7 @@
 static DevPrivateKeyRec VidModeKeyRec;
 static DevPrivateKey VidModeKey;
 static int VidModeCount = 0;
-static Bool VidModeClose(int i, ScreenPtr pScreen);
+static Bool VidModeClose(ScreenPtr pScreen);
 
 #define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey))
 
@@ -93,7 +93,7 @@ VidModeExtensionInit(ScreenPtr pScreen)
 #ifdef XF86VIDMODE
 
 static Bool
-VidModeClose(int i, ScreenPtr pScreen)
+VidModeClose(ScreenPtr pScreen)
 {
     VidModePtr pVidMode = VMPTR(pScreen);
 
@@ -108,7 +108,7 @@ VidModeClose(int i, ScreenPtr pScreen)
         dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
         VidModeKey = NULL;
     }
-    return pScreen->CloseScreen(i, pScreen);
+    return pScreen->CloseScreen(pScreen);
 }
 
 Bool
@@ -303,7 +303,7 @@ VidModeSetViewPort(int scrnIndex, int x, int y)
                          pScrn->virtualY - pScrn->currentMode->VDisplay);
     pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
     if (pScrn->AdjustFrame != NULL)
-        (pScrn->AdjustFrame) (scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+        (pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0);
 
     return TRUE;
 }
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index 460fafde3..25f84e579 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -80,9 +80,9 @@ typedef struct {
     DestroyColormapProcPtr DestroyColormap;
     InstallColormapProcPtr InstallColormap;
     StoreColorsProcPtr StoreColors;
-    Bool (*EnterVT) (int, int);
-    Bool (*SwitchMode) (int, DisplayModePtr, int);
-    int (*SetDGAMode) (int, int, DGADevicePtr);
+    Bool (*EnterVT) (ScrnInfoPtr);
+    Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr);
+    int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr);
     xf86ChangeGammaProc *ChangeGamma;
     int maxColors;
     int sigRGBbits;
@@ -111,17 +111,17 @@ static DevPrivateKeyRec CMapColormapKeyRec;
 
 static void CMapInstallColormap(ColormapPtr);
 static void CMapStoreColors(ColormapPtr, int, xColorItem *);
-static Bool CMapCloseScreen(int, ScreenPtr);
+static Bool CMapCloseScreen(ScreenPtr);
 static Bool CMapCreateColormap(ColormapPtr);
 static void CMapDestroyColormap(ColormapPtr);
 
-static Bool CMapEnterVT(int, int);
-static Bool CMapSwitchMode(int, DisplayModePtr, int);
+static Bool CMapEnterVT(ScrnInfoPtr);
+static Bool CMapSwitchMode(ScrnInfoPtr, DisplayModePtr);
 
 #ifdef XFreeXDGA
-static int CMapSetDGAMode(int, int, DGADevicePtr);
+static int CMapSetDGAMode(ScrnInfoPtr, int, DGADevicePtr);
 #endif
-static int CMapChangeGamma(int, Gamma);
+static int CMapChangeGamma(ScrnInfoPtr, Gamma);
 
 static void ComputeGamma(CMapScreenPtr);
 static Bool CMapAllocateColormapPrivate(ColormapPtr);
@@ -241,11 +241,11 @@ xf86HandleColormaps(ScreenPtr pScreen,
 /**** Screen functions ****/
 
 static Bool
-CMapCloseScreen(int i, ScreenPtr pScreen)
+CMapCloseScreen(ScreenPtr pScreen)
 {
     CMapUnwrapScreen(pScreen);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static Bool
@@ -462,16 +462,15 @@ CMapInstallColormap(ColormapPtr pmap)
 /**** ScrnInfoRec functions ****/
 
 static Bool
-CMapEnterVT(int index, int flags)
+CMapEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     Bool ret;
     CMapScreenPtr pScreenPriv =
         (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
 
     pScrn->EnterVT = pScreenPriv->EnterVT;
-    ret = (*pScreenPriv->EnterVT) (index, flags);
+    ret = (*pScreenPriv->EnterVT) (pScrn);
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = CMapEnterVT;
     if (ret) {
@@ -483,13 +482,13 @@ CMapEnterVT(int index, int flags)
 }
 
 static Bool
-CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+CMapSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     CMapScreenPtr pScreenPriv =
         (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
 
-    if ((*pScreenPriv->SwitchMode) (index, mode, flags)) {
+    if ((*pScreenPriv->SwitchMode) (pScrn, mode)) {
         if (GetInstalledmiColormap(pScreen))
             CMapReinstallMap(GetInstalledmiColormap(pScreen));
         return TRUE;
@@ -499,16 +498,16 @@ CMapSwitchMode(int index, DisplayModePtr mode, int flags)
 
 #ifdef XFreeXDGA
 static int
-CMapSetDGAMode(int index, int num, DGADevicePtr dev)
+CMapSetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr dev)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     CMapScreenPtr pScreenPriv =
         (CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
     int ret;
 
-    ret = (*pScreenPriv->SetDGAMode) (index, num, dev);
+    ret = (*pScreenPriv->SetDGAMode) (pScrn, num, dev);
 
-    pScreenPriv->isDGAmode = DGAActive(index);
+    pScreenPriv->isDGAmode = DGAActive(pScrn->scrnIndex);
 
     if (!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
         && xf86ScreenToScrn(pScreen)->vtSema)
@@ -908,11 +907,10 @@ ComputeGamma(CMapScreenPtr priv)
 }
 
 int
-CMapChangeGamma(int index, Gamma gamma)
+CMapChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
 {
     int ret = Success;
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = pScrn->pScreen;
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     CMapColormapPtr pColPriv;
     CMapScreenPtr pScreenPriv;
     CMapLinkPtr pLink;
@@ -979,7 +977,7 @@ CMapChangeGamma(int index, Gamma gamma)
 
     pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
     if (pScrn->ChangeGamma)
-        ret = pScrn->ChangeGamma(index, gamma);
+        ret = pScrn->ChangeGamma(pScrn, gamma);
     pScrn->ChangeGamma = CMapChangeGamma;
 
     return ret;
@@ -1175,7 +1173,7 @@ xf86ChangeGamma(ScreenPtr pScreen, Gamma gamma)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
     if (pScrn->ChangeGamma)
-        return (*pScrn->ChangeGamma) (pScreen->myNum, gamma);
+        return (*pScrn->ChangeGamma) (pScrn, gamma);
 
     return BadImplementation;
 }
diff --git a/xorg-server/hw/xfree86/common/xf86fbman.c b/xorg-server/hw/xfree86/common/xf86fbman.c
index e2db1c354..c2e7bab9f 100644
--- a/xorg-server/hw/xfree86/common/xf86fbman.c
+++ b/xorg-server/hw/xfree86/common/xf86fbman.c
@@ -1149,7 +1149,7 @@ static FBManagerFuncs xf86FBManFuncs = {
 };
 
 static Bool
-xf86FBCloseScreen(int i, ScreenPtr pScreen)
+xf86FBCloseScreen(ScreenPtr pScreen)
 {
     FBLinkPtr pLink, tmp;
     FBLinearLinkPtr pLinearLink, tmp2;
@@ -1180,7 +1180,7 @@ xf86FBCloseScreen(int i, ScreenPtr pScreen)
     free(offman);
     dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 Bool
diff --git a/xorg-server/hw/xfree86/common/xf86sbusBus.c b/xorg-server/hw/xfree86/common/xf86sbusBus.c
index 27d24f8e1..b6a6b94b3 100644
--- a/xorg-server/hw/xfree86/common/xf86sbusBus.c
+++ b/xorg-server/hw/xfree86/common/xf86sbusBus.c
@@ -667,7 +667,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 }
 
 static Bool
-xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
+xf86SbusCmapCloseScreen(ScreenPtr pScreen)
 {
     sbusCmapPtr cmap;
     struct fbcmap fbcmap;
@@ -683,7 +683,7 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
     }
     pScreen->CloseScreen = cmap->CloseScreen;
     free(cmap);
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 Bool
diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
index 6294845bc..a1404c3aa 100644
--- a/xorg-server/hw/xfree86/common/xf86str.h
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -630,18 +630,18 @@ typedef struct {
 
 typedef Bool xf86ProbeProc(DriverPtr, int);
 typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
-typedef Bool xf86ScreenInitProc(int, ScreenPtr, int, char **);
-typedef Bool xf86SwitchModeProc(int, DisplayModePtr, int);
-typedef void xf86AdjustFrameProc(int, int, int, int);
-typedef Bool xf86EnterVTProc(int, int);
-typedef void xf86LeaveVTProc(int, int);
-typedef void xf86FreeScreenProc(int, int);
-typedef ModeStatus xf86ValidModeProc(int, DisplayModePtr, Bool, int);
-typedef void xf86EnableDisableFBAccessProc(int, Bool);
-typedef int xf86SetDGAModeProc(int, int, DGADevicePtr);
-typedef int xf86ChangeGammaProc(int, Gamma);
-typedef void xf86PointerMovedProc(int, int, int);
-typedef Bool xf86PMEventProc(int, pmEvent, Bool);
+typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
+typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr);
+typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int);
+typedef Bool xf86EnterVTProc(ScrnInfoPtr);
+typedef void xf86LeaveVTProc(ScrnInfoPtr);
+typedef void xf86FreeScreenProc(ScrnInfoPtr);
+typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
+typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
+typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
+typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
+typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int);
+typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool);
 typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
 typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
 typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index b10034852..1a964d270 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -56,7 +56,7 @@
 
 /* XvScreenRec fields */
 
-static Bool xf86XVCloseScreen(int, ScreenPtr);
+static Bool xf86XVCloseScreen(ScreenPtr);
 static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
 
 /* XvAdaptorRec fields */
@@ -100,9 +100,9 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
 
 /* ScrnInfoRec functions */
 
-static Bool xf86XVEnterVT(int, int);
-static void xf86XVLeaveVT(int, int);
-static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static Bool xf86XVEnterVT(ScrnInfoPtr);
+static void xf86XVLeaveVT(ScrnInfoPtr);
+static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y);
 static void xf86XVModeSet(ScrnInfoPtr pScrn);
 
 /* misc */
@@ -1066,7 +1066,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible)
 static void
 xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
 {
-    ScreenPtr pScreen = pScrn->pScreen;
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
     XvAdaptorPtr pa;
     int c, i;
@@ -1255,7 +1255,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 /**** Required XvScreenRec fields ****/
 
 static Bool
-xf86XVCloseScreen(int i, ScreenPtr pScreen)
+xf86XVCloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
@@ -1299,15 +1299,14 @@ xf86XVQueryAdaptors(ScreenPtr pScreen,
 /**** ScrnInfoRec fields ****/
 
 static Bool
-xf86XVEnterVT(int index, int flags)
+xf86XVEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
     Bool ret;
 
     pScrn->EnterVT = ScreenPriv->EnterVT;
-    ret = (*ScreenPriv->EnterVT) (index, flags);
+    ret = (*ScreenPriv->EnterVT) (pScrn);
     ScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = xf86XVEnterVT;
 
@@ -1318,10 +1317,9 @@ xf86XVEnterVT(int index, int flags)
 }
 
 static void
-xf86XVLeaveVT(int index, int flags)
+xf86XVLeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
     XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
     XvAdaptorPtr pAdaptor;
@@ -1353,21 +1351,20 @@ xf86XVLeaveVT(int index, int flags)
     }
 
     pScrn->LeaveVT = ScreenPriv->LeaveVT;
-    (*ScreenPriv->LeaveVT) (index, flags);
+    (*ScreenPriv->LeaveVT) (pScrn);
     ScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = xf86XVLeaveVT;
 }
 
 static void
-xf86XVAdjustFrame(int index, int x, int y, int flags)
+xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = pScrn->pScreen;
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
 
     if (ScreenPriv->AdjustFrame) {
         pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
-        (*pScrn->AdjustFrame) (index, x, y, flags);
+        (*pScrn->AdjustFrame) (pScrn, x, y);
         pScrn->AdjustFrame = xf86XVAdjustFrame;
     }
 
@@ -1377,7 +1374,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 static void
 xf86XVModeSet(ScrnInfoPtr pScrn)
 {
-    ScreenPtr pScreen = pScrn->pScreen;
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XF86XVScreenPtr ScreenPriv;
 
     /* Can be called before pScrn->pScreen is set */
diff --git a/xorg-server/hw/xfree86/common/xf86xvmc.c b/xorg-server/hw/xfree86/common/xf86xvmc.c
index b7da7589a..2e529dd92 100644
--- a/xorg-server/hw/xfree86/common/xf86xvmc.c
+++ b/xorg-server/hw/xfree86/common/xf86xvmc.c
@@ -132,7 +132,7 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
 }
 
 static Bool
-xf86XvMCCloseScreen(int i, ScreenPtr pScreen)
+xf86XvMCCloseScreen(ScreenPtr pScreen)
 {
     xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
 
@@ -141,7 +141,7 @@ xf86XvMCCloseScreen(int i, ScreenPtr pScreen)
     free(pScreenPriv->dixinfo);
     free(pScreenPriv);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 Bool
diff --git a/xorg-server/hw/xfree86/common/xf86xvpriv.h b/xorg-server/hw/xfree86/common/xf86xvpriv.h
index 289ca5843..e95f959a8 100644
--- a/xorg-server/hw/xfree86/common/xf86xvpriv.h
+++ b/xorg-server/hw/xfree86/common/xf86xvpriv.h
@@ -41,9 +41,9 @@ typedef struct {
     ClipNotifyProcPtr ClipNotify;
     WindowExposuresProcPtr WindowExposures;
     PostValidateTreeProcPtr PostValidateTree;
-    void (*AdjustFrame) (int, int, int, int);
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
+    void (*AdjustFrame) (ScrnInfoPtr, int, int);
+    Bool (*EnterVT) (ScrnInfoPtr);
+    void (*LeaveVT) (ScrnInfoPtr);
     xf86ModeSetProc *ModeSet;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
diff --git a/xorg-server/hw/xfree86/ddc/DDC.HOWTO b/xorg-server/hw/xfree86/ddc/DDC.HOWTO
index 1d06ca124..54fbe73ad 100644
--- a/xorg-server/hw/xfree86/ddc/DDC.HOWTO
+++ b/xorg-server/hw/xfree86/ddc/DDC.HOWTO
@@ -1,97 +1,97 @@
-			DDC.HOWTO
-
-  This file describes how to add DDC support to a chipset driver.
-
-1) DDC INITIALIZATION
-
-   When implementing DDC in the driver one has the choice between
-   DDC1 and DDC2. 
-   DDC1 data is continuously transmitted by a DDC1 capable display 
-   device. The data is send serially over a data line; the Vsync 
-   signal serves as clock. Only one EDID 1.x data block can be 
-   transmitted using DDC1. Since transmission of an EDID1 block 
-   using a regular Vsync frequency would take up several seconds 
-   the driver can increase the Vsync frequency to up to 25 kHz as 
-   soon as it detects DDC1 activity on the data line.
-   DDC2 data is transmitted using the I2C protocol. This requires
-   an additional clock line. DDC2 is capable of transmitting EDID1
-   and EDID2 block as well as a VDIF block on display devices that 
-   support these.  
-   Display devices switch into the DDC2 mode as soon as they detect
-   activity on the DDC clock line. Once the are in DDC2 mode they
-   stop transmitting DDC1 signals until the next power cycle.
-
-   Some graphics chipset configurations which are not capable of
-   DDC2 might still be able to read DDC1 data. Where available
-   DDC2 it is preferable. 
-	
-   All relevant prototypes and defines are in xf86DDC.h.
-   DDC2 additionally requires I2C support. The I2C prototypes
-   are in xf86i2c.h.
-
-   DDC1 Support:
-
-     The driver has to provide a read function which waits for the
-     end of the next Vsync signal and reads in and returns the status
-     of the DDC line:
-
-     unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
-     
-     Additionally a function is required to increase the Vsync
-     frequency to max. 25 kHz. 
- 
-     void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
- 
-     If the speed argument is DDC_FAST the function should increase
-     the Vsync frequency on DDC_SLOW it should restore the original
-     value. For convenience a generic ddc1SetSpeed() function is provided
-     in the vga module for VGA-like chipsets.     
-	
-     void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed).
-
-     To read out the DDC1 data the driver should call 
-
-     xf86MonPtr xf86DoEDID_DDC1(int scrnIndex, 
-                              void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
-                              unsigned int (*DDC1Read)(ScrnInfoPtr))
- 
-     in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
-     function, DDC1Read has to point to the DDC1 read function.
-     The function will return a pointer to the xf86Monitor structure
-     which contains all information retrieved by DDC.
-     NULL will be returned on failure.
-
-   DDC2 Support
- 
-     To read out DDC2 information I2C has to be initialized first.
-     (See documentation for the i2c module). 
-     The function 
-     
-     xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
-
-     is provided to read out and process DDC2 data. A pointer
-     to the I2CBusRec of the appropriate I2C Bus has to be passed
-     as the second argument.
-     The function will return a pointer to the xf86Monitor structure
-     which contains all information retrieved by DDC.
-     NULL will be returned on failure.
-
-   Printing monitor parameters   
-
-     To print out the information contained in the xf86Monitor
-     structure the function 
-
-     xf86MonPtr xf86PrintEDID(xf86MonPtr monitor)
- 
-     is provided.
-
-    Further processing of the xf86Monitor structure is not yet 
-    implemented. However, it is planned to use the information
-    about video modes, gamma values etc.
-    Therefore it is strongly recommended to read out DDC data
-    before any video mode processing is done.
-
-
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $
+			DDC.HOWTO
+
+  This file describes how to add DDC support to a chipset driver.
+
+1) DDC INITIALIZATION
+
+   When implementing DDC in the driver one has the choice between
+   DDC1 and DDC2. 
+   DDC1 data is continuously transmitted by a DDC1 capable display 
+   device. The data is send serially over a data line; the Vsync 
+   signal serves as clock. Only one EDID 1.x data block can be 
+   transmitted using DDC1. Since transmission of an EDID1 block 
+   using a regular Vsync frequency would take up several seconds 
+   the driver can increase the Vsync frequency to up to 25 kHz as 
+   soon as it detects DDC1 activity on the data line.
+   DDC2 data is transmitted using the I2C protocol. This requires
+   an additional clock line. DDC2 is capable of transmitting EDID1
+   and EDID2 block as well as a VDIF block on display devices that 
+   support these.  
+   Display devices switch into the DDC2 mode as soon as they detect
+   activity on the DDC clock line. Once the are in DDC2 mode they
+   stop transmitting DDC1 signals until the next power cycle.
+
+   Some graphics chipset configurations which are not capable of
+   DDC2 might still be able to read DDC1 data. Where available
+   DDC2 it is preferable. 
+	
+   All relevant prototypes and defines are in xf86DDC.h.
+   DDC2 additionally requires I2C support. The I2C prototypes
+   are in xf86i2c.h.
+
+   DDC1 Support:
+
+     The driver has to provide a read function which waits for the
+     end of the next Vsync signal and reads in and returns the status
+     of the DDC line:
+
+     unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
+     
+     Additionally a function is required to increase the Vsync
+     frequency to max. 25 kHz. 
+ 
+     void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
+ 
+     If the speed argument is DDC_FAST the function should increase
+     the Vsync frequency on DDC_SLOW it should restore the original
+     value. For convenience a generic ddc1SetSpeed() function is provided
+     in the vga module for VGA-like chipsets.     
+	
+     void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed).
+
+     To read out the DDC1 data the driver should call 
+
+     xf86MonPtr xf86DoEDID_DDC1(int scrnIndex, 
+                              void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
+                              unsigned int (*DDC1Read)(ScrnInfoPtr))
+ 
+     in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
+     function, DDC1Read has to point to the DDC1 read function.
+     The function will return a pointer to the xf86Monitor structure
+     which contains all information retrieved by DDC.
+     NULL will be returned on failure.
+
+   DDC2 Support
+ 
+     To read out DDC2 information I2C has to be initialized first.
+     (See documentation for the i2c module). 
+     The function 
+     
+     xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+
+     is provided to read out and process DDC2 data. A pointer
+     to the I2CBusRec of the appropriate I2C Bus has to be passed
+     as the second argument.
+     The function will return a pointer to the xf86Monitor structure
+     which contains all information retrieved by DDC.
+     NULL will be returned on failure.
+
+   Printing monitor parameters   
+
+     To print out the information contained in the xf86Monitor
+     structure the function 
+
+     xf86MonPtr xf86PrintEDID(xf86MonPtr monitor)
+ 
+     is provided.
+
+    Further processing of the xf86Monitor structure is not yet 
+    implemented. However, it is planned to use the information
+    about video modes, gamma values etc.
+    Therefore it is strongly recommended to read out DDC data
+    before any video mode processing is done.
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $
diff --git a/xorg-server/hw/xfree86/ddc/Makefile.am b/xorg-server/hw/xfree86/ddc/Makefile.am
index 93ea4a2a5..0db5d833f 100644
--- a/xorg-server/hw/xfree86/ddc/Makefile.am
+++ b/xorg-server/hw/xfree86/ddc/Makefile.am
@@ -1,11 +1,11 @@
-sdk_HEADERS = edid.h xf86DDC.h
-
-noinst_LTLIBRARIES = libddc.la
-
-libddc_la_SOURCES = ddc.c interpret_edid.c print_edid.c ddcProperty.c
-
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-EXTRA_DIST = DDC.HOWTO
+sdk_HEADERS = edid.h xf86DDC.h
+
+noinst_LTLIBRARIES = libddc.la
+
+libddc_la_SOURCES = ddc.c interpret_edid.c print_edid.c ddcProperty.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+EXTRA_DIST = DDC.HOWTO
diff --git a/xorg-server/hw/xfree86/ddc/ddc.c b/xorg-server/hw/xfree86/ddc/ddc.c
index a1281d735..28c969646 100644
--- a/xorg-server/hw/xfree86/ddc/ddc.c
+++ b/xorg-server/hw/xfree86/ddc/ddc.c
@@ -258,10 +258,9 @@ EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
  * @return NULL if no monitor attached or failure to interpret the EDID.
  */
 xf86MonPtr
-xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
+xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed,
                 unsigned int (*DDC1Read) (ScrnInfoPtr))
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     unsigned char *EDID_block = NULL;
     xf86MonPtr tmp = NULL;
 
@@ -285,7 +284,7 @@ xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
     OsReleaseSignals();
 
     if (EDID_block) {
-        tmp = xf86InterpretEDID(scrnIndex, EDID_block);
+        tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block);
     }
 #ifdef DEBUG
     else
@@ -323,7 +322,7 @@ DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
 }
 
 static I2CDevPtr
-DDC2Init(int scrnIndex, I2CBusPtr pBus)
+DDC2Init(I2CBusPtr pBus)
 {
     I2CDevPtr dev = NULL;
 
@@ -403,9 +402,8 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
  * @return NULL if no monitor attached or failure to interpret the EDID.
  */
 xf86MonPtr
-xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
+xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     unsigned char *EDID_block = NULL;
     xf86MonPtr tmp = NULL;
     I2CDevPtr dev = NULL;
@@ -427,7 +425,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
     if (noddc || noddc2)
         return NULL;
 
-    if (!(dev = DDC2Init(scrnIndex, pBus)))
+    if (!(dev = DDC2Init(pBus)))
         return NULL;
 
     EDID_block = calloc(1, EDID1_LEN);
@@ -444,7 +442,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
                 DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i)));
         }
 
-        tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
+        tmp = xf86InterpretEEDID(pScrn->scrnIndex, EDID_block);
     }
 
     if (tmp && complete)
@@ -465,9 +463,9 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
  * @return NULL if no monitor attached or failure to interpret the EDID.
  */
 xf86MonPtr
-xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
+xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus)
 {
-    return xf86DoEEDID(scrnIndex, pBus, FALSE);
+    return xf86DoEEDID(pScrn, pBus, FALSE);
 }
 
 /* XXX write me */
@@ -489,9 +487,8 @@ DDC2ReadDisplayID(void)
  * @return NULL if no monitor attached or failure to interpret the DisplayID.
  */
 xf86MonPtr
-xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
+xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     unsigned char *did = NULL;
     xf86MonPtr tmp = NULL;
     I2CDevPtr dev = NULL;
@@ -513,7 +510,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
     if (noddc || noddc2)
         return NULL;
 
-    if (!(dev = DDC2Init(scrnIndex, pBus)))
+    if (!(dev = DDC2Init(pBus)))
         return NULL;
 
     if ((did = DDC2ReadDisplayID())) {
@@ -521,7 +518,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
         if (!tmp)
             return NULL;
 
-        tmp->scrnIndex = scrnIndex;
+        tmp->scrnIndex = pScrn->scrnIndex;
         tmp->flags |= MONITOR_DISPLAYID;
         tmp->rawData = did;
     }
diff --git a/xorg-server/hw/xfree86/ddc/xf86DDC.h b/xorg-server/hw/xfree86/ddc/xf86DDC.h
index 2071d530d..c63da8bff 100644
--- a/xorg-server/hw/xfree86/ddc/xf86DDC.h
+++ b/xorg-server/hw/xfree86/ddc/xf86DDC.h
@@ -24,15 +24,15 @@ typedef enum {
 
 typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed);
 
-extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(int scrnIndex,
+extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn,
                                             DDC1SetSpeedProc DDC1SetSpeed,
                                             unsigned
                                             int (*DDC1Read) (ScrnInfoPtr)
     );
 
-extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus);
+extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus);
 
-extern _X_EXPORT xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool);
+extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool);
 
 extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr);
 
@@ -50,7 +50,7 @@ extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
 extern _X_EXPORT Bool
  xf86MonitorIsHDMI(xf86MonPtr mon);
 
-extern _X_EXPORT xf86MonPtr xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus);
+extern _X_EXPORT xf86MonPtr xf86DoDisplayID(ScrnInfoPtr pScrn, I2CBusPtr pBus);
 
 extern _X_EXPORT void
  xf86DisplayIDMonitorSet(int scrnIndex, MonPtr mon, xf86MonPtr DDC);
diff --git a/xorg-server/hw/xfree86/doc/.gitignore b/xorg-server/hw/xfree86/doc/.gitignore
new file mode 100644
index 000000000..63eee5960
--- /dev/null
+++ b/xorg-server/hw/xfree86/doc/.gitignore
@@ -0,0 +1,4 @@
+ddxDesign.html
+ddxDesign.pdf
+ddxDesign.ps
+ddxDesign.txt
diff --git a/xorg-server/hw/xfree86/doc/README.DRIcomp b/xorg-server/hw/xfree86/doc/README.DRIcomp
index 617897949..2d3ebf148 100644
--- a/xorg-server/hw/xfree86/doc/README.DRIcomp
+++ b/xorg-server/hw/xfree86/doc/README.DRIcomp
@@ -1,554 +1,554 @@
-                            DRI Compilation Guide
-
-          VA Linux Systems, Inc. Professional Services - Graphics.
-
-                                21 April 2001
-
-1.  Preamble
-
-1.1  Copyright
-
-Copyright 2000-2001 by VA Linux Systems, Inc.  All Rights Reserved.
-
-Permission is granted to make and distribute verbatim copies of this document
-provided the copyright notice and this permission notice are preserved on all
-copies.
-
-1.2  Trademarks
-
-OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics,
-Inc.  Unix is a registered trademark of The Open Group.  The `X' device and X
-Window System are trademarks of The Open Group.  XFree86 is a trademark of
-The XFree86 Project.  Linux is a registered trademark of Linus Torvalds.
-Intel is a registered trademark of Intel Corporation.  3Dlabs, GLINT, and
-Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd.
-3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter-
-active, Incorporated.  Matrox is a registered trademark of Matrox Electronic
-Systems Ltd.  ATI Rage and Radeon is a registered trademark of ATI Technolo-
-gies, Inc.  All other trademarks mentioned are the property of their respec-
-tive owners.
-
-2.  Introduction
-
-This document describes how to download, compile and install the DRI.  The
-DRI provides 3D graphics hardware acceleration for the XFree86 project.  This
-information is intended for experienced Linux developers.  Beginners are
-probably better off installing precompiled packages.
-
-Edits, corrections and updates to this document may be mailed to <brian@tung-
-stengraphics.com>.
-
-Last updated on 13 February 2002 by Brian Paul.
-
-3.  Prerequisites
-
-You'll need the following:
-
-   o An installation of XFree86 4.1 or later.  The DRI tree has been pruned
-     down to minimize its size.  But in order to build the DRI tree you need
-     to have recent X header files, etc. already installed.  If you don't
-     have XFree86 4.1 (or later) installed you can probably install it from
-     RPMs (or another package format).  Or, you can download XFree86 as
-     sources and compile/install it yourself.
-
-   o At least 200MB of free disk space.  If you compile for debugging (the -g
-     option) then you'll need about 600MB.
-
-   o GCC compiler and related tools.
-
-   o ssh (secure shell) if you're a DRI developer and don't want to use
-     anonymous CVS download.
-
-   o A 2.4.x Linux Kernel.  See below for details.
-
-   o FreeBSD support is not currently being maintained and may not work.
-
-The DRI 3D drivers generally work on systems with Intel or AMD CPUs.  How-
-ever, limited support for Alpha and PowerPC support is underway.
-
-For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library
-(libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5).  These can be
-downloaded from the DRI website.  You can compile them yourself, but it's
-often a painful process.
-
-For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll
-also need AGP support in your Linux kernel, either built-in or as a loadable
-module.
-
-4.  Linux Kernel Preparation
-
-Only the Linux 2.4.x kernels are currently supported by the DRI hardware
-drivers.  2.5.x kernels may work, but aren't tested.
-
-Most of the DRI drivers require AGP support and using Intel Pentium III SSE
-optimizations also requires an up-to-date Linux kernel.  Configuring your
-kernel correctly is very important, as features such as SSE optimizations
-will be disabled if your kernel does not support them.  Thus, if you have a
-Pentium III processor, you must configure your kernel for the Pentium III
-processor family.
-
-Building a new Linux kernel can be difficult for beginners but there are
-resources on the Internet to help.  This document assumes experience with
-configuring, building and installing Linux kernels.
-
-Linux kernels can be downloaded from www.kernel.org
-
-Here are the basic steps for kernel setup.
-
-   o Download the needed kernel and put it in /usr/src.  Create a directory
-     for the source and unpack it.  For example:
-
-                    cd /usr/src
-                    rm -f linux
-                    mkdir linux-2.4.x
-                    ln -s linux-2.4.x linux
-                    bzcat linux-2.4.x.tar.bz2 | tar xf -
-
-     It is critical that /usr/src/linux point to your new kernel sources,
-     otherwise the kernel headers will not be used when building the DRI.
-     This will almost certainly cause compilation problems.
-
-   o Read /usr/src/linux/Documentation/Changes.  This file lists the minimum
-     requirements for all software packages required to build the kernel.
-     You must upgrade at least gcc, make, binutils and modutils to at least
-     the versions specified in this file.  The other packages may not be
-     needed.  If you are upgrading from Linux 2.2.x you must upgrade your
-     modutils package for Linux 2.4.x.
-
-   o Configure your kernel.  You might, for example, use make menuconfig and
-     do the following:
-
-        o Go to Code maturity level options
-
-        o Enable Prompt for development and/or incomplete code/drivers
-
-        o hit ESC to return to the top-level menu
-
-        o Go to Processor type and features
-
-        o Select your processor type from Processor Family
-
-        o hit ESC to return to the top-level menu
-
-        o Go to Character devices
-
-        o Disable Direct Rendering Manager (XFree86 DRI support) since we'll
-          use the DRI code from the XFree86/DRI tree and will compile it
-          there.
-
-        o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)
-
-        o Hit SPACE twice to build AGP support into the kernel
-
-        o Enable all chipsets' support for AGP
-
-        o It's recommended that you turn on MTRRs under Processor type and
-          Features, but not required.
-
-   o Configure the rest of the kernel as required for your system (i.e. Eth-
-     ernet, SCSI, etc)
-
-   o Exit, saving your kernel configuration.
-
-   o Edit your /etc/lilo.conf file.  Make sure you have an image entry as
-     follows (or similar):
-
-                      image=/boot/vmlinuz
-                            label=linux.2.4.x
-                            read-only
-                            root=/dev/hda1
-
-     The important part is that you have /boot/vmlinuz without a trailing
-     version number.  If this is the first entry in your /etc/lilo.conf AND
-     you haven't set a default, then this will be your default kernel.
-
-   o Compile the new kernel.
-
-                    cd /usr/src/linux-2.4.x
-                    make dep
-                    make bzImage
-                    make modules
-                    make modules_install
-                    make install
-
-     Note that last make command will automatically run lilo for you.
-
-   o Now reboot to use the new kernel.
-
-5.  CPU Architectures
-
-In general, nothing special has to be done to use the DRI on different CPU
-architectures.  There are, however, a few optimizations that are CPU-depen-
-dent.  Mesa will determine at runtime which CPU-dependent optimizations
-should be used and enable them where appropriate.
-
-5.1  Intel Pentium III Features
-
-The Pentium III SSE instructions are used in optimized vertex transformation
-functions in the Mesa-based DRI drivers.  On Linux, SSE requires a recent
-kernel (such as 2.4.0-test11 or later) both at compile time and runtime.
-
-5.2  AMD 3DNow! Features
-
-AMD's 3DNow! instructions are used in optimized vertex transformation func-
-tions in the Mesa-based DRI drivers.  3DNow! is supported in most versions of
-Linux.
-
-5.3  Alpha Features
-
-On newer Alpha processors a significant performance increase can be seen with
-the addition of the -mcpu= option to GCC.  This option is dependent on the
-architecture of the processor.  For example, -mcpu=ev6 will build specifi-
-cally for the EV6 based AXP's, giving both byte and word alignment access to
-the DRI/Mesa drivers.
-
-To enable this optimization edit your xc/config/host.def file and add the
-line:
-
-#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
-
-Additional speed improvements to 3D rendering can be achieved by installing
-Compaq's Math Libraries (CPML) which can be obtained from http://www.sup-
-port.compaq.com/alpha-tools/software/index.html
-
-Once installed, you can add this line to your host.def to build with the CPML
-libraries:
-
-#define UseCompaqMathLibrary YES
-
-The host.def file is explained below.
-
-6.  Downloading the XFree86/DRI CVS Sources
-
-The DRI project is hosted by SourceForge.  The DRI source code, which is a
-subset of the XFree86 source tree, is kept in a CVS repository there.
-
-The DRI CVS sources may be accessed either anonymously or as a registered
-SourceForge user.  It's recommended that you become a registered SourceForge
-user so that you may submit non-anonymous bug reports and can participate in
-the mailing lists.
-
-6.1  Anonymous CVS download:
-
-  1.  Create a directory to store the CVS files:
-
-                       cd ~
-                       mkdir DRI-CVS
-
-      You could put your CVS directory in a different place but we'll use
-      ~/DRI-CVS/ here.
-
-  2.  Check out the CVS sources:
-
-                       cd ~/DRI-CVS
-                       cvs -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri login
-                         (hit ENTER when prompted for a password)
-                       cvs -z3 -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri co xc
-
-      The -z3 flag causes compression to be used in order to reduce the down-
-      load time.
-
-6.2  Registered CVS download:
-
-  1.  Create a directory to store the CVS files:
-
-                       cd ~
-                       mkdir DRI-CVS
-
-      You could put your CVS directory in a different place but we'll use
-      ~/DRI-CVS/ here.
-
-  2.  Set the CVS_RSH environment variable:
-
-                       setenv CVS_RSH ssh      // if using csh or tcsh
-                       export CVS_RSH=ssh      // if using sh or bash
-
-  3.  Check out the CVS sources:
-
-                       cd ~/DRI-CVS
-                       cvs -z3 -d:ext:YOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc
-
-      Replace YOURID with your CVS login name.  You'll be prompted to enter
-      your sourceforge password.
-
-      The -z3 flag causes compression to be used in order to reduce the down-
-      load time.
-
-6.3  Updating your CVS sources
-
-In the future you'll want to occasionally update your local copy of the DRI
-source code to get the latest changes.  This can be done with:
-
-                cd ~/DRI-CVS
-                cvs -z3 update -dA xc
-
-The -d flag causes any new subdirectories to be created and -A causes most
-recent trunk sources to be fetched, not branch sources.
-
-7.  Mesa
-
-Most of the DRI 3D drivers are based on Mesa (the free implementation of the
-OpenGL API).  The relevant files from Mesa are already included in the
-XFree86/DRI source tree.  There is no need to download or install the Mesa
-source files separately.
-
-Sometimes a newer version of Mesa will be available than the version included
-in XFree86/DRI.  Upgrading Mesa within XFree86/DRI is not always straightfor-
-ward.  It can be an error-prone undertaking, especially for beginners, and is
-not generally recommended.  The DRI developers will upgrade Mesa when appro-
-priate.
-
-8.  Compiling the XFree86/DRI tree
-
-8.1  Make a build tree
-
-Rather than placing object files and library files right in the source tree,
-they're instead put into a parallel build tree.  The build tree is made with
-the lndir command:
-
-                 cd ~/DRI-CVS
-                 ln -s xc XFree40
-                 mkdir build
-                 cd build
-                 lndir -silent -ignorelinks ../XFree40
-
-The build tree will be populated with symbolic links which point back into
-the CVS source tree.
-
-Advanced users may have several build trees for compiling and testing with
-different options.
-
-8.2  Edit the host.def file
-
-The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the
-XFree86 build process.  You can change it to customize your build options or
-make adjustments for your particular system configuration
-
-The default host.def file will look something like this:
-
-                 #define DefaultCCOptions -Wall
-     (i386)      #define DefaultGcc2i386Opt -O2
-     (Alpha)     #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
-                 #define LibraryCDebugFlags -O2
-                 #define BuildServersOnly YES
-                 #define XF86CardDrivers vga tdfx mga ati i810
-                 #define LinuxDistribution LinuxRedHat
-                 #define DefaultCCOptions -ansi GccWarningOptions -pipe
-                 #define BuildXF86DRI YES
-                 /* Optionally turn these on for debugging */
-                 /* #define GlxBuiltInTdfx YES */
-                 /* #define GlxBuiltInMga YES */
-                 /* #define GlxBuiltInR128 YES */
-                 /* #define GlxBuiltInRadeon YES */
-                 /* #define DoLoadableServer NO */
-                 #define SharedLibFont NO
-
-The ProjectRoot variable specifies where the XFree86 files will be installed.
-We recommend installing the DRI files over your existing XFree86 installation
-- it's generally safe to do and less error-prone.  This policy is different
-than what we used to recommend.
-
-If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow-
-ing to the host.def file:
-
-                 #define ProjectRoot pathToYourXFree86installation
-
-Note the XF86CardDrivers line to be sure your card's driver is listed.
-
-If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you
-should add the following:
-
-                 #define MesaUse3DNow YES
-
-You don't have to be using an AMD processor in order to enable this option.
-The DRI will look for 3DNow! support and runtime and only enable it if appli-
-cable.
-
-If you want to enable SSE optimizations in Mesa and the DRI drivers, you must
-upgrade to a Linux 2.4.x kernel.  Mesa will verify that SSE is supported by
-both your processor and your operating system, but to build Mesa inside the
-DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux.  If
-you enable SSE optimizations with an earlier version of the Linux kernel in
-/usr/src/linux, Mesa will not compile.  You have been warned.  If you do have
-a 2.4.x kernel, you should add the following:
-
-                 #define MesaUseSSE YES
-
-If you want to build the DRM kernel modules as part of the full build pro-
-cess, add the following:
-
-                 #define BuildXF86DRM YES
-
-Otherwise, you'll need to build them separately as described below.
-
-8.3  Compilation
-
-To compile the complete DRI tree:
-
-                 cd ~/DRI-CVS/build/xc/
-                 make World >& world.log
-
-Or if you want to watch the compilation progress:
-
-                 cd ~/DRI-CVS/build/xc/
-                 make World >& world.log &
-                 tail -f world.log
-
-With the default compilation flags it's normal to get a lot of warnings dur-
-ing compilation.
-
-Building will take some time so you may want to go check your email or visit
-slashdot.
-
-WARNING: do not use the -j option with make.  It's reported that it does not
-work with XFree86/DRI.
-
-8.4  Check for compilation errors
-
-Using your text editor, examine world.log for errors by searching for the
-pattern ***.
-
-After fixing the errors, run make World again.  Later, you might just compile
-parts of the source tree but it's important that the whole tree will build
-first.
-
-If you edited your host.def file to enable automatic building of the DRI ker-
-nel module(s), verify that they were built:
-
-               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
-               ls
-
-Otherwise, build them now by running
-
-               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
-               make -f Makefile.linux
-
-For the 3dfx Voodoo, you should see tdfx.o.  For the Matrox G200/G400, you
-should see mga.o.  For the ATI Rage 128, you should see r128.o.  For the ATI
-Radeon, you should see radeon.o.  For the Intel i810, you should see i810.o.
-
-If the DRI kernel module(s) failed to build you should verify that you're
-using the right version of the Linux kernel.  The most recent kernels are not
-always supported.
-
-If your build machine is running a different version of the kernel than your
-target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel
-source tree. This can be fixed by explicitly setting the value of LINUXDIR.
-If the path to your kernel source is /usr/src/linux-2.4.x,
-
-               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
-               make -f Makefile.linux LINUXDIR=/usr/src/linux-2.4.x
-
-or alternatively, edit Makefile.linux to set LINUXDIR before the ifndef LIN-
-UXDIR line.
-
-8.5  DRI kernel module installation
-
-The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro-
-grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/.
-
-To load the appropriate DRM module in your running kernel you can either use
-ismod and restart your X server or copy the kernel module to /lib/mod-
-ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X
-server.
-
-Make sure you first unload any older DRI kernel modules that might be already
-loaded.
-
-Note that some DRM modules require that the agpgart module be loaded first.
-
-9.  Normal Installation and Configuration
-
-Most users will want to install the new X server and use it in place of their
-old X server.  This section explains how to do that.
-
-Developers, on the other hand, may just want to test the X server without
-actually installing it as their default server.  If you want to do that, skip
-to the next section.
-
-9.1  Installation
-
-Here are the installation commands:
-
-                su
-                cd ~/DRI-CVS/build/xc
-                make install
-
-9.2  Update the XF86Config File
-
-You may need to edit your XF86Config file to enable the DRI.  The config file
-is usually installed as /etc/X11/XF86Config-4.  See the DRI User Guide for
-details, but basically, you need to load the "glx" and "dri" modules and add
-a "DRI" section.
-
-On the DRI web site, in the resources section, you'll find example XF86Config
-files for a number of graphics cards.  These configuration files also setup
-DRI options so it's highly recommended that you look at these examples.
-
-The XFree86 4.x server can generate a basic configuration file itself.  Sim-
-ply do this:
-
-                  cd /usr/X11R6/bin
-                  ./XFree86 -configure
-
-A file named /root/XF86Config.new will be created.  It should allow you to
-try your X server but you'll almost certainly have to edit it.  For example,
-you should add HorizSync and VertRefresh options to the Monitor section and
-Modes options to the Screen section.  Also, the ModulePath option in the
-Files section should be set to /usr/X11R6/lib/modules.
-
-9.3  Start the New X Server
-
-The new X server should be ready to use now.  Start your X server in your
-usual manner.  Often times the startx command is used:
-
-                  startx
-
-10.  Testing the Server Without Installing It
-
-As mentioned at the start of section 9, developers may want to simply run the
-X server without installing it.  This can save some time and allow you to
-keep a number of X servers available for testing.
-
-10.1  Configuration
-
-As described in the preceding section, you'll need to create a configuration
-file for the new server.  Put the XF86Config file in your ~/DRI-
-CVS/build/xc/programs/Xserver directory.
-
-Be sure the ModulePath option in your XF86Config file is set correctly.
-
-10.2  A Startup Script
-
-A simple shell script can be used to start the X server.  Here's an example.
-
-             #!/bin/sh
-             export DISPLAY=:0
-             ./XFree86 -xf86config XF86Config & \
-             sleep 2
-             fvwm2 &
-             xset b off
-             xmodmap -e "clear mod4"
-             xsetroot -solid "#00306f"
-             xterm -geometry 80x40+0+0
-
-You might name this script start-dri.  Put it in your ~/DRI-CVS/build/xc/pro-
-grams/Xserver directory.
-
-To test the server run the script:
-
-                  cd ~/DRI-CVS/build/xc/programs/Xserver
-                  ./start-dri
-
-For debugging, you may also want to capture the log messages printed by the
-server in a file.  If you're using the C-shell:
-
-                  ./start-dri >& log
-
-11.  Where To Go From Here
-
-At this point your X server should be up and running with hardware-acceler-
-ated direct rendering.  Please read the DRI User Guide for information about
-trouble shooting and how to use the DRI-enabled X server for 3D applications.
-
-     Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 dawes Exp $
+                            DRI Compilation Guide
+
+          VA Linux Systems, Inc. Professional Services - Graphics.
+
+                                21 April 2001
+
+1.  Preamble
+
+1.1  Copyright
+
+Copyright 2000-2001 by VA Linux Systems, Inc.  All Rights Reserved.
+
+Permission is granted to make and distribute verbatim copies of this document
+provided the copyright notice and this permission notice are preserved on all
+copies.
+
+1.2  Trademarks
+
+OpenGL is a registered trademark and SGI is a trademark of Silicon Graphics,
+Inc.  Unix is a registered trademark of The Open Group.  The `X' device and X
+Window System are trademarks of The Open Group.  XFree86 is a trademark of
+The XFree86 Project.  Linux is a registered trademark of Linus Torvalds.
+Intel is a registered trademark of Intel Corporation.  3Dlabs, GLINT, and
+Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd.
+3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter-
+active, Incorporated.  Matrox is a registered trademark of Matrox Electronic
+Systems Ltd.  ATI Rage and Radeon is a registered trademark of ATI Technolo-
+gies, Inc.  All other trademarks mentioned are the property of their respec-
+tive owners.
+
+2.  Introduction
+
+This document describes how to download, compile and install the DRI.  The
+DRI provides 3D graphics hardware acceleration for the XFree86 project.  This
+information is intended for experienced Linux developers.  Beginners are
+probably better off installing precompiled packages.
+
+Edits, corrections and updates to this document may be mailed to <brian@tung-
+stengraphics.com>.
+
+Last updated on 13 February 2002 by Brian Paul.
+
+3.  Prerequisites
+
+You'll need the following:
+
+   o An installation of XFree86 4.1 or later.  The DRI tree has been pruned
+     down to minimize its size.  But in order to build the DRI tree you need
+     to have recent X header files, etc. already installed.  If you don't
+     have XFree86 4.1 (or later) installed you can probably install it from
+     RPMs (or another package format).  Or, you can download XFree86 as
+     sources and compile/install it yourself.
+
+   o At least 200MB of free disk space.  If you compile for debugging (the -g
+     option) then you'll need about 600MB.
+
+   o GCC compiler and related tools.
+
+   o ssh (secure shell) if you're a DRI developer and don't want to use
+     anonymous CVS download.
+
+   o A 2.4.x Linux Kernel.  See below for details.
+
+   o FreeBSD support is not currently being maintained and may not work.
+
+The DRI 3D drivers generally work on systems with Intel or AMD CPUs.  How-
+ever, limited support for Alpha and PowerPC support is underway.
+
+For 3dfx Voodoo hardware, you'll also need the Glide3 runtime library
+(libglide3-v3.so for Voodoo3 or libglide3-v5.so for Voodoo4/5).  These can be
+downloaded from the DRI website.  You can compile them yourself, but it's
+often a painful process.
+
+For Matrox G200/G400, Intel i810/i830 or ATI Rage128/Radeon hardware, you'll
+also need AGP support in your Linux kernel, either built-in or as a loadable
+module.
+
+4.  Linux Kernel Preparation
+
+Only the Linux 2.4.x kernels are currently supported by the DRI hardware
+drivers.  2.5.x kernels may work, but aren't tested.
+
+Most of the DRI drivers require AGP support and using Intel Pentium III SSE
+optimizations also requires an up-to-date Linux kernel.  Configuring your
+kernel correctly is very important, as features such as SSE optimizations
+will be disabled if your kernel does not support them.  Thus, if you have a
+Pentium III processor, you must configure your kernel for the Pentium III
+processor family.
+
+Building a new Linux kernel can be difficult for beginners but there are
+resources on the Internet to help.  This document assumes experience with
+configuring, building and installing Linux kernels.
+
+Linux kernels can be downloaded from www.kernel.org
+
+Here are the basic steps for kernel setup.
+
+   o Download the needed kernel and put it in /usr/src.  Create a directory
+     for the source and unpack it.  For example:
+
+                    cd /usr/src
+                    rm -f linux
+                    mkdir linux-2.4.x
+                    ln -s linux-2.4.x linux
+                    bzcat linux-2.4.x.tar.bz2 | tar xf -
+
+     It is critical that /usr/src/linux point to your new kernel sources,
+     otherwise the kernel headers will not be used when building the DRI.
+     This will almost certainly cause compilation problems.
+
+   o Read /usr/src/linux/Documentation/Changes.  This file lists the minimum
+     requirements for all software packages required to build the kernel.
+     You must upgrade at least gcc, make, binutils and modutils to at least
+     the versions specified in this file.  The other packages may not be
+     needed.  If you are upgrading from Linux 2.2.x you must upgrade your
+     modutils package for Linux 2.4.x.
+
+   o Configure your kernel.  You might, for example, use make menuconfig and
+     do the following:
+
+        o Go to Code maturity level options
+
+        o Enable Prompt for development and/or incomplete code/drivers
+
+        o hit ESC to return to the top-level menu
+
+        o Go to Processor type and features
+
+        o Select your processor type from Processor Family
+
+        o hit ESC to return to the top-level menu
+
+        o Go to Character devices
+
+        o Disable Direct Rendering Manager (XFree86 DRI support) since we'll
+          use the DRI code from the XFree86/DRI tree and will compile it
+          there.
+
+        o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)
+
+        o Hit SPACE twice to build AGP support into the kernel
+
+        o Enable all chipsets' support for AGP
+
+        o It's recommended that you turn on MTRRs under Processor type and
+          Features, but not required.
+
+   o Configure the rest of the kernel as required for your system (i.e. Eth-
+     ernet, SCSI, etc)
+
+   o Exit, saving your kernel configuration.
+
+   o Edit your /etc/lilo.conf file.  Make sure you have an image entry as
+     follows (or similar):
+
+                      image=/boot/vmlinuz
+                            label=linux.2.4.x
+                            read-only
+                            root=/dev/hda1
+
+     The important part is that you have /boot/vmlinuz without a trailing
+     version number.  If this is the first entry in your /etc/lilo.conf AND
+     you haven't set a default, then this will be your default kernel.
+
+   o Compile the new kernel.
+
+                    cd /usr/src/linux-2.4.x
+                    make dep
+                    make bzImage
+                    make modules
+                    make modules_install
+                    make install
+
+     Note that last make command will automatically run lilo for you.
+
+   o Now reboot to use the new kernel.
+
+5.  CPU Architectures
+
+In general, nothing special has to be done to use the DRI on different CPU
+architectures.  There are, however, a few optimizations that are CPU-depen-
+dent.  Mesa will determine at runtime which CPU-dependent optimizations
+should be used and enable them where appropriate.
+
+5.1  Intel Pentium III Features
+
+The Pentium III SSE instructions are used in optimized vertex transformation
+functions in the Mesa-based DRI drivers.  On Linux, SSE requires a recent
+kernel (such as 2.4.0-test11 or later) both at compile time and runtime.
+
+5.2  AMD 3DNow! Features
+
+AMD's 3DNow! instructions are used in optimized vertex transformation func-
+tions in the Mesa-based DRI drivers.  3DNow! is supported in most versions of
+Linux.
+
+5.3  Alpha Features
+
+On newer Alpha processors a significant performance increase can be seen with
+the addition of the -mcpu= option to GCC.  This option is dependent on the
+architecture of the processor.  For example, -mcpu=ev6 will build specifi-
+cally for the EV6 based AXP's, giving both byte and word alignment access to
+the DRI/Mesa drivers.
+
+To enable this optimization edit your xc/config/host.def file and add the
+line:
+
+#define DefaultGcc2AxpOpt -O2 -mcpu=ev6
+
+Additional speed improvements to 3D rendering can be achieved by installing
+Compaq's Math Libraries (CPML) which can be obtained from http://www.sup-
+port.compaq.com/alpha-tools/software/index.html
+
+Once installed, you can add this line to your host.def to build with the CPML
+libraries:
+
+#define UseCompaqMathLibrary YES
+
+The host.def file is explained below.
+
+6.  Downloading the XFree86/DRI CVS Sources
+
+The DRI project is hosted by SourceForge.  The DRI source code, which is a
+subset of the XFree86 source tree, is kept in a CVS repository there.
+
+The DRI CVS sources may be accessed either anonymously or as a registered
+SourceForge user.  It's recommended that you become a registered SourceForge
+user so that you may submit non-anonymous bug reports and can participate in
+the mailing lists.
+
+6.1  Anonymous CVS download:
+
+  1.  Create a directory to store the CVS files:
+
+                       cd ~
+                       mkdir DRI-CVS
+
+      You could put your CVS directory in a different place but we'll use
+      ~/DRI-CVS/ here.
+
+  2.  Check out the CVS sources:
+
+                       cd ~/DRI-CVS
+                       cvs -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri login
+                         (hit ENTER when prompted for a password)
+                       cvs -z3 -d:pserver:anonymous@cvs.dri.sourceforge.net:/cvsroot/dri co xc
+
+      The -z3 flag causes compression to be used in order to reduce the down-
+      load time.
+
+6.2  Registered CVS download:
+
+  1.  Create a directory to store the CVS files:
+
+                       cd ~
+                       mkdir DRI-CVS
+
+      You could put your CVS directory in a different place but we'll use
+      ~/DRI-CVS/ here.
+
+  2.  Set the CVS_RSH environment variable:
+
+                       setenv CVS_RSH ssh      // if using csh or tcsh
+                       export CVS_RSH=ssh      // if using sh or bash
+
+  3.  Check out the CVS sources:
+
+                       cd ~/DRI-CVS
+                       cvs -z3 -d:ext:YOURID@cvs.dri.sourceforge.net:/cvsroot/dri co xc
+
+      Replace YOURID with your CVS login name.  You'll be prompted to enter
+      your sourceforge password.
+
+      The -z3 flag causes compression to be used in order to reduce the down-
+      load time.
+
+6.3  Updating your CVS sources
+
+In the future you'll want to occasionally update your local copy of the DRI
+source code to get the latest changes.  This can be done with:
+
+                cd ~/DRI-CVS
+                cvs -z3 update -dA xc
+
+The -d flag causes any new subdirectories to be created and -A causes most
+recent trunk sources to be fetched, not branch sources.
+
+7.  Mesa
+
+Most of the DRI 3D drivers are based on Mesa (the free implementation of the
+OpenGL API).  The relevant files from Mesa are already included in the
+XFree86/DRI source tree.  There is no need to download or install the Mesa
+source files separately.
+
+Sometimes a newer version of Mesa will be available than the version included
+in XFree86/DRI.  Upgrading Mesa within XFree86/DRI is not always straightfor-
+ward.  It can be an error-prone undertaking, especially for beginners, and is
+not generally recommended.  The DRI developers will upgrade Mesa when appro-
+priate.
+
+8.  Compiling the XFree86/DRI tree
+
+8.1  Make a build tree
+
+Rather than placing object files and library files right in the source tree,
+they're instead put into a parallel build tree.  The build tree is made with
+the lndir command:
+
+                 cd ~/DRI-CVS
+                 ln -s xc XFree40
+                 mkdir build
+                 cd build
+                 lndir -silent -ignorelinks ../XFree40
+
+The build tree will be populated with symbolic links which point back into
+the CVS source tree.
+
+Advanced users may have several build trees for compiling and testing with
+different options.
+
+8.2  Edit the host.def file
+
+The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the
+XFree86 build process.  You can change it to customize your build options or
+make adjustments for your particular system configuration
+
+The default host.def file will look something like this:
+
+                 #define DefaultCCOptions -Wall
+     (i386)      #define DefaultGcc2i386Opt -O2
+     (Alpha)     #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar)
+                 #define LibraryCDebugFlags -O2
+                 #define BuildServersOnly YES
+                 #define XF86CardDrivers vga tdfx mga ati i810
+                 #define LinuxDistribution LinuxRedHat
+                 #define DefaultCCOptions -ansi GccWarningOptions -pipe
+                 #define BuildXF86DRI YES
+                 /* Optionally turn these on for debugging */
+                 /* #define GlxBuiltInTdfx YES */
+                 /* #define GlxBuiltInMga YES */
+                 /* #define GlxBuiltInR128 YES */
+                 /* #define GlxBuiltInRadeon YES */
+                 /* #define DoLoadableServer NO */
+                 #define SharedLibFont NO
+
+The ProjectRoot variable specifies where the XFree86 files will be installed.
+We recommend installing the DRI files over your existing XFree86 installation
+- it's generally safe to do and less error-prone.  This policy is different
+than what we used to recommend.
+
+If XFree86 4.x is not installed in /usr/X11R6/ you'll have to add the follow-
+ing to the host.def file:
+
+                 #define ProjectRoot pathToYourXFree86installation
+
+Note the XF86CardDrivers line to be sure your card's driver is listed.
+
+If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you
+should add the following:
+
+                 #define MesaUse3DNow YES
+
+You don't have to be using an AMD processor in order to enable this option.
+The DRI will look for 3DNow! support and runtime and only enable it if appli-
+cable.
+
+If you want to enable SSE optimizations in Mesa and the DRI drivers, you must
+upgrade to a Linux 2.4.x kernel.  Mesa will verify that SSE is supported by
+both your processor and your operating system, but to build Mesa inside the
+DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux.  If
+you enable SSE optimizations with an earlier version of the Linux kernel in
+/usr/src/linux, Mesa will not compile.  You have been warned.  If you do have
+a 2.4.x kernel, you should add the following:
+
+                 #define MesaUseSSE YES
+
+If you want to build the DRM kernel modules as part of the full build pro-
+cess, add the following:
+
+                 #define BuildXF86DRM YES
+
+Otherwise, you'll need to build them separately as described below.
+
+8.3  Compilation
+
+To compile the complete DRI tree:
+
+                 cd ~/DRI-CVS/build/xc/
+                 make World >& world.log
+
+Or if you want to watch the compilation progress:
+
+                 cd ~/DRI-CVS/build/xc/
+                 make World >& world.log &
+                 tail -f world.log
+
+With the default compilation flags it's normal to get a lot of warnings dur-
+ing compilation.
+
+Building will take some time so you may want to go check your email or visit
+slashdot.
+
+WARNING: do not use the -j option with make.  It's reported that it does not
+work with XFree86/DRI.
+
+8.4  Check for compilation errors
+
+Using your text editor, examine world.log for errors by searching for the
+pattern ***.
+
+After fixing the errors, run make World again.  Later, you might just compile
+parts of the source tree but it's important that the whole tree will build
+first.
+
+If you edited your host.def file to enable automatic building of the DRI ker-
+nel module(s), verify that they were built:
+
+               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+               ls
+
+Otherwise, build them now by running
+
+               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+               make -f Makefile.linux
+
+For the 3dfx Voodoo, you should see tdfx.o.  For the Matrox G200/G400, you
+should see mga.o.  For the ATI Rage 128, you should see r128.o.  For the ATI
+Radeon, you should see radeon.o.  For the Intel i810, you should see i810.o.
+
+If the DRI kernel module(s) failed to build you should verify that you're
+using the right version of the Linux kernel.  The most recent kernels are not
+always supported.
+
+If your build machine is running a different version of the kernel than your
+target machine (i.e. 2.2.x vs. 2.4.x), make will select the wrong kernel
+source tree. This can be fixed by explicitly setting the value of LINUXDIR.
+If the path to your kernel source is /usr/src/linux-2.4.x,
+
+               cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
+               make -f Makefile.linux LINUXDIR=/usr/src/linux-2.4.x
+
+or alternatively, edit Makefile.linux to set LINUXDIR before the ifndef LIN-
+UXDIR line.
+
+8.5  DRI kernel module installation
+
+The DRI kernel modules will be in ~/DRI-CVS/build/xc/pro-
+grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/.
+
+To load the appropriate DRM module in your running kernel you can either use
+ismod and restart your X server or copy the kernel module to /lib/mod-
+ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X
+server.
+
+Make sure you first unload any older DRI kernel modules that might be already
+loaded.
+
+Note that some DRM modules require that the agpgart module be loaded first.
+
+9.  Normal Installation and Configuration
+
+Most users will want to install the new X server and use it in place of their
+old X server.  This section explains how to do that.
+
+Developers, on the other hand, may just want to test the X server without
+actually installing it as their default server.  If you want to do that, skip
+to the next section.
+
+9.1  Installation
+
+Here are the installation commands:
+
+                su
+                cd ~/DRI-CVS/build/xc
+                make install
+
+9.2  Update the XF86Config File
+
+You may need to edit your XF86Config file to enable the DRI.  The config file
+is usually installed as /etc/X11/XF86Config-4.  See the DRI User Guide for
+details, but basically, you need to load the "glx" and "dri" modules and add
+a "DRI" section.
+
+On the DRI web site, in the resources section, you'll find example XF86Config
+files for a number of graphics cards.  These configuration files also setup
+DRI options so it's highly recommended that you look at these examples.
+
+The XFree86 4.x server can generate a basic configuration file itself.  Sim-
+ply do this:
+
+                  cd /usr/X11R6/bin
+                  ./XFree86 -configure
+
+A file named /root/XF86Config.new will be created.  It should allow you to
+try your X server but you'll almost certainly have to edit it.  For example,
+you should add HorizSync and VertRefresh options to the Monitor section and
+Modes options to the Screen section.  Also, the ModulePath option in the
+Files section should be set to /usr/X11R6/lib/modules.
+
+9.3  Start the New X Server
+
+The new X server should be ready to use now.  Start your X server in your
+usual manner.  Often times the startx command is used:
+
+                  startx
+
+10.  Testing the Server Without Installing It
+
+As mentioned at the start of section 9, developers may want to simply run the
+X server without installing it.  This can save some time and allow you to
+keep a number of X servers available for testing.
+
+10.1  Configuration
+
+As described in the preceding section, you'll need to create a configuration
+file for the new server.  Put the XF86Config file in your ~/DRI-
+CVS/build/xc/programs/Xserver directory.
+
+Be sure the ModulePath option in your XF86Config file is set correctly.
+
+10.2  A Startup Script
+
+A simple shell script can be used to start the X server.  Here's an example.
+
+             #!/bin/sh
+             export DISPLAY=:0
+             ./XFree86 -xf86config XF86Config & \
+             sleep 2
+             fvwm2 &
+             xset b off
+             xmodmap -e "clear mod4"
+             xsetroot -solid "#00306f"
+             xterm -geometry 80x40+0+0
+
+You might name this script start-dri.  Put it in your ~/DRI-CVS/build/xc/pro-
+grams/Xserver directory.
+
+To test the server run the script:
+
+                  cd ~/DRI-CVS/build/xc/programs/Xserver
+                  ./start-dri
+
+For debugging, you may also want to capture the log messages printed by the
+server in a file.  If you're using the C-shell:
+
+                  ./start-dri >& log
+
+11.  Where To Go From Here
+
+At this point your X server should be up and running with hardware-acceler-
+ated direct rendering.  Please read the DRI User Guide for information about
+trouble shooting and how to use the DRI-enabled X server for 3D applications.
+
+     Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.19 dawes Exp $
diff --git a/xorg-server/hw/xfree86/doc/README.modes b/xorg-server/hw/xfree86/doc/README.modes
index 894e21313..da9d41eb5 100644
--- a/xorg-server/hw/xfree86/doc/README.modes
+++ b/xorg-server/hw/xfree86/doc/README.modes
@@ -1,474 +1,474 @@
-		    Multi-monitor Mode Setting APIs
-	           Keith Packard, <keithp@keithp.com
-		   	   6 March 2007
-
-1. Introduction
-
-This document describes a set of mode setting APIs added in X server version
-1.3 that support multiple monitors per card. These interfaces expose the
-underlying hardware CRTC and output concepts to the xf86 DDX layer so that
-the implementation of initial server setup and mode changes through
-extensions can be shared across drivers. In addition, these new interfaces
-support a new configuration mechanism as well which allows each monitor to
-be customized separately providing a consistent cross-driver configuration
-mechanism that supports the full range of output features.
-
-All of the code implementing this interface can be found in hw/xfree86/modes
-in the X server sources.
-
-2. Overview
-
-This document describes both the driver API and the configuration data
-placed in xorg.conf; these are entirely separate as the driver has no
-interaction with the configuration information at all. Much of the structure
-here is cloned from the RandR extension version 1.2 additions which deal
-with the same kinds of information.
-
-2.1 API overview
-
-The mode setting API is expressed through two new driver-visible objects,
-the 'CRTC' (xf86CrtcRec) and the 'Output' (xf86OutputRec). A CRTC refers to
-hardware within the video system that can scan a subset of the framebuffer
-and generate a video signal. An Output receives that signal and transmits it
-to a monitor, projector or other device.
-
-The xf86CrtcRec and xf86OutputRec contain a small amount of state data
-related to the object along with a pointer to a set of functions provided by
-the driver that manipulate the object in fairly simple ways.
-
-To emulate older behaviour, one of the outputs is picked as the 'compat'
-output; this output changes over time as outputs are detected and used, the
-goal is to always have one 'special' output which is used for operations
-which need a single defined monitor (like XFree86-VidModeExtension mode
-setting, RandR 1.1 mode setting, DDC property setting, etc.).
-
-2.1.1 Output overview 
-
-As outputs are connected to monitors, they hold a list of modes supported by
-the monitor. If the monitor and output support DDC, then the list of modes
-generally comes from the EDID data in the monitor. Otherwise, the server
-uses the standard VESA modes, pruned by monitor timing. If the configuration
-file doesn't contain monitor timing data, the server uses default timing
-information which supports 640x480, 800x600 and 1024x768 all with a 60Hz
-refresh rate.
-
-As hardware often limits possible configuration combinations, each output
-knows the set of CRTCs that it can be connected to as well as the set of
-other outputs which can be simutaneously connected to a CRTC.
-
-2.1.2 CRTC overview
-
-CRTCs serve only to stream frame buffer data to outputs using a mode line.
-Ideally, they would not be presented to the user at all, and in fact the
-configuration file doesn't expose them. The RandR 1.2 protocol does, but the
-hope there is that client-side applications will hide them carefully away.
-
-Each crtc has an associated cursor, along with the current configuration.
-All of the data needed to determine valid configurations is contained within
-the Outputs.
-
-2.2 Configuration overview
-
-As outputs drive monitors, the "Monitor" section has been repurposed to
-define their configuration. This provides for a bit more syntax than
-the large list of driver-specific options that were used in the past for
-similar configuration.
-
-However, the existing "Monitor" section referenced by the active "Screen"
-section no longer has any use at all; some sensible meaning for this
-parameter is needed now that a Screen can have multiple Monitors.
-
-3. Public Functions
-
-3.1 PreInit functions
-
-These functions should be used during the driver PreInit phase, they are
-arranged in the order they should be invoked.
-
-    void
-    xf86CrtcConfigInit (ScrnInfoPtr			scrn
-			const xf86CrtcConfigFuncsRec	*funcs)
-
-This function allocates and initializes structures needed to track CRTC and
-Output state.
-
-    void
-    xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
-			  int minWidth, int minHeight,
-			  int maxWidth, int maxHeight)
-
-This sets the range of screen sizes supported by the driver.
-
-    xf86CrtcPtr
-    xf86CrtcCreate (ScrnInfoPtr             scrn,
-		    const xf86CrtcFuncsRec  *funcs)
-    
-Create one CRTC object. See the discussion below for a description of the
-contents of the xf86CrtcFuncsRec. Note that this is done in PreInit, so it
-should not be re-invoked at each server generation. Create one of these for
-each CRTC present in the hardware.
-    
-    xf86OutputPtr
-    xf86OutputCreate (ScrnInfoPtr              scrn,
-		      const xf86OutputFuncsRec *funcs,
-		      const char	       *name)
-
-Create one Output object. See the discussion below for a description of the
-contents of the xf86OutputFuncsRec. This is also called from PreInit and
-need not be re-invoked at each ScreenInit time. An Output should be created
-for every Output present in the hardware, not just for outputs which have
-detected monitors.
-    
-    Bool
-    xf86OutputRename (xf86OutputPtr output, const char *name)
-
-If necessary, the name of an output can be changed after it is created using
-this function.
-    
-    Bool
-    xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
-
-Using the resources provided, and the configuration specified by the user,
-this function computes an initial configuration for the server. It tries to
-enable as much hardware as possible using some fairly simple heuristics. 
-
-The 'canGrow' parameter indicates that the frame buffer does not have a fixed
-size (fixed size frame buffers are required by XAA). When the frame buffer
-has a fixed size, the configuration selects a 'reasonablely large' frame
-buffer so that common reconfiguration options are possible. For resizable
-frame buffers, the frame buffer is set to the smallest size that encloses
-the desired configuration.
-    
-3.2 ScreenInit functions
-
-These functions should be used during the driver ScreenInit phase.
-
-    Bool
-    xf86DiDGAInit (ScreenPtr screen, unsigned long dga_address)
-
-This function provides driver-independent accelerated DGA support for some
-of the DGA operations; using this, the driver can avoid needing to implement
-any of the rest of DGA.
-
-    Bool
-    xf86SaveScreen(ScreenPtr pScreen, int mode)
-
-Stick this in pScreen->SaveScreen and the core X screen saver will be
-implemented by disabling outputs and crtcs using their dpms functions.
-
-    void
-    xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
-
-Pass this function to xf86DPMSInit and all DPMS mode switching will be
-managed by using the dpms functions provided by the Outputs and CRTCs.
-
-    Bool
-    xf86CrtcScreenInit (ScreenPtr screen)
-
-This function completes the screen initialization process for the crtc and
-output objects. Call it near the end of the ScreenInit function, after the
-frame buffer and acceleration layers have been added.
-
-3.3 EnterVT functions
-
-Functions used during EnterVT, or whenever the current configuration needs
-to be applied to the hardware.
-
-    Bool
-    xf86SetDesiredModes (ScrnInfoPtr scrn)
-
-xf86InitialConfiguration selects the desired configuration at PreInit time;
-when the server finally hits ScreenInit, xf86SetDesiredModes is used by the
-driver to take that configuration and apply it to the hardware. In addition,
-successful mode selection at other times updates the configuration that will
-be used by this function, so LeaveVT/EnterVT pairs can simply invoke this
-and return to the previous configuration.
-
-3.4 SwitchMode functions
-
-Functions called from the pScrn->SwitchMode hook, which is used by the
-XFree86-VidModeExtension and the keypad mode switch commands.
-
-    Bool
-    xf86SetSingleMode (ScrnInfoPtr	scrn, 
-		       DisplayModePtr   desired,
-		       Rotation		rotation)
-
-This function applies the specified mode to all active outputs. Which is to
-say, it picks reasonable modes for all active outputs, attempting to get the
-screen to the specified size while not breaking anything that is currently
-working.
-
-3.7 get_modes functions
-
-Functions called during output->get_modes to help build lists of modes
-
-    xf86MonPtr
-    xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
-
-This returns the EDID data structure for the 'output' using the I2C bus
-'pDDCBus'. This has no effect on 'output' itself.
-
-    void
-    xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
-
-Once the EDID data has been fetched, this call applies the EDID data to the
-output object, setting the physical size and also various properties, like
-the DDC root window property (when output is the 'compat' output), and the
-RandR 1.2 EDID output properties.
-
-    DisplayModePtr
-    xf86OutputGetEDIDModes (xf86OutputPtr output)
-
-Given an EDID data structure, this function computes a list of suitable
-modes. This function also applies a sequence of 'quirks' during this process
-so that the returned modes may not actually match the mode data present in
-the EDID data.
-
-3.6 Other functions
-
-These remaining functions in the API can be used by the driver as needed.
-
-    Bool
-    xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
-		     int x, int y)
-
-Applies a mode to a CRTC. All of the outputs which are currently using the
-specified CRTC are included in the mode setting process. 'x' and 'y' are the
-offset within the frame buffer that the crtc is placed at. No checking is
-done in this function to ensure that the mode is usable by the active
-outputs.
-    
-    void
-    xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
-
-This discards the mode lists for all outputs, re-detects monitor presence
-and then acquires new mode lists for all monitors which are not disconnected.
-Monitor configuration data is used to modify the mode lists returned by the
-outputs. 'maxX' and 'maxY' limit the maximum size modes that will be
-returned.
-    
-    void
-    xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
-
-This copies the 'compat' output mode list into the pScrn modes list which is
-used by the XFree86-VidModeExtension and the keypad mode switching
-operations. The current 'desired' mode for the CRTC associated with the
-'compat' output is placed first in this list to indicate the current mode.
-Usually, the driver won't need to call this function as
-xf86InitialConfiguration will do so automatically, as well as any RandR
-functions which reprobe for modes. However, if the driver reprobes for modes
-at other times using xf86ProbeOutputModes, this function needs to be called.
-    
-    Bool
-    xf86DiDGAReInit (ScreenPtr pScreen)
-
-This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output
-mode list to the set of modes advertised by the DGA extension; it needs to
-be called whenever xf86ProbeOutputModes is invoked.
-
-    void
-    xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
-
-After any sequence of calls using xf86CrtcSetMode, this function cleans up
-any leftover Output and CRTC objects by disabling them, saving power. It is
-safe to call this whenever the server is running as it only disables objects
-which are not currently in use.
-    
-4. CRTC operations
-
-4.1 CRTC functions
-
-These functions provide an abstract interface for the CRTC object; most
-manipulation of the CRTC object is done through these functions.
-
-    void
-    crtc->funcs->dpms (xf86CrtcPtr crtc, int mode)
-
-Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or
-DPMSModeOn. This requests that the crtc go to the specified power state.
-When changing power states, the output dpms functions are invoked before the
-crtc dpms functions.
-
-    void
-    crtc->funcs->save (xf86CrtcPtr crtc)
-	
-    void
-    crtc->funcs->restore (xf86CrtcPtr crtc)
-
-Preserve/restore any register contents related to the CRTC. These are
-strictly a convenience for the driver writer; if the existing driver has
-fully operation save/restore functions, you need not place any additional
-code here. In particular, the server itself never uses this function.
-
-    Bool
-    crtc->funcs->lock (xf86CrtcPtr crtc)
-	
-    void
-    crtc->funcs->unlock (xf86CrtcPtr crtc)
-
-These functions are invoked around mode setting operations; the intent is
-that DRI locking be done here to prevent DRI applications from manipulating
-the hardware while the server is busy changing the output configuration. If
-the lock function returns FALSE, the unlock function will not be invoked.
-
-    Bool
-    crtc->funcs->mode_fixup (xf86CrtcPtr crtc, 
-			     DisplayModePtr mode,
-			     DisplayModePtr adjusted_mode)
-
-This call gives the CRTC a chance to see what mode will be set and to
-comment on the mode by changing 'adjusted_mode' as needed. This function
-shall not modify the state of the crtc hardware at all. If the CRTC cannot
-accept this mode, this function may return FALSE.
-
-    void
-    crtc->funcs->prepare (xf86CrtcPtr crtc)
-
-This call is made just before the mode is set to make the hardware ready for
-the operation. A usual function to perform here is to disable the crtc so
-that mode setting can occur with clocks turned off and outputs deactivated.
-
-    void
-    crtc->funcs->mode_set (xf86CrtcPtr crtc,
-			   DisplayModePtr mode,
-			   DisplayModePtr adjusted_mode)
-
-This function applies the specified mode (possibly adjusted by the CRTC
-and/or Outputs).
-
-    void
-    crtc->funcs->commit (xf86CrtcPtr crtc)
-
-Once the mode has been applied to the CRTC and Outputs, this function is
-invoked to let the hardware turn things back on.
-
-    void
-    crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red,
-			    CARD16 *green, CARD16 *blue, int size)
-
-This function adjusts the gamma ramps for the specified crtc.
-
-    void *
-    crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height)
-
-This function allocates frame buffer space for a shadow frame buffer. When
-allocated, the crtc must scan from the shadow instead of the main frame
-buffer. This is used for rotation. The address returned is passed to the
-shadow_create function. This function should return NULL on failure.
-
-    PixmapPtr
-    crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data,
-				int width, int height)
-
-This function creates a pixmap object that will be used as a shadow of the
-main frame buffer for CRTCs which are rotated or reflected. 'data' is the
-value returned by shadow_allocate.
-
-    void
-    crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap,
-				 void *data)
-
-Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap
-was not created, but 'data' may still be non-NULL indicating that the shadow
-had been allocated.
-
-    void
-    crtc->funcs->destroy (xf86CrtcPtr crtc)
-
-When a CRTC is destroyed (which only happens in error cases), this function
-can clean up any driver-specific data.
-
-4.2 CRTC fields
-
-The CRTC object is not opaque; there are several fields of interest to the
-driver writer.
-
-    struct _xf86Crtc {
-	/**
-	 * Associated ScrnInfo
-	 */
-	ScrnInfoPtr     scrn;
-    
-	/**
-	 * Active state of this CRTC
-	 *
-	 * Set when this CRTC is driving one or more outputs
-	 */
-	Bool            enabled;
-    
-	/** Track whether cursor is within CRTC range  */
-	Bool            cursorInRange;
-    
-	/** Track state of cursor associated with this CRTC */
-	Bool            cursorShown;
-    
-	/**
-	 * Active mode
-	 *
-	 * This reflects the mode as set in the CRTC currently
-	 * It will be cleared when the VT is not active or
-	 * during server startup
-	 */
-	DisplayModeRec  mode;
-	Rotation        rotation;
-	PixmapPtr       rotatedPixmap;
-	void            *rotatedData;
-    
-	/**
-	 * Position on screen
-	 *
-	 * Locates this CRTC within the frame buffer
-	 */
-	int             x, y;
-    
-	/**
-	 * Desired mode
-	 *
-	 * This is set to the requested mode, independent of
-	 * whether the VT is active. In particular, it receives
-	 * the startup configured mode and saves the active mode
-	 * on VT switch.
-	 */
-	DisplayModeRec  desiredMode;
-	Rotation        desiredRotation;
-	int             desiredX, desiredY;
-    
-	/** crtc-specific functions */
-	const xf86CrtcFuncsRec *funcs;
-    
-	/**
-	 * Driver private
-	 *
-	 * Holds driver-private information
-	 */
-	void            *driver_private;
-    #ifdef RANDR_12_INTERFACE
-	/**
-	 * RandR crtc
-	 *
-	 * When RandR 1.2 is available, this
-	 * points at the associated crtc object
-	 */
-	RRCrtcPtr       randr_crtc;
-    #else
-	void            *randr_crtc;
-    #endif
-    };
-
-    
-5. Output functions.
-
-6. Configuration
-
-Because the configuration file syntax is fixed,
-this was done by creating new "Driver" section options that hook specific
-outputs to specific "Monitor" sections in the file. The option:
-section of the form:
-
-	Option	"monitor-VGA" "My VGA Monitor"
-
-connects the VGA output of this driver to the "Monitor" section with
-Identifier "My VGA Monitor". All of the usual monitor options can now be
-placed in that "Monitor" section and will be applied to the VGA output
-configuration.
+		    Multi-monitor Mode Setting APIs
+	           Keith Packard, <keithp@keithp.com
+		   	   6 March 2007
+
+1. Introduction
+
+This document describes a set of mode setting APIs added in X server version
+1.3 that support multiple monitors per card. These interfaces expose the
+underlying hardware CRTC and output concepts to the xf86 DDX layer so that
+the implementation of initial server setup and mode changes through
+extensions can be shared across drivers. In addition, these new interfaces
+support a new configuration mechanism as well which allows each monitor to
+be customized separately providing a consistent cross-driver configuration
+mechanism that supports the full range of output features.
+
+All of the code implementing this interface can be found in hw/xfree86/modes
+in the X server sources.
+
+2. Overview
+
+This document describes both the driver API and the configuration data
+placed in xorg.conf; these are entirely separate as the driver has no
+interaction with the configuration information at all. Much of the structure
+here is cloned from the RandR extension version 1.2 additions which deal
+with the same kinds of information.
+
+2.1 API overview
+
+The mode setting API is expressed through two new driver-visible objects,
+the 'CRTC' (xf86CrtcRec) and the 'Output' (xf86OutputRec). A CRTC refers to
+hardware within the video system that can scan a subset of the framebuffer
+and generate a video signal. An Output receives that signal and transmits it
+to a monitor, projector or other device.
+
+The xf86CrtcRec and xf86OutputRec contain a small amount of state data
+related to the object along with a pointer to a set of functions provided by
+the driver that manipulate the object in fairly simple ways.
+
+To emulate older behaviour, one of the outputs is picked as the 'compat'
+output; this output changes over time as outputs are detected and used, the
+goal is to always have one 'special' output which is used for operations
+which need a single defined monitor (like XFree86-VidModeExtension mode
+setting, RandR 1.1 mode setting, DDC property setting, etc.).
+
+2.1.1 Output overview 
+
+As outputs are connected to monitors, they hold a list of modes supported by
+the monitor. If the monitor and output support DDC, then the list of modes
+generally comes from the EDID data in the monitor. Otherwise, the server
+uses the standard VESA modes, pruned by monitor timing. If the configuration
+file doesn't contain monitor timing data, the server uses default timing
+information which supports 640x480, 800x600 and 1024x768 all with a 60Hz
+refresh rate.
+
+As hardware often limits possible configuration combinations, each output
+knows the set of CRTCs that it can be connected to as well as the set of
+other outputs which can be simutaneously connected to a CRTC.
+
+2.1.2 CRTC overview
+
+CRTCs serve only to stream frame buffer data to outputs using a mode line.
+Ideally, they would not be presented to the user at all, and in fact the
+configuration file doesn't expose them. The RandR 1.2 protocol does, but the
+hope there is that client-side applications will hide them carefully away.
+
+Each crtc has an associated cursor, along with the current configuration.
+All of the data needed to determine valid configurations is contained within
+the Outputs.
+
+2.2 Configuration overview
+
+As outputs drive monitors, the "Monitor" section has been repurposed to
+define their configuration. This provides for a bit more syntax than
+the large list of driver-specific options that were used in the past for
+similar configuration.
+
+However, the existing "Monitor" section referenced by the active "Screen"
+section no longer has any use at all; some sensible meaning for this
+parameter is needed now that a Screen can have multiple Monitors.
+
+3. Public Functions
+
+3.1 PreInit functions
+
+These functions should be used during the driver PreInit phase, they are
+arranged in the order they should be invoked.
+
+    void
+    xf86CrtcConfigInit (ScrnInfoPtr			scrn
+			const xf86CrtcConfigFuncsRec	*funcs)
+
+This function allocates and initializes structures needed to track CRTC and
+Output state.
+
+    void
+    xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+			  int minWidth, int minHeight,
+			  int maxWidth, int maxHeight)
+
+This sets the range of screen sizes supported by the driver.
+
+    xf86CrtcPtr
+    xf86CrtcCreate (ScrnInfoPtr             scrn,
+		    const xf86CrtcFuncsRec  *funcs)
+    
+Create one CRTC object. See the discussion below for a description of the
+contents of the xf86CrtcFuncsRec. Note that this is done in PreInit, so it
+should not be re-invoked at each server generation. Create one of these for
+each CRTC present in the hardware.
+    
+    xf86OutputPtr
+    xf86OutputCreate (ScrnInfoPtr              scrn,
+		      const xf86OutputFuncsRec *funcs,
+		      const char	       *name)
+
+Create one Output object. See the discussion below for a description of the
+contents of the xf86OutputFuncsRec. This is also called from PreInit and
+need not be re-invoked at each ScreenInit time. An Output should be created
+for every Output present in the hardware, not just for outputs which have
+detected monitors.
+    
+    Bool
+    xf86OutputRename (xf86OutputPtr output, const char *name)
+
+If necessary, the name of an output can be changed after it is created using
+this function.
+    
+    Bool
+    xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+
+Using the resources provided, and the configuration specified by the user,
+this function computes an initial configuration for the server. It tries to
+enable as much hardware as possible using some fairly simple heuristics. 
+
+The 'canGrow' parameter indicates that the frame buffer does not have a fixed
+size (fixed size frame buffers are required by XAA). When the frame buffer
+has a fixed size, the configuration selects a 'reasonablely large' frame
+buffer so that common reconfiguration options are possible. For resizable
+frame buffers, the frame buffer is set to the smallest size that encloses
+the desired configuration.
+    
+3.2 ScreenInit functions
+
+These functions should be used during the driver ScreenInit phase.
+
+    Bool
+    xf86DiDGAInit (ScreenPtr screen, unsigned long dga_address)
+
+This function provides driver-independent accelerated DGA support for some
+of the DGA operations; using this, the driver can avoid needing to implement
+any of the rest of DGA.
+
+    Bool
+    xf86SaveScreen(ScreenPtr pScreen, int mode)
+
+Stick this in pScreen->SaveScreen and the core X screen saver will be
+implemented by disabling outputs and crtcs using their dpms functions.
+
+    void
+    xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
+
+Pass this function to xf86DPMSInit and all DPMS mode switching will be
+managed by using the dpms functions provided by the Outputs and CRTCs.
+
+    Bool
+    xf86CrtcScreenInit (ScreenPtr screen)
+
+This function completes the screen initialization process for the crtc and
+output objects. Call it near the end of the ScreenInit function, after the
+frame buffer and acceleration layers have been added.
+
+3.3 EnterVT functions
+
+Functions used during EnterVT, or whenever the current configuration needs
+to be applied to the hardware.
+
+    Bool
+    xf86SetDesiredModes (ScrnInfoPtr scrn)
+
+xf86InitialConfiguration selects the desired configuration at PreInit time;
+when the server finally hits ScreenInit, xf86SetDesiredModes is used by the
+driver to take that configuration and apply it to the hardware. In addition,
+successful mode selection at other times updates the configuration that will
+be used by this function, so LeaveVT/EnterVT pairs can simply invoke this
+and return to the previous configuration.
+
+3.4 SwitchMode functions
+
+Functions called from the pScrn->SwitchMode hook, which is used by the
+XFree86-VidModeExtension and the keypad mode switch commands.
+
+    Bool
+    xf86SetSingleMode (ScrnInfoPtr	scrn, 
+		       DisplayModePtr   desired,
+		       Rotation		rotation)
+
+This function applies the specified mode to all active outputs. Which is to
+say, it picks reasonable modes for all active outputs, attempting to get the
+screen to the specified size while not breaking anything that is currently
+working.
+
+3.7 get_modes functions
+
+Functions called during output->get_modes to help build lists of modes
+
+    xf86MonPtr
+    xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+
+This returns the EDID data structure for the 'output' using the I2C bus
+'pDDCBus'. This has no effect on 'output' itself.
+
+    void
+    xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+
+Once the EDID data has been fetched, this call applies the EDID data to the
+output object, setting the physical size and also various properties, like
+the DDC root window property (when output is the 'compat' output), and the
+RandR 1.2 EDID output properties.
+
+    DisplayModePtr
+    xf86OutputGetEDIDModes (xf86OutputPtr output)
+
+Given an EDID data structure, this function computes a list of suitable
+modes. This function also applies a sequence of 'quirks' during this process
+so that the returned modes may not actually match the mode data present in
+the EDID data.
+
+3.6 Other functions
+
+These remaining functions in the API can be used by the driver as needed.
+
+    Bool
+    xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+		     int x, int y)
+
+Applies a mode to a CRTC. All of the outputs which are currently using the
+specified CRTC are included in the mode setting process. 'x' and 'y' are the
+offset within the frame buffer that the crtc is placed at. No checking is
+done in this function to ensure that the mode is usable by the active
+outputs.
+    
+    void
+    xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
+
+This discards the mode lists for all outputs, re-detects monitor presence
+and then acquires new mode lists for all monitors which are not disconnected.
+Monitor configuration data is used to modify the mode lists returned by the
+outputs. 'maxX' and 'maxY' limit the maximum size modes that will be
+returned.
+    
+    void
+    xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
+
+This copies the 'compat' output mode list into the pScrn modes list which is
+used by the XFree86-VidModeExtension and the keypad mode switching
+operations. The current 'desired' mode for the CRTC associated with the
+'compat' output is placed first in this list to indicate the current mode.
+Usually, the driver won't need to call this function as
+xf86InitialConfiguration will do so automatically, as well as any RandR
+functions which reprobe for modes. However, if the driver reprobes for modes
+at other times using xf86ProbeOutputModes, this function needs to be called.
+    
+    Bool
+    xf86DiDGAReInit (ScreenPtr pScreen)
+
+This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output
+mode list to the set of modes advertised by the DGA extension; it needs to
+be called whenever xf86ProbeOutputModes is invoked.
+
+    void
+    xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+
+After any sequence of calls using xf86CrtcSetMode, this function cleans up
+any leftover Output and CRTC objects by disabling them, saving power. It is
+safe to call this whenever the server is running as it only disables objects
+which are not currently in use.
+    
+4. CRTC operations
+
+4.1 CRTC functions
+
+These functions provide an abstract interface for the CRTC object; most
+manipulation of the CRTC object is done through these functions.
+
+    void
+    crtc->funcs->dpms (xf86CrtcPtr crtc, int mode)
+
+Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or
+DPMSModeOn. This requests that the crtc go to the specified power state.
+When changing power states, the output dpms functions are invoked before the
+crtc dpms functions.
+
+    void
+    crtc->funcs->save (xf86CrtcPtr crtc)
+	
+    void
+    crtc->funcs->restore (xf86CrtcPtr crtc)
+
+Preserve/restore any register contents related to the CRTC. These are
+strictly a convenience for the driver writer; if the existing driver has
+fully operation save/restore functions, you need not place any additional
+code here. In particular, the server itself never uses this function.
+
+    Bool
+    crtc->funcs->lock (xf86CrtcPtr crtc)
+	
+    void
+    crtc->funcs->unlock (xf86CrtcPtr crtc)
+
+These functions are invoked around mode setting operations; the intent is
+that DRI locking be done here to prevent DRI applications from manipulating
+the hardware while the server is busy changing the output configuration. If
+the lock function returns FALSE, the unlock function will not be invoked.
+
+    Bool
+    crtc->funcs->mode_fixup (xf86CrtcPtr crtc, 
+			     DisplayModePtr mode,
+			     DisplayModePtr adjusted_mode)
+
+This call gives the CRTC a chance to see what mode will be set and to
+comment on the mode by changing 'adjusted_mode' as needed. This function
+shall not modify the state of the crtc hardware at all. If the CRTC cannot
+accept this mode, this function may return FALSE.
+
+    void
+    crtc->funcs->prepare (xf86CrtcPtr crtc)
+
+This call is made just before the mode is set to make the hardware ready for
+the operation. A usual function to perform here is to disable the crtc so
+that mode setting can occur with clocks turned off and outputs deactivated.
+
+    void
+    crtc->funcs->mode_set (xf86CrtcPtr crtc,
+			   DisplayModePtr mode,
+			   DisplayModePtr adjusted_mode)
+
+This function applies the specified mode (possibly adjusted by the CRTC
+and/or Outputs).
+
+    void
+    crtc->funcs->commit (xf86CrtcPtr crtc)
+
+Once the mode has been applied to the CRTC and Outputs, this function is
+invoked to let the hardware turn things back on.
+
+    void
+    crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red,
+			    CARD16 *green, CARD16 *blue, int size)
+
+This function adjusts the gamma ramps for the specified crtc.
+
+    void *
+    crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height)
+
+This function allocates frame buffer space for a shadow frame buffer. When
+allocated, the crtc must scan from the shadow instead of the main frame
+buffer. This is used for rotation. The address returned is passed to the
+shadow_create function. This function should return NULL on failure.
+
+    PixmapPtr
+    crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data,
+				int width, int height)
+
+This function creates a pixmap object that will be used as a shadow of the
+main frame buffer for CRTCs which are rotated or reflected. 'data' is the
+value returned by shadow_allocate.
+
+    void
+    crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap,
+				 void *data)
+
+Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap
+was not created, but 'data' may still be non-NULL indicating that the shadow
+had been allocated.
+
+    void
+    crtc->funcs->destroy (xf86CrtcPtr crtc)
+
+When a CRTC is destroyed (which only happens in error cases), this function
+can clean up any driver-specific data.
+
+4.2 CRTC fields
+
+The CRTC object is not opaque; there are several fields of interest to the
+driver writer.
+
+    struct _xf86Crtc {
+	/**
+	 * Associated ScrnInfo
+	 */
+	ScrnInfoPtr     scrn;
+    
+	/**
+	 * Active state of this CRTC
+	 *
+	 * Set when this CRTC is driving one or more outputs
+	 */
+	Bool            enabled;
+    
+	/** Track whether cursor is within CRTC range  */
+	Bool            cursorInRange;
+    
+	/** Track state of cursor associated with this CRTC */
+	Bool            cursorShown;
+    
+	/**
+	 * Active mode
+	 *
+	 * This reflects the mode as set in the CRTC currently
+	 * It will be cleared when the VT is not active or
+	 * during server startup
+	 */
+	DisplayModeRec  mode;
+	Rotation        rotation;
+	PixmapPtr       rotatedPixmap;
+	void            *rotatedData;
+    
+	/**
+	 * Position on screen
+	 *
+	 * Locates this CRTC within the frame buffer
+	 */
+	int             x, y;
+    
+	/**
+	 * Desired mode
+	 *
+	 * This is set to the requested mode, independent of
+	 * whether the VT is active. In particular, it receives
+	 * the startup configured mode and saves the active mode
+	 * on VT switch.
+	 */
+	DisplayModeRec  desiredMode;
+	Rotation        desiredRotation;
+	int             desiredX, desiredY;
+    
+	/** crtc-specific functions */
+	const xf86CrtcFuncsRec *funcs;
+    
+	/**
+	 * Driver private
+	 *
+	 * Holds driver-private information
+	 */
+	void            *driver_private;
+    #ifdef RANDR_12_INTERFACE
+	/**
+	 * RandR crtc
+	 *
+	 * When RandR 1.2 is available, this
+	 * points at the associated crtc object
+	 */
+	RRCrtcPtr       randr_crtc;
+    #else
+	void            *randr_crtc;
+    #endif
+    };
+
+    
+5. Output functions.
+
+6. Configuration
+
+Because the configuration file syntax is fixed,
+this was done by creating new "Driver" section options that hook specific
+outputs to specific "Monitor" sections in the file. The option:
+section of the form:
+
+	Option	"monitor-VGA" "My VGA Monitor"
+
+connects the VGA output of this driver to the "Monitor" section with
+Identifier "My VGA Monitor". All of the usual monitor options can now be
+placed in that "Monitor" section and will be applied to the VGA output
+configuration.
diff --git a/xorg-server/hw/xfree86/doc/Registry b/xorg-server/hw/xfree86/doc/Registry
index 89a5f10fa..48e24a2f4 100644
--- a/xorg-server/hw/xfree86/doc/Registry
+++ b/xorg-server/hw/xfree86/doc/Registry
@@ -1,409 +1,409 @@
-This is the XFree86 driver/module registry.  To avoid name space clashes and
-to maintain some consistency between drivers the important name spaces are
-maintained here.
-
-1. Module Names.
-
-Each module is required to have a unique name.  Registered names are:
-
-GLcore
-acecad
-afb
-apm
-ark
-ati
-atimisc
-bitmap
-bt8xx
-calcomp
-cfb
-cfb16
-cfb24
-cfb32
-chips
-cirrus
-citron
-cyrix
-dbe
-ddc
-digitaledge
-dmc
-dri
-drm
-dynapro
-elo2300
-elographics
-extmod
-fb
-fbdev
-fbdevhw
-fi12x6
-freetype
-glide
-glint
-glx
-hyperpen
-i128
-i2c
-i740
-i810
-imstt
-int10
-joystick
-keyboard
-layer
-magellan
-magictouch
-mfb
-mga
-microtouch
-mouse
-msp34xx
-mutouch
-neomagic
-newport
-nv
-pcidata
-penmount
-pex5
-r128
-radeon
-rac
-ramdac
-record
-rendition
-s3
-s3virge
-savage
-shadow
-shadowfb
-siliconmotion
-sis
-spaceorb
-speedo
-summa
-sunbw2
-suncg14
-suncg3
-suncg6
-sunffb
-sunleo
-suntcx
-tdfx
-tga
-trident
-tseng
-type1
-v4l
-vbe
-vesa
-vga
-vgahw
-vmware
-void
-wacom
-xaa
-xf1bpp
-xf24_32bpp
-xf4bpp
-xf8_16bpp
-xf8_32bpp
-xf8_32wid
-xie
-xtrap
-xtt
-
-2. External Module Object Symbols.
-
-Each module is required to use a unique prefix or prefixes for all of
-its externally visible symbols. They should be unique without regard to
-case.  Registered prefixes are:
-
-ati
-bt8xx
-cfb
-chips
-fi12x6
-glide
-glint
-mfb
-mga
-msp34xx
-neo
-permedia
-tseng
-vga
-vgahw
-vmware
-xaa
-xf1bpp
-xf4bpp
-
-3. Chipset Names.
-
-Each video driver is required to use a unique set of chipset names.  Case,
-white space and underscore characters are ignored when comparing chipset
-names.  All names listed here are in lower case with all white space and
-underscores removed.  Registered chipset names are:
-
-ati
-ativga
-ct64200
-ct64300
-ct65520
-ct65525
-ct65530
-ct65535
-ct65540
-ct65545
-ct65546
-ct65548
-ct65550
-ct65554
-ct65555
-ct68554
-ct69000
-et4000
-et4000w32
-et4000w32i
-et4000w32p
-et6000
-et6100
-generic
-ibmvga
-ibm8514
-mach32
-mach64
-mach8
-mga2064w
-mga1064sg
-mga2164w
-mga2164wagp
-neo2070
-neo2090
-neo2093
-neo2097
-neo2160
-neo2200
-tipm2
-vgawonder
-voodoo
-
-4. Option Names.
-
-Option names and their usage should be consistent between drivers.
-Case, white space and underscore characters are ignored when comparing
-option names.  The prefix "no" may be added or removed from boolean
-option names.  All names listed here are in their preferred user-visible
-form.  Some registered option names are:
-
-Types are:  B = boolean, O = set/unset (no value), I = integer, S = string,
-            A = optional string, F = floating point number Q = frequency
-
-Scopes are: F = global flags, V = video driver, C = common (per screen),
-            I = input drivers, X = XAA, Xv = Xv extension, M = misc.
-
-Names currently in use:
-
-Name                    Type  Scope      Description
-----------------------------------------------------------------------------
-AllowMouseOpenFail        B     F    ignore mouse dev open failure
-AllowNonLocalModInDev     B     F    allow non-local mod of input devs
-AllowNonLocalXvidtune     B     F    allow non-local VidMode connections
-BlankTime                 I     F    Screen saver timeout (min)
-DisableModInDev           B     F    disallow changing input devs
-DisableVidModeExtension   B     F    disable VidMode extension
-DontVTSwitch              B     F    disable Ctrl-Alt-Fn
-DontZap                   B     F    disable Ctrl-Alt-BS sequence
-DontZoom                  B     F    disable Ctrl-Alt-+/-
-NoTrapSignals             B     F    don't trap signals
-OffTime                   I     F    Time before DPMS off mode active (min)
-PciProbe1                 O     F    use PCI probe algorithm 1
-PciProbe2                 O     F    use PCI probe algorithm 2
-PciForceConfig1           O     F    force PCI config type 1
-PciForceConfig2           O     F    force PCI config type 2
-Pixmap                    I     F    depth 24 pixmap size (24 or 32)
-StandbyTime               I     F    Time before DPMS standby active (min)
-SuspendTime               I     F    Time before DPMS suspend mode active (min)
-
-BackingStore              B     C    Enable backing store
-DDC                       B     C    Enable/disable DDC
-DDC1                      B     C    Enable/disable DDC1
-DDC2                      B     C    Enable/disable DDC2
-DPMS                      O     C    Enable DPMS
-MTRR                      B     C    Enable/disable setting MTRRs
-
-BaudRate                  I     I    Serial port baud rate
-ButtonNumber              I     I    Button number (for touch screen?)
-ButtonThreshold           I     I    ??
-ClearDTR                  O     I    Clear serial port DTR
-ClearRTS                  O     I    Clear serial port RTS
-DataBits                  I     I    Serial port data bits
-DemandLoad                O     I    ??
-Device                    S     I    Device file name
-DeviceName                S     I    Input device name
-FlowControl               S     I    Serial flow control ("xon", "none")
-Floating                  B     I    Device initialised as floating
-HistorySize               I     I    ??
-MaxX                      I     I    Maximum X coordinate
-MaxY                      I     I    Maximum Y coordinate
-MinX                      I     I    Minimum X coordinate
-MinY                      I     I    Minimum Y coordinate
-Parity                    S     I    Serial port parity ("odd", "even", "none")
-ReportDelay               I     I    ??
-ReportingMode             S     I    may be "raw" or "scaled"
-ScreenNumber              I     I    Screen number (for touch screen)
-SendCoreEvents            B     I    Send core events
-StopBits                  I     I    Serial port stop bits
-SwapXY                    B     I    Swap the X and Y axes
-UntouchDelay              I     I    ??
-Vmin                      I     I    Tty VMIN
-Vtime                     I     I    Tty VTIME
-
-
-18BitBus                  B     V    ??
-8Plus16                   B     V    Enable depth 8 + depth 16 with overlay
-8Plus24                   B     V    Enable depth 8 + depth 24 with overlay
-BlockWrite                B     V    Enable/disable block write
-ColorKey                  I     V    Set the color key for overlay modes
-CompositeSync             B     V    Composite sync
-CRTDisplay                B     V    Force display on CRT, not LCD
-CRTScreen                 B     V    Display on CRT, not LCD (Obsolete)
-EarlyRasPrecharge         O     V    Early RAS pre-charge
-FastDRAM                  O     V    Fast DRAM
-FifoAggressive            O     V    Aggressive FIFO setting
-FifoConservative          O     V    Conservative FIFO setting
-FifoModerate              O     V    Moderate FIFO setting
-FireGL3000                B     V    Card is Diamond FireGL3000
-FixPanelSize              B     V    ??
-FPClock8                  Q     V    Flat panel clock for 8bpp fb (MHz)
-FPClock16                 Q     V    Flat panel clock for 16bpp fb (MHz)
-FPClock24                 Q     V    Flat panel clock for 24bpp fb (MHz)
-FPClock32                 Q     V    Flat panel clock for 32bpp fb (MHz)
-FPMVRAM                   O     V    Fast page mode VRAM
-FramebufferWC             B     V    Enable/disable WC for the framebuffer
-GlideDevice               I     V    Selects which Voodoo board to use
-HiBitHigh                 O     V    High clock bit default to set
-HiBitLow                  O     V    High clock bit default to cleared
-HWClocks                  B     V    Enable/disable HW clocks
-HWCursor                  B     V    Enable/disable HW cursor
-LateRasPrecharge          O     V    Late RAS pre-charge
-Legend                    O     V    Card is Legend ET4000
-LCDCenter                 B     V    Enable/disable centering for LCD displays
-Linear                    B     V    Enable/disable linear framebuffer
-MCLK                      Q     V    Specify the current MCLK value (MHz)
-MedDRAM                   B     V    Medium speed DRAM
-MemCfg1                   I     V    ??
-MemCfg2                   I     V    ??
-MGASDRAM                  B     V    Mga card has SDRAM
-MMIO                      B     V    Enable/disable memory mapped I/O
-MMIOCache                 B     V    Enable/Disable MMIO cache
-MuxThreshold              I     V    Multiplexing threshold (kHz)
-NoAccel                   B     V    Disable/enable acceleration
-NoClockChip               B     V    ??
-NoStretch                 B     V    Disable/enable stretching for LCD displays
-OnAtExit                  B     V    Leave video signal on when exiting server
-OverclockMem              B     V    Enable memory overclocking
-Overlay                   A     V    Enable multi-depth/overlay.  An optional
-                                     string "M,N" may be specified, where
-                                     M, N are the depths.
-PanelDisplay              B     V    Force display on LCD
-PciBurst                  B     V    Enable/disable PCI burst mode
-PciRetry                  B     V    Enable/disable PCI retries
-ProbeClocks               B     V    Force probe for non-programmable clocks
-ReferenceClock            Q     V    Clock generator reference frequency
-RGBbits                   I     V    Number of significant bits per rgb
-Rotate                    S     V    Rotate the virtual display (CW or CCW)
-SetLCDClk                 Q     V    Set LCD clock (MHz)
-SetMclk                   Q     V    Set Memory Clock (MHz)
-ShadowFB                  B     V    Enable shadow framebuffer layer
-ShowCache                 B     V    Enable viewing of offscreen memory
-ShowOverscan              O     V    Set the overscan area to a visible colour
-SlowDRAM                  O     V    Slow DRAM
-SlowEDODRAM               O     V    Slow EDO DRAM
-STN                       B     V    STN screen type (??)
-SWCursor                  B     V    Enable/disable SW cursor
-SuspendHack               B     V    ??
-SyncOnGreen               B     V    Enable/disable sync on green
-TurboQueue                B     V    Enable/disable turbo queue
-UseFBDev                  B     V    Use the fbdev driver interface
-UseModeLine               B     V    Use Modeline (??)
-W32Interleave             B     V    ??
-
-Buffers			  I	Xv   Number of buffers
-Device			  S	Xv   Device file name
-Expose                    B     Xv   Disable occlusion clipping (see DESIGN)
-FramesPerSec		  I	Xv   Max. refresh frequency
-
-XAA options.  All are of type "O" and scope "X", and are self-explanatory
-
-XaaNoColor8x8PatternFillRect
-XaaNoColor8x8PatternFillTrap
-XaaNoCPUToScreenColorExpandFill
-XaaNoDashedBresenhamLine
-XaaNoDashedTwoPointLine
-XaaNoScreenToScreenCopy
-XaaNoImageReadRect
-XaaNoImageWriteRect
-XaaNoMono8x8PatternFillRect
-XaaNoMono8x8PatternFillTrap
-XaaNoOffscreenPixmaps
-XaaNoPixmapCache
-XaaNoScanlineCPUToScreenColorExpandFill
-XaaNoScanlineImageWriteRect
-XaaNoScreenToScreenColorExpandFill
-XaaNoSolidBresenhamLine
-XaaNoSolidFillRect
-XaaNoSolidFillTrap
-XaaNoSolidHorVertLine
-XaaNoSolidTwoPointLine
-
-
-Names used in previous versions:
-
-16Clocks
-8Clocks
-ClkDiv2
-EDO VRAM
-ExternDisp
-ExtFramBuf
-FastVRAM
-FavorBitBlt
-InternDisp
-NoBitBlt
-NoFontCache
-NoImageBlt
-NoMemAccess
-NoPciDisconnect
-NoPixmapCache
-NoProgramClocks
-NoSplitXfer
-OverrideBIOS
-OverrideValidateMode
-ProgLcdModeRegs
-ProgLcdModeStretch
-SlowDRAMrefresh
-SlowVRAM
-SwapHiBit
-
-
-5. Ramdac Names.
-
-Ramdac names should be consistent between drivers.  Case, white space
-and underscore characters are ignored when comparing ramdac names.  All
-names listed here are in lower case with all white space and underscores
-removed.
-
-
-6. Clock Chip Names.
-
-Clock chip names should be consistent between drivers.  Case, white
-space and underscore characters are ignored when comparing clock chip
-names.  All names listed here are in lower case with all white space
-and underscores removed.
-
-
-
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $
+This is the XFree86 driver/module registry.  To avoid name space clashes and
+to maintain some consistency between drivers the important name spaces are
+maintained here.
+
+1. Module Names.
+
+Each module is required to have a unique name.  Registered names are:
+
+GLcore
+acecad
+afb
+apm
+ark
+ati
+atimisc
+bitmap
+bt8xx
+calcomp
+cfb
+cfb16
+cfb24
+cfb32
+chips
+cirrus
+citron
+cyrix
+dbe
+ddc
+digitaledge
+dmc
+dri
+drm
+dynapro
+elo2300
+elographics
+extmod
+fb
+fbdev
+fbdevhw
+fi12x6
+freetype
+glide
+glint
+glx
+hyperpen
+i128
+i2c
+i740
+i810
+imstt
+int10
+joystick
+keyboard
+layer
+magellan
+magictouch
+mfb
+mga
+microtouch
+mouse
+msp34xx
+mutouch
+neomagic
+newport
+nv
+pcidata
+penmount
+pex5
+r128
+radeon
+rac
+ramdac
+record
+rendition
+s3
+s3virge
+savage
+shadow
+shadowfb
+siliconmotion
+sis
+spaceorb
+speedo
+summa
+sunbw2
+suncg14
+suncg3
+suncg6
+sunffb
+sunleo
+suntcx
+tdfx
+tga
+trident
+tseng
+type1
+v4l
+vbe
+vesa
+vga
+vgahw
+vmware
+void
+wacom
+xaa
+xf1bpp
+xf24_32bpp
+xf4bpp
+xf8_16bpp
+xf8_32bpp
+xf8_32wid
+xie
+xtrap
+xtt
+
+2. External Module Object Symbols.
+
+Each module is required to use a unique prefix or prefixes for all of
+its externally visible symbols. They should be unique without regard to
+case.  Registered prefixes are:
+
+ati
+bt8xx
+cfb
+chips
+fi12x6
+glide
+glint
+mfb
+mga
+msp34xx
+neo
+permedia
+tseng
+vga
+vgahw
+vmware
+xaa
+xf1bpp
+xf4bpp
+
+3. Chipset Names.
+
+Each video driver is required to use a unique set of chipset names.  Case,
+white space and underscore characters are ignored when comparing chipset
+names.  All names listed here are in lower case with all white space and
+underscores removed.  Registered chipset names are:
+
+ati
+ativga
+ct64200
+ct64300
+ct65520
+ct65525
+ct65530
+ct65535
+ct65540
+ct65545
+ct65546
+ct65548
+ct65550
+ct65554
+ct65555
+ct68554
+ct69000
+et4000
+et4000w32
+et4000w32i
+et4000w32p
+et6000
+et6100
+generic
+ibmvga
+ibm8514
+mach32
+mach64
+mach8
+mga2064w
+mga1064sg
+mga2164w
+mga2164wagp
+neo2070
+neo2090
+neo2093
+neo2097
+neo2160
+neo2200
+tipm2
+vgawonder
+voodoo
+
+4. Option Names.
+
+Option names and their usage should be consistent between drivers.
+Case, white space and underscore characters are ignored when comparing
+option names.  The prefix "no" may be added or removed from boolean
+option names.  All names listed here are in their preferred user-visible
+form.  Some registered option names are:
+
+Types are:  B = boolean, O = set/unset (no value), I = integer, S = string,
+            A = optional string, F = floating point number Q = frequency
+
+Scopes are: F = global flags, V = video driver, C = common (per screen),
+            I = input drivers, X = XAA, Xv = Xv extension, M = misc.
+
+Names currently in use:
+
+Name                    Type  Scope      Description
+----------------------------------------------------------------------------
+AllowMouseOpenFail        B     F    ignore mouse dev open failure
+AllowNonLocalModInDev     B     F    allow non-local mod of input devs
+AllowNonLocalXvidtune     B     F    allow non-local VidMode connections
+BlankTime                 I     F    Screen saver timeout (min)
+DisableModInDev           B     F    disallow changing input devs
+DisableVidModeExtension   B     F    disable VidMode extension
+DontVTSwitch              B     F    disable Ctrl-Alt-Fn
+DontZap                   B     F    disable Ctrl-Alt-BS sequence
+DontZoom                  B     F    disable Ctrl-Alt-+/-
+NoTrapSignals             B     F    don't trap signals
+OffTime                   I     F    Time before DPMS off mode active (min)
+PciProbe1                 O     F    use PCI probe algorithm 1
+PciProbe2                 O     F    use PCI probe algorithm 2
+PciForceConfig1           O     F    force PCI config type 1
+PciForceConfig2           O     F    force PCI config type 2
+Pixmap                    I     F    depth 24 pixmap size (24 or 32)
+StandbyTime               I     F    Time before DPMS standby active (min)
+SuspendTime               I     F    Time before DPMS suspend mode active (min)
+
+BackingStore              B     C    Enable backing store
+DDC                       B     C    Enable/disable DDC
+DDC1                      B     C    Enable/disable DDC1
+DDC2                      B     C    Enable/disable DDC2
+DPMS                      O     C    Enable DPMS
+MTRR                      B     C    Enable/disable setting MTRRs
+
+BaudRate                  I     I    Serial port baud rate
+ButtonNumber              I     I    Button number (for touch screen?)
+ButtonThreshold           I     I    ??
+ClearDTR                  O     I    Clear serial port DTR
+ClearRTS                  O     I    Clear serial port RTS
+DataBits                  I     I    Serial port data bits
+DemandLoad                O     I    ??
+Device                    S     I    Device file name
+DeviceName                S     I    Input device name
+FlowControl               S     I    Serial flow control ("xon", "none")
+Floating                  B     I    Device initialised as floating
+HistorySize               I     I    ??
+MaxX                      I     I    Maximum X coordinate
+MaxY                      I     I    Maximum Y coordinate
+MinX                      I     I    Minimum X coordinate
+MinY                      I     I    Minimum Y coordinate
+Parity                    S     I    Serial port parity ("odd", "even", "none")
+ReportDelay               I     I    ??
+ReportingMode             S     I    may be "raw" or "scaled"
+ScreenNumber              I     I    Screen number (for touch screen)
+SendCoreEvents            B     I    Send core events
+StopBits                  I     I    Serial port stop bits
+SwapXY                    B     I    Swap the X and Y axes
+UntouchDelay              I     I    ??
+Vmin                      I     I    Tty VMIN
+Vtime                     I     I    Tty VTIME
+
+
+18BitBus                  B     V    ??
+8Plus16                   B     V    Enable depth 8 + depth 16 with overlay
+8Plus24                   B     V    Enable depth 8 + depth 24 with overlay
+BlockWrite                B     V    Enable/disable block write
+ColorKey                  I     V    Set the color key for overlay modes
+CompositeSync             B     V    Composite sync
+CRTDisplay                B     V    Force display on CRT, not LCD
+CRTScreen                 B     V    Display on CRT, not LCD (Obsolete)
+EarlyRasPrecharge         O     V    Early RAS pre-charge
+FastDRAM                  O     V    Fast DRAM
+FifoAggressive            O     V    Aggressive FIFO setting
+FifoConservative          O     V    Conservative FIFO setting
+FifoModerate              O     V    Moderate FIFO setting
+FireGL3000                B     V    Card is Diamond FireGL3000
+FixPanelSize              B     V    ??
+FPClock8                  Q     V    Flat panel clock for 8bpp fb (MHz)
+FPClock16                 Q     V    Flat panel clock for 16bpp fb (MHz)
+FPClock24                 Q     V    Flat panel clock for 24bpp fb (MHz)
+FPClock32                 Q     V    Flat panel clock for 32bpp fb (MHz)
+FPMVRAM                   O     V    Fast page mode VRAM
+FramebufferWC             B     V    Enable/disable WC for the framebuffer
+GlideDevice               I     V    Selects which Voodoo board to use
+HiBitHigh                 O     V    High clock bit default to set
+HiBitLow                  O     V    High clock bit default to cleared
+HWClocks                  B     V    Enable/disable HW clocks
+HWCursor                  B     V    Enable/disable HW cursor
+LateRasPrecharge          O     V    Late RAS pre-charge
+Legend                    O     V    Card is Legend ET4000
+LCDCenter                 B     V    Enable/disable centering for LCD displays
+Linear                    B     V    Enable/disable linear framebuffer
+MCLK                      Q     V    Specify the current MCLK value (MHz)
+MedDRAM                   B     V    Medium speed DRAM
+MemCfg1                   I     V    ??
+MemCfg2                   I     V    ??
+MGASDRAM                  B     V    Mga card has SDRAM
+MMIO                      B     V    Enable/disable memory mapped I/O
+MMIOCache                 B     V    Enable/Disable MMIO cache
+MuxThreshold              I     V    Multiplexing threshold (kHz)
+NoAccel                   B     V    Disable/enable acceleration
+NoClockChip               B     V    ??
+NoStretch                 B     V    Disable/enable stretching for LCD displays
+OnAtExit                  B     V    Leave video signal on when exiting server
+OverclockMem              B     V    Enable memory overclocking
+Overlay                   A     V    Enable multi-depth/overlay.  An optional
+                                     string "M,N" may be specified, where
+                                     M, N are the depths.
+PanelDisplay              B     V    Force display on LCD
+PciBurst                  B     V    Enable/disable PCI burst mode
+PciRetry                  B     V    Enable/disable PCI retries
+ProbeClocks               B     V    Force probe for non-programmable clocks
+ReferenceClock            Q     V    Clock generator reference frequency
+RGBbits                   I     V    Number of significant bits per rgb
+Rotate                    S     V    Rotate the virtual display (CW or CCW)
+SetLCDClk                 Q     V    Set LCD clock (MHz)
+SetMclk                   Q     V    Set Memory Clock (MHz)
+ShadowFB                  B     V    Enable shadow framebuffer layer
+ShowCache                 B     V    Enable viewing of offscreen memory
+ShowOverscan              O     V    Set the overscan area to a visible colour
+SlowDRAM                  O     V    Slow DRAM
+SlowEDODRAM               O     V    Slow EDO DRAM
+STN                       B     V    STN screen type (??)
+SWCursor                  B     V    Enable/disable SW cursor
+SuspendHack               B     V    ??
+SyncOnGreen               B     V    Enable/disable sync on green
+TurboQueue                B     V    Enable/disable turbo queue
+UseFBDev                  B     V    Use the fbdev driver interface
+UseModeLine               B     V    Use Modeline (??)
+W32Interleave             B     V    ??
+
+Buffers			  I	Xv   Number of buffers
+Device			  S	Xv   Device file name
+Expose                    B     Xv   Disable occlusion clipping (see DESIGN)
+FramesPerSec		  I	Xv   Max. refresh frequency
+
+XAA options.  All are of type "O" and scope "X", and are self-explanatory
+
+XaaNoColor8x8PatternFillRect
+XaaNoColor8x8PatternFillTrap
+XaaNoCPUToScreenColorExpandFill
+XaaNoDashedBresenhamLine
+XaaNoDashedTwoPointLine
+XaaNoScreenToScreenCopy
+XaaNoImageReadRect
+XaaNoImageWriteRect
+XaaNoMono8x8PatternFillRect
+XaaNoMono8x8PatternFillTrap
+XaaNoOffscreenPixmaps
+XaaNoPixmapCache
+XaaNoScanlineCPUToScreenColorExpandFill
+XaaNoScanlineImageWriteRect
+XaaNoScreenToScreenColorExpandFill
+XaaNoSolidBresenhamLine
+XaaNoSolidFillRect
+XaaNoSolidFillTrap
+XaaNoSolidHorVertLine
+XaaNoSolidTwoPointLine
+
+
+Names used in previous versions:
+
+16Clocks
+8Clocks
+ClkDiv2
+EDO VRAM
+ExternDisp
+ExtFramBuf
+FastVRAM
+FavorBitBlt
+InternDisp
+NoBitBlt
+NoFontCache
+NoImageBlt
+NoMemAccess
+NoPciDisconnect
+NoPixmapCache
+NoProgramClocks
+NoSplitXfer
+OverrideBIOS
+OverrideValidateMode
+ProgLcdModeRegs
+ProgLcdModeStretch
+SlowDRAMrefresh
+SlowVRAM
+SwapHiBit
+
+
+5. Ramdac Names.
+
+Ramdac names should be consistent between drivers.  Case, white space
+and underscore characters are ignored when comparing ramdac names.  All
+names listed here are in lower case with all white space and underscores
+removed.
+
+
+6. Clock Chip Names.
+
+Clock chip names should be consistent between drivers.  Case, white
+space and underscore characters are ignored when comparing clock chip
+names.  All names listed here are in lower case with all white space
+and underscores removed.
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $
diff --git a/xorg-server/hw/xfree86/doc/ddxDesign.xml b/xorg-server/hw/xfree86/doc/ddxDesign.xml
index a6b9da2d5..24b0c0324 100644
--- a/xorg-server/hw/xfree86/doc/ddxDesign.xml
+++ b/xorg-server/hw/xfree86/doc/ddxDesign.xml
@@ -1306,7 +1306,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    Bool ChipScreenInit(int index, ScreenPtr pScreen,
+    Bool ChipScreenInit(ScreenPtr pScreen,
                         int argc, char **argv);
 	  </programlisting>
 	  <blockquote><para>
@@ -1442,7 +1442,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    Bool ChipSwitchMode(int index, DisplayModePtr mode, int flags);
+    Bool ChipSwitchMode(int index, DisplayModePtr mode);
 	  </programlisting>
 	  <blockquote><para>
       Initialises the new mode for the screen identified by
@@ -1464,7 +1464,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    void ChipAdjustFrame(int index, int x, int y, int flags);
+    void ChipAdjustFrame(int index, int x, int y);
 	  </programlisting>
 	  <blockquote><para>
       Changes the viewport for the screen identified by
@@ -1572,7 +1572,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    Bool ChipEnterVT(int index, int flags);
+    Bool ChipEnterVT(ScrnInfoPtr pScrn);
 	  </programlisting>
 	  <blockquote><para>
       This function should initialise the current video mode and
@@ -1589,7 +1589,7 @@ Here is what <function>InitOutput()</function> does:
 
       <blockquote><para>
 	  <programlisting>
-    void ChipLeaveVT(int index, int flags);
+    void ChipLeaveVT(ScrnInfoPtr pScrn);
 	  </programlisting>
 	  <blockquote><para>
       This function should restore the saved video state.  If
@@ -1691,7 +1691,7 @@ but their presence is optional.
 
       <blockquote><para>
 	  <programlisting>
-    ModeStatus ChipValidMode(int index, DisplayModePtr mode,
+    ModeStatus ChipValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
                              Bool verbose, int flags);
 	  </programlisting>
 	  <blockquote><para>
@@ -1739,7 +1739,7 @@ MODECHECK_FINAL are intended for checks that may involve more than one mode.
 
       <blockquote><para>
 	  <programlisting>
-    void ChipFreeScreen(int scrnindex, int flags);
+    void ChipFreeScreen(ScrnInfoPtr pScrn);
 	  </programlisting>
 	  <blockquote><para>
       Free any driver-allocated data that may have been allocated up to
@@ -2824,12 +2824,12 @@ Several functions are provided to simplify resource registration:
 
 	  <blockquote><para>
 	      <programlisting>
-    Bool xf86IsScreenPrimary(int scrnIndex);
+    Bool xf86IsScreenPrimary(ScrnInfoPtr pScrn);
 	      </programlisting>
 	      <blockquote><para>
       This function returns <constant>TRUE</constant> if the primary entity
       is registered with the screen referenced by
-      <parameter>scrnIndex</parameter>.
+      <parameter>pScrn</parameter>.
 		</para>
 
 	      </blockquote></para></blockquote>
@@ -9033,7 +9033,7 @@ ZZZModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
 	<programlisting>
 static Bool
-ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ZZZScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
     /* Get the ScrnInfoRec */
     pScrn = xf86ScreenToScrn(pScreen);
@@ -9051,7 +9051,7 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
     /* Set the viewport if supported */
 
-    ZZZAdjustFrame(scrnIndex, pScrn-&gt;frameX0, pScrn-&gt;frameY0, 0);
+    ZZZAdjustFrame(pScrn, pScrn-&gt;frameX0, pScrn-&gt;frameY0);
 
     /*
      * Setup the screen's visuals, and initialise the framebuffer
@@ -9220,9 +9220,9 @@ ZZZScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
 	<programlisting>
 static Bool
-ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+ZZZSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
-    return ZZZModeInit(xf86Screens[scrnIndex], mode);
+    return ZZZModeInit(pScrn, mode);
 }
 	</programlisting>
       </sect3>
@@ -9237,7 +9237,7 @@ ZZZSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 
 	<programlisting>
 static void
-ZZZAdjustFrame(int scrnIndex, int x, int y, int flags)
+ZZZAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
     /* Adjust the viewport */
 }
@@ -9258,16 +9258,14 @@ ZZZAdjustFrame(int scrnIndex, int x, int y, int flags)
 
 	<programlisting>
 static Bool
-ZZZEnterVT(int scrnIndex, int flags)
+ZZZEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     return ZZZModeInit(pScrn, pScrn-&gt;currentMode);
 }
 
 static void
-ZZZLeaveVT(int scrnIndex, int flags)
+ZZZLeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     ZZZRestore(pScrn);
 }
 	</programlisting>
@@ -9288,16 +9286,16 @@ ZZZLeaveVT(int scrnIndex, int flags)
 
 	<programlisting>
 static Bool
-ZZZCloseScreen(int scrnIndex, ScreenPtr pScreen)
+ZZZCloseScreen(ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     if (pScrn-&gt;vtSema) {
         ZZZRestore(pScrn);
         ZZZUnmapMem(pScrn);
     }
     pScrn-&gt;vtSema = FALSE;
     pScreen-&gt;CloseScreen = ZZZPTR(pScrn)-&gt;CloseScreen;
-    return (*pScreen-&gt;CloseScreen)(scrnIndex, pScreen);
+    return (*pScreen-&gt;CloseScreen)(pScreen);
 }
 	</programlisting>
       </sect3>
@@ -9342,13 +9340,13 @@ ZZZSaveScreen(ScreenPtr pScreen, int mode)
 
 	<programlisting>
 static void
-ZZZFreeScreen(int scrnIndex, int flags)
+ZZZFreeScreen(ScrnInfoPtr pScrn)
 {
     /*
      * If the vgahw module is used vgaHWFreeHWRec() would be called
      * here.
      */
-    ZZZFreeRec(xf86Screens[scrnIndex]);
+    ZZZFreeRec(pScrn);
 }
 
 	</programlisting>
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index 20eb683ad..46a9ae457 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -1618,7 +1618,7 @@ DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask)
         DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
         if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.WakeupHandler)
-            (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (i, wakeupData,
+            (*pDRIPriv->pDriverInfo->wrap.WakeupHandler) (pScreen,
                                                           result, pReadmask);
     }
 }
@@ -1633,16 +1633,15 @@ DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
         DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
         if (pDRIPriv && pDRIPriv->pDriverInfo->wrap.BlockHandler)
-            (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (i, blockData,
+            (*pDRIPriv->pDriverInfo->wrap.BlockHandler) (pScreen,
                                                          pTimeout, pReadmask);
     }
 }
 
 void
-DRIDoWakeupHandler(int screenNum, pointer wakeupData,
+DRIDoWakeupHandler(ScreenPtr pScreen,
                    unsigned long result, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     DRILock(pScreen, 0);
@@ -1658,10 +1657,9 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData,
 }
 
 void
-DRIDoBlockHandler(int screenNum, pointer blockData,
+DRIDoBlockHandler(ScreenPtr pScreen,
                   pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     if (pDRIPriv->pDriverInfo->driverSwapMethod == DRI_HIDE_X_CONTEXT) {
@@ -2307,15 +2305,14 @@ _DRIAdjustFrame(ScrnInfoPtr pScrn, DRIScreenPrivPtr pDRIPriv, int x, int y)
 }
 
 void
-DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
+DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScreenPtr pScreen = screenInfo.screens[scrnIndex];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
-    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     int px, py;
 
     if (!pDRIPriv || !pDRIPriv->pSAREA) {
-        DRIDrvMsg(scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
+        DRIDrvMsg(pScrn->scrnIndex, X_ERROR, "[DRI] No SAREA (%p %p)\n",
                   pDRIPriv, pDRIPriv ? pDRIPriv->pSAREA : NULL);
         return;
     }
@@ -2347,7 +2344,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
         /* unwrap */
         pScrn->AdjustFrame = pDRIPriv->wrap.AdjustFrame;
         /* call lower layers */
-        (*pScrn->AdjustFrame) (scrnIndex, x, y, flags);
+        (*pScrn->AdjustFrame) (pScrn, x, y);
         /* rewrap */
         pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame;
         pScrn->AdjustFrame = DRIAdjustFrame;
diff --git a/xorg-server/hw/xfree86/dri/dri.h b/xorg-server/hw/xfree86/dri/dri.h
index 53458bb4a..0a4036c35 100644
--- a/xorg-server/hw/xfree86/dri/dri.h
+++ b/xorg-server/hw/xfree86/dri/dri.h
@@ -73,7 +73,7 @@ typedef int DRIWindowRequests;
 #define DRI_ALL_WINDOWS      2
 
 typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
-typedef void (*AdjustFramePtr) (int scrnIndex, int x, int y, int flags);
+typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y);
 
 /*
  * These functions can be wrapped by the DRI.  Each of these have
@@ -271,13 +271,11 @@ extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData,
 extern _X_EXPORT void DRIBlockHandler(pointer blockData,
                                       OSTimePtr pTimeout, pointer pReadmask);
 
-extern _X_EXPORT void DRIDoWakeupHandler(int screenNum,
-                                         pointer wakeupData,
+extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen,
                                          unsigned long result,
                                          pointer pReadmask);
 
-extern _X_EXPORT void DRIDoBlockHandler(int screenNum,
-                                        pointer blockData,
+extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen,
                                         pointer pTimeout, pointer pReadmask);
 
 extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx);
@@ -334,7 +332,7 @@ extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
 extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
                                       int *minorVersion, int *patchVersion);
 
-extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
+extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
 
 extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
                                            int dx,
diff --git a/xorg-server/hw/xfree86/exa/examodule.c b/xorg-server/hw/xfree86/exa/examodule.c
index 50924587d..4e809ea37 100644
--- a/xorg-server/hw/xfree86/exa/examodule.c
+++ b/xorg-server/hw/xfree86/exa/examodule.c
@@ -38,7 +38,7 @@
 
 typedef struct _ExaXorgScreenPrivRec {
     CloseScreenProcPtr SavedCloseScreen;
-    EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
+    xf86EnableDisableFBAccessProc *SavedEnableDisableFBAccess;
     OptionInfoPtr options;
 } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
 
@@ -70,7 +70,7 @@ static const OptionInfoRec EXAOptions[] = {
 };
 
 static Bool
-exaXorgCloseScreen(int i, ScreenPtr pScreen)
+exaXorgCloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
@@ -83,24 +83,24 @@ exaXorgCloseScreen(int i, ScreenPtr pScreen)
     free(pScreenPriv->options);
     free(pScreenPriv);
 
-    return pScreen->CloseScreen(i, pScreen);
+    return pScreen->CloseScreen(pScreen);
 }
 
 static void
-exaXorgEnableDisableFBAccess(int index, Bool enable)
+exaXorgEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
         dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
 
     if (!enable)
-        exaEnableDisableFBAccess(index, enable);
+        exaEnableDisableFBAccess(pScreen, enable);
 
     if (pScreenPriv->SavedEnableDisableFBAccess)
-        pScreenPriv->SavedEnableDisableFBAccess(index, enable);
+        pScreenPriv->SavedEnableDisableFBAccess(pScrn, enable);
 
     if (enable)
-        exaEnableDisableFBAccess(index, enable);
+        exaEnableDisableFBAccess(pScreen, enable);
 }
 
 /**
diff --git a/xorg-server/hw/xfree86/fbdevhw/README b/xorg-server/hw/xfree86/fbdevhw/README
index 27cc337d4..65ca06033 100644
--- a/xorg-server/hw/xfree86/fbdevhw/README
+++ b/xorg-server/hw/xfree86/fbdevhw/README
@@ -1,16 +1,16 @@
-
-This is a submodule to access linux framebuffer devices.
-It is supported to work as helper module (like vgahw)
-for the chipset drivers.  There are functions for
-saving/restoring/setting video modes, set palette entries,
-and a few more helper functions.  Some of them can be
-hooked directly into ScrnInfoRec.
-
-In ../drivers/fbdev is a "chipset" driver.  It is a simple,
-non-accelerated and hardware-independent driver which works
-on top of this fbdevhw submodule.
-
-  Gerd
-
---
-Gerd Knorr <kraxel@goldbach.in-berlin.de>
+
+This is a submodule to access linux framebuffer devices.
+It is supported to work as helper module (like vgahw)
+for the chipset drivers.  There are functions for
+saving/restoring/setting video modes, set palette entries,
+and a few more helper functions.  Some of them can be
+hooked directly into ScrnInfoRec.
+
+In ../drivers/fbdev is a "chipset" driver.  It is a simple,
+non-accelerated and hardware-independent driver which works
+on top of this fbdevhw submodule.
+
+  Gerd
+
+--
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
index 0444d481c..d4b5558a7 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.c
@@ -775,10 +775,8 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 /* these can be hooked directly into ScrnInfoRec                        */
 
 ModeStatus
-fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!fbdevHWSetMode(pScrn, mode, TRUE))
         return MODE_BAD;
 
@@ -786,10 +784,8 @@ fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 }
 
 Bool
-fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!fbdevHWSetMode(pScrn, mode, FALSE))
         return FALSE;
 
@@ -797,9 +793,8 @@ fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
 }
 
 void
-fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
 
     if (x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
@@ -809,26 +804,22 @@ fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
     fPtr->var.xoffset = x;
     fPtr->var.yoffset = y;
     if (-1 == ioctl(fPtr->fd, FBIOPAN_DISPLAY, (void *) &fPtr->var))
-        xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
+        xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 5,
                        "FBIOPAN_DISPLAY: %s\n", strerror(errno));
 }
 
 Bool
-fbdevHWEnterVT(int scrnIndex, int flags)
+fbdevHWEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
         return FALSE;
-    fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+    fbdevHWAdjustFrame(pScrn, pScrn->frameX0, pScrn->frameY0);
     return TRUE;
 }
 
 void
-fbdevHWLeaveVT(int scrnIndex, int flags)
+fbdevHWLeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     fbdevHWRestore(pScrn);
 }
 
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
index 536987101..4984ccf89 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhw.h
@@ -44,14 +44,12 @@ extern _X_EXPORT void fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors,
                                          int *indices, LOCO * colors,
                                          VisualPtr pVisual);
 
-extern _X_EXPORT ModeStatus fbdevHWValidMode(int scrnIndex, DisplayModePtr mode,
+extern _X_EXPORT ModeStatus fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode,
                                              Bool verbose, int flags);
-extern _X_EXPORT Bool fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode,
-                                        int flags);
-extern _X_EXPORT void fbdevHWAdjustFrame(int scrnIndex, int x, int y,
-                                         int flags);
-extern _X_EXPORT Bool fbdevHWEnterVT(int scrnIndex, int flags);
-extern _X_EXPORT void fbdevHWLeaveVT(int scrnIndex, int flags);
+extern _X_EXPORT Bool fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+extern _X_EXPORT void fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
+extern _X_EXPORT Bool fbdevHWEnterVT(ScrnInfoPtr pScrn);
+extern _X_EXPORT void fbdevHWLeaveVT(ScrnInfoPtr pScrn);
 extern _X_EXPORT void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags);
 
 extern _X_EXPORT Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode);
diff --git a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
index 6e0a470b8..b7b4d2e7d 100644
--- a/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
+++ b/xorg-server/hw/xfree86/fbdevhw/fbdevhwstub.c
@@ -131,30 +131,30 @@ fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 }
 
 ModeStatus
-fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+fbdevHWValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
 {
     return MODE_ERROR;
 }
 
 Bool
-fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+fbdevHWSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
     return FALSE;
 }
 
 void
-fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
+fbdevHWAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int flags)
 {
 }
 
 Bool
-fbdevHWEnterVT(int scrnIndex, int flags)
+fbdevHWEnterVT(ScrnInfoPtr pScrn)
 {
     return FALSE;
 }
 
 void
-fbdevHWLeaveVT(int scrnIndex, int flags)
+fbdevHWLeaveVT(ScrnInfoPtr pScrn)
 {
 }
 
diff --git a/xorg-server/hw/xfree86/i2c/i2c_def.h b/xorg-server/hw/xfree86/i2c/i2c_def.h
index 140a071d6..e6a4e039e 100644
--- a/xorg-server/hw/xfree86/i2c/i2c_def.h
+++ b/xorg-server/hw/xfree86/i2c/i2c_def.h
@@ -1,6 +1,6 @@
-#ifndef __I2C_DEF_H__
-#define __I2C_DEF_H__
-
-#include "xf86i2c.h"
-
-#endif
+#ifndef __I2C_DEF_H__
+#define __I2C_DEF_H__
+
+#include "xf86i2c.h"
+
+#endif
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.c b/xorg-server/hw/xfree86/i2c/xf86i2c.c
index 1273f4bab..2d261d4ce 100644
--- a/xorg-server/hw/xfree86/i2c/xf86i2c.c
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.c
@@ -709,6 +709,7 @@ xf86CreateI2CBusRec(void)
 
     if (b != NULL) {
         b->scrnIndex = -1;
+        b->pScrn = NULL;
         b->HoldTime = 5;        /* 100 kHz bus */
         b->BitTimeout = 5;
         b->ByteTimeout = 5;
diff --git a/xorg-server/hw/xfree86/i2c/xf86i2c.h b/xorg-server/hw/xfree86/i2c/xf86i2c.h
index 9a8fb21a3..e296d7d81 100644
--- a/xorg-server/hw/xfree86/i2c/xf86i2c.h
+++ b/xorg-server/hw/xfree86/i2c/xf86i2c.h
@@ -6,6 +6,7 @@
 #define _XF86I2C_H
 
 #include "regionstr.h"
+#include "xf86.h"
 
 typedef unsigned char I2CByte;
 typedef unsigned short I2CSlaveAddr;
@@ -18,6 +19,7 @@ typedef struct _I2CDevRec *I2CDevPtr;
 typedef struct _I2CBusRec {
     char *BusName;
     int scrnIndex;
+    ScrnInfoPtr pScrn;
 
     void (*I2CUDelay) (I2CBusPtr b, int usec);
 
diff --git a/xorg-server/hw/xfree86/int10/INT10.HOWTO b/xorg-server/hw/xfree86/int10/INT10.HOWTO
index e2154c1c3..f2f08ceec 100644
--- a/xorg-server/hw/xfree86/int10/INT10.HOWTO
+++ b/xorg-server/hw/xfree86/int10/INT10.HOWTO
@@ -1,344 +1,344 @@
-
-                 INT10  X86 Real Mode executor
-                 =============================
-
-		         PRELIMINARY
-
-INT10 is  a XFree86  module for soft-booting  and executing  real mode
-int10 BIOS calls. The BIOS call code is largely untested, yet.
-
-1. Usage
-========
-
-To   use   the   int10   module   in  a   driver   the   header   file
-xfree86/os-support/int10/xf86int10.h must be included.
-
- a. Initialization
- -----------------
-
-The int10-executer gets initialized by calling:
-
-   xf86Int10InfoPtr xf86InitInt10(int entityIndex);
-
-The  function  will soft-boot  any  non-primary  device  and return  a
-pointer  to a  xf86Int10InfoRec on  success. If  anything fails  or if
-int10 execution  is disabled by an  option in the  device section NULL
-will  be returned.   The driver  should store  this pointer  for later
-calls to other int10 module functions.
-
- b. Memory allocation
- --------------------
-
-To allocate memory in the real mode execution environment
-    
-   void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
-
-can  be called.  It  allocates num  consecutive  pagesize chunks.   It
-returns the address of the allocated area. off is set to its offset in
-the real mode memory space.
-
-  void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
-
-Is used to free num pages beginning at pbase.
-
- c. Doing int10 BIOS calls
- -------------------------
-
-The BIOS call is executed by calling:
-   
-   void xf86ExecX86int10(xf86Int10InfoPtr pInt);
-
-The number  of the interrupt (normally  10) and the  initial values of
-the ax, bx, cx, dx, si, di  and es x86-CPU registers can be set in the
-xf86Int10InfoRec  passed to  the function.   On return  this structure
-contains the  exit values  of the registers  listed above and  the CPU
-flag register.
-
- d. De-initializing
- -----------------
-
-If no further int10 calls are required for a certain chipset
-the driver should call:
-
-  void xf86FreeInt10(xf86Int10InfoPtr pInt);
-
-to free the memory allocated for real mode int10 calls.
-
-
-2. Porting issues
-=================
-
-The int10 real mode executor is  designed to run on top of various x86
-CPU emulators as well as in vm86  mode of a real x86 CPU. If used with
-a CPU  emulator the emulator and  CPU specific interfaces  can be held
-separate thus  requiring minimal efforts  to port the int10  module to
-new  platforms.   Currently  an  interface  to the  x86emu  real  mode
-emulator is  provided.  Since  details of setting  up and  running the
-vm86  mode   is  platform   dependent  both  the   platform  dependent
-environment and the emulation layer  have to be ported. Several helper
-functions are provided for that.
-
-A CPU emulator should meet certain requirements to be usable
-for the INT10 executor:
-
-1. It must trap  calls to intXX instructions and  pass execution to an
-   external  function  which  is   allowed  to  modify  CPU  registers
-   including  the instruction  pointer  (IP) before  returning to  the
-   emulator for  continuing execution.  When the external  function is
-   called the  IP must point to  the instruction past  the intXX call.
-
-2. The  emulator should  use externally  provided functions  to handle
-   PIO.
-
-3.  The emulator  should be able to use  externally provided functions
- to access memory  from the real mode memory  environment.  Note, that
- the  vm86  mode  usually  requires  one hunk  of  consecutive  memory
- starting at address  0 in the process virtual  memory space.  Thus if
- this mode is to be used, the OS environment has to be able to provide
- that, ie. it must be able to remap the processes virtual memory space
- onto itself.  If the  emulator is able  to handle memory  access thru
- externally  provided functions the  real mode  process memory  can be
- located anywhere  in the processes  virtual memory. It does  not even
- have to be consecutive.
-
-4. The executor should terminate on encountering a 'hlt' instruction.
-
-
-Functions to implement:
-
-To simplify development  the code has been split  into a general setup
-part and an emulator specific one. A generic setup code is provided in
-generic.c.  It  should be  usable  with  any  emulator satisfying  the
-conditions mentioned  above. Therefore the following  section on int10
-setup may be skipped when porting int10 to new emulator.
-
-If the  vm86() is to be used  no memory access functions  can be used.
-Therefore the layout of the real mode memory image has to meet certain
-requirements. Therefore  when porting to  other platforms a  new setup
-code may  have to  be designed, too.  The following section  will give
-guidelines how  this may be  done. A sample implementation  using SysV
-IPC to  map the  appropriate real  mode memory image  to address  0 in
-virtual  address  space  just  prior  to execution  may  be  found  in
-xfree86/os-support/linux/int10/linux.c.
-
-On  non-PC like  platforms emulation  of certain  PC features  such as
-initialization of  BIOS int vectors, sys_BIOS constants  or PCI config
-method 1 can be turned on by defining _PC.
-
-I. Setup Code
--------------
-
-This sets  up the real mode  memory image, calls the  emulator to POST
-the chipset if required and  maintains memory allocations in real mode
-address space.
-
-1. xf86Int10InfoPtr xf86InitInt10(int entityIndex);
-
-This  function should  first find  the screen  assigned to  the entity
-carrying entitiyIndex and then call
-
-       Bool int10skip(ScrnInfoPtr pScrn)
-
-to find out if the user  has requested not to initialize int10.  If so
-xf86InitInt10()  should  return  NULL. Otherwise  an  xf86Int10InfoRec
-should be allocated.  This structure contains the following fields:
-
-    a. int entityIndex   - index of the entity whose BIOS is to be 
-                           executed.
-    b. int scrnIndex     - index of the screen assigned the entity.
-    c. pointer cpuRegs   - pointer to a emulator/vm86-mode private 
-                           structure.  May hold cpu register values 
-                           for the emulator.
-    d. CARD16 BIOSseg    - Video BIOS segment address.
-    e. pointer private   - pointer to a os specific data structure.
-    f. struct _int10Mem* - pointer to a structure to hold the memory
-                           access functions for use by an emulator.
-    g. int num           - number of the int to be called.
-    h. int ax..es,flags  - CPU register values to pass to int-call.
-
-The Init  function should initialize  a-f. To initialize  the emulator
-specific execute environment the function
-
-     Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-
-should be called. If this function returns FALSE any already allocated
-memory should be freed and xf86Int10Init(0 should exit returning NULL.
-
-If the  platform has  a PC  like system BIOS  it may  be copied  to or
-mapped into memory  locations SYS_BIOS to SYS_SIZE-1 of  the real mode
-memory environment of this process. Otherwise the helper function: 
-
-int setup_system_bios(CARD32 base_addr); 
-
-may be  called to set  up a rudimentary  system BIOS sufficient  to be
-used to  boot video BIOSes.   base_addr specifies the  virtual address
-corresponding to SYS_BIOS in the  real mode environment.  If a PC-like
-int vector and BIOS data area is available it should be copied to 0 to
-LOW_PAGE_SIZE of the entities real mode environment.  In this case the
-video interrupt  related entries should  be reset for  all non-primary
-cards by calling:
-
-void reset_int_vect(xf86Int10InfoPtr pInt); To initialize the
-
-correct video BIOS  entry points the BIOS must  be warm-booted.  If no
-PC-like int vector is available one can be set up by calling 
-
-void setup_int_vect(xf86Int10InfoPtr pInt); 
-
-In this  case the  video BIOS  has to be  warm-booted always.   If the
-video BIOS  for this entity has  been installed during boot  it may be
-mapped (or  copied) directly to the  correct address in  the real mode
-memory environment.  Otherwise
-
-int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address); 
-
-should  be called  to copy  the BIOS  image from  PCI  ROM.  'address'
-specifies the address this image should be copied to. Sufficient space
-to  hold an entire  BIOS image  should be  allocated prior  to calling
-mapPciRom(). This function  will return the size of  the BIOS image in
-bytes  if  it   was  able  to  successfully  copy   the  image  and  0
-otherwise. To create a well defined point to exit the softbooter
-
-void set_return_trap(xf86Int10Ptr pInt); 
-
-may be called.  It sets up a 'hlt' instruction  in the emulator memory
-just above the BIOS variable area. Before entering real mode execution
-this address will be pushed onto  the return stack.  If the BIOS needs
-to be  warm-booted this should be done  before leaving xf86InitInt10()
-by setting num in the xf86Int10InfoRec to 0xe6 and calling
-
-void xf86ExecX86int10(xf86Int10IfoPtr pInt); 
-
-The  implementation of this  function will  be discussed  below.  This
-function  should be  wrapped  by calls  to void  LockLegacyVGA(screen,
-legacyVGAPtr vga); and void UnlockLegacyVGA(screen, legacyVGAPtr vga);
-The struct  vga is  used to hold  the state  of the legacy  VGA access
-registers  if  a legacy  VGA  device  exists.  xf86InitInt10()  should
-return a pointer to the xf86Int10InfoRec allocated.
-
-2. Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
-
-In case  a platform specific  mapping has to  be performed to  map the
-memory allocated for the real  mode memory environment into a specific
-location prior to executing the x86 real mode code a function
-
-        Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
-
-has to  be provided. It will  be called by a  helper function whenever
-the active entity changes. If the  vm86 mode is used it is most likely
-that the 1MB real mode memory space located somewhere in the processes
-virtual memory  will have to be  remapped to address 0  of the virtual
-memory space.
-
-3.   void xf86FreeInt10(xf86Int10InfoPtr pInt);
-
-To free all memory allocated for video BIOS calls of a specific entity
-the function
-
-       void xf86FreeInt10(xf86Int10InfoPtr pInt);
-
-should  be  provided.  If  the  entity  to  be  freed  was  mapped  by
-MapCurrentInt10() this mapping needs to be undone also.
-
-4. 
-   void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-   void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-
-xf86Int10AllocPages()  should  allocate  'num'  consecutive  page-size
-chunks of memory. In real mode memory space this range needs to occupy
-consecutive addresses,  too. The function  must return the  address of
-this memory.  The offset in real  mode memory needs to  be returned in
-'off'. If  no block of 'num'  pages are available  the function should
-return NULL.
-
-xf86Int10FreePages() will  free the  'num' pages starting  at 'pbase'.
-'num'  is  equal  to  the  number  of  pages  allocated  by  a  single
-xf86Int10AllocatePages()  call. 'pbase'  is the  address of  the range
-previously returned by xf86Int10AllocatePages().
-
-II. Emulator specific functions
--------------------------------
-
-1. Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
-
-This function will  be called from xf86InitInt10(). It  may be used to
-set  up   the  static  emulator   specific  part  of  the   real  mode
-environment. On success it should return TRUE.
-
-2. xf86ExecX86int10(xf86Int10InfoPtr pInt);
-
-This function  gets called  to execute  an int call.  It may  call the
-helper function:
-
-       void setup_int(xf86Int10InfoPrt pInt);
-
-to copy the register values  to the emulator specific locations and to
-set up the non-static real mode execution environment.  On return from
-setup_int()   'Int10Current'   holds   a   pointer  to   the   current
-xf86Int10InfoRec.
-
-It should start execution by calling 
-
-       Bool int_handler(xf86Int10InfoPtr pInt);
-
-and if this function returns TRUE it should call whatever necessary to
-continue execution until a  'hlt' instruction is encountered.  To copy
-the resulting register values back to the xf86Int10InfoRec structure
-
-     void finish_int(xf86Int10InfoPtr pInt);
-
-should be called. 
-
-Helper  functions are  provided to  aid the  implementation of  a vm86
-call:
-
-  Bool vm86_GP_fault(xf86Int10InfoPtr pInt);
-
-This  function  handles  instructions  which  cause  a  vm86  call  to
-trap.  PIO  access  is handled  by  the  in/out  calls as  defined  in
-compiler.h. Optionally the PIO  instructions can be logged by defining
-PRINT_PORT in xf86int10.h. This is meant for debugging purposes.
-
-Unknown  instructions  and   'hlt'  cause  vm86_GP_fault()  to  return
-FALSE. Otherwise TRUE is returned.
-
-Note: This  function is  currently based on  the Linux vm86  call.  It
-might have  to be modified  or even rewritten  for other OS.   So your
-milage may vary.
-
-Functions to dump memory, code, xf86 CPU register values and stack are
-also provided.  Take a  look at  helper.c To view  a memory  range the
-function
-
-    void dprint(unsigned long start, unsigned long size)
-
-is provided. The use should be self explanatory.
-
-Register  and memory  access functions  are provided  in helper_mem.c.
-The PIO register access functions  can trap access to PCI config space
-access register (config method 1) if _PC is not defined.
-
-A header  file 'defines.h' is required to  define OS/emulator specific
-ways  to access  memory and  xf86 CPU  registers: Defines  need  to be
-provided     for    memory     byte/work/long     read/write    access
-(MEM_RB(name,addr),MEM_RW(name,addr),MEM_RL(name,addr),
-MEM_WB(name,addr,val),MEM_WL(name,addr,val),MEM_WL(name,addr,val))   of
-the real mode memory environment. 'name' will contain a pointer to the
-current   xf86Int10InfoRec.  Currently   defines  are   available  for
-vm86-mode under  Linux and x86emu.  They may be activated  by defining
-_X86EMU or _VM86_LINUX respectively.
-
-Note: Emulators usually are not able to pass this pointer when calling
-memory  access functions.  In this  case a  global variable  should be
-defined  which can  hold this  pointer. This  variable can  be  set in
-MapCurrentInt10().  It also  must be  set in  xf86InitInt10()  if this
-function  calls the  memory  access functions  either  directly or  by
-calling  xf86ExecX86int10(pInt).   Defines   to  access  the  emulator
-specific   xf86   CPU    register   locations   are   also   required:
-X86_EAX,...,X86_EFLAGS  for  access  of  the full  32  bit  registers,
-X86_AX...X86_FLAGS   for  access   of   the  16   bit  registers   and
-XF86_AL,XF86_BL,XF86_CL,XF86_DL  to  access  the  lower  byte  of  the
-AX,BX,CX and DX register.
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.2 2000/02/08 13:13:22 eich Exp $
+
+                 INT10  X86 Real Mode executor
+                 =============================
+
+		         PRELIMINARY
+
+INT10 is  a XFree86  module for soft-booting  and executing  real mode
+int10 BIOS calls. The BIOS call code is largely untested, yet.
+
+1. Usage
+========
+
+To   use   the   int10   module   in  a   driver   the   header   file
+xfree86/os-support/int10/xf86int10.h must be included.
+
+ a. Initialization
+ -----------------
+
+The int10-executer gets initialized by calling:
+
+   xf86Int10InfoPtr xf86InitInt10(int entityIndex);
+
+The  function  will soft-boot  any  non-primary  device  and return  a
+pointer  to a  xf86Int10InfoRec on  success. If  anything fails  or if
+int10 execution  is disabled by an  option in the  device section NULL
+will  be returned.   The driver  should store  this pointer  for later
+calls to other int10 module functions.
+
+ b. Memory allocation
+ --------------------
+
+To allocate memory in the real mode execution environment
+    
+   void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off);
+
+can  be called.  It  allocates num  consecutive  pagesize chunks.   It
+returns the address of the allocated area. off is set to its offset in
+the real mode memory space.
+
+  void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num);
+
+Is used to free num pages beginning at pbase.
+
+ c. Doing int10 BIOS calls
+ -------------------------
+
+The BIOS call is executed by calling:
+   
+   void xf86ExecX86int10(xf86Int10InfoPtr pInt);
+
+The number  of the interrupt (normally  10) and the  initial values of
+the ax, bx, cx, dx, si, di  and es x86-CPU registers can be set in the
+xf86Int10InfoRec  passed to  the function.   On return  this structure
+contains the  exit values  of the registers  listed above and  the CPU
+flag register.
+
+ d. De-initializing
+ -----------------
+
+If no further int10 calls are required for a certain chipset
+the driver should call:
+
+  void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+to free the memory allocated for real mode int10 calls.
+
+
+2. Porting issues
+=================
+
+The int10 real mode executor is  designed to run on top of various x86
+CPU emulators as well as in vm86  mode of a real x86 CPU. If used with
+a CPU  emulator the emulator and  CPU specific interfaces  can be held
+separate thus  requiring minimal efforts  to port the int10  module to
+new  platforms.   Currently  an  interface  to the  x86emu  real  mode
+emulator is  provided.  Since  details of setting  up and  running the
+vm86  mode   is  platform   dependent  both  the   platform  dependent
+environment and the emulation layer  have to be ported. Several helper
+functions are provided for that.
+
+A CPU emulator should meet certain requirements to be usable
+for the INT10 executor:
+
+1. It must trap  calls to intXX instructions and  pass execution to an
+   external  function  which  is   allowed  to  modify  CPU  registers
+   including  the instruction  pointer  (IP) before  returning to  the
+   emulator for  continuing execution.  When the external  function is
+   called the  IP must point to  the instruction past  the intXX call.
+
+2. The  emulator should  use externally  provided functions  to handle
+   PIO.
+
+3.  The emulator  should be able to use  externally provided functions
+ to access memory  from the real mode memory  environment.  Note, that
+ the  vm86  mode  usually  requires  one hunk  of  consecutive  memory
+ starting at address  0 in the process virtual  memory space.  Thus if
+ this mode is to be used, the OS environment has to be able to provide
+ that, ie. it must be able to remap the processes virtual memory space
+ onto itself.  If the  emulator is able  to handle memory  access thru
+ externally  provided functions the  real mode  process memory  can be
+ located anywhere  in the processes  virtual memory. It does  not even
+ have to be consecutive.
+
+4. The executor should terminate on encountering a 'hlt' instruction.
+
+
+Functions to implement:
+
+To simplify development  the code has been split  into a general setup
+part and an emulator specific one. A generic setup code is provided in
+generic.c.  It  should be  usable  with  any  emulator satisfying  the
+conditions mentioned  above. Therefore the following  section on int10
+setup may be skipped when porting int10 to new emulator.
+
+If the  vm86() is to be used  no memory access functions  can be used.
+Therefore the layout of the real mode memory image has to meet certain
+requirements. Therefore  when porting to  other platforms a  new setup
+code may  have to  be designed, too.  The following section  will give
+guidelines how  this may be  done. A sample implementation  using SysV
+IPC to  map the  appropriate real  mode memory image  to address  0 in
+virtual  address  space  just  prior  to execution  may  be  found  in
+xfree86/os-support/linux/int10/linux.c.
+
+On  non-PC like  platforms emulation  of certain  PC features  such as
+initialization of  BIOS int vectors, sys_BIOS constants  or PCI config
+method 1 can be turned on by defining _PC.
+
+I. Setup Code
+-------------
+
+This sets  up the real mode  memory image, calls the  emulator to POST
+the chipset if required and  maintains memory allocations in real mode
+address space.
+
+1. xf86Int10InfoPtr xf86InitInt10(int entityIndex);
+
+This  function should  first find  the screen  assigned to  the entity
+carrying entitiyIndex and then call
+
+       Bool int10skip(ScrnInfoPtr pScrn)
+
+to find out if the user  has requested not to initialize int10.  If so
+xf86InitInt10()  should  return  NULL. Otherwise  an  xf86Int10InfoRec
+should be allocated.  This structure contains the following fields:
+
+    a. int entityIndex   - index of the entity whose BIOS is to be 
+                           executed.
+    b. int scrnIndex     - index of the screen assigned the entity.
+    c. pointer cpuRegs   - pointer to a emulator/vm86-mode private 
+                           structure.  May hold cpu register values 
+                           for the emulator.
+    d. CARD16 BIOSseg    - Video BIOS segment address.
+    e. pointer private   - pointer to a os specific data structure.
+    f. struct _int10Mem* - pointer to a structure to hold the memory
+                           access functions for use by an emulator.
+    g. int num           - number of the int to be called.
+    h. int ax..es,flags  - CPU register values to pass to int-call.
+
+The Init  function should initialize  a-f. To initialize  the emulator
+specific execute environment the function
+
+     Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
+
+should be called. If this function returns FALSE any already allocated
+memory should be freed and xf86Int10Init(0 should exit returning NULL.
+
+If the  platform has  a PC  like system BIOS  it may  be copied  to or
+mapped into memory  locations SYS_BIOS to SYS_SIZE-1 of  the real mode
+memory environment of this process. Otherwise the helper function: 
+
+int setup_system_bios(CARD32 base_addr); 
+
+may be  called to set  up a rudimentary  system BIOS sufficient  to be
+used to  boot video BIOSes.   base_addr specifies the  virtual address
+corresponding to SYS_BIOS in the  real mode environment.  If a PC-like
+int vector and BIOS data area is available it should be copied to 0 to
+LOW_PAGE_SIZE of the entities real mode environment.  In this case the
+video interrupt  related entries should  be reset for  all non-primary
+cards by calling:
+
+void reset_int_vect(xf86Int10InfoPtr pInt); To initialize the
+
+correct video BIOS  entry points the BIOS must  be warm-booted.  If no
+PC-like int vector is available one can be set up by calling 
+
+void setup_int_vect(xf86Int10InfoPtr pInt); 
+
+In this  case the  video BIOS  has to be  warm-booted always.   If the
+video BIOS  for this entity has  been installed during boot  it may be
+mapped (or  copied) directly to the  correct address in  the real mode
+memory environment.  Otherwise
+
+int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address); 
+
+should  be called  to copy  the BIOS  image from  PCI  ROM.  'address'
+specifies the address this image should be copied to. Sufficient space
+to  hold an entire  BIOS image  should be  allocated prior  to calling
+mapPciRom(). This function  will return the size of  the BIOS image in
+bytes  if  it   was  able  to  successfully  copy   the  image  and  0
+otherwise. To create a well defined point to exit the softbooter
+
+void set_return_trap(xf86Int10Ptr pInt); 
+
+may be called.  It sets up a 'hlt' instruction  in the emulator memory
+just above the BIOS variable area. Before entering real mode execution
+this address will be pushed onto  the return stack.  If the BIOS needs
+to be  warm-booted this should be done  before leaving xf86InitInt10()
+by setting num in the xf86Int10InfoRec to 0xe6 and calling
+
+void xf86ExecX86int10(xf86Int10IfoPtr pInt); 
+
+The  implementation of this  function will  be discussed  below.  This
+function  should be  wrapped  by calls  to void  LockLegacyVGA(screen,
+legacyVGAPtr vga); and void UnlockLegacyVGA(screen, legacyVGAPtr vga);
+The struct  vga is  used to hold  the state  of the legacy  VGA access
+registers  if  a legacy  VGA  device  exists.  xf86InitInt10()  should
+return a pointer to the xf86Int10InfoRec allocated.
+
+2. Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
+In case  a platform specific  mapping has to  be performed to  map the
+memory allocated for the real  mode memory environment into a specific
+location prior to executing the x86 real mode code a function
+
+        Bool MapCurrentInt10(xf86Int10InfoPtr pInt);
+
+has to  be provided. It will  be called by a  helper function whenever
+the active entity changes. If the  vm86 mode is used it is most likely
+that the 1MB real mode memory space located somewhere in the processes
+virtual memory  will have to be  remapped to address 0  of the virtual
+memory space.
+
+3.   void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+To free all memory allocated for video BIOS calls of a specific entity
+the function
+
+       void xf86FreeInt10(xf86Int10InfoPtr pInt);
+
+should  be  provided.  If  the  entity  to  be  freed  was  mapped  by
+MapCurrentInt10() this mapping needs to be undone also.
+
+4. 
+   void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
+   void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
+
+xf86Int10AllocPages()  should  allocate  'num'  consecutive  page-size
+chunks of memory. In real mode memory space this range needs to occupy
+consecutive addresses,  too. The function  must return the  address of
+this memory.  The offset in real  mode memory needs to  be returned in
+'off'. If  no block of 'num'  pages are available  the function should
+return NULL.
+
+xf86Int10FreePages() will  free the  'num' pages starting  at 'pbase'.
+'num'  is  equal  to  the  number  of  pages  allocated  by  a  single
+xf86Int10AllocatePages()  call. 'pbase'  is the  address of  the range
+previously returned by xf86Int10AllocatePages().
+
+II. Emulator specific functions
+-------------------------------
+
+1. Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt);
+
+This function will  be called from xf86InitInt10(). It  may be used to
+set  up   the  static  emulator   specific  part  of  the   real  mode
+environment. On success it should return TRUE.
+
+2. xf86ExecX86int10(xf86Int10InfoPtr pInt);
+
+This function  gets called  to execute  an int call.  It may  call the
+helper function:
+
+       void setup_int(xf86Int10InfoPrt pInt);
+
+to copy the register values  to the emulator specific locations and to
+set up the non-static real mode execution environment.  On return from
+setup_int()   'Int10Current'   holds   a   pointer  to   the   current
+xf86Int10InfoRec.
+
+It should start execution by calling 
+
+       Bool int_handler(xf86Int10InfoPtr pInt);
+
+and if this function returns TRUE it should call whatever necessary to
+continue execution until a  'hlt' instruction is encountered.  To copy
+the resulting register values back to the xf86Int10InfoRec structure
+
+     void finish_int(xf86Int10InfoPtr pInt);
+
+should be called. 
+
+Helper  functions are  provided to  aid the  implementation of  a vm86
+call:
+
+  Bool vm86_GP_fault(xf86Int10InfoPtr pInt);
+
+This  function  handles  instructions  which  cause  a  vm86  call  to
+trap.  PIO  access  is handled  by  the  in/out  calls as  defined  in
+compiler.h. Optionally the PIO  instructions can be logged by defining
+PRINT_PORT in xf86int10.h. This is meant for debugging purposes.
+
+Unknown  instructions  and   'hlt'  cause  vm86_GP_fault()  to  return
+FALSE. Otherwise TRUE is returned.
+
+Note: This  function is  currently based on  the Linux vm86  call.  It
+might have  to be modified  or even rewritten  for other OS.   So your
+milage may vary.
+
+Functions to dump memory, code, xf86 CPU register values and stack are
+also provided.  Take a  look at  helper.c To view  a memory  range the
+function
+
+    void dprint(unsigned long start, unsigned long size)
+
+is provided. The use should be self explanatory.
+
+Register  and memory  access functions  are provided  in helper_mem.c.
+The PIO register access functions  can trap access to PCI config space
+access register (config method 1) if _PC is not defined.
+
+A header  file 'defines.h' is required to  define OS/emulator specific
+ways  to access  memory and  xf86 CPU  registers: Defines  need  to be
+provided     for    memory     byte/work/long     read/write    access
+(MEM_RB(name,addr),MEM_RW(name,addr),MEM_RL(name,addr),
+MEM_WB(name,addr,val),MEM_WL(name,addr,val),MEM_WL(name,addr,val))   of
+the real mode memory environment. 'name' will contain a pointer to the
+current   xf86Int10InfoRec.  Currently   defines  are   available  for
+vm86-mode under  Linux and x86emu.  They may be activated  by defining
+_X86EMU or _VM86_LINUX respectively.
+
+Note: Emulators usually are not able to pass this pointer when calling
+memory  access functions.  In this  case a  global variable  should be
+defined  which can  hold this  pointer. This  variable can  be  set in
+MapCurrentInt10().  It also  must be  set in  xf86InitInt10()  if this
+function  calls the  memory  access functions  either  directly or  by
+calling  xf86ExecX86int10(pInt).   Defines   to  access  the  emulator
+specific   xf86   CPU    register   locations   are   also   required:
+X86_EAX,...,X86_EFLAGS  for  access  of  the full  32  bit  registers,
+X86_AX...X86_FLAGS   for  access   of   the  16   bit  registers   and
+XF86_AL,XF86_BL,XF86_CL,XF86_DL  to  access  the  lower  byte  of  the
+AX,BX,CX and DX register.
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.2 2000/02/08 13:13:22 eich Exp $
diff --git a/xorg-server/hw/xfree86/int10/generic.c b/xorg-server/hw/xfree86/int10/generic.c
index 8614e0b9b..5343e47e3 100644
--- a/xorg-server/hw/xfree86/int10/generic.c
+++ b/xorg-server/hw/xfree86/int10/generic.c
@@ -70,12 +70,12 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     void *base = 0;
     void *vbiosMem = 0;
     void *options = NULL;
-    int screen;
     legacyVGARec vga;
+    ScrnInfoPtr pScrn;
 
-    screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
+    pScrn = xf86FindScreenForEntity(entityIndex);
 
-    options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
+    options = xf86HandleInt10Options(pScrn, entityIndex);
 
     if (int10skip(options)) {
         free(options);
@@ -89,7 +89,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     pInt->mem = &genericMem;
     pInt->private = (pointer) xnfcalloc(1, sizeof(genericInt10Priv));
     INTPriv(pInt)->alloc = (pointer) xnfcalloc(1, ALLOC_ENTRIES(getpagesize()));
-    pInt->scrnIndex = screen;
+    pInt->pScrn = pScrn;
     base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
 
     /* FIXME: Shouldn't this be a failure case?  Leaving dev as NULL seems like
@@ -109,7 +109,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     INTPriv(pInt)->sysMem = sysMem;
 
     if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
-        xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n");
         goto error1;
     }
 
@@ -148,7 +148,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
             vbiosMem = (unsigned char *) base + bios_location;
             err = pci_device_read_rom(rom_device, vbiosMem);
             if (err) {
-                xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (3) %s\n",
+                xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read V_BIOS (3) %s\n",
                            strerror(err));
                 goto error1;
             }
@@ -249,7 +249,6 @@ MapVRam(xf86Int10InfoPtr pInt)
 static void
 UnmapVRam(xf86Int10InfoPtr pInt)
 {
-    int screen = pInt->scrnIndex;
     int pagesize = getpagesize();
     int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
 
diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c
index 1e908778f..1c58cf7ae 100644
--- a/xorg-server/hw/xfree86/int10/helper_exec.c
+++ b/xorg-server/hw/xfree86/int10/helper_exec.c
@@ -125,7 +125,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
     if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) {      /* SYS_BIOS_SEG ? */
 
         if (num == 21 && X86_AH == 0x4e) {
-            xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_NOTICE,
                        "Failing Find-Matching-File on non-PC"
                        " (int 21, func 4e)\n");
             X86_AX = 2;
@@ -133,7 +133,7 @@ run_bios_int(int num, xf86Int10InfoPtr pInt)
             return 1;
         }
         else {
-            xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+            xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                            "Ignoring int 0x%02x call\n", num);
             if (xf86GetVerbosity() > 3) {
                 dump_registers(pInt);
@@ -169,7 +169,7 @@ dump_code(xf86Int10InfoPtr pInt)
     int i;
     CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
 
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
                    lina);
     for (i = 0; i < 0x10; i++)
         xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
@@ -182,19 +182,19 @@ dump_code(xf86Int10InfoPtr pInt)
 void
 dump_registers(xf86Int10InfoPtr pInt)
 {
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
                    (unsigned long) X86_EAX, (unsigned long) X86_EBX,
                    (unsigned long) X86_ECX, (unsigned long) X86_EDX);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
                    (unsigned long) X86_ESP, (unsigned long) X86_EBP,
                    (unsigned long) X86_ESI, (unsigned long) X86_EDI);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "CS=0x%4.4x, SS=0x%4.4x,"
                    " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
                    X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
-    xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
+    xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3,
                    "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
                    (unsigned long) X86_EIP, (unsigned long) X86_EFLAGS);
 }
@@ -337,7 +337,7 @@ x_inb(CARD16 port)
     }
     else if (port < 0x0100) {   /* Don't interfere with mainboard */
         val = 0;
-        xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "inb 0x%4.4x\n", port);
         if (xf86GetVerbosity() > 3) {
             dump_registers(Int10Current);
@@ -395,7 +395,7 @@ x_outb(CARD16 port, CARD8 val)
 #ifdef __NOT_YET__
     }
     else if (port < 0x0100) {   /* Don't interfere with mainboard */
-        xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(Int10Current->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "outb 0x%4.4x,0x%2.2x\n", port, val);
         if (xf86GetVerbosity() > 3) {
             dump_registers(Int10Current);
diff --git a/xorg-server/hw/xfree86/int10/helper_mem.c b/xorg-server/hw/xfree86/int10/helper_mem.c
index 96c598a53..160c5aedf 100644
--- a/xorg-server/hw/xfree86/int10/helper_mem.c
+++ b/xorg-server/hw/xfree86/int10/helper_mem.c
@@ -281,7 +281,7 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
 
 #define CHECK_V_SEGMENT_RANGE(x)   \
     if (((x) << 4) < V_BIOS) { \
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
+	xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, \
 		   "V_BIOS address 0x%lx out of range\n", \
 		   (unsigned long)(x) << 4); \
 	return FALSE; \
@@ -306,17 +306,17 @@ xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base)
 
         CHECK_V_SEGMENT_RANGE(cs);
         vbiosMem = (unsigned char *) base + (cs << 4);
-        if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+        if (int10_check_bios(pInt->pScrn->scrnIndex, cs, vbiosMem)) {
             break;
         }
     }
 
     if (segments[i] == ~0) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "No V_BIOS found\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "No V_BIOS found\n");
         return FALSE;
     }
 
-    xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
+    xf86DrvMsg(pInt->pScrn->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
                (unsigned long) cs);
 
     pInt->BIOSseg = cs;
diff --git a/xorg-server/hw/xfree86/int10/x86emu.c b/xorg-server/hw/xfree86/int10/x86emu.c
index b3320e5b9..087059131 100644
--- a/xorg-server/hw/xfree86/int10/x86emu.c
+++ b/xorg-server/hw/xfree86/int10/x86emu.c
@@ -1,12 +1,12 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "debug.c"
-#include "decode.c"
-#include "fpu.c"
-#include "ops.c"
-#include "ops2.c"
-#include "prim_ops.c"
-#include "sys.c"
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "debug.c"
+#include "decode.c"
+#include "fpu.c"
+#include "ops.c"
+#include "ops2.c"
+#include "prim_ops.c"
+#include "sys.c"
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.c b/xorg-server/hw/xfree86/int10/xf86int10.c
index df347d4dd..5ead44f23 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.c
+++ b/xorg-server/hw/xfree86/int10/xf86int10.c
@@ -57,7 +57,7 @@ int_handler(xf86Int10InfoPtr pInt)
         ret = run_bios_int(num, pInt);
 
     if (!ret) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Halting on int 0x%2.2x!\n", num);
         dump_registers(pInt);
         stack_trace(pInt);
     }
@@ -257,7 +257,7 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*         DL = character column                      */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n",
                        pInt->num);
         if (xf86GetVerbosity() > 3) {
@@ -314,10 +314,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        " AL=0x%2.2x, BH=0x%2.2x,"
                        " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
@@ -339,10 +339,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        " AL=0x%2.2x, BH=0x%2.2x,"
                        " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL);
@@ -360,10 +360,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*         AL = character                             */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at"
                        " Cursor\n", pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "BH=0x%2.2x\n", X86_BH);
         if (xf86GetVerbosity() > 3) {
             dump_registers(pInt);
@@ -382,10 +382,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at"
                        " Cursor\n", pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_BL, X86_CX);
         if (xf86GetVerbosity() > 3) {
@@ -404,10 +404,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_BL, X86_CX);
         if (xf86GetVerbosity() > 3) {
@@ -450,10 +450,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  Nothing                                    */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n",
                        X86_AL, X86_BH, X86_CX, X86_DX);
         if (xf86GetVerbosity() > 3) {
@@ -471,10 +471,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /* Leave:  AL = pixel value                           */
         /* Not Implemented                                    */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", X86_BH, X86_CX,
                        X86_DX);
         if (xf86GetVerbosity() > 3) {
@@ -498,10 +498,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*           which might or might not have been       */
         /*           installed yet.                           */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n",
                        X86_AL, X86_BH, X86_BL);
         if (xf86GetVerbosity() > 3) {
@@ -564,10 +564,10 @@ int42_handler(xf86Int10InfoPtr pInt)
         /*           which might or might not have been       */
         /*           installed yet.                           */
     {                           /* Localise */
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n",
                        pInt->num);
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 3,
                        "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x,"
                        " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n",
                        X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP);
@@ -840,7 +840,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 #endif
         return 1;
     default:
-        xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
+        xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_NOT_IMPLEMENTED, 2,
                        "int 0x1a subfunction\n");
         dump_registers(pInt);
         if (xf86GetVerbosity() > 3)
diff --git a/xorg-server/hw/xfree86/int10/xf86int10.h b/xorg-server/hw/xfree86/int10/xf86int10.h
index 36b659fd7..6d564fc1a 100644
--- a/xorg-server/hw/xfree86/int10/xf86int10.h
+++ b/xorg-server/hw/xfree86/int10/xf86int10.h
@@ -21,10 +21,10 @@
 /* int10 info structure */
 typedef struct {
     int entityIndex;
-    int scrnIndex;
-    pointer cpuRegs;
     CARD16 BIOSseg;
     CARD16 inb40time;
+    ScrnInfoPtr pScrn;
+    pointer cpuRegs;
     char *BIOSScratch;
     int Flags;
     pointer private;
diff --git a/xorg-server/hw/xfree86/int10/xf86x86emu.h b/xorg-server/hw/xfree86/int10/xf86x86emu.h
index 4af2dafb7..320ad6fa8 100644
--- a/xorg-server/hw/xfree86/int10/xf86x86emu.h
+++ b/xorg-server/hw/xfree86/int10/xf86x86emu.h
@@ -1,54 +1,54 @@
-/*
- *                   XFree86 int10 module
- *   execute BIOS int 10h calls in x86 real mode environment
- *                 Copyright 1999 Egbert Eich
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef XF86X86EMU_H_
-#define XF86X86EMU_H_
-#include <x86emu.h>
-
-#define M _X86EMU_env
-
-#define X86_EAX M.x86.R_EAX
-#define X86_EBX M.x86.R_EBX
-#define X86_ECX M.x86.R_ECX
-#define X86_EDX M.x86.R_EDX
-#define X86_ESI M.x86.R_ESI
-#define X86_EDI M.x86.R_EDI
-#define X86_EBP M.x86.R_EBP
-#define X86_EIP M.x86.R_EIP
-#define X86_ESP M.x86.R_ESP
-#define X86_EFLAGS M.x86.R_EFLG
-
-#define X86_FLAGS M.x86.R_FLG
-#define X86_AX M.x86.R_AX
-#define X86_BX M.x86.R_BX
-#define X86_CX M.x86.R_CX
-#define X86_DX M.x86.R_DX
-#define X86_SI M.x86.R_SI
-#define X86_DI M.x86.R_DI
-#define X86_BP M.x86.R_BP
-#define X86_IP M.x86.R_IP
-#define X86_SP M.x86.R_SP
-#define X86_CS M.x86.R_CS
-#define X86_DS M.x86.R_DS
-#define X86_ES M.x86.R_ES
-#define X86_SS M.x86.R_SS
-#define X86_FS M.x86.R_FS
-#define X86_GS M.x86.R_GS
-
-#define X86_AL M.x86.R_AL
-#define X86_BL M.x86.R_BL
-#define X86_CL M.x86.R_CL
-#define X86_DL M.x86.R_DL
-
-#define X86_AH M.x86.R_AH
-#define X86_BH M.x86.R_BH
-#define X86_CH M.x86.R_CH
-#define X86_DH M.x86.R_DH
-
-#endif
+/*
+ *                   XFree86 int10 module
+ *   execute BIOS int 10h calls in x86 real mode environment
+ *                 Copyright 1999 Egbert Eich
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef XF86X86EMU_H_
+#define XF86X86EMU_H_
+#include <x86emu.h>
+
+#define M _X86EMU_env
+
+#define X86_EAX M.x86.R_EAX
+#define X86_EBX M.x86.R_EBX
+#define X86_ECX M.x86.R_ECX
+#define X86_EDX M.x86.R_EDX
+#define X86_ESI M.x86.R_ESI
+#define X86_EDI M.x86.R_EDI
+#define X86_EBP M.x86.R_EBP
+#define X86_EIP M.x86.R_EIP
+#define X86_ESP M.x86.R_ESP
+#define X86_EFLAGS M.x86.R_EFLG
+
+#define X86_FLAGS M.x86.R_FLG
+#define X86_AX M.x86.R_AX
+#define X86_BX M.x86.R_BX
+#define X86_CX M.x86.R_CX
+#define X86_DX M.x86.R_DX
+#define X86_SI M.x86.R_SI
+#define X86_DI M.x86.R_DI
+#define X86_BP M.x86.R_BP
+#define X86_IP M.x86.R_IP
+#define X86_SP M.x86.R_SP
+#define X86_CS M.x86.R_CS
+#define X86_DS M.x86.R_DS
+#define X86_ES M.x86.R_ES
+#define X86_SS M.x86.R_SS
+#define X86_FS M.x86.R_FS
+#define X86_GS M.x86.R_GS
+
+#define X86_AL M.x86.R_AL
+#define X86_BL M.x86.R_BL
+#define X86_CL M.x86.R_CL
+#define X86_DL M.x86.R_DL
+
+#define X86_AH M.x86.R_AH
+#define X86_BH M.x86.R_BH
+#define X86_CH M.x86.R_CH
+#define X86_DH M.x86.R_DH
+
+#endif
diff --git a/xorg-server/hw/xfree86/modes/Makefile.am b/xorg-server/hw/xfree86/modes/Makefile.am
index 9236426bf..e0386d748 100644
--- a/xorg-server/hw/xfree86/modes/Makefile.am
+++ b/xorg-server/hw/xfree86/modes/Makefile.am
@@ -1,35 +1,35 @@
-noinst_LTLIBRARIES = libxf86modes.la
-
-if DGA
-DGA_SRCS = xf86DiDGA.c
-endif
-
-libxf86modes_la_SOURCES = \
-	xf86Crtc.c \
-	xf86Crtc.h \
-	xf86Cursors.c \
-	xf86cvt.c \
-	xf86gtf.c \
-	xf86DisplayIDModes.c \
-	xf86EdidModes.c \
-	xf86Modes.c \
-	xf86Modes.h \
-	xf86RandR12.c \
-	xf86RandR12.h \
-	xf86Rename.h \
-	xf86Rotate.c \
-        $(DGA_SRCS)
-
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-	   -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
-	   -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-	   -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
-	   -I$(srcdir)/../dixmods/extmod
-
-sdk_HEADERS = \
-	xf86Crtc.h \
-	xf86Modes.h \
-	xf86RandR12.h \
-	xf86Rename.h
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+noinst_LTLIBRARIES = libxf86modes.la
+
+if DGA
+DGA_SRCS = xf86DiDGA.c
+endif
+
+libxf86modes_la_SOURCES = \
+	xf86Crtc.c \
+	xf86Crtc.h \
+	xf86Cursors.c \
+	xf86cvt.c \
+	xf86gtf.c \
+	xf86DisplayIDModes.c \
+	xf86EdidModes.c \
+	xf86Modes.c \
+	xf86Modes.h \
+	xf86RandR12.c \
+	xf86RandR12.h \
+	xf86Rename.h \
+	xf86Rotate.c \
+        $(DGA_SRCS)
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+	   -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+	   -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+	   -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
+	   -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = \
+	xf86Crtc.h \
+	xf86Modes.h \
+	xf86RandR12.h \
+	xf86Rename.h
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index ab6ed5e32..2c8878fa7 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -716,7 +716,7 @@ xf86CrtcCreateScreenResources(ScreenPtr screen)
  * Clean up config on server reset
  */
 static Bool
-xf86CrtcCloseScreen(int index, ScreenPtr screen)
+xf86CrtcCloseScreen(ScreenPtr screen)
 {
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -738,7 +738,7 @@ xf86CrtcCloseScreen(int index, ScreenPtr screen)
     }
     xf86RandR12CloseScreen(screen);
 
-    return screen->CloseScreen(index, screen);
+    return screen->CloseScreen(screen);
 }
 
 /*
@@ -3009,7 +3009,7 @@ xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus)
     ScrnInfoPtr scrn = output->scrn;
     xf86MonPtr mon;
 
-    mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
+    mon = xf86DoEEDID(scrn, pDDCBus, TRUE);
     if (mon)
         xf86DDCApplyQuirks(scrn->scrnIndex, mon);
 
diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
index fdec6cb4b..bb954ac4b 100644
--- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c
+++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
@@ -137,7 +137,7 @@ xf86_dga_get_viewport(ScrnInfoPtr scrn)
 static void
 xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
 {
-    scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+    scrn->AdjustFrame(scrn, x, y);
 }
 
 static Bool
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index e6b205223..59b6f8217 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -515,7 +515,7 @@ xf86RandR12SetMode(ScreenPtr pScreen,
     Bool ret = TRUE;
 
     if (pRoot)
-        (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+        (*scrp->EnableDisableFBAccess) (scrp, FALSE);
     if (useVirtual) {
         scrp->virtualX = randrp->virtualX;
         scrp->virtualY = randrp->virtualY;
@@ -568,7 +568,7 @@ xf86RandR12SetMode(ScreenPtr pScreen,
     xf86SetViewport(pScreen, pScreen->width, pScreen->height);
     xf86SetViewport(pScreen, 0, 0);
     if (pRoot)
-        (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+        (*scrp->EnableDisableFBAccess) (scrp, TRUE);
     return ret;
 }
 
@@ -685,7 +685,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
         }
     }
     if (pRoot && pScrn->vtSema)
-        (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+        (*pScrn->EnableDisableFBAccess) (pScrn, FALSE);
 
     /* Let the driver update virtualX and virtualY */
     if (!(*config->funcs->resize) (pScrn, width, height))
@@ -724,7 +724,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     update_desktop_dimensions();
 
     if (pRoot && pScrn->vtSema)
-        (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+        (*pScrn->EnableDisableFBAccess) (pScrn, TRUE);
 #if RANDR_12_INTERFACE
     if (xf86RandR12Key && pScreen->root && ret)
         RRScreenSizeNotify(pScreen);
@@ -1596,10 +1596,9 @@ xf86RandR12TellChanged(ScreenPtr pScreen)
 }
 
 static void
-xf86RandR12PointerMoved(int scrnIndex, int x, int y)
+xf86RandR12PointerMoved(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScreenPtr pScreen = screenInfo.screens[scrnIndex];
-    ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
     XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
     int c;
@@ -1688,10 +1687,9 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
 }
 
 static int
-xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
+xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
 {
     CARD16 *points, *red, *green, *blue;
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
     int size;
 
@@ -1723,10 +1721,9 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
 }
 
 static Bool
-xf86RandR12EnterVT(int screen_index, int flags)
+xf86RandR12EnterVT(ScrnInfoPtr pScrn)
 {
-    ScreenPtr pScreen = screenInfo.screens[screen_index];
-    ScrnInfoPtr pScrn = xf86Screens[screen_index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
     rrScrPrivPtr rp = rrGetScrPriv(pScreen);
     Bool ret;
@@ -1734,7 +1731,7 @@ xf86RandR12EnterVT(int screen_index, int flags)
 
     if (randrp->orig_EnterVT) {
         pScrn->EnterVT = randrp->orig_EnterVT;
-        ret = pScrn->EnterVT(screen_index, flags);
+        ret = pScrn->EnterVT(pScrn);
         randrp->orig_EnterVT = pScrn->EnterVT;
         pScrn->EnterVT = xf86RandR12EnterVT;
         if (!ret)
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index 26eefc8c0..6a661e195 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -250,17 +250,16 @@ xf86RotateRedisplay(ScreenPtr pScreen)
 }
 
 static void
-xf86RotateBlockHandler(int screenNum, pointer blockData,
+xf86RotateBlockHandler(ScreenPtr pScreen,
                        pointer pTimeout, pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[screenNum];
-    ScrnInfoPtr pScrn = xf86Screens[screenNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     Bool rotation_active;
 
     rotation_active = xf86RotateRedisplay(pScreen);
     pScreen->BlockHandler = xf86_config->BlockHandler;
-    (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
     /* cannot avoid re-wrapping until all wrapping is audited */
     xf86_config->BlockHandler = pScreen->BlockHandler;
     pScreen->BlockHandler = xf86RotateBlockHandler;
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
index b6ecdf1d1..55eb1151d 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.am
@@ -1,76 +1,76 @@
-noinst_LTLIBRARIES = libbsd.la
-
-# APM support.
-if BSD_KQUEUE_APM
-APM_SOURCES = $(srcdir)/bsd_kqueue_apm.c
-else 
-if BSD_APM
-APM_SOURCES = $(srcdir)/bsd_apm.c
-else
-APM_SOURCES = $(srcdir)/../shared/pm_noop.c
-endif
-endif
-
-if FREEBSD_KLDLOAD
-KMOD_SOURCES = bsd_kmod.c
-else
-KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c
-endif
-
-if AGP
-AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c
-else
-AGP_SOURCES = $(srcdir)/../shared/agp_noop.c
-endif
-
-if ALPHA_VIDEO
-# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
-ARCH_SOURCES = \
-	alpha_video.c \
-	bsd_ev56.c \
-	bsd_axp.c \
-	$(srcdir)/../shared/xf86Axp.c
-endif
-
-if ARM_VIDEO
-ARCH_SOURCES = arm_video.c
-endif
-
-if I386_VIDEO
-ARCH_SOURCES = i386_video.c
-endif
-
-if PPC_VIDEO
-ARCH_SOURCES = ppc_video.c
-endif
-
-if SPARC64_VIDEO
-# Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO.
-ARCH_SOURCES = \
-	sparc64_video.c \
-	$(srcdir)/../shared/ioperm_noop.c
-endif
-
-# FIXME: NetBSD Aperture defines (configure.ac)
-AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
-
-INCLUDES = $(XORG_INCS)
-
-libbsd_la_SOURCES = \
-	$(srcdir)/../shared/posix_tty.c \
-	$(srcdir)/../shared/sigio.c \
-	$(srcdir)/../shared/vidmem.c \
-	bsd_VTsw.c \
-	bsd_init.c \
-	bsd_bell.c \
-	$(ARCH_SOURCES) \
-	$(AGP_SOURCES) \
-	$(APM_SOURCES) \
-	$(AXP_SOURCES) \
-	$(DRI_SOURCES) \
-	$(KMOD_SOURCES) \
-	$(RES_SOURCES)
-
-# FIXME: Add these files to the build as needed
-EXTRA_DIST = \
-	memrange.h
+noinst_LTLIBRARIES = libbsd.la
+
+# APM support.
+if BSD_KQUEUE_APM
+APM_SOURCES = $(srcdir)/bsd_kqueue_apm.c
+else 
+if BSD_APM
+APM_SOURCES = $(srcdir)/bsd_apm.c
+else
+APM_SOURCES = $(srcdir)/../shared/pm_noop.c
+endif
+endif
+
+if FREEBSD_KLDLOAD
+KMOD_SOURCES = bsd_kmod.c
+else
+KMOD_SOURCES = $(srcdir)/../shared/kmod_noop.c
+endif
+
+if AGP
+AGP_SOURCES = $(srcdir)/../linux/lnx_agp.c
+else
+AGP_SOURCES = $(srcdir)/../shared/agp_noop.c
+endif
+
+if ALPHA_VIDEO
+# Cheat here and piggyback other alpha bits on ALPHA_VIDEO.
+ARCH_SOURCES = \
+	alpha_video.c \
+	bsd_ev56.c \
+	bsd_axp.c \
+	$(srcdir)/../shared/xf86Axp.c
+endif
+
+if ARM_VIDEO
+ARCH_SOURCES = arm_video.c
+endif
+
+if I386_VIDEO
+ARCH_SOURCES = i386_video.c
+endif
+
+if PPC_VIDEO
+ARCH_SOURCES = ppc_video.c
+endif
+
+if SPARC64_VIDEO
+# Cheat here and piggyback other sparc64 bits on SPARC64_VIDEO.
+ARCH_SOURCES = \
+	sparc64_video.c \
+	$(srcdir)/../shared/ioperm_noop.c
+endif
+
+# FIXME: NetBSD Aperture defines (configure.ac)
+AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
+
+libbsd_la_SOURCES = \
+	$(srcdir)/../shared/posix_tty.c \
+	$(srcdir)/../shared/sigio.c \
+	$(srcdir)/../shared/vidmem.c \
+	bsd_VTsw.c \
+	bsd_init.c \
+	bsd_bell.c \
+	$(ARCH_SOURCES) \
+	$(AGP_SOURCES) \
+	$(APM_SOURCES) \
+	$(AXP_SOURCES) \
+	$(DRI_SOURCES) \
+	$(KMOD_SOURCES) \
+	$(RES_SOURCES)
+
+# FIXME: Add these files to the build as needed
+EXTRA_DIST = \
+	memrange.h
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
index 3e8224753..2f0ba2ac8 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.am
@@ -1,15 +1,15 @@
-noinst_LTLIBRARIES = libhurd.la
-
-libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
-		hurd_video.c \
-		$(srcdir)/../shared/VTsw_noop.c \
-		$(srcdir)/../shared/posix_tty.c \
-		$(srcdir)/../shared/vidmem.c \
-		$(srcdir)/../shared/sigiostubs.c \
-		$(srcdir)/../shared/pm_noop.c \
-		$(srcdir)/../shared/kmod_noop.c \
-		$(srcdir)/../shared/agp_noop.c
-
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
-
-INCLUDES = $(XORG_INCS)
+noinst_LTLIBRARIES = libhurd.la
+
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
+		hurd_video.c \
+		$(srcdir)/../shared/VTsw_noop.c \
+		$(srcdir)/../shared/posix_tty.c \
+		$(srcdir)/../shared/vidmem.c \
+		$(srcdir)/../shared/sigiostubs.c \
+		$(srcdir)/../shared/pm_noop.c \
+		$(srcdir)/../shared/kmod_noop.c \
+		$(srcdir)/../shared/agp_noop.c
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS)
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c
index 33965a44c..8750eaf44 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_bell.c
@@ -1,37 +1,37 @@
-/*
- * Copyright © 2006 Daniel Stone
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Author: Daniel Stone <daniel@fooishbar.org>
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Priv.h"
-
-void
-xf86OSRingBell(int loudness, int pitch, int duration)
-{
-    return;
-}
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+    return;
+}
diff --git a/xorg-server/hw/xfree86/os-support/int10Defines.h b/xorg-server/hw/xfree86/os-support/int10Defines.h
index d942fbdad..e79722839 100644
--- a/xorg-server/hw/xfree86/os-support/int10Defines.h
+++ b/xorg-server/hw/xfree86/os-support/int10Defines.h
@@ -1,89 +1,89 @@
-/*
- * Copyright (c) 2000-2001 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _INT10DEFINES_H_
-#define _INT10DEFINES_H_ 1
-
-#ifdef _VM86_LINUX
-
-#include <asm/vm86.h>
-
-#define CPU_R(type,name,num) \
-	(((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num])
-#define CPU_RD(name,num) CPU_R(CARD32,name,num)
-#define CPU_RW(name,num) CPU_R(CARD16,name,num)
-#define CPU_RB(name,num) CPU_R(CARD8,name,num)
-
-#define X86_EAX CPU_RD(eax,0)
-#define X86_EBX CPU_RD(ebx,0)
-#define X86_ECX CPU_RD(ecx,0)
-#define X86_EDX CPU_RD(edx,0)
-#define X86_ESI CPU_RD(esi,0)
-#define X86_EDI CPU_RD(edi,0)
-#define X86_EBP CPU_RD(ebp,0)
-#define X86_EIP CPU_RD(eip,0)
-#define X86_ESP CPU_RD(esp,0)
-#define X86_EFLAGS CPU_RD(eflags,0)
-
-#define X86_FLAGS CPU_RW(eflags,0)
-#define X86_AX CPU_RW(eax,0)
-#define X86_BX CPU_RW(ebx,0)
-#define X86_CX CPU_RW(ecx,0)
-#define X86_DX CPU_RW(edx,0)
-#define X86_SI CPU_RW(esi,0)
-#define X86_DI CPU_RW(edi,0)
-#define X86_BP CPU_RW(ebp,0)
-#define X86_IP CPU_RW(eip,0)
-#define X86_SP CPU_RW(esp,0)
-#define X86_CS CPU_RW(cs,0)
-#define X86_DS CPU_RW(ds,0)
-#define X86_ES CPU_RW(es,0)
-#define X86_SS CPU_RW(ss,0)
-#define X86_FS CPU_RW(fs,0)
-#define X86_GS CPU_RW(gs,0)
-
-#define X86_AL CPU_RB(eax,0)
-#define X86_BL CPU_RB(ebx,0)
-#define X86_CL CPU_RB(ecx,0)
-#define X86_DL CPU_RB(edx,0)
-
-#define X86_AH CPU_RB(eax,1)
-#define X86_BH CPU_RB(ebx,1)
-#define X86_CH CPU_RB(ecx,1)
-#define X86_DH CPU_RB(edx,1)
-
-#elif defined(_X86EMU)
-
-#include "xf86x86emu.h"
-
-#endif
-
-#endif
+/*
+ * Copyright (c) 2000-2001 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _INT10DEFINES_H_
+#define _INT10DEFINES_H_ 1
+
+#ifdef _VM86_LINUX
+
+#include <asm/vm86.h>
+
+#define CPU_R(type,name,num) \
+	(((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num])
+#define CPU_RD(name,num) CPU_R(CARD32,name,num)
+#define CPU_RW(name,num) CPU_R(CARD16,name,num)
+#define CPU_RB(name,num) CPU_R(CARD8,name,num)
+
+#define X86_EAX CPU_RD(eax,0)
+#define X86_EBX CPU_RD(ebx,0)
+#define X86_ECX CPU_RD(ecx,0)
+#define X86_EDX CPU_RD(edx,0)
+#define X86_ESI CPU_RD(esi,0)
+#define X86_EDI CPU_RD(edi,0)
+#define X86_EBP CPU_RD(ebp,0)
+#define X86_EIP CPU_RD(eip,0)
+#define X86_ESP CPU_RD(esp,0)
+#define X86_EFLAGS CPU_RD(eflags,0)
+
+#define X86_FLAGS CPU_RW(eflags,0)
+#define X86_AX CPU_RW(eax,0)
+#define X86_BX CPU_RW(ebx,0)
+#define X86_CX CPU_RW(ecx,0)
+#define X86_DX CPU_RW(edx,0)
+#define X86_SI CPU_RW(esi,0)
+#define X86_DI CPU_RW(edi,0)
+#define X86_BP CPU_RW(ebp,0)
+#define X86_IP CPU_RW(eip,0)
+#define X86_SP CPU_RW(esp,0)
+#define X86_CS CPU_RW(cs,0)
+#define X86_DS CPU_RW(ds,0)
+#define X86_ES CPU_RW(es,0)
+#define X86_SS CPU_RW(ss,0)
+#define X86_FS CPU_RW(fs,0)
+#define X86_GS CPU_RW(gs,0)
+
+#define X86_AL CPU_RB(eax,0)
+#define X86_BL CPU_RB(ebx,0)
+#define X86_CL CPU_RB(ecx,0)
+#define X86_DL CPU_RB(edx,0)
+
+#define X86_AH CPU_RB(eax,1)
+#define X86_BH CPU_RB(ebx,1)
+#define X86_CH CPU_RB(ecx,1)
+#define X86_DH CPU_RB(edx,1)
+
+#elif defined(_X86EMU)
+
+#include "xf86x86emu.h"
+
+#endif
+
+#endif
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
index fa58a72b6..8bca37524 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/linux.c
@@ -52,7 +52,6 @@ typedef struct {
     int highMem;
     char *base;
     char *base_high;
-    int screen;
     char *alloc;
 } linuxInt10Priv;
 
@@ -89,15 +88,16 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     memType cs;
     legacyVGARec vga;
     Bool videoBiosMapped = FALSE;
-
+    ScrnInfoPtr pScrn;
     if (int10Generation != serverGeneration) {
         counter = 0;
         int10Generation = serverGeneration;
     }
 
-    screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
+    pScrn = xf86FindScreenForEntity(entityIndex);
+    screen = pScrn->scrnIndex;
 
-    options = xf86HandleInt10Options(xf86Screens[screen], entityIndex);
+    options = xf86HandleInt10Options(pScrn, entityIndex);
 
     if (int10skip(options)) {
         free(options);
@@ -106,7 +106,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
 
 #if defined DoSubModules
     if (loadedSubModule == INT10_NOT_LOADED)
-        loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
+        loadedSubModule = int10LinuxLoadSubModule(pScrn);
 
     if (loadedSubModule == INT10_LOAD_FAILED)
         return NULL;
@@ -145,7 +145,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     }
 
     pInt = (xf86Int10InfoPtr) xnfcalloc(1, sizeof(xf86Int10InfoRec));
-    pInt->scrnIndex = screen;
+    pInt->pScrn = pScrn;
     pInt->entityIndex = entityIndex;
     pInt->dev = xf86GetPciInfoForEntity(entityIndex);
 
@@ -154,7 +154,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     pInt->mem = &linuxMem;
     pagesize = getpagesize();
     pInt->private = (pointer) xnfcalloc(1, sizeof(linuxInt10Priv));
-    ((linuxInt10Priv *) pInt->private)->screen = screen;
     ((linuxInt10Priv *) pInt->private)->alloc =
         (pointer) xnfcalloc(1, ALLOC_ENTRIES(pagesize));
 
@@ -333,28 +332,28 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
     addr =
         shmat(((linuxInt10Priv *) pInt->private)->lowMem, (char *) 1, SHM_RND);
     if (addr == SHMERRORPTR) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                    "shmat(low_mem) error: %s\n", strerror(errno));
         return FALSE;
     }
     if (mprotect((void *) 0, V_RAM, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                    "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
 
     if (((linuxInt10Priv *) pInt->private)->highMem >= 0) {
         addr = shmat(((linuxInt10Priv *) pInt->private)->highMem,
                      (char *) HIGH_MEM, 0);
         if (addr == SHMERRORPTR) {
-            xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                        "Cannot shmat() high memory\n");
-            xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                        "shmget error: %s\n", strerror(errno));
             return FALSE;
         }
         if (mprotect((void *) HIGH_MEM, HIGH_MEM_SIZE,
                      PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
-            xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                        "Cannot set EXEC bit on high memory: %s\n",
                        strerror(errno));
     }
@@ -364,13 +363,13 @@ MapCurrentInt10(xf86Int10InfoPtr pInt)
                      PROT_READ | PROT_WRITE | PROT_EXEC,
                      MAP_SHARED | MAP_FIXED, fd, V_BIOS)
                 == MAP_FAILED) {
-                xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
+                xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
                 close(fd);
                 return FALSE;
             }
         }
         else {
-            xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM);
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "Cannot open %s\n", DEV_MEM);
             return FALSE;
         }
         close(fd);
diff --git a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
index 8502b21b7..187698399 100644
--- a/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
+++ b/xorg-server/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
@@ -210,19 +210,19 @@ vm86_GP_fault(xf86Int10InfoPtr pInt)
         return FALSE;
 
     case 0x0f:
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                    "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS,
                    X86_EIP);
         goto op0ferr;
 
     default:
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown reason for exception\n");
 
  op0ferr:
         dump_registers(pInt);
         stack_trace(pInt);
         dump_code(pInt);
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "cannot continue\n");
         return FALSE;
     }                           /* end of switch() */
     return TRUE;
@@ -238,7 +238,7 @@ do_vm86(xf86Int10InfoPtr pInt)
     xf86InterceptSignals(NULL);
 
     if (signo >= 0) {
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                    "vm86() syscall generated signal %d.\n", signo);
         dump_registers(pInt);
         dump_code(pInt);
@@ -252,7 +252,7 @@ do_vm86(xf86Int10InfoPtr pInt)
             return 0;
         break;
     case VM86_STI:
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "vm86_sti :-((\n");
         dump_registers(pInt);
         dump_code(pInt);
         stack_trace(pInt);
@@ -260,7 +260,7 @@ do_vm86(xf86Int10InfoPtr pInt)
     case VM86_INTx:
         pInt->num = VM86_ARG(retval);
         if (!int_handler(pInt)) {
-            xf86DrvMsg(pInt->scrnIndex, X_ERROR,
+            xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR,
                        "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
             dump_registers(pInt);
             dump_code(pInt);
@@ -275,10 +275,10 @@ do_vm86(xf86Int10InfoPtr pInt)
          * we used to warn here and bail out - but now the sigio stuff
          * always fires signals at us. So we just ignore them for now.
          */
-        xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_WARNING, "received signal\n");
         return 0;
     default:
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
+        xf86DrvMsg(pInt->pScrn->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
                    VM86_ARG(retval), VM86_TYPE(retval));
         dump_registers(pInt);
         dump_code(pInt);
diff --git a/xorg-server/hw/xfree86/os-support/misc/Makefile.am b/xorg-server/hw/xfree86/os-support/misc/Makefile.am
index 4bd3fc3e1..db5e7cff0 100644
--- a/xorg-server/hw/xfree86/os-support/misc/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/misc/Makefile.am
@@ -1,12 +1,12 @@
-
-noinst_LTLIBRARIES = libmisc.la
-
-libmisc_la_SOURCES = SlowBcopy.c
-
-#AM_LDFLAGS = -r
-
-INCLUDES = $(XORG_INCS)
-
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
-
-EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS)
+
+noinst_LTLIBRARIES = libmisc.la
+
+libmisc_la_SOURCES = SlowBcopy.c
+
+#AM_LDFLAGS = -r
+
+INCLUDES = $(XORG_INCS)
+
+AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS)
diff --git a/xorg-server/hw/xfree86/os-support/solaris/Makefile.am b/xorg-server/hw/xfree86/os-support/solaris/Makefile.am
index 5163f4423..9f358a6ea 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/Makefile.am
+++ b/xorg-server/hw/xfree86/os-support/solaris/Makefile.am
@@ -1,37 +1,37 @@
-if SOLARIS_VT
-VTSW_SRC = sun_VTsw.c
-else
-VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
-endif
-
-if AGP
-AGP_SRC = sun_agp.c
-else
-AGP_SRC = $(srcdir)/../shared/agp_noop.c
-endif
-
-SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S
-DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il
-
-solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S
-	$(CPP) -P -DINLINE_ASM $(srcdir)/solaris-@SOLARIS_INOUT_ARCH@.S > $@
-
-noinst_LTLIBRARIES = libsolaris.la
-libsolaris_la_SOURCES = sun_init.c \
-	sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
-	$(srcdir)/../shared/kmod_noop.c \
-	$(srcdir)/../shared/posix_tty.c \
-	$(srcdir)/../shared/sigio.c \
-	$(srcdir)/../shared/vidmem.c \
-	$(VTSW_SRC)
-nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC)
-
-sdk_HEADERS =
-nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
-
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
-
-INCLUDES = $(XORG_INCS) 
-
-EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S \
-	apSolaris.shar sun_inout.s
+if SOLARIS_VT
+VTSW_SRC = sun_VTsw.c
+else
+VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
+endif
+
+if AGP
+AGP_SRC = sun_agp.c
+else
+AGP_SRC = $(srcdir)/../shared/agp_noop.c
+endif
+
+SOLARIS_INOUT_SRC = solaris-@SOLARIS_INOUT_ARCH@.S
+DISTCLEANFILES = solaris-@SOLARIS_INOUT_ARCH@.il
+
+solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S
+	$(CPP) -P -DINLINE_ASM $(srcdir)/solaris-@SOLARIS_INOUT_ARCH@.S > $@
+
+noinst_LTLIBRARIES = libsolaris.la
+libsolaris_la_SOURCES = sun_init.c \
+	sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
+	$(srcdir)/../shared/kmod_noop.c \
+	$(srcdir)/../shared/posix_tty.c \
+	$(srcdir)/../shared/sigio.c \
+	$(srcdir)/../shared/vidmem.c \
+	$(VTSW_SRC)
+nodist_libsolaris_la_SOURCES = $(SOLARIS_INOUT_SRC)
+
+sdk_HEADERS =
+nodist_sdk_HEADERS = solaris-@SOLARIS_INOUT_ARCH@.il
+
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(DIX_CFLAGS)
+
+INCLUDES = $(XORG_INCS) 
+
+EXTRA_DIST = solaris-amd64.S solaris-ia32.S solaris-sparcv8plus.S \
+	apSolaris.shar sun_inout.s
diff --git a/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar b/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar
index a3548f7b4..68f44029e 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar
+++ b/xorg-server/hw/xfree86/os-support/solaris/apSolaris.shar
@@ -1,806 +1,806 @@
-#!/bin/sh
-#
-# This is a shell archive.  Save it in a file, remove anything before
-# this line, and then unpack it by entering "sh file".  Note, it may
-# create directories; files and directories will be owned by you and
-# have default permissions.
-# Made on Sun Jun 25 20:24:59 CEST 2006 by Martin Bochnig at martux.org
-#
-# This archive contains:
-#
-#	./aperture
-#	
-#	./aperture/Makefile
-#	./aperture/Makefile.amd64
-#	./aperture/Makefile.sparcv9
-#	./aperture/README
-#	./aperture/aperture.c
-#	./aperture/aperture.conf
-#	./aperture/devlink.tab
-#
-echo c - ./aperture
-mkdir -p ./aperture > /dev/null 2>&1
-#
-echo x - ./aperture/Makefile
-sed 's/^X//' >./aperture/Makefile << 'END-of-./aperture/Makefile'
-X#
-X#   File: makefile for aperture Framebuffer Driver
-X# Author: Doug Anson (danson@lgc.com)
-X#   Date: 2/15/94
-X# Modified: David Holland (davidh@use.com)
-X#   Date: 2/23/94
-X#   - Changed name, and debugging structure
-X# Modified: Marc Aurele La France (tsi@xfree86.org)
-X#   Date: 2001.06.08
-X#   - SPARC support, cleanup and turf aptest.
-X#
-X# >>NOTE<< Have a look at Makefile.sparcv9 for  specifics.
-X#
-X# Modified: Martin Bochnig (martin@martux.org)
-X#   Date: 2006.06.24
-X#   - Slightly modified to also build on Solaris 10 and 11.
-X#   - amd64 64 bit kernel support
-X#   - cosmetical changes to also support sun4v, not only sun4u
-X#
-X# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics.
-X#
-X# GNU gcc compiler
-XCC=gcc
-XCFLGS=-fno-builtin -Wall -O3
-X
-X#
-X# SUNWspro compiler
-X#CC=/opt/SUNWspro/bin/cc
-X#CFLGS=-Xa -xnolib -xO3
-X
-X#
-X# Debug error reporting
-X#DEBUG_FLG=
-X#DEBUG_FLG=-DAPERTURE_DEBUG
-X
-X#
-X# Files and object declarations
-XKERNEL_FLGS=-D_KERNEL -DSUNDDI
-XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
-XCFILES= aperture.c
-XOBJS= aperture.o
-XDRIVER= aperture
-X
-X#
-X# Make rules
-Xall: $(DRIVER)
-X
-X$(DRIVER): $(OBJS)
-X	@if [ -f "Makefile.`isainfo -k`" ]; then \
-X		make -f Makefile.`isainfo -k` $(DRIVER); \
-X	else \
-X		rm -f $(DRIVER); \
-X		ld -r -o $(DRIVER) $(OBJS); \
-X	fi
-X
-Xinstall: $(DRIVER)
-X	@if [ -f "Makefile.`isainfo -k`" ]; then \
-X		make -f Makefile.`isainfo -k` install; \
-X	else \
-X		cp aperture.conf /kernel/drv; \
-X		cp $(DRIVER) /kernel/drv; \
-X	fi
-X
-Xadd_drv:
-X	@if [ -f "Makefile.`isainfo -k`" ]; then \
-X		make -f Makefile.`isainfo -k` add_drv; \
-X	else \
-X		add_drv aperture; \
-X	fi
-X
-Xclean:
-X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
-X
-X.SUFFIXES: .i
-X
-X.c.i:
-X	$(CC) -E $(CFLAGS) $*.c > $@
-X
-X.c.o:
-X	@if [ -f "Makefile.`isainfo -k`" ]; then \
-X		make -f Makefile.`isainfo -k` $@; \
-X	else \
-X		rm -f $@; \
-X		$(CC) -c $(CFLAGS) $*.c -o $@; \
-X	fi
-END-of-./aperture/Makefile
-echo x - ./aperture/Makefile.amd64
-sed 's/^X//' >./aperture/Makefile.amd64 << 'END-of-./aperture/Makefile.amd64'
-X#
-X#   File: Makefile for aperture Framebuffer Driver
-X# Author: Doug Anson (danson@lgc.com)
-X#   Date: 2/15/94
-X# Modified: David Holland (davidh@use.com)
-X#   Date: 2/23/94
-X#   - Changed name, and debugging structure
-X# Modified: Marc Aurele La France (tsi@xfree86.org)
-X#   Date: 2001.06.08
-X#   - SPARC support, cleanup and turf aptest.
-X# Modified: Martin Bochnig (martin@martux.org)
-X#   - amd64 64 bit kernel support, cosmetics and also
-X#     supporting sun4v (and arbitrary sparcv9) platforms
-X#     as well as SunOS 5.10 or higher now
-X#   - Changed name
-X#
-X
-X#
-X# GNU gcc compiler, version 3.2 or later
-X#
-XCC=gcc
-XCFLGS=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel
-X
-X#
-X# SUNWspro compiler (untested, might not properly work for amd64 here)
-X#CC=/opt/SUNWspro/bin/cc
-X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
-X
-X#
-X# Debug error reporting
-X#DEBUG_FLG=
-X#DEBUG_FLG=-DAPERTURE_DEBUG
-X
-X#
-X# Files and object declarations
-XKERNEL_FLGS=-D_KERNEL -DSUNDDI
-XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
-XCFILES= aperture.c
-XOBJS= aperture.o
-XDRIVER= aperture
-X
-X#
-X# Make rules
-Xall: $(DRIVER)
-X
-X$(DRIVER): $(OBJS)
-X	rm -f $(DRIVER)
-X	ld -r -o $(DRIVER) $(OBJS)
-X
-Xinstall: $(DRIVER)
-X	cp aperture.conf /kernel/drv
-X	cp $(DRIVER) /kernel/drv/amd64
-X
-Xadd_drv:
-X	add_drv aperture
-X
-Xclean:
-X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
-X
-X.SUFFIXES: .i
-X
-X.c.i:
-X	$(CC) -E $(CFLAGS) $*.c > $@
-END-of-./aperture/Makefile.amd64
-echo x - ./aperture/Makefile.sparcv9
-sed 's/^X//' >./aperture/Makefile.sparcv9 << 'END-of-./aperture/Makefile.sparcv9'
-X#
-X#   File: makefile for aperture Framebuffer Driver
-X# Author: Doug Anson (danson@lgc.com)
-X#   Date: 2/15/94
-X# Modified: David Holland (davidh@use.com)
-X#   Date: 2/23/94
-X#   - Changed name, and debugging structure
-X# Modified: Marc Aurele La France (tsi@xfree86.org)
-X#   Date: 2001.06.08
-X#   - SPARC support, cleanup and turf aptest.
-X# Modified: Martin Bochnig (martin@martux.org)
-X#   Date: 2006.06.24
-X#   - Changed name for generic sparcv9 support
-X#   - updated to better work with Solaris 10 and 11
-X#
-X
-X#
-X# GNU gcc compiler, version 3.2 or later
-X#
-XCC=gcc
-XCFLGS=-fno-builtin -Wall -O3 -m64
-X
-X#
-X# SUNWspro compiler
-X#CC=/opt/SUNWspro/bin/cc
-X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
-X
-X#
-X# Debug error reporting
-X#DEBUG_FLG=
-X#DEBUG_FLG=-DAPERTURE_DEBUG
-X
-X#
-X# Files and object declarations
-XKERNEL_FLGS=-D_KERNEL -DSUNDDI
-XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
-XCFILES= aperture.c
-XOBJS= aperture.o
-XDRIVER= aperture
-X
-X#
-X# Make rules
-Xall: $(DRIVER)
-X
-X$(DRIVER): $(OBJS)
-X	rm -f $(DRIVER)
-X	ld -r -o $(DRIVER) $(OBJS)
-X
-Xinstall: $(DRIVER)
-X	cp aperture.conf /kernel/drv
-X	cp $(DRIVER) /kernel/drv/sparcv9
-X
-Xadd_drv:
-X	add_drv aperture
-X
-Xclean:
-X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
-X
-X.SUFFIXES: .i
-X
-X.c.i:
-X	$(CC) -E $(CFLAGS) $*.c > $@
-END-of-./aperture/Makefile.sparcv9
-echo x - ./aperture/README
-sed 's/^X//' >./aperture/README << 'END-of-./aperture/README'
-XFramebuffer aperture driver.
-X
-XThis driver was written to provide a device that, unlike /dev/mem, allows
-Xmmap()'ing of ranges beyond installed memory.
-X
-XThe original x86-based version of this driver was the collaborative work of
-XDoug Anson (danson@lgc.com), and David Holland (davidh@use.com).  It has since
-Xbeen rewritten to also work on sparc machines and - later on - also on sparcv9 
-Xand recently amd64 64 bit kernels.
-XIt flawlessly compiles and installs on Solaris 10 and 11 now.
-X
-X
-XInstallation instructions:
-X
-X1) Check the Makefile, for appropriate CC, and CFLAGS definitions.  Compiling
-X   with APERTURE_DEBUG defined means the driver will generate reams of
-X   debugging output.  You'll probably want to leave this off...
-X
-X2) Type 'make' (or 'gmake').  Both the driver and test program should compile 
-X   without any problems. No warning messages should be generated.
-X
-X3) Become 'root'.
-X
-X4) Type 'make install' and 'make add_drv'.  The screen should look something
-X   like this:
-X
-X	# make install
-X	cp aperture aperture.conf /kernel/drv
-X	# make add_drv
-X	add_drv aperture
-X
-X   On a sparcv9 machine this will mention the /kernel/drv/sparcv9 directory
-X   instead of /kernel/drv. Similarily /kernel/drv/amd64 should be used on amd64.
-X
-X   This installs the driver to the system.
-X
-X5) While as root modify the file /etc/devlink.tab, adding these lines:
-X
-X# The following entry is for the framebuffer driver
-Xtype=ddi_pseudo;name=aperture	fbs/\M0
-X
-X   Add that line exactly as shown. You may also simply add the
-X   contents of the devlink.tab file supplied to /etc/devlink.tab.
-X   It contains the lines as well.  (Yes, that is a tab between
-X   aperture and fbs, not spaces - very important)
-X
-X6) Perform a reconfiguration boot of the system.
-X
-X	# touch /reconfigure
-X	# init 6
-X
-XBug reports, questions, suggestions, etc can be sent to xfree86@xfree86.org.
-END-of-./aperture/README
-echo x - ./aperture/aperture.c
-sed 's/^X//' >./aperture/aperture.c << 'END-of-./aperture/aperture.c'
-X/*
-X * Copyright (C) 2001 The XFree86 Project, Inc.  All Rights Reserved.
-X *
-X * Permission is hereby granted, free of charge, to any person obtaining a copy
-X * of this software and associated documentation files (the "Software"), to
-X * deal in the Software without restriction, including without limitation the
-X * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-X * sell copies of the Software, and to permit persons to whom the Software is
-X * furnished to do so, subject to the following conditions:
-X *
-X * The above copyright notice and this permission notice shall be included in
-X * all copies or substantial portions of the Software.
-X *
-X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-X * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-X * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-X * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-X *
-X * Except as contained in this notice, the name of the XFree86 Project shall
-X * not be used in advertising or otherwise to promote the sale, use or other
-X * dealings in this Software without prior written authorization from the
-X * XFree86 Project.
-X */
-X
-X/*
-X * Aperture driver for Solaris.
-X */
-X
-X/*
-X * Modified: Martin Bochnig (martin@martux.org)
-X * Log:      Commented out obsolete kernel interfaces DDI_IDENTIFIED and DDI_NOT_IDENTIFIED
-X *           not supported by SunOS 5.10 or higher anymore, 
-X *           see http://docs.sun.com/app/docs/doc/819-2255/6n4ibnffr?a=view
-X */
-X
-X#include <sys/conf.h>
-X#include <sys/ddi.h>
-X#include <sys/modctl.h>
-X#include <sys/open.h>
-X#include <sys/stat.h>
-X#include <sys/sunddi.h>
-X
-X#define DEV_IDENT  "aperture"
-X#define DEV_BANNER "XFree86 aperture driver"
-X
-X#ifndef D_64BIT
-X#define D_64BIT 0
-X#endif
-X
-X#ifndef NULL
-X#define NULL ((void *)0)
-X#endif
-X
-X/*
-X * open(9E)
-X */
-X/*ARGSUSED*/
-Xstatic int
-Xaperture_open
-X(
-X#ifdef __STDC__
-X	dev_t *devp,
-X	int flag,
-X	int typ,
-X	struct cred *cred
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_t *devp;
-X	int flag;
-X	int typ;
-X	struct cred *cred;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering open()\n");
-X
-X#endif
-X
-X	if ((typ != OTYP_CHR) || (getminor(*devp)))
-X		error = EINVAL;
-X	else
-X		error = 0;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving open() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * mmap(9E)
-X */
-X/*ARGSUSED*/
-Xstatic int
-Xaperture_mmap
-X(
-X#ifdef __STDC__
-X	dev_t dev,
-X	off_t off,
-X	int prot
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_t dev;
-X	off_t off;
-X	int prot;
-X#endif
-X{
-X	pfn_t pf;
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering mmap(0x%016lx)\n", off);
-X
-X#endif
-X
-X	pf = btop((unsigned long)off);
-X
-X	/* Deal with mmap(9E) interface limits */
-X	error = (int)pf;
-X	if ((error < 0) || (pf != (pfn_t)error))
-X		error = -1;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving mmap() = 0x%08lx", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-Xstatic struct cb_ops aperture_cb_ops =
-X{
-X	aperture_open,		/* open */
-X	nulldev,		/* close */
-X	nodev,			/* strategy */
-X	nodev,			/* print */
-X	nodev,			/* dump */
-X	nodev,			/* read */
-X	nodev,			/* write */
-X	nodev,			/* ioctl */
-X	nodev,			/* devmap */
-X	aperture_mmap,		/* mmap */
-X	ddi_segmap,		/* segmap */
-X	nochpoll,		/* poll */
-X	ddi_prop_op,		/* cb_prop_op */
-X	0,			/* streamtab  */
-X	D_NEW | D_MP | D_64BIT	/* Driver compatibility flag */
-X};
-X
-X
-Xstatic dev_info_t *aperture_dip;	/* private copy of devinfo pointer */
-X
-X/*
-X * getinfo(9E)
-X */
-X/*ARGSUSED*/
-Xstatic int
-Xaperture_getinfo
-X(
-X#ifdef __STDC__
-X	dev_info_t *dip,
-X	ddi_info_cmd_t infocmd,
-X	void *arg,
-X	void **result
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_info_t *dip;
-X	ddi_info_cmd_t infocmd;
-X	void *arg;
-X	void **result;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering getinfo()\n");
-X
-X#endif
-X
-X	switch (infocmd) {
-X	case DDI_INFO_DEVT2DEVINFO:
-X		*result = aperture_dip;
-X		error = DDI_SUCCESS;
-X		break;
-X	case DDI_INFO_DEVT2INSTANCE:
-X		*result = NULL;
-X		error = DDI_SUCCESS;
-X		break;
-X	default:
-X		error = DDI_FAILURE;
-X	}
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving getinfo() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * identify(9E)
-X */
-X/*ARGSUSED*/
-Xstatic int
-Xaperture_identify
-X(
-X#ifdef __STDC__
-X	dev_info_t *dip
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_info_t *dip;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering identify()\n");
-X
-X#endif
-X
-X	if (strcmp(ddi_get_name(dip), DEV_IDENT))
-X	  error = 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS 5.10 */ ;
-X	else
-X	  error = 2 /* DDI_IDENTIFIED obsolete since SunOS 5.10 */ ;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving identify() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * attach(9E)
-X */
-X/*ARGSUSED*/
-Xstatic int
-Xaperture_attach
-X(
-X#ifdef __STDC__
-X	dev_info_t *dip,
-X	ddi_attach_cmd_t cmd
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_info_t *dip;
-X	ddi_attach_cmd_t cmd;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering attach()\n");
-X
-X#endif
-X
-X	if (cmd != DDI_ATTACH)
-X	{
-X
-X#ifdef APERTURE_DEBUG
-X
-X		cmn_err(CE_CONT, DEV_IDENT ":  not attach(, DDI_ATTACH)\n");
-X
-X#endif
-X
-X		error = DDI_FAILURE;
-X	}
-X	else
-X	{
-X		error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
-X					      (minor_t)ddi_get_instance(dip),
-X					      NULL, 0 /* NODESPECIFIC_DEV obsolete since SunOS 5.10 */ );
-X
-X		if (error == DDI_SUCCESS)
-X		{
-X			aperture_dip = dip;
-X			ddi_report_dev(dip);
-X		}
-X	}
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving attach() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * detach(9E)
-X */
-Xstatic int
-Xaperture_detach
-X(
-X#ifdef __STDC__
-X	dev_info_t *dip,
-X	ddi_detach_cmd_t cmd
-X#endif
-X)
-X#ifndef __STDC__
-X	dev_info_t *dip;
-X	ddi_detach_cmd_t cmd;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering detach()\n");
-X
-X#endif
-X
-X	if (cmd != DDI_DETACH)
-X	{
-X		error = DDI_FAILURE;
-X	}
-X	else
-X	{
-X		ddi_remove_minor_node(dip, NULL);
-X		aperture_dip = NULL;
-X		error = DDI_SUCCESS;
-X	}
-X
-X#if APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving detach() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X
-Xstatic struct dev_ops aperture_ops =
-X{
-X	DEVO_REV,		/* revision */
-X	0,			/* refcnt  */
-X	aperture_getinfo,	/* getinfo */
-X	aperture_identify,	/* identify */
-X	nulldev,		/* probe */
-X	aperture_attach,	/* attach */
-X	aperture_detach,	/* detach */
-X	nodev,			/* reset */
-X	&aperture_cb_ops,	/* driver operations */
-X	NULL			/* bus operations */
-X};
-X
-X
-Xstatic struct modldrv modldrv =
-X{
-X	&mod_driverops,		/* mod_ops structure pointer */
-X	DEV_BANNER,		/* driver banner string */
-X	&aperture_ops,		/* dev_ops structure pointer */
-X};
-X
-X
-Xstatic struct modlinkage modlinkage =
-X{
-X	MODREV_1,		/* module API revision */
-X	{
-X		&modldrv,	/* module driver structure pointer */
-X		NULL		/* list termination */
-X	}
-X};
-X
-X
-X/*
-X * _init(9E)
-X */
-Xint
-X_init
-X(
-X#ifdef __STDC__
-X	void
-X#endif
-X)
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering _init()\n");
-X
-X#endif
-X
-X	error = mod_install(&modlinkage);
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _init() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * _info(9E)
-X */
-Xint
-X_info
-X(
-X#ifdef __STDC__
-X	struct modinfo *modinfop
-X#endif
-X)
-X#ifndef __STDC__
-X	struct modinfo *modinfop;
-X#endif
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering _info()\n");
-X
-X#endif
-X
-X	error = mod_info(&modlinkage, modinfop);
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _info() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-X
-X/*
-X * _fini(9E)
-X */
-Xint
-X_fini
-X(
-X#ifdef __STDC__
-X	void
-X#endif
-X)
-X{
-X	int error;
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  entering _fini()\n");
-X
-X#endif
-X
-X	error = mod_remove(&modlinkage);
-X
-X#ifdef APERTURE_DEBUG
-X
-X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _fini() = %d\n", error);
-X
-X#endif
-X
-X	return error;
-X}
-END-of-./aperture/aperture.c
-echo x - ./aperture/aperture.conf
-sed 's/^X//' >./aperture/aperture.conf << 'END-of-./aperture/aperture.conf'
-X#
-X# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com
-X#
-X# File:   aperture.conf
-X# Author: Doug Anson (danson@lgc.com)
-X# 
-X# Modified: David Holland (davidh@use.com)
-X# Log:	    Change comments		02/23/94
-X#	    Change defaults/comments	09/25/94
-X#
-X# Modified: Marc Aurele La France (tsi@xfree86.org)
-X# Log:      SPARC changes		2001.09
-X#
-X# Purpose:  This conf file is used by the aperture driver.
-X#
-Xname="aperture" parent="pseudo";
-END-of-./aperture/aperture.conf
-echo x - ./aperture/devlink.tab
-sed 's/^X//' >./aperture/devlink.tab << 'END-of-./aperture/devlink.tab'
-X# The following entry is for the aperture driver
-Xtype=ddi_pseudo;name=aperture	fbs/\M0
-END-of-./aperture/devlink.tab
-exit
-
+#!/bin/sh
+#
+# This is a shell archive.  Save it in a file, remove anything before
+# this line, and then unpack it by entering "sh file".  Note, it may
+# create directories; files and directories will be owned by you and
+# have default permissions.
+# Made on Sun Jun 25 20:24:59 CEST 2006 by Martin Bochnig at martux.org
+#
+# This archive contains:
+#
+#	./aperture
+#	
+#	./aperture/Makefile
+#	./aperture/Makefile.amd64
+#	./aperture/Makefile.sparcv9
+#	./aperture/README
+#	./aperture/aperture.c
+#	./aperture/aperture.conf
+#	./aperture/devlink.tab
+#
+echo c - ./aperture
+mkdir -p ./aperture > /dev/null 2>&1
+#
+echo x - ./aperture/Makefile
+sed 's/^X//' >./aperture/Makefile << 'END-of-./aperture/Makefile'
+X#
+X#   File: makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X#   Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X#   Date: 2/23/94
+X#   - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X#   Date: 2001.06.08
+X#   - SPARC support, cleanup and turf aptest.
+X#
+X# >>NOTE<< Have a look at Makefile.sparcv9 for  specifics.
+X#
+X# Modified: Martin Bochnig (martin@martux.org)
+X#   Date: 2006.06.24
+X#   - Slightly modified to also build on Solaris 10 and 11.
+X#   - amd64 64 bit kernel support
+X#   - cosmetical changes to also support sun4v, not only sun4u
+X#
+X# >>NOTE<< Have a look at Makefile.amd64 for amd64 specifics.
+X#
+X# GNU gcc compiler
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3
+X
+X#
+X# SUNWspro compiler
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` $(DRIVER); \
+X	else \
+X		rm -f $(DRIVER); \
+X		ld -r -o $(DRIVER) $(OBJS); \
+X	fi
+X
+Xinstall: $(DRIVER)
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` install; \
+X	else \
+X		cp aperture.conf /kernel/drv; \
+X		cp $(DRIVER) /kernel/drv; \
+X	fi
+X
+Xadd_drv:
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` add_drv; \
+X	else \
+X		add_drv aperture; \
+X	fi
+X
+Xclean:
+X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X	$(CC) -E $(CFLAGS) $*.c > $@
+X
+X.c.o:
+X	@if [ -f "Makefile.`isainfo -k`" ]; then \
+X		make -f Makefile.`isainfo -k` $@; \
+X	else \
+X		rm -f $@; \
+X		$(CC) -c $(CFLAGS) $*.c -o $@; \
+X	fi
+END-of-./aperture/Makefile
+echo x - ./aperture/Makefile.amd64
+sed 's/^X//' >./aperture/Makefile.amd64 << 'END-of-./aperture/Makefile.amd64'
+X#
+X#   File: Makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X#   Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X#   Date: 2/23/94
+X#   - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X#   Date: 2001.06.08
+X#   - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin@martux.org)
+X#   - amd64 64 bit kernel support, cosmetics and also
+X#     supporting sun4v (and arbitrary sparcv9) platforms
+X#     as well as SunOS 5.10 or higher now
+X#   - Changed name
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64 -mcmodel=kernel
+X
+X#
+X# SUNWspro compiler (untested, might not properly work for amd64 here)
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X	rm -f $(DRIVER)
+X	ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X	cp aperture.conf /kernel/drv
+X	cp $(DRIVER) /kernel/drv/amd64
+X
+Xadd_drv:
+X	add_drv aperture
+X
+Xclean:
+X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X	$(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.amd64
+echo x - ./aperture/Makefile.sparcv9
+sed 's/^X//' >./aperture/Makefile.sparcv9 << 'END-of-./aperture/Makefile.sparcv9'
+X#
+X#   File: makefile for aperture Framebuffer Driver
+X# Author: Doug Anson (danson@lgc.com)
+X#   Date: 2/15/94
+X# Modified: David Holland (davidh@use.com)
+X#   Date: 2/23/94
+X#   - Changed name, and debugging structure
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X#   Date: 2001.06.08
+X#   - SPARC support, cleanup and turf aptest.
+X# Modified: Martin Bochnig (martin@martux.org)
+X#   Date: 2006.06.24
+X#   - Changed name for generic sparcv9 support
+X#   - updated to better work with Solaris 10 and 11
+X#
+X
+X#
+X# GNU gcc compiler, version 3.2 or later
+X#
+XCC=gcc
+XCFLGS=-fno-builtin -Wall -O3 -m64
+X
+X#
+X# SUNWspro compiler
+X#CC=/opt/SUNWspro/bin/cc
+X#CFLGS=-Xa -xarch=v9 -xnolib -xO3
+X
+X#
+X# Debug error reporting
+X#DEBUG_FLG=
+X#DEBUG_FLG=-DAPERTURE_DEBUG
+X
+X#
+X# Files and object declarations
+XKERNEL_FLGS=-D_KERNEL -DSUNDDI
+XCFLAGS= $(CFLGS) $(KERNEL_FLGS) $(DEBUG_FLG)
+XCFILES= aperture.c
+XOBJS= aperture.o
+XDRIVER= aperture
+X
+X#
+X# Make rules
+Xall: $(DRIVER)
+X
+X$(DRIVER): $(OBJS)
+X	rm -f $(DRIVER)
+X	ld -r -o $(DRIVER) $(OBJS)
+X
+Xinstall: $(DRIVER)
+X	cp aperture.conf /kernel/drv
+X	cp $(DRIVER) /kernel/drv/sparcv9
+X
+Xadd_drv:
+X	add_drv aperture
+X
+Xclean:
+X	rm -f *% *.BAK $(OBJS) $(DRIVER) core
+X
+X.SUFFIXES: .i
+X
+X.c.i:
+X	$(CC) -E $(CFLAGS) $*.c > $@
+END-of-./aperture/Makefile.sparcv9
+echo x - ./aperture/README
+sed 's/^X//' >./aperture/README << 'END-of-./aperture/README'
+XFramebuffer aperture driver.
+X
+XThis driver was written to provide a device that, unlike /dev/mem, allows
+Xmmap()'ing of ranges beyond installed memory.
+X
+XThe original x86-based version of this driver was the collaborative work of
+XDoug Anson (danson@lgc.com), and David Holland (davidh@use.com).  It has since
+Xbeen rewritten to also work on sparc machines and - later on - also on sparcv9 
+Xand recently amd64 64 bit kernels.
+XIt flawlessly compiles and installs on Solaris 10 and 11 now.
+X
+X
+XInstallation instructions:
+X
+X1) Check the Makefile, for appropriate CC, and CFLAGS definitions.  Compiling
+X   with APERTURE_DEBUG defined means the driver will generate reams of
+X   debugging output.  You'll probably want to leave this off...
+X
+X2) Type 'make' (or 'gmake').  Both the driver and test program should compile 
+X   without any problems. No warning messages should be generated.
+X
+X3) Become 'root'.
+X
+X4) Type 'make install' and 'make add_drv'.  The screen should look something
+X   like this:
+X
+X	# make install
+X	cp aperture aperture.conf /kernel/drv
+X	# make add_drv
+X	add_drv aperture
+X
+X   On a sparcv9 machine this will mention the /kernel/drv/sparcv9 directory
+X   instead of /kernel/drv. Similarily /kernel/drv/amd64 should be used on amd64.
+X
+X   This installs the driver to the system.
+X
+X5) While as root modify the file /etc/devlink.tab, adding these lines:
+X
+X# The following entry is for the framebuffer driver
+Xtype=ddi_pseudo;name=aperture	fbs/\M0
+X
+X   Add that line exactly as shown. You may also simply add the
+X   contents of the devlink.tab file supplied to /etc/devlink.tab.
+X   It contains the lines as well.  (Yes, that is a tab between
+X   aperture and fbs, not spaces - very important)
+X
+X6) Perform a reconfiguration boot of the system.
+X
+X	# touch /reconfigure
+X	# init 6
+X
+XBug reports, questions, suggestions, etc can be sent to xfree86@xfree86.org.
+END-of-./aperture/README
+echo x - ./aperture/aperture.c
+sed 's/^X//' >./aperture/aperture.c << 'END-of-./aperture/aperture.c'
+X/*
+X * Copyright (C) 2001 The XFree86 Project, Inc.  All Rights Reserved.
+X *
+X * Permission is hereby granted, free of charge, to any person obtaining a copy
+X * of this software and associated documentation files (the "Software"), to
+X * deal in the Software without restriction, including without limitation the
+X * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+X * sell copies of the Software, and to permit persons to whom the Software is
+X * furnished to do so, subject to the following conditions:
+X *
+X * The above copyright notice and this permission notice shall be included in
+X * all copies or substantial portions of the Software.
+X *
+X * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+X * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+X * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+X * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+X * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+X *
+X * Except as contained in this notice, the name of the XFree86 Project shall
+X * not be used in advertising or otherwise to promote the sale, use or other
+X * dealings in this Software without prior written authorization from the
+X * XFree86 Project.
+X */
+X
+X/*
+X * Aperture driver for Solaris.
+X */
+X
+X/*
+X * Modified: Martin Bochnig (martin@martux.org)
+X * Log:      Commented out obsolete kernel interfaces DDI_IDENTIFIED and DDI_NOT_IDENTIFIED
+X *           not supported by SunOS 5.10 or higher anymore, 
+X *           see http://docs.sun.com/app/docs/doc/819-2255/6n4ibnffr?a=view
+X */
+X
+X#include <sys/conf.h>
+X#include <sys/ddi.h>
+X#include <sys/modctl.h>
+X#include <sys/open.h>
+X#include <sys/stat.h>
+X#include <sys/sunddi.h>
+X
+X#define DEV_IDENT  "aperture"
+X#define DEV_BANNER "XFree86 aperture driver"
+X
+X#ifndef D_64BIT
+X#define D_64BIT 0
+X#endif
+X
+X#ifndef NULL
+X#define NULL ((void *)0)
+X#endif
+X
+X/*
+X * open(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_open
+X(
+X#ifdef __STDC__
+X	dev_t *devp,
+X	int flag,
+X	int typ,
+X	struct cred *cred
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_t *devp;
+X	int flag;
+X	int typ;
+X	struct cred *cred;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering open()\n");
+X
+X#endif
+X
+X	if ((typ != OTYP_CHR) || (getminor(*devp)))
+X		error = EINVAL;
+X	else
+X		error = 0;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving open() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * mmap(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_mmap
+X(
+X#ifdef __STDC__
+X	dev_t dev,
+X	off_t off,
+X	int prot
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_t dev;
+X	off_t off;
+X	int prot;
+X#endif
+X{
+X	pfn_t pf;
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering mmap(0x%016lx)\n", off);
+X
+X#endif
+X
+X	pf = btop((unsigned long)off);
+X
+X	/* Deal with mmap(9E) interface limits */
+X	error = (int)pf;
+X	if ((error < 0) || (pf != (pfn_t)error))
+X		error = -1;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving mmap() = 0x%08lx", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+Xstatic struct cb_ops aperture_cb_ops =
+X{
+X	aperture_open,		/* open */
+X	nulldev,		/* close */
+X	nodev,			/* strategy */
+X	nodev,			/* print */
+X	nodev,			/* dump */
+X	nodev,			/* read */
+X	nodev,			/* write */
+X	nodev,			/* ioctl */
+X	nodev,			/* devmap */
+X	aperture_mmap,		/* mmap */
+X	ddi_segmap,		/* segmap */
+X	nochpoll,		/* poll */
+X	ddi_prop_op,		/* cb_prop_op */
+X	0,			/* streamtab  */
+X	D_NEW | D_MP | D_64BIT	/* Driver compatibility flag */
+X};
+X
+X
+Xstatic dev_info_t *aperture_dip;	/* private copy of devinfo pointer */
+X
+X/*
+X * getinfo(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_getinfo
+X(
+X#ifdef __STDC__
+X	dev_info_t *dip,
+X	ddi_info_cmd_t infocmd,
+X	void *arg,
+X	void **result
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_info_t *dip;
+X	ddi_info_cmd_t infocmd;
+X	void *arg;
+X	void **result;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering getinfo()\n");
+X
+X#endif
+X
+X	switch (infocmd) {
+X	case DDI_INFO_DEVT2DEVINFO:
+X		*result = aperture_dip;
+X		error = DDI_SUCCESS;
+X		break;
+X	case DDI_INFO_DEVT2INSTANCE:
+X		*result = NULL;
+X		error = DDI_SUCCESS;
+X		break;
+X	default:
+X		error = DDI_FAILURE;
+X	}
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving getinfo() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * identify(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_identify
+X(
+X#ifdef __STDC__
+X	dev_info_t *dip
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_info_t *dip;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering identify()\n");
+X
+X#endif
+X
+X	if (strcmp(ddi_get_name(dip), DEV_IDENT))
+X	  error = 1 /* DDI_NOT_IDENTIFIED obsolete since SunOS 5.10 */ ;
+X	else
+X	  error = 2 /* DDI_IDENTIFIED obsolete since SunOS 5.10 */ ;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving identify() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * attach(9E)
+X */
+X/*ARGSUSED*/
+Xstatic int
+Xaperture_attach
+X(
+X#ifdef __STDC__
+X	dev_info_t *dip,
+X	ddi_attach_cmd_t cmd
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_info_t *dip;
+X	ddi_attach_cmd_t cmd;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering attach()\n");
+X
+X#endif
+X
+X	if (cmd != DDI_ATTACH)
+X	{
+X
+X#ifdef APERTURE_DEBUG
+X
+X		cmn_err(CE_CONT, DEV_IDENT ":  not attach(, DDI_ATTACH)\n");
+X
+X#endif
+X
+X		error = DDI_FAILURE;
+X	}
+X	else
+X	{
+X		error = ddi_create_minor_node(dip, ddi_get_name(dip), S_IFCHR,
+X					      (minor_t)ddi_get_instance(dip),
+X					      NULL, 0 /* NODESPECIFIC_DEV obsolete since SunOS 5.10 */ );
+X
+X		if (error == DDI_SUCCESS)
+X		{
+X			aperture_dip = dip;
+X			ddi_report_dev(dip);
+X		}
+X	}
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving attach() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * detach(9E)
+X */
+Xstatic int
+Xaperture_detach
+X(
+X#ifdef __STDC__
+X	dev_info_t *dip,
+X	ddi_detach_cmd_t cmd
+X#endif
+X)
+X#ifndef __STDC__
+X	dev_info_t *dip;
+X	ddi_detach_cmd_t cmd;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering detach()\n");
+X
+X#endif
+X
+X	if (cmd != DDI_DETACH)
+X	{
+X		error = DDI_FAILURE;
+X	}
+X	else
+X	{
+X		ddi_remove_minor_node(dip, NULL);
+X		aperture_dip = NULL;
+X		error = DDI_SUCCESS;
+X	}
+X
+X#if APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving detach() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X
+Xstatic struct dev_ops aperture_ops =
+X{
+X	DEVO_REV,		/* revision */
+X	0,			/* refcnt  */
+X	aperture_getinfo,	/* getinfo */
+X	aperture_identify,	/* identify */
+X	nulldev,		/* probe */
+X	aperture_attach,	/* attach */
+X	aperture_detach,	/* detach */
+X	nodev,			/* reset */
+X	&aperture_cb_ops,	/* driver operations */
+X	NULL			/* bus operations */
+X};
+X
+X
+Xstatic struct modldrv modldrv =
+X{
+X	&mod_driverops,		/* mod_ops structure pointer */
+X	DEV_BANNER,		/* driver banner string */
+X	&aperture_ops,		/* dev_ops structure pointer */
+X};
+X
+X
+Xstatic struct modlinkage modlinkage =
+X{
+X	MODREV_1,		/* module API revision */
+X	{
+X		&modldrv,	/* module driver structure pointer */
+X		NULL		/* list termination */
+X	}
+X};
+X
+X
+X/*
+X * _init(9E)
+X */
+Xint
+X_init
+X(
+X#ifdef __STDC__
+X	void
+X#endif
+X)
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering _init()\n");
+X
+X#endif
+X
+X	error = mod_install(&modlinkage);
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _init() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * _info(9E)
+X */
+Xint
+X_info
+X(
+X#ifdef __STDC__
+X	struct modinfo *modinfop
+X#endif
+X)
+X#ifndef __STDC__
+X	struct modinfo *modinfop;
+X#endif
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering _info()\n");
+X
+X#endif
+X
+X	error = mod_info(&modlinkage, modinfop);
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _info() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+X
+X/*
+X * _fini(9E)
+X */
+Xint
+X_fini
+X(
+X#ifdef __STDC__
+X	void
+X#endif
+X)
+X{
+X	int error;
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  entering _fini()\n");
+X
+X#endif
+X
+X	error = mod_remove(&modlinkage);
+X
+X#ifdef APERTURE_DEBUG
+X
+X	cmn_err(CE_CONT, DEV_IDENT ":  leaving _fini() = %d\n", error);
+X
+X#endif
+X
+X	return error;
+X}
+END-of-./aperture/aperture.c
+echo x - ./aperture/aperture.conf
+sed 's/^X//' >./aperture/aperture.conf << 'END-of-./aperture/aperture.conf'
+X#
+X# Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com
+X#
+X# File:   aperture.conf
+X# Author: Doug Anson (danson@lgc.com)
+X# 
+X# Modified: David Holland (davidh@use.com)
+X# Log:	    Change comments		02/23/94
+X#	    Change defaults/comments	09/25/94
+X#
+X# Modified: Marc Aurele La France (tsi@xfree86.org)
+X# Log:      SPARC changes		2001.09
+X#
+X# Purpose:  This conf file is used by the aperture driver.
+X#
+Xname="aperture" parent="pseudo";
+END-of-./aperture/aperture.conf
+echo x - ./aperture/devlink.tab
+sed 's/^X//' >./aperture/devlink.tab << 'END-of-./aperture/devlink.tab'
+X# The following entry is for the aperture driver
+Xtype=ddi_pseudo;name=aperture	fbs/\M0
+END-of-./aperture/devlink.tab
+exit
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
index a371f9b66..4cc0642dd 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-amd64.S
@@ -1,67 +1,67 @@
-/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-/ 
-/ Permission is hereby granted, free of charge, to any person obtaining a
-/ copy of this software and associated documentation files (the "Software"),
-/ to deal in the Software without restriction, including without limitation
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ Software is furnished to do so, subject to the following conditions:
-/
-/ The above copyright notice and this permission notice (including the next
-/ paragraph) shall be included in all copies or substantial portions of the
-/ Software.
-/
-/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-/ DEALINGS IN THE SOFTWARE.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n)	.inline f,n
-#define FUNCTION_END(f)		.end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n)	ENTRY(f)
-#define FUNCTION_END(f)		ret; SET_SIZE(f)
-#endif
-
-	FUNCTION_START(inb,4)
-	movq	%rdi, %rdx
-	xorq    %rax, %rax
-	inb	(%dx)
-	FUNCTION_END(inb)
-
-	FUNCTION_START(inw,4)
-	movq	%rdi, %rdx
-	xorq    %rax, %rax
-	inw	(%dx)
-	FUNCTION_END(inw)
-
-	FUNCTION_START(inl,4)
-	movq	%rdi, %rdx
-	xorq    %rax, %rax
-	inl	(%dx)
-	FUNCTION_END(inl)
-
-	FUNCTION_START(outb,8)
-	movq	%rdi, %rdx
-	movq    %rsi, %rax
-	outb	(%dx)
-	FUNCTION_END(outb)
-
-	FUNCTION_START(outw,8)
-	movq	%rdi, %rdx
-	movq    %rsi, %rax
-	outw	(%dx)
-	FUNCTION_END(outw)
-
-	FUNCTION_START(outl,8)
-	movq	%rdi, %rdx
-	movq    %rsi, %rax
-	outl	(%dx)
-	FUNCTION_END(outl)
-
+/ Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+/ 
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the "Software"),
+/ to deal in the Software without restriction, including without limitation
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ Software is furnished to do so, subject to the following conditions:
+/
+/ The above copyright notice and this permission notice (including the next
+/ paragraph) shall be included in all copies or substantial portions of the
+/ Software.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/ DEALINGS IN THE SOFTWARE.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n)	.inline f,n
+#define FUNCTION_END(f)		.end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n)	ENTRY(f)
+#define FUNCTION_END(f)		ret; SET_SIZE(f)
+#endif
+
+	FUNCTION_START(inb,4)
+	movq	%rdi, %rdx
+	xorq    %rax, %rax
+	inb	(%dx)
+	FUNCTION_END(inb)
+
+	FUNCTION_START(inw,4)
+	movq	%rdi, %rdx
+	xorq    %rax, %rax
+	inw	(%dx)
+	FUNCTION_END(inw)
+
+	FUNCTION_START(inl,4)
+	movq	%rdi, %rdx
+	xorq    %rax, %rax
+	inl	(%dx)
+	FUNCTION_END(inl)
+
+	FUNCTION_START(outb,8)
+	movq	%rdi, %rdx
+	movq    %rsi, %rax
+	outb	(%dx)
+	FUNCTION_END(outb)
+
+	FUNCTION_START(outw,8)
+	movq	%rdi, %rdx
+	movq    %rsi, %rax
+	outw	(%dx)
+	FUNCTION_END(outw)
+
+	FUNCTION_START(outl,8)
+	movq	%rdi, %rdx
+	movq    %rsi, %rax
+	outl	(%dx)
+	FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
index 0068b06e4..74d787d31 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-ia32.S
@@ -1,67 +1,67 @@
-/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
-/ 
-/ Permission is hereby granted, free of charge, to any person obtaining a
-/ copy of this software and associated documentation files (the "Software"),
-/ to deal in the Software without restriction, including without limitation
-/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
-/ and/or sell copies of the Software, and to permit persons to whom the
-/ Software is furnished to do so, subject to the following conditions:
-/
-/ The above copyright notice and this permission notice (including the next
-/ paragraph) shall be included in all copies or substantial portions of the
-/ Software.
-/
-/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-/ DEALINGS IN THE SOFTWARE.
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n)	.inline f,n
-#define FUNCTION_END(f)		.end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n)	ENTRY(f)
-#define FUNCTION_END(f)		ret; SET_SIZE(f)
-#endif
-
-	FUNCTION_START(inb,4)
-	movl	(%esp), %edx
-	xorl    %eax, %eax
-	inb	(%dx)
-	FUNCTION_END(inb)
-
-	FUNCTION_START(inw,4)
-	movl	(%esp), %edx
-	xorl    %eax, %eax
-	inw	(%dx)
-	FUNCTION_END(inw)
-
-	FUNCTION_START(inl,4)
-	movl	(%esp), %edx
-	xorl    %eax, %eax
-	inl	(%dx)
-	FUNCTION_END(inl)
-
-	FUNCTION_START(outb,8)
-	movl	(%esp), %edx
-	movl    4(%esp), %eax
-	outb	(%dx)
-	FUNCTION_END(outb)
-
-	FUNCTION_START(outw,8)
-	movl	(%esp), %edx
-	movl    4(%esp), %eax
-	outw	(%dx)
-	FUNCTION_END(outw)
-
-	FUNCTION_START(outl,8)
-	movl	(%esp), %edx
-	movl    4(%esp), %eax
-	outl	(%dx)
-	FUNCTION_END(outl)
-
+/ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+/ 
+/ Permission is hereby granted, free of charge, to any person obtaining a
+/ copy of this software and associated documentation files (the "Software"),
+/ to deal in the Software without restriction, including without limitation
+/ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+/ and/or sell copies of the Software, and to permit persons to whom the
+/ Software is furnished to do so, subject to the following conditions:
+/
+/ The above copyright notice and this permission notice (including the next
+/ paragraph) shall be included in all copies or substantial portions of the
+/ Software.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+/ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+/ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+/ DEALINGS IN THE SOFTWARE.
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n)	.inline f,n
+#define FUNCTION_END(f)		.end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n)	ENTRY(f)
+#define FUNCTION_END(f)		ret; SET_SIZE(f)
+#endif
+
+	FUNCTION_START(inb,4)
+	movl	(%esp), %edx
+	xorl    %eax, %eax
+	inb	(%dx)
+	FUNCTION_END(inb)
+
+	FUNCTION_START(inw,4)
+	movl	(%esp), %edx
+	xorl    %eax, %eax
+	inw	(%dx)
+	FUNCTION_END(inw)
+
+	FUNCTION_START(inl,4)
+	movl	(%esp), %edx
+	xorl    %eax, %eax
+	inl	(%dx)
+	FUNCTION_END(inl)
+
+	FUNCTION_START(outb,8)
+	movl	(%esp), %edx
+	movl    4(%esp), %eax
+	outb	(%dx)
+	FUNCTION_END(outb)
+
+	FUNCTION_START(outw,8)
+	movl	(%esp), %edx
+	movl    4(%esp), %eax
+	outw	(%dx)
+	FUNCTION_END(outw)
+
+	FUNCTION_START(outl,8)
+	movl	(%esp), %edx
+	movl    4(%esp), %eax
+	outl	(%dx)
+	FUNCTION_END(outl)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
index 3bb8d241c..0ecafb352 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
+++ b/xorg-server/hw/xfree86/os-support/solaris/solaris-sparcv8plus.S
@@ -1,138 +1,138 @@
-/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifdef INLINE_ASM
-#define FUNCTION_START(f,n)	.inline f,n
-#define FUNCTION_END(f)		.end
-#else
-#define _ASM
-#include <sys/asm_linkage.h>
-#define FUNCTION_START(f,n)	ENTRY(f)
-#define FUNCTION_END(f)		retl; nop; SET_SIZE(f)
-#endif
-
-/* Converted from common/compiler.h gcc inline format to Sun cc inline
- * format by Kenjiro Tsuji	
- *	
- *	The value 0x88 means ASI_PRIMARY_LITTLE.
- *	The store or load to/from the address space will be done
- *	as little-endian. In the original xrog code, the value
- *	is defined as the macro ASI_PL.
- *
- *	In the original xorg code, "membar #StoreStore|#StoreLoad"
- *	is directly implemented as an instruction "0x8143e00a".
- *
- */
-
-	FUNCTION_START(outb, 0)
-	stba	%o1, [%o0] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(outb)
-
-	FUNCTION_START(outw, 0)
-	stha	%o1, [%o0] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(outw)
-
-	FUNCTION_START(outl, 0)
-	sta	%o1, [%o0] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(outl)
-
-	FUNCTION_START(inb, 0)
-	lduba	[%o0] 0x88, %o0
-	FUNCTION_END(inb)
-
-	FUNCTION_START(inw, 0)
-	lduha	[%o0] 0x88, %o0
-	FUNCTION_END(inw)
-
-	FUNCTION_START(inl, 0)
-	lda	[%o0] 0x88, %o0
-	FUNCTION_END(inl)
-
-	FUNCTION_START(xf86ReadMmio8, 0)
-	lduba	[%o0 + %o1] 0x88, %o0
-	FUNCTION_END(xf86ReadMmio8)
-
-	FUNCTION_START(xf86ReadMmio16Be, 0)
-	lduh	[%o0 + %o1], %o0
-	FUNCTION_END(xf86ReadMmio16Be)
-
-	FUNCTION_START(xf86ReadMmio16Le, 0)
-	lduha	[%o0 + %o1] 0x88, %o0
-	FUNCTION_END(xf86ReadMmio16Le)
-
-	FUNCTION_START(xf86ReadMmio32Be, 0)
-	ld	[%o0 + %o1], %o0
-	FUNCTION_END(xf86ReadMmio32Be)
-
-	FUNCTION_START(xf86ReadMmio32Le, 0)
-	lda	[%o0 + %o1] 0x88, %o0
-	FUNCTION_END(xf86ReadMmio32Le)
-
-	FUNCTION_START(xf86WriteMmio8, 0)
-	stba	%o2, [%o0 + %o1] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(xf86WriteMmio8)
-
-	FUNCTION_START(xf86WriteMmio16Be, 0)
-	sth	%o2, [%o0 + %o1]
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(xf86WriteMmio16Be)
-
-	FUNCTION_START(xf86WriteMmio16Le, 0)
-	stha	%o2, [%o0 + %o1] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(xf86WriteMmio16Le)
-
-	FUNCTION_START(xf86WriteMmio32Be, 0)
-	st	%o2, [%o0 + %o1]
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(xf86WriteMmio32Be)
-
-	FUNCTION_START(xf86WriteMmio32Le, 0)
-	sta	%o2, [%o0 + %o1] 0x88
-	membar	#StoreStore|#StoreLoad
-	FUNCTION_END(xf86WriteMmio32Le)
-
-	FUNCTION_START(xf86WriteMmio8NB, 0)
-	add	%o0, %o1, %o0
-	stba	%o2, [%o0] 0x88
-	FUNCTION_END(xf86WriteMmio8NB)
-
-	FUNCTION_START(xf86WriteMmio16BeNB, 0)
-	sth	%o2, [%o0 + %o1]
-	FUNCTION_END(xf86WriteMmio16BeNB)
-
-	FUNCTION_START(xf86WriteMmio16LeNB, 0)
-	stha	%o2, [%o0 + %o1] 0x88
-	FUNCTION_END(xf86WriteMmio16LeNB)
-
-	FUNCTION_START(xf86WriteMmio32BeNB, 0)
-	st	%o2, [%o0 + %o1]
-	FUNCTION_END(xf86WriteMmio32BeNB)
-
-	FUNCTION_START(xf86WriteMmio32LeNB, 0)
-	sta	%o2, [%o0 + %o1] 0x88
-	FUNCTION_END(xf86WriteMmio32LeNB)
-
+/* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef INLINE_ASM
+#define FUNCTION_START(f,n)	.inline f,n
+#define FUNCTION_END(f)		.end
+#else
+#define _ASM
+#include <sys/asm_linkage.h>
+#define FUNCTION_START(f,n)	ENTRY(f)
+#define FUNCTION_END(f)		retl; nop; SET_SIZE(f)
+#endif
+
+/* Converted from common/compiler.h gcc inline format to Sun cc inline
+ * format by Kenjiro Tsuji	
+ *	
+ *	The value 0x88 means ASI_PRIMARY_LITTLE.
+ *	The store or load to/from the address space will be done
+ *	as little-endian. In the original xrog code, the value
+ *	is defined as the macro ASI_PL.
+ *
+ *	In the original xorg code, "membar #StoreStore|#StoreLoad"
+ *	is directly implemented as an instruction "0x8143e00a".
+ *
+ */
+
+	FUNCTION_START(outb, 0)
+	stba	%o1, [%o0] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(outb)
+
+	FUNCTION_START(outw, 0)
+	stha	%o1, [%o0] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(outw)
+
+	FUNCTION_START(outl, 0)
+	sta	%o1, [%o0] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(outl)
+
+	FUNCTION_START(inb, 0)
+	lduba	[%o0] 0x88, %o0
+	FUNCTION_END(inb)
+
+	FUNCTION_START(inw, 0)
+	lduha	[%o0] 0x88, %o0
+	FUNCTION_END(inw)
+
+	FUNCTION_START(inl, 0)
+	lda	[%o0] 0x88, %o0
+	FUNCTION_END(inl)
+
+	FUNCTION_START(xf86ReadMmio8, 0)
+	lduba	[%o0 + %o1] 0x88, %o0
+	FUNCTION_END(xf86ReadMmio8)
+
+	FUNCTION_START(xf86ReadMmio16Be, 0)
+	lduh	[%o0 + %o1], %o0
+	FUNCTION_END(xf86ReadMmio16Be)
+
+	FUNCTION_START(xf86ReadMmio16Le, 0)
+	lduha	[%o0 + %o1] 0x88, %o0
+	FUNCTION_END(xf86ReadMmio16Le)
+
+	FUNCTION_START(xf86ReadMmio32Be, 0)
+	ld	[%o0 + %o1], %o0
+	FUNCTION_END(xf86ReadMmio32Be)
+
+	FUNCTION_START(xf86ReadMmio32Le, 0)
+	lda	[%o0 + %o1] 0x88, %o0
+	FUNCTION_END(xf86ReadMmio32Le)
+
+	FUNCTION_START(xf86WriteMmio8, 0)
+	stba	%o2, [%o0 + %o1] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(xf86WriteMmio8)
+
+	FUNCTION_START(xf86WriteMmio16Be, 0)
+	sth	%o2, [%o0 + %o1]
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(xf86WriteMmio16Be)
+
+	FUNCTION_START(xf86WriteMmio16Le, 0)
+	stha	%o2, [%o0 + %o1] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(xf86WriteMmio16Le)
+
+	FUNCTION_START(xf86WriteMmio32Be, 0)
+	st	%o2, [%o0 + %o1]
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(xf86WriteMmio32Be)
+
+	FUNCTION_START(xf86WriteMmio32Le, 0)
+	sta	%o2, [%o0 + %o1] 0x88
+	membar	#StoreStore|#StoreLoad
+	FUNCTION_END(xf86WriteMmio32Le)
+
+	FUNCTION_START(xf86WriteMmio8NB, 0)
+	add	%o0, %o1, %o0
+	stba	%o2, [%o0] 0x88
+	FUNCTION_END(xf86WriteMmio8NB)
+
+	FUNCTION_START(xf86WriteMmio16BeNB, 0)
+	sth	%o2, [%o0 + %o1]
+	FUNCTION_END(xf86WriteMmio16BeNB)
+
+	FUNCTION_START(xf86WriteMmio16LeNB, 0)
+	stha	%o2, [%o0 + %o1] 0x88
+	FUNCTION_END(xf86WriteMmio16LeNB)
+
+	FUNCTION_START(xf86WriteMmio32BeNB, 0)
+	st	%o2, [%o0 + %o1]
+	FUNCTION_END(xf86WriteMmio32BeNB)
+
+	FUNCTION_START(xf86WriteMmio32LeNB, 0)
+	sta	%o2, [%o0 + %o1] 0x88
+	FUNCTION_END(xf86WriteMmio32LeNB)
+
diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_inout.s b/xorg-server/hw/xfree86/os-support/solaris/sun_inout.s
index e8f03d0e8..c13ba8b2f 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/sun_inout.s
+++ b/xorg-server/hw/xfree86/os-support/solaris/sun_inout.s
@@ -1,124 +1,124 @@
-/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s,v 1.1 2001/05/28 02:42:31 tsi Exp $
-/
-/ Copyright 1994-2001 The XFree86 Project, Inc.  All Rights Reserved.
-/
-/ Permission is hereby granted, free of charge, to any person obtaining a copy
-/ of this software and associated documentation files (the "Software"), to deal
-/ in the Software without restriction, including without limitation the rights
-/ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-/ copies of the Software, and to permit persons to whom the Software is
-/ furnished to do so, subject to the following conditions:
-/
-/ The above copyright notice and this permission notice shall be included in
-/ all copies or substantial portions of the Software.
-/
-/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-/ XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-/ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-/ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-/
-/ Except as contained in this notice, the name of the XFree86 Project shall not
-/ be used in advertising or otherwise to promote the sale, use or other
-/ dealings in this Software without prior written authorization from the
-/ XFree86 Project.
-/
-/
-/ File: sun_inout.s
-/
-/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions
-/	   for Solaris x86 using the ProWorks compiler by SunPro
-/
-/ Author:  Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com)
-/	   Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com)
-/
-/ Synopsis: (c callable external declarations)
-/	   extern unsigned char inb(int port);
-/	   extern unsigned short inw(int port);
-/	   extern unsigned long inl(int port);
-/	   extern void outb(int port, unsigned char value);
-/	   extern void outw(int port, unsigned short value);
-/	   extern void outl(int port, unsigned long value);
-/
-
-.file "sunos_inout.s"
-.text
-
-.globl	inb
-.globl	inw
-.globl	inl
-.globl	outb
-.globl	outw
-.globl	outl
-
-/
-/ unsigned char inb(int port);
-/
-.align	4
-inb:
-	movl 4(%esp),%edx
-	subl %eax,%eax
-	inb  (%dx)
-	ret
-.type	inb,@function
-.size	inb,.-inb
-
-/
-/ unsigned short inw(int port);
-/
-.align	4
-inw:
-	movl 4(%esp),%edx
-	subl %eax,%eax
-	inw  (%dx)
-	ret
-.type	inw,@function
-.size	inw,.-inw
-
-/
-/ unsigned long inl(int port);
-/
-.align	4
-inl:
-	movl 4(%esp),%edx
-	inl  (%dx)
-	ret
-.type	inl,@function
-.size	inl,.-inl
-
-/
-/     void outb(int port, unsigned char value);
-/
-.align	4
-outb:
-	movl 4(%esp),%edx
-	movl 8(%esp),%eax
-	outb (%dx)
-	ret
-.type	outb,@function
-.size	outb,.-outb
-
-/
-/     void outw(int port, unsigned short value);
-/
-.align	4
-outw:
-	movl 4(%esp),%edx
-	movl 8(%esp),%eax
-	outw (%dx)
-	ret
-.type	outw,@function
-.size	outw,.-outw
-
-/
-/     void outl(int port, unsigned long value);
-/
-.align	4
-outl:
-	movl 4(%esp),%edx
-	movl 8(%esp),%eax
-	outl (%dx)
-	ret
-.type	outl,@function
-.size	outl,.-outl
+/ $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_inout.s,v 1.1 2001/05/28 02:42:31 tsi Exp $
+/
+/ Copyright 1994-2001 The XFree86 Project, Inc.  All Rights Reserved.
+/
+/ Permission is hereby granted, free of charge, to any person obtaining a copy
+/ of this software and associated documentation files (the "Software"), to deal
+/ in the Software without restriction, including without limitation the rights
+/ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/ copies of the Software, and to permit persons to whom the Software is
+/ furnished to do so, subject to the following conditions:
+/
+/ The above copyright notice and this permission notice shall be included in
+/ all copies or substantial portions of the Software.
+/
+/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+/ XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+/ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+/ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+/
+/ Except as contained in this notice, the name of the XFree86 Project shall not
+/ be used in advertising or otherwise to promote the sale, use or other
+/ dealings in this Software without prior written authorization from the
+/ XFree86 Project.
+/
+/
+/ File: sun_inout.s
+/
+/ Purpose: Provide inb(), inw(), inl(), outb(), outw(), outl() functions
+/	   for Solaris x86 using the ProWorks compiler by SunPro
+/
+/ Author:  Installed into XFree86 SuperProbe by Doug Anson (danson@lgc.com)
+/	   Portions donated to XFree86 by Steve Dever (Steve.Dever@Eng.Sun.Com)
+/
+/ Synopsis: (c callable external declarations)
+/	   extern unsigned char inb(int port);
+/	   extern unsigned short inw(int port);
+/	   extern unsigned long inl(int port);
+/	   extern void outb(int port, unsigned char value);
+/	   extern void outw(int port, unsigned short value);
+/	   extern void outl(int port, unsigned long value);
+/
+
+.file "sunos_inout.s"
+.text
+
+.globl	inb
+.globl	inw
+.globl	inl
+.globl	outb
+.globl	outw
+.globl	outl
+
+/
+/ unsigned char inb(int port);
+/
+.align	4
+inb:
+	movl 4(%esp),%edx
+	subl %eax,%eax
+	inb  (%dx)
+	ret
+.type	inb,@function
+.size	inb,.-inb
+
+/
+/ unsigned short inw(int port);
+/
+.align	4
+inw:
+	movl 4(%esp),%edx
+	subl %eax,%eax
+	inw  (%dx)
+	ret
+.type	inw,@function
+.size	inw,.-inw
+
+/
+/ unsigned long inl(int port);
+/
+.align	4
+inl:
+	movl 4(%esp),%edx
+	inl  (%dx)
+	ret
+.type	inl,@function
+.size	inl,.-inl
+
+/
+/     void outb(int port, unsigned char value);
+/
+.align	4
+outb:
+	movl 4(%esp),%edx
+	movl 8(%esp),%eax
+	outb (%dx)
+	ret
+.type	outb,@function
+.size	outb,.-outb
+
+/
+/     void outw(int port, unsigned short value);
+/
+.align	4
+outw:
+	movl 4(%esp),%edx
+	movl 8(%esp),%eax
+	outw (%dx)
+	ret
+.type	outw,@function
+.size	outw,.-outw
+
+/
+/     void outl(int port, unsigned long value);
+/
+.align	4
+outl:
+	movl 4(%esp),%edx
+	movl 8(%esp),%eax
+	outl (%dx)
+	ret
+.type	outl,@function
+.size	outl,.-outl
diff --git a/xorg-server/hw/xfree86/ramdac/.gitignore b/xorg-server/hw/xfree86/ramdac/.gitignore
new file mode 100644
index 000000000..9074a4300
--- /dev/null
+++ b/xorg-server/hw/xfree86/ramdac/.gitignore
@@ -0,0 +1,2 @@
+#		Add & Override for this directory and it's subdirectories
+xf86BitOrder.c
diff --git a/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES
index 726e2edc1..a0ecd02ae 100644
--- a/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES
+++ b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES
@@ -1,191 +1,191 @@
-			CURSOR.NOTES
-
-  This file describes how to add hardware cursor support to a chipset
-driver.  Though the cursor support itself is in the ramdac module,
-cursor management is separate from the rest of the module.
-
-
-1) CURSOR INITIALIZATION AND SHUTDOWN
-
-   All relevant prototypes and defines are in xf86Cursor.h.
-
-  To initialize the cursor, the driver should allocate an 
-xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described 
-later in this  document and pass it to xf86InitCursor().  xf86InitCursor() 
-must be called _after_ the software cursor initialization (usually
-miDCInitialize).
-
-   When shutting down, the driver should free the xf86CursorInfoRec
-structure in its CloseScreen function via xf86DestroyCursorInfoRec().
-
-
-2) FILLING OUT THE xf86CursorInfoRec
-
-   The driver informs the ramdac module of it's hardware cursor capablities by
-filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor().
-The xf86CursorInfoRec contains the following function pointers:
-
-
-/**** These functions are required ****/
-
-void ShowCursor(ScrnInfoPtr pScrn)
-
-    ShowCursor should display the current cursor.
-
-void HideCursor(ScrnInfoPtr pScrn)
-
-    HideCursor should hide the current cursor.
-
-void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
-
-    Set the cursor position to (x,y).  X and/or y may be negative
-    indicating that the cursor image is partially offscreen on
-    the left and/or top edges of the screen.  It is up to the
-    driver to trap for this and deal with that situation.
-
-void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
-
-    Set the cursor foreground and background colors.  In 8bpp, fg and
-    bg are indicies into the current colormap unless the 
-    HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set.  In that case
-    and in all other bpps the fg and bg are in 8-8-8 RGB format.
-    
-void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
-
-    LoadCursorImage is how the hardware cursor bits computed by the
-    RealizeCursor function will be passed to the driver when the cursor
-    shape needs to be changed.
-
-
-/**** These functions are optional ****/
-
-    
-unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) 
-
-    If RealizeCursor is not provided by the driver, one will be provided
-    for you based on the Flags field described below.  The driver must
-    provide this function if the hardware cursor format is not one of
-    the common ones supported by this module.
-  
-
-Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
-
-    If the driver is unable to use a hardware cursor for reasons
-    other than the cursor being larger than the maximum specified
-    in the MaxWidth or MaxHeight field below, it can supply the
-    UseHWCursor function.  If UseHWCursor is provided by the driver,
-    it will be called whenever the cursor shape changes or the video
-    mode changes.  This is useful for when the hardware cursor cannot
-    be used in interlaced or doublescan modes.
-
-
-/**** The following fields are required ****/
-
-MaxWidth
-MaxHeight
-
-    These indicate the largest sized cursor that can be a hardware
-    cursor.  It will fall back to a software cursor when a cursor
-    exceeding this size needs to be used.
-
-
-Flags
-
-   /* Color related flags */
-
-   HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
-
-   This indicates that the colors passed to the SetCursorColors
-   function should not be in 8-8-8 RGB format in 8bpp but rather,
-   they should be the pixel values from the current colormap.
-
-
-   /* Cursor data loading flags */
-
-   HARDWARE_CURSOR_SHOW_TRANSPARENT
-
-   The HideCursor entry will normally be called instead of displaying a
-   completely transparent cursor, or when a switch to a software cursor
-   needs to occur.  This flag prevents this behaviour, thus causing the
-   LoadCursorImage entry to be called with transparent cursor data.
-   NOTE:  If you use this flag and provide your own RealizeCursor() entry,
-          ensure this entry returns transparent cursor data when called
-          with a NULL pCurs parameter.
-
-   HARDWARE_CURSOR_UPDATE_UNHIDDEN
-
-   This flag prevents the HideCursor call that would normally occur just before
-   the LoadCursorImage entry is to be called to load a new hardware cursor
-   image.
-
-
-   /* Cursor data packing flags */
-
-   Hardware cursor data consists of two pieces, a source and a mask.
-   The mask is a bitmap indicating which parts of the cursor are 
-   transparent and which parts are drawn.  The source is a bitmap
-   indicating which parts of the non-transparent portion of the the
-   cursor should be painted in the foreground color and which should
-   be painted in the background color.
-
-   HARDWARE_CURSOR_INVERT_MASK
-
-   By default, set bits indicate the opaque part of the mask bitmap
-   and clear bits indicate the transparent part.  If your hardware
-   wants this the opposite way, this flag will invert the mask.
-
-   HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK
-
-   By default, RealizeCursor will store the source first and then
-   the mask.  If the hardware needs this order reversed then this
-   flag should be set.
-
-   HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
-
-   This flag will have the module logical AND the source with the mask to make  
-   sure there are no source bits set if the corresponding mask bits 
-   aren't set.  Some hardware will not care if source bits are set where
-   there are supposed to be transparent areas, but some hardware will
-   interpret this as a third cursor color or similar.  That type of
-   hardware will need this flag set.
-
-   HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
-
-   By default, it is assumed that the least significant bit in each byte
-   corresponds to the leftmost pixel on the screen.  If your hardware
-   has this reversed you should set this flag.
-
-   HARDWARE_CURSOR_NIBBLE_SWAPPED
-
-   If your hardware requires byte swapping of the hardware cursor, enable
-   this option.
-
-
-   /* Source-Mask interleaving flags */
-
-   By default the source and mask data are inlined (source first unless
-   the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set).  Some hardware
-   will require the source and mask to be interleaved, that is, X number
-   of source bits should packed and then X number of mask bits repeating
-   until the entire pattern is stored.  The following flags describe the
-   bit interleave.
-
-   HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED   
-
-   This one is the default.
- 
-   The following are for interleaved cursors.
-    
-   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1        
-   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8        
-   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16       
-   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32       
-   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64   
-
-   And once again, if your hardware requires something different than
-   these packing styles, your driver can supply its own RealizeCursor
-   function.   
-
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $
+			CURSOR.NOTES
+
+  This file describes how to add hardware cursor support to a chipset
+driver.  Though the cursor support itself is in the ramdac module,
+cursor management is separate from the rest of the module.
+
+
+1) CURSOR INITIALIZATION AND SHUTDOWN
+
+   All relevant prototypes and defines are in xf86Cursor.h.
+
+  To initialize the cursor, the driver should allocate an 
+xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described 
+later in this  document and pass it to xf86InitCursor().  xf86InitCursor() 
+must be called _after_ the software cursor initialization (usually
+miDCInitialize).
+
+   When shutting down, the driver should free the xf86CursorInfoRec
+structure in its CloseScreen function via xf86DestroyCursorInfoRec().
+
+
+2) FILLING OUT THE xf86CursorInfoRec
+
+   The driver informs the ramdac module of it's hardware cursor capablities by
+filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor().
+The xf86CursorInfoRec contains the following function pointers:
+
+
+/**** These functions are required ****/
+
+void ShowCursor(ScrnInfoPtr pScrn)
+
+    ShowCursor should display the current cursor.
+
+void HideCursor(ScrnInfoPtr pScrn)
+
+    HideCursor should hide the current cursor.
+
+void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+
+    Set the cursor position to (x,y).  X and/or y may be negative
+    indicating that the cursor image is partially offscreen on
+    the left and/or top edges of the screen.  It is up to the
+    driver to trap for this and deal with that situation.
+
+void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+
+    Set the cursor foreground and background colors.  In 8bpp, fg and
+    bg are indicies into the current colormap unless the 
+    HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set.  In that case
+    and in all other bpps the fg and bg are in 8-8-8 RGB format.
+    
+void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
+
+    LoadCursorImage is how the hardware cursor bits computed by the
+    RealizeCursor function will be passed to the driver when the cursor
+    shape needs to be changed.
+
+
+/**** These functions are optional ****/
+
+    
+unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) 
+
+    If RealizeCursor is not provided by the driver, one will be provided
+    for you based on the Flags field described below.  The driver must
+    provide this function if the hardware cursor format is not one of
+    the common ones supported by this module.
+  
+
+Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
+
+    If the driver is unable to use a hardware cursor for reasons
+    other than the cursor being larger than the maximum specified
+    in the MaxWidth or MaxHeight field below, it can supply the
+    UseHWCursor function.  If UseHWCursor is provided by the driver,
+    it will be called whenever the cursor shape changes or the video
+    mode changes.  This is useful for when the hardware cursor cannot
+    be used in interlaced or doublescan modes.
+
+
+/**** The following fields are required ****/
+
+MaxWidth
+MaxHeight
+
+    These indicate the largest sized cursor that can be a hardware
+    cursor.  It will fall back to a software cursor when a cursor
+    exceeding this size needs to be used.
+
+
+Flags
+
+   /* Color related flags */
+
+   HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
+
+   This indicates that the colors passed to the SetCursorColors
+   function should not be in 8-8-8 RGB format in 8bpp but rather,
+   they should be the pixel values from the current colormap.
+
+
+   /* Cursor data loading flags */
+
+   HARDWARE_CURSOR_SHOW_TRANSPARENT
+
+   The HideCursor entry will normally be called instead of displaying a
+   completely transparent cursor, or when a switch to a software cursor
+   needs to occur.  This flag prevents this behaviour, thus causing the
+   LoadCursorImage entry to be called with transparent cursor data.
+   NOTE:  If you use this flag and provide your own RealizeCursor() entry,
+          ensure this entry returns transparent cursor data when called
+          with a NULL pCurs parameter.
+
+   HARDWARE_CURSOR_UPDATE_UNHIDDEN
+
+   This flag prevents the HideCursor call that would normally occur just before
+   the LoadCursorImage entry is to be called to load a new hardware cursor
+   image.
+
+
+   /* Cursor data packing flags */
+
+   Hardware cursor data consists of two pieces, a source and a mask.
+   The mask is a bitmap indicating which parts of the cursor are 
+   transparent and which parts are drawn.  The source is a bitmap
+   indicating which parts of the non-transparent portion of the the
+   cursor should be painted in the foreground color and which should
+   be painted in the background color.
+
+   HARDWARE_CURSOR_INVERT_MASK
+
+   By default, set bits indicate the opaque part of the mask bitmap
+   and clear bits indicate the transparent part.  If your hardware
+   wants this the opposite way, this flag will invert the mask.
+
+   HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK
+
+   By default, RealizeCursor will store the source first and then
+   the mask.  If the hardware needs this order reversed then this
+   flag should be set.
+
+   HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+
+   This flag will have the module logical AND the source with the mask to make  
+   sure there are no source bits set if the corresponding mask bits 
+   aren't set.  Some hardware will not care if source bits are set where
+   there are supposed to be transparent areas, but some hardware will
+   interpret this as a third cursor color or similar.  That type of
+   hardware will need this flag set.
+
+   HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+
+   By default, it is assumed that the least significant bit in each byte
+   corresponds to the leftmost pixel on the screen.  If your hardware
+   has this reversed you should set this flag.
+
+   HARDWARE_CURSOR_NIBBLE_SWAPPED
+
+   If your hardware requires byte swapping of the hardware cursor, enable
+   this option.
+
+
+   /* Source-Mask interleaving flags */
+
+   By default the source and mask data are inlined (source first unless
+   the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set).  Some hardware
+   will require the source and mask to be interleaved, that is, X number
+   of source bits should packed and then X number of mask bits repeating
+   until the entire pattern is stored.  The following flags describe the
+   bit interleave.
+
+   HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED   
+
+   This one is the default.
+ 
+   The following are for interleaved cursors.
+    
+   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1        
+   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8        
+   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16       
+   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32       
+   HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64   
+
+   And once again, if your hardware requires something different than
+   these packing styles, your driver can supply its own RealizeCursor
+   function.   
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.am b/xorg-server/hw/xfree86/ramdac/Makefile.am
index e6f8ed552..3c3780516 100644
--- a/xorg-server/hw/xfree86/ramdac/Makefile.am
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.am
@@ -1,19 +1,19 @@
-noinst_LTLIBRARIES = libramdac.la
-
-libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
-                      xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
-		      xf86BitOrder.c
-
-sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
-
-DISTCLEANFILES = xf86BitOrder.c
-EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
-	CURSOR.NOTES
-
-AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
-            $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS)
-
-xf86BitOrder.c:
-	$(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
-	$(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
+noinst_LTLIBRARIES = libramdac.la
+
+libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
+                      xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
+		      xf86BitOrder.c
+
+sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
+
+DISTCLEANFILES = xf86BitOrder.c
+EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
+	CURSOR.NOTES
+
+AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
+            $(DIX_CFLAGS) $(XORG_CFLAGS)
+INCLUDES = $(XORG_INCS)
+
+xf86BitOrder.c:
+	$(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
+	$(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
index 7fd70fc34..15e2ada78 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
@@ -43,14 +43,14 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
 static void xf86CursorInstallColormap(ColormapPtr);
 static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr,
                                     Bool);
-static Bool xf86CursorCloseScreen(int, ScreenPtr);
+static Bool xf86CursorCloseScreen(ScreenPtr);
 static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
                                     ScreenPtr);
 
 /* ScrnInfoRec functions */
 
-static void xf86CursorEnableDisableFBAccess(int, Bool);
-static Bool xf86CursorSwitchMode(int, DisplayModePtr, int);
+static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool);
+static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr);
 
 Bool
 xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
@@ -118,7 +118,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
 /***** Screen functions *****/
 
 static Bool
-xf86CursorCloseScreen(int i, ScreenPtr pScreen)
+xf86CursorCloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     miPointerScreenPtr PointPriv =
@@ -149,7 +149,7 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen)
     free(ScreenPriv->transparentData);
     free(ScreenPriv);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static void
@@ -203,11 +203,11 @@ xf86CursorRecolorCursor(DeviceIntPtr pDev,
 /***** ScrnInfoRec functions *********/
 
 static void
-xf86CursorEnableDisableFBAccess(int index, Bool enable)
+xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
 {
     DeviceIntPtr pDev = inputInfo.pointer;
 
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     xf86CursorScreenPtr ScreenPriv =
         (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                xf86CursorScreenKey);
@@ -223,7 +223,7 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable)
     }
 
     if (ScreenPriv->EnableDisableFBAccess)
-        (*ScreenPriv->EnableDisableFBAccess) (index, enable);
+        (*ScreenPriv->EnableDisableFBAccess) (pScrn, enable);
 
     if (enable && ScreenPriv->SavedCursor) {
         /*
@@ -237,10 +237,10 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable)
 }
 
 static Bool
-xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
+xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
     Bool ret;
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     xf86CursorScreenPtr ScreenPriv =
         (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                                xf86CursorScreenKey);
@@ -250,7 +250,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
         ScreenPriv->isUp = FALSE;
     }
 
-    ret = (*ScreenPriv->SwitchMode) (index, mode, flags);
+    ret = (*ScreenPriv->SwitchMode) (pScrn, mode);
 
     /*
      * Cannot restore cursor here because the new frame[XY][01] haven't been
diff --git a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
index 062b2eb7c..d04f93207 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -26,7 +26,7 @@ typedef struct {
     miPointerSpriteFuncPtr spriteFuncs;
     Bool PalettedCursor;
     ColormapPtr pInstalledMap;
-    Bool (*SwitchMode) (int, DisplayModePtr, int);
+    Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr);
     xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
     CursorPtr SavedCursor;
 
diff --git a/xorg-server/hw/xfree86/shadowfb/shadow.c b/xorg-server/hw/xfree86/shadowfb/shadow.c
index 5aeee6cbf..614501770 100644
--- a/xorg-server/hw/xfree86/shadowfb/shadow.c
+++ b/xorg-server/hw/xfree86/shadowfb/shadow.c
@@ -28,13 +28,13 @@
 
 #include "picturestr.h"
 
-static Bool ShadowCloseScreen(int i, ScreenPtr pScreen);
+static Bool ShadowCloseScreen(ScreenPtr pScreen);
 static void ShadowCopyWindow(WindowPtr pWin,
                              DDXPointRec ptOldOrg, RegionPtr prgn);
 static Bool ShadowCreateGC(GCPtr pGC);
 
-static Bool ShadowEnterVT(int index, int flags);
-static void ShadowLeaveVT(int index, int flags);
+static Bool ShadowEnterVT(ScrnInfoPtr pScrn);
+static void ShadowLeaveVT(ScrnInfoPtr pScrn);
 
 static void ShadowComposite(CARD8 op,
                             PicturePtr pSrc,
@@ -56,8 +56,8 @@ typedef struct {
     CreateGCProcPtr CreateGC;
     ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
     CompositeProcPtr Composite;
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
+    Bool (*EnterVT) (ScrnInfoPtr);
+    void (*LeaveVT) (ScrnInfoPtr);
     Bool vtSema;
 } ShadowScreenRec, *ShadowScreenPtr;
 
@@ -192,14 +192,13 @@ ShadowFBInit(ScreenPtr pScreen, RefreshAreaFuncPtr refreshArea)
 /**********************************************************/
 
 static Bool
-ShadowEnterVT(int index, int flags)
+ShadowEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
     Bool ret;
     ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
 
     pScrn->EnterVT = pPriv->EnterVT;
-    ret = (*pPriv->EnterVT) (index, flags);
+    ret = (*pPriv->EnterVT) (pScrn);
     pPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = ShadowEnterVT;
     if (ret) {
@@ -211,15 +210,14 @@ ShadowEnterVT(int index, int flags)
 }
 
 static void
-ShadowLeaveVT(int index, int flags)
+ShadowLeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(xf86Screens[index]->pScreen);
+    ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScrn->pScreen);
 
     pPriv->vtSema = FALSE;
 
     pScrn->LeaveVT = pPriv->LeaveVT;
-    (*pPriv->LeaveVT) (index, flags);
+    (*pPriv->LeaveVT) (pScrn);
     pPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = ShadowLeaveVT;
 }
@@ -227,7 +225,7 @@ ShadowLeaveVT(int index, int flags)
 /**********************************************************/
 
 static Bool
-ShadowCloseScreen(int i, ScreenPtr pScreen)
+ShadowCloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pScreen);
@@ -247,7 +245,7 @@ ShadowCloseScreen(int i, ScreenPtr pScreen)
 
     free((pointer) pPriv);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static void
diff --git a/xorg-server/hw/xfree86/utils/cvt/.gitignore b/xorg-server/hw/xfree86/utils/cvt/.gitignore
new file mode 100644
index 000000000..a217c5563
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/cvt/.gitignore
@@ -0,0 +1 @@
+cvt
diff --git a/xorg-server/hw/xfree86/utils/gtf/.gitignore b/xorg-server/hw/xfree86/utils/gtf/.gitignore
new file mode 100644
index 000000000..919c993fb
--- /dev/null
+++ b/xorg-server/hw/xfree86/utils/gtf/.gitignore
@@ -0,0 +1 @@
+gtf
diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c
index bbb60e3a1..97a9bcf60 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.c
+++ b/xorg-server/hw/xfree86/vbe/vbe.c
@@ -179,7 +179,7 @@ static Bool
 vbeProbeDDC(vbeInfoPtr pVbe)
 {
     const char *ddc_level;
-    int screen = pVbe->pInt10->scrnIndex;
+    int screen = pVbe->pInt10->pScrn->scrnIndex;
 
     if (pVbe->ddc == DDC_NONE)
         return FALSE;
@@ -262,7 +262,8 @@ vbeReadEDID(vbeInfoPtr pVbe)
     unsigned char *tmp = NULL;
     Bool novbe = FALSE;
     Bool noddc = FALSE;
-    int screen = pVbe->pInt10->scrnIndex;
+    ScrnInfoPtr pScrn = pVbe->pInt10->pScrn;
+    int screen = pScrn->scrnIndex;
     OptionInfoPtr options;
 
     if (!page)
@@ -270,7 +271,7 @@ vbeReadEDID(vbeInfoPtr pVbe)
 
     options = xnfalloc(sizeof(VBEOptions));
     (void) memcpy(options, VBEOptions, sizeof(VBEOptions));
-    xf86ProcessOptions(screen, xf86Screens[screen]->options, options);
+    xf86ProcessOptions(screen, pScrn->options, options);
     xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe);
     xf86GetOptValBool(options, VBEOPT_NODDC, &noddc);
     free(options);
@@ -330,7 +331,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
 
     if (!(pModule = pDDCModule)) {
         pModule =
-            xf86LoadSubModule(xf86Screens[pVbe->pInt10->scrnIndex], "ddc");
+            xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc");
         if (!pModule)
             return NULL;
     }
@@ -340,7 +341,7 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
     if (!DDC_data)
         return NULL;
 
-    pMonitor = xf86InterpretEDID(pVbe->pInt10->scrnIndex, DDC_data);
+    pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data);
 
     if (!pDDCModule)
         xf86UnloadSubModule(pModule);
@@ -598,7 +599,7 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function,
      */
 
     if ((pVbe->version & 0xff00) > 0x100) {
-        int screen = pVbe->pInt10->scrnIndex;
+        int screen = pVbe->pInt10->pScrn->scrnIndex;
 
         if (function == MODE_QUERY || (function == MODE_SAVE && !*memory)) {
             /* Query amount of memory to save state */
@@ -904,7 +905,7 @@ VBEBuildVbeModeList(vbeInfoPtr pVbe, VbeInfoBlock * vbe)
         m->n = id;
         m->next = ModeList;
 
-        xf86DrvMsgVerb(pVbe->pInt10->scrnIndex, X_PROBED, 3,
+        xf86DrvMsgVerb(pVbe->pInt10->pScrn->scrnIndex, X_PROBED, 3,
                        "BIOS reported VESA mode 0x%x: x:%i y:%i bpp:%i\n",
                        m->n, m->width, m->height, m->bpp);
 
@@ -1026,23 +1027,22 @@ VBEDPMSSet(vbeInfoPtr pVbe, int mode)
 }
 
 void
-VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
+VBEInterpretPanelID(ScrnInfoPtr pScrn, struct vbePanelID *data)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     DisplayModePtr mode;
     const float PANEL_HZ = 60.0;
 
     if (!data)
         return;
 
-    xf86DrvMsg(scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n",
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PanelID returned panel resolution %dx%d\n",
                data->hsize, data->vsize);
 
     if (pScrn->monitor->nHsync || pScrn->monitor->nVrefresh)
         return;
 
     if (data->hsize < 320 || data->vsize < 240) {
-        xf86DrvMsg(scrnIndex, X_INFO, "...which I refuse to believe\n");
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "...which I refuse to believe\n");
         return;
     }
 
@@ -1069,7 +1069,7 @@ VBEReadPanelID(vbeInfoPtr pVbe)
     int RealOff = pVbe->real_mode_base;
     pointer page = pVbe->memory;
     void *tmp = NULL;
-    int screen = pVbe->pInt10->scrnIndex;
+    int screen = pVbe->pInt10->pScrn->scrnIndex;
 
     pVbe->pInt10->ax = 0x4F11;
     pVbe->pInt10->bx = 0x01;
diff --git a/xorg-server/hw/xfree86/vbe/vbe.h b/xorg-server/hw/xfree86/vbe/vbe.h
index 81be0ff40..3907c53f3 100644
--- a/xorg-server/hw/xfree86/vbe/vbe.h
+++ b/xorg-server/hw/xfree86/vbe/vbe.h
@@ -350,7 +350,7 @@ struct vbePanelID {
     char reserved[14];
 };
 
-extern _X_EXPORT void VBEInterpretPanelID(int scrnIndex,
+extern _X_EXPORT void VBEInterpretPanelID(ScrnInfoPtr pScrn,
                                           struct vbePanelID *data);
 extern _X_EXPORT struct vbePanelID *VBEReadPanelID(vbeInfoPtr pVbe);
 
diff --git a/xorg-server/hw/xfree86/vgahw/Makefile.am b/xorg-server/hw/xfree86/vgahw/Makefile.am
index f48e46a11..0634e47e3 100644
--- a/xorg-server/hw/xfree86/vgahw/Makefile.am
+++ b/xorg-server/hw/xfree86/vgahw/Makefile.am
@@ -1,9 +1,9 @@
-module_LTLIBRARIES = libvgahw.la
-libvgahw_la_LDFLAGS = -avoid-version
-libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-sdk_HEADERS = vgaHW.h
-
-EXTRA_DIST = vgaCmap.c
+module_LTLIBRARIES = libvgahw.la
+libvgahw_la_LDFLAGS = -avoid-version
+libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+sdk_HEADERS = vgaHW.h
+
+EXTRA_DIST = vgaCmap.c
diff --git a/xorg-server/hw/xfree86/x86emu/Makefile.am b/xorg-server/hw/xfree86/x86emu/Makefile.am
index df9697767..c4108cffb 100644
--- a/xorg-server/hw/xfree86/x86emu/Makefile.am
+++ b/xorg-server/hw/xfree86/x86emu/Makefile.am
@@ -1,29 +1,29 @@
-if INT10_X86EMU
-noinst_LTLIBRARIES = libx86emu.la
-endif
-
-libx86emu_la_SOURCES = debug.c \
-                      decode.c \
-                      fpu.c \
-                      ops2.c \
-                      ops.c \
-                      prim_ops.c \
-                      sys.c \
-                      x86emu.h
-
-INCLUDES = 
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
-
-EXTRA_DIST = validate.c \
-             x86emu/debug.h \
-             x86emu/decode.h \
-             x86emu/fpu.h \
-             x86emu/fpu_regs.h \
-             x86emu/ops.h \
-             x86emu/prim_asm.h \
-             x86emu/prim_ops.h \
-	     x86emu/prim_x86_gcc.h \
-             x86emu/regs.h \
-             x86emu/types.h \
-             x86emu/x86emui.h
+if INT10_X86EMU
+noinst_LTLIBRARIES = libx86emu.la
+endif
+
+libx86emu_la_SOURCES = debug.c \
+                      decode.c \
+                      fpu.c \
+                      ops2.c \
+                      ops.c \
+                      prim_ops.c \
+                      sys.c \
+                      x86emu.h
+
+INCLUDES = 
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+
+EXTRA_DIST = validate.c \
+             x86emu/debug.h \
+             x86emu/decode.h \
+             x86emu/fpu.h \
+             x86emu/fpu_regs.h \
+             x86emu/ops.h \
+             x86emu/prim_asm.h \
+             x86emu/prim_ops.h \
+	     x86emu/prim_x86_gcc.h \
+             x86emu/regs.h \
+             x86emu/types.h \
+             x86emu/x86emui.h
diff --git a/xorg-server/hw/xfree86/xaa/.gitignore b/xorg-server/hw/xfree86/xaa/.gitignore
new file mode 100644
index 000000000..1ba5b2602
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/.gitignore
@@ -0,0 +1,4 @@
+#		Add & Override for this directory and it's subdirectories
+[lms]-xaa*.c
+[lm]f3-xaa*.c
+[lm][f3]-xaa*.c
diff --git a/xorg-server/hw/xfree86/xaa/XAA.HOWTO b/xorg-server/hw/xfree86/xaa/XAA.HOWTO
index cbd71c138..531ead0a0 100644
--- a/xorg-server/hw/xfree86/xaa/XAA.HOWTO
+++ b/xorg-server/hw/xfree86/xaa/XAA.HOWTO
@@ -1,1427 +1,1427 @@
-
-
-                          XAA.HOWTO
-
-  This file describes how to add basic XAA support to a chipset driver.
-
-0)  What is XAA
-1)  XAA Initialization and Shutdown
-2)  The Primitives
-  2.0  Generic Flags
-  2.1  Screen to Screen Copies
-  2.2  Solid Fills
-  2.3  Solid Lines
-  2.4  Dashed Lines
-  2.5  Color Expand Fills
-    2.5.1 Screen to Screen Color Expansion
-    2.5.2 CPU to Screen Color Expansion
-      2.5.2.1 The Direct Method
-      2.5.2.2 The Indirect Method
-  2.6  8x8 Mono Pattern Fills
-  2.7  8x8 Color Pattern Fills
-  2.8  Image Writes
-    2.8.1 The Direct Method
-    2.8.2 The Indirect Method
-  2.9 Clipping
-3)  The Pixmap Cache
-4)  Offscreen Pixmaps
-
-/********************************************************************/
-
-0) WHAT IS XAA
-	
-   XAA (the XFree86 Acceleration Architecture) is a device dependent
-layer that encapsulates the unaccelerated framebuffer rendering layer,
-intercepting rendering commands sent to it from higher levels of the
-server.  For rendering tasks where hardware acceleration is not 
-possible, XAA allows the requests to proceed to the software rendering
-code.  Otherwise, XAA breaks the sometimes complicated X primitives
-into simpler primitives more suitable for hardware acceleration and
-will use accelerated functions exported by the chipset driver to 
-render these.
-
-   XAA provides a simple, easy to use driver interface that allows
-the driver to communicate its acceleration capabilities and restrictions
-back to XAA.  XAA will use the information provided by the driver
-to determine whether or not acceleration will be possible for a
-particular X primitive.
-
-
-
-1) XAA INITIALIZATION AND SHUTDOWN
-
-   All relevant prototypes and defines are in xaa.h.
-
-   To Initialize the XAA layer, the driver should allocate an XAAInfoRec
-via XAACreateInfoRec(), fill it out as described in this document
-and pass it to XAAInit().  XAAInit() must be called _after_ the 
-framebuffer initialization (usually cfb?ScreenInit or similar) since 
-it is "wrapping" that layer.  XAAInit() should be called _before_ the 
-cursor initialization (usually miDCInitialize) since the cursor
-layer needs to "wrap" all the rendering code including XAA.
-
-   When shutting down, the driver should free the XAAInfoRec
-structure in its CloseScreen function via XAADestroyInfoRec().
-The prototypes for the functions mentioned above are as follows:
-
-   XAAInfoRecPtr XAACreateInfoRec(void);
-   Bool XAAInit(ScreenPtr, XAAInfoRecPtr);
-   void XAADestroyInfoRec(XAAInfoRec);
-
-   The driver informs XAA of it's acceleration capablities by
-filling out an XAAInfoRec structure and passing it to XAAInit().
-The XAAInfoRec structure contains many fields, most of which are
-function pointers and flags.  Each primitive will typically have
-two functions and a set of flags associated with it, but it may
-have more.  These two functions are the "SetupFor" and "Subsequent" 
-functions.  The "SetupFor" function tells the driver that the 
-hardware should be initialized for a particular type of graphics 
-operation.  After the "SetupFor" function, one or more calls to the 
-"Subsequent" function will be made to indicate that an instance
-of the particular primitive should be rendered by the hardware.
-The details of each instance (width, height, etc...) are given
-with each "Subsequent" function.   The set of flags associated
-with each primitive lets the driver tell XAA what its hardware
-limitations are (eg. It doesn't support a planemask, it can only
-do one of the raster-ops, etc...).
-
-  Of the XAAInfoRec fields, one is required.  This is the
-Sync function.  XAA initialization will fail if this function
-is not provided.
-
-void Sync(ScrnInfoPtr pScrn)			/* Required */
-
-   Sync will be called when XAA needs to be certain that all
-   graphics coprocessor operations are finished, such as when
-   the framebuffer must be written to or read from directly
-   and it must be certain that the accelerator will not be
-   overwriting the area of interest.
-
-   One needs to make certain that the Sync function not only
-   waits for the accelerator fifo to empty, but that it waits for
-   the rendering of that last operation to complete.
-
-   It is guaranteed that no direct framebuffer access will
-   occur after a "SetupFor" or "Subsequent" function without
-   the Sync function being called first.
-
-
-
-2)  THE PRIMITIVES
-
-2.0  Generic Flags
-
-  Each primitive type has a set of flags associated with it which
-allow the driver to tell XAA what the hardware limitations are.
-The common ones are as follows:
-
-/* Foreground, Background, rop and planemask restrictions */
-
-   GXCOPY_ONLY
-
-     This indicates that the accelerator only supports GXcopy
-     for the particular primitive.
-
-   ROP_NEEDS_SOURCE
-
-     This indicates that the accelerator doesn't supports a
-     particular primitive with rops that don't involve the source.
-     These rops are GXclear, GXnoop, GXinvert and GXset. If neither
-     this flag nor GXCOPY_ONLY is defined, it is assumed that the
-     accelerator supports all 16 raster operations (rops) for that
-     primitive.
-
-   NO_PLANEMASK
-
-     This indicates that the accelerator does not support a hardware
-     write planemask for the particular primitive.
-
-   RGB_EQUAL
-
-     This indicates that the particular primitive requires the red, 
-     green and blue bytes of the foreground color (and background color,
-     if applicable) to be equal. This is useful for 24bpp when a graphics
-     coprocessor is used in 8bpp mode, which is not uncommon in older
-     hardware since some have no support for or only limited support for 
-     acceleration at 24bpp. This way, many operations will be accelerated 
-     for the common case of "grayscale" colors.  This flag should only
-     be used in 24bpp.
-
-  In addition to the common ones listed above which are possible for
-nearly all primitives, each primitive may have its own flags specific
-to that primitive.  If such flags exist they are documented in the
-descriptions of those primitives below.
- 
-
-
-
-2.1  Screen to Screen Copies
-
-   The SetupFor and Subsequent ScreenToScreenCopy functions provide
-   an interface for copying rectangular areas from video memory to
-   video memory.  To accelerate this primitive the driver should
-   provide both the SetupFor and Subsequent functions and indicate
-   the hardware restrictions via the ScreenToScreenCopyFlags.  The
-   NO_PLANEMASK, GXCOPY_ONLY and ROP_NEEDS_SOURCE flags as described
-   in Section 2.0 are valid as well as the following:
-
-    NO_TRANSPARENCY
-     
-      This indicates that the accelerator does not support skipping
-      of color keyed pixels when copying from the source to the destination.
-
-    TRANSPARENCY_GXCOPY_ONLY
-
-      This indicates that the accelerator supports skipping of color keyed
-      pixels only when the rop is GXcopy.
-
-    ONLY_LEFT_TO_RIGHT_BITBLT
-
-      This indicates that the hardware only accepts blitting when the
-      x direction is positive.
-
-    ONLY_TWO_BITBLT_DIRECTIONS
-
-      This indicates that the hardware can only cope with blitting when
-      the direction of x is the same as the direction in y.
-
-
-void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn,
-			int xdir, int ydir,
-			int rop,
-			unsigned int planemask,
-			int trans_color )
-
-    When this is called, SubsequentScreenToScreenCopy will be called
-    one or more times directly after.  If ydir is 1, then the accelerator
-    should copy starting from the top (minimum y) of the source and
-    proceed downward.  If ydir is -1, then the accelerator should copy
-    starting from the bottom of the source (maximum y) and proceed
-    upward.  If xdir is 1, then the accelerator should copy each
-    y scanline starting from the leftmost pixel of the source.  If
-    xdir is -1, it should start from the rightmost pixel.  
-       If trans_color is not -1 then trans_color indicates that the
-    accelerator should not copy pixels with the color trans_color
-    from the source to the destination, but should skip them. 
-    Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
- 
-
-void SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
-			int x1, int y1,
-			int x2, int y2,
-			int width, int height)
-
-    Copy a rectangle "width" x "height" from the source (x1,y1) to the 
-    destination (x2,y2) using the parameters passed by the last
-    SetupForScreenToScreenCopy call. (x1,y1) and (x2,y2) always denote 
-    the upper left hand corners of the source and destination regardless 
-    of which xdir and ydir values are given by SetupForScreenToScreenCopy.  
-
-
-
-2.2 Solid Fills
-
-   The SetupFor and Subsequent SolidFill(Rect/Trap) functions provide
-   an interface for filling rectangular areas of the screen with a
-   foreground color.  To accelerate this primitive the driver should
-   provide both the SetupForSolidFill and SubsequentSolidFillRect 
-   functions and indicate the hardware restrictions via the SolidFillFlags.
-   The driver may optionally provide a SubsequentSolidFillTrap if
-   it is capable of rendering the primitive correctly.  
-   The GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
-   as described in Section 2.0 are valid.
-
-  
-void SetupForSolidFill(ScrnInfoPtr pScrn, 
-                       int color, int rop, unsigned int planemask)
-
-    SetupForSolidFill indicates that any combination of the following 
-    may follow it.
-
-	SubsequentSolidFillRect
-	SubsequentSolidFillTrap
-
-
- 
-void SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
-
-     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
-     using the color, rop and planemask given by the last 
-     SetupForSolidFill call.
-
-void SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, 
-	int left, int dxL, int dyL, int eL,
-	int right, int dxR, int dyR, int eR)
-
-     These parameters describe a trapezoid via a version of
-     Bresenham's parameters. "y" is the top line. "h" is the
-     number of spans to be filled in the positive Y direction.
-     "left" and "right" indicate the starting X values of the
-     left and right edges.  dy/dx describes the edge slope.
-     These are not the deltas between the beginning and ending
-     points on an edge.  They merely describe the slope. "e" is
-     the initial error term.  It's the relationships between dx,
-     dy and e that define the edge.
-	If your engine does not do bresenham trapezoids or does
-     not allow the programmer to specify the error term then
-     you are not expected to be able to accelerate them.
-
-
-2.3  Solid Lines
-
-    XAA provides an interface for drawing thin lines.  In order to
-    draw X lines correctly a high degree of accuracy is required.
-    This usually limits line acceleration to hardware which has a
-    Bresenham line engine, though depending on the algorithm used,
-    other line engines may come close if they accept 16 bit line 
-    deltas.  XAA has both a Bresenham line interface and a two-point
-    line interface for drawing lines of arbitrary orientation.  
-    Additionally there is a SubsequentSolidHorVertLine which will
-    be used for all horizontal and vertical lines.  Horizontal and
-    vertical lines are handled separately since hardware that doesn't
-    have a line engine (or has one that is unusable due to precision
-    problems) can usually draw these lines by some other method such
-    as drawing them as thin rectangles.  Even for hardware that can
-    draw arbitrary lines via the Bresenham or two-point interfaces,
-    the SubsequentSolidHorVertLine is used for horizontal and vertical
-    lines since most hardware is able to render the horizontal lines
-    and sometimes the vertical lines faster by other methods (Hint:
-    try rendering horizontal lines as flattened rectangles).  If you have 
-    not provided a SubsequentSolidHorVertLine but you have provided 
-    Bresenham or two-point lines, a SubsequentSolidHorVertLine function 
-    will be supplied for you.
-
-    The flags field associated with Solid Lines is SolidLineFlags and 
-    the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
-    described in Section 2.0 are valid restrictions.  
-
-    Some line engines have line biases hardcoded to comply with
-    Microsoft line biasing rules.  A tell-tale sign of this is the
-    hardware lines not matching the software lines in the zeroth and
-    fourth octants.  The driver can set the flag:
-	
-	MICROSOFT_ZERO_LINE_BIAS
-
-    in the AccelInfoRec.Flags field to adjust the software lines to
-    match the hardware lines.   This is in the generic flags field
-    rather than the SolidLineFlags since this flag applies to all
-    software zero-width lines on the screen and not just the solid ones.
-
-
-void SetupForSolidLine(ScrnInfoPtr pScrn, 
-                       int color, int rop, unsigned int planemask)
-
-    SetupForSolidLine indicates that any combination of the following 
-    may follow it.
-
-	SubsequentSolidBresenhamLine
-	SubsequentSolidTwoPointLine
-        SubsequentSolidHorVertLine 	
-
-
-void SubsequentSolidHorVertLine( ScrnInfoPtr pScrn,
-        			int x, int y, int len, int dir )
-
-    All vertical and horizontal solid thin lines are rendered with
-    this function.  The line starts at coordinate (x,y) and extends
-    "len" pixels inclusive.  In the direction indicated by "dir."
-    The direction is either DEGREES_O or DEGREES_270.  That is, it
-    always extends to the right or down.
-
-
-
-void SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
-        	int x1, int y1, int x2, int y2, int flags)
-
-    Draw a line from (x1,y1) to (x2,y2).  If the flags field contains
-    the flag OMIT_LAST, the last pixel should not be drawn.  Otherwise,
-    the pixel at (x2,y2) should be drawn.
-
-    If you use the TwoPoint line interface there is a good possibility
-    that your line engine has hard-coded line biases that do not match
-    the default X zero-width lines.  If so, you may need to set the
-    MICROSOFT_ZERO_LINE_BIAS flag described above.  Note that since
-    any vertex in the 16-bit signed coordinate system is valid, your
-    line engine is expected to handle 16-bit values if you have hardware
-    line clipping enabled.  If your engine cannot handle 16-bit values,
-    you should not use hardware line clipping.
-
-
-void SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
-        int x, int y, int major, int minor, int err, int len, int octant)
-
-    "X" and "y" are the starting point of the line.  "Major" and "minor" 
-    are the major and minor step constants.  "Err" is the initial error
-    term.  "Len" is the number of pixels to be drawn (inclusive). "Octant"
-    can be any combination of the following flags OR'd together:
-
-      Y_MAJOR		Y is the major axis (X otherwise)
-      X_DECREASING	The line is drawn from right to left
-      Y_DECREASING	The line is drawn from bottom to top
-	  
-    The major, minor and err terms are the "raw" Bresenham parameters
-    consistent with a line engine that does:
-
-	e = err;
-	while(len--) {
-	   DRAW_POINT(x,y);
-	   e += minor;
-	   if(e >= 0) {
-		e -= major;
-		TAKE_ONE_STEP_ALONG_MINOR_AXIS;
-	   }
-	   TAKE_ONE_STEP_ALONG_MAJOR_AXIS;
-	}
-
-    IBM 8514 style Bresenham line interfaces require their parameters
-    modified in the following way:
-
-	Axial = minor;
-	Diagonal = minor - major;
-	Error = minor + err;
-
-SolidBresenhamLineErrorTermBits
-
-    This field allows the driver to tell XAA how many bits large its
-    Bresenham parameter registers are.  Many engines have registers that
-    only accept 12 or 13 bit Bresenham parameters, and the parameters
-    for clipped lines may overflow these if they are not scaled down.
-    If this field is not set, XAA will assume the engine can accomodate
-    16 bit parameters, otherwise, it will scale the parameters to the
-    size specified.
-
-
-2.4  Dashed Lines
-
-    The same degree of accuracy required by the solid lines is required
-    for drawing dashed lines as well.  The dash pattern itself is a
-    buffer of binary data where ones are expanded into the foreground
-    color and zeros either correspond to the background color or
-    indicate transparency depending on whether or not DoubleDash or
-    OnOffDashes are being drawn.  
-
-    The flags field associated with dashed Lines is DashedLineFlags and 
-    the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
-    described in Section 2.0 are valid restrictions.  Additionally, the
-    following flags are valid:
-
-      NO_TRANSPARENCY
-
-	This indicates that the driver cannot support dashed lines
-	with transparent backgrounds (OnOffDashes).
-
-      TRANSPARENCY_ONLY
-
-	This indicates that the driver cannot support dashes with
-	both a foreground and background color (DoubleDashes).
-
-      LINE_PATTERN_POWER_OF_2_ONLY
-
-	This indicates that only patterns with a power of 2 length
-	can be accelerated.
-
-      LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
-      LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
-      LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
-      LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
-
-	These describe how the line pattern should be packed.
-	The pattern buffer is DWORD padded.  LSBFIRST indicates
-	that the pattern runs from the LSB end to the MSB end.
-	MSBFIRST indicates that the pattern runs from the MSB end
-	to the LSB end.  When the pattern does not completely fill
-	the DWORD padded buffer, the pattern will be justified 
-	towards the MSB or LSB end based on the flags above.
-
-
-    The following field indicates the maximum length dash pattern that
-    should be accelerated.
-
-	int DashPatternMaxLength
-
-
-void SetupForDashedLine(ScrnInfoPtr pScrn,
-		int fg, int bg, int rop, unsigned int planemask,
-        	int length, unsigned char *pattern)
-
-    
-    SetupForDashedLine indicates that any combination of the following 
-    may follow it.
-
-	SubsequentDashedBresenhamLine
-	SubsequentDashedTwoPointLine
-
-    If "bg" is -1, then the background (pixels corresponding to clear
-    bits in the pattern) should remain unmodified. "Bg" indicates the
-    background color otherwise.  "Length" indicates the length of
-    the pattern in bits and "pattern" points to the DWORD padded buffer
-    holding the pattern which has been packed according to the flags
-    set above.  
-
-    
-void SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn,
-        int x1, int y1, int x2, int y2, int flags, int phase)
-
-void SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
-        int x1, int y1, int major, int minor, int err, int len, int octant,
-        int phase)
-  
-    These are the same as the SubsequentSolidTwoPointLine and
-    SubsequentBresenhamLine functions except for the addition
-    of the "phase" field which indicates the offset into the dash 
-    pattern that the pixel at (x1,y1) corresponds to.
-
-    As with the SubsequentBresenhamLine, there is an
- 
-	int DashedBresenhamLineErrorTermBits 
-   
-    field which indicates the size of the error term registers
-    used with dashed lines.  This is usually the same value as
-    the field for the solid lines (because it's usually the same
-    register).
-       
-      
-
-2.5   Color Expansion Fills
-
-    When filling a color expansion rectangle, the accelerator
-    paints each pixel depending on whether or not a bit in a
-    corresponding bitmap is set or clear. Opaque expansions are 
-    when a set bit corresponds to the foreground color and a clear 
-    bit corresponds to the background color.  A transparent expansion
-    is when a set bit corresponds to the foreground color and a
-    clear bit indicates that the pixel should remain unmodified.
-   
-    The graphics accelerator usually has access to the source 
-    bitmap in one of two ways: 1) the bitmap data is sent serially
-    to the accelerator by the CPU through some memory mapped aperture
-    or 2) the accelerator reads the source bitmap out of offscreen
-    video memory.  Some types of primitives are better suited towards 
-    one method or the other.  Type 2 is useful for reusable patterns
-    such as stipples which can be cached in offscreen memory.  The
-    aperature method can be used for stippling but the CPU must pass
-    the data across the bus each time a stippled fill is to be performed.  
-    For expanding 1bpp client pixmaps or text strings to the screen,
-    the aperature method is usually superior because the intermediate
-    copy in offscreen memory needed by the second method would only be 
-    used once.  Unfortunately, many accelerators can only do one of these
-    methods and not both.  
-
-    XAA provides both ScreenToScreen and CPUToScreen color expansion 
-    interfaces for doing color expansion fills.  The ScreenToScreen
-    functions can only be used with hardware that supports reading
-    of source bitmaps from offscreen video memory, and these are only
-    used for cacheable patterns such as stipples.  There are two
-    variants of the CPUToScreen routines - a direct method intended
-    for hardware that has a transfer aperature, and an indirect method
-    intended for hardware without transfer aperatures or hardware
-    with unusual transfer requirements.  Hardware that can only expand
-    bitmaps from video memory should supply ScreenToScreen routines
-    but also ScanlineCPUToScreen (indirect) routines to optimize transfers 
-    of non-cacheable data.  Hardware that can only accept source bitmaps
-    through an aperature should supply CPUToScreen (or ScanlineCPUToScreen) 
-    routines. Hardware that can do both should provide both ScreenToScreen 
-    and CPUToScreen routines.
-
-    For both ScreenToScreen and CPUToScreen interfaces, the GXCOPY_ONLY,
-    ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags described in
-    Section 2.0 are valid as well as the following:
-
-    /* bit order requirements (one of these must be set) */
-   
-    BIT_ORDER_IN_BYTE_LSBFIRST
-
-      This indicates that least significant bit in each byte of the source
-      data corresponds to the leftmost of that block of 8 pixels.  This
-      is the prefered format.
-
-    BIT_ORDER_IN_BYTE_MSBFIRST    
-
-      This indicates that most significant bit in each byte of the source
-      data corresponds to the leftmost of that block of 8 pixels.
-
-    /* transparency restrictions */
-
-    NO_TRANSPARENCY
-
-      This indicates that the accelerator cannot do a transparent expansion.
-
-    TRANSPARENCY_ONLY
-
-      This indicates that the accelerator cannot do an opaque expansion.
-      In cases where where the background needs to be filled, XAA will
-      render the primitive in two passes when using the CPUToScreen
-      interface, but will not do so with the ScreenToScreen interface 
-      since that would require caching of two patterns.  Some 
-      ScreenToScreen hardware may be able to render two passes at the
-      driver level and remove the TRANSPARENCY_ONLY restriction if
-      it can render pixels corresponding to the zero bits.
-
-
-
-2.5.1  Screen To Screen Color Expansion
-
-    The ScreenToScreenColorExpandFill routines provide an interface
-    for doing expansion blits from source patterns stored in offscreen
-    video memory.
-
-    void SetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn,
-        			int fg, int bg, 
-				int rop, unsigned int planemask)
-
-
-    Ones in the source bitmap will correspond to the fg color.
-    Zeros in the source bitmap will correspond to the bg color
-    unless bg = -1.  In that case the pixels corresponding to the
-    zeros in the bitmap shall be left unmodified by the accelerator.
-
-    For hardware that doesn't allow an easy implementation of skipleft, the
-    driver can replace CacheMonoStipple function with one that stores multiple
-    rotated copies of the stipple and select between them. In this case the
-    driver should set CacheColorExpandDensity to tell XAA how many copies of
-    the pattern are stored in the width of a cache slot. For instance if the
-    hardware can specify the starting address in bytes, then 8 rotated copies
-    of the stipple are needed and CacheColorExpandDensity should be set to 8.
-
-    void SubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
-				int x, int y, int w, int h,
-				int srcx, int srcy, int offset )
-
-   
-    Fill a rectangle "w" x "h" at location (x,y).  The source pitch
-    between scanlines is the framebuffer pitch (pScrn->displayWidth
-    pixels) and srcx and srcy indicate the start of the source pattern 
-    in units of framebuffer pixels. "Offset" indicates the bit offset
-    into the pattern that corresponds to the pixel being painted at
-    "x" on the screen.  Some hardware accepts source coordinates in
-    units of bits which makes implementation of the offset trivial.
-    In that case, the bit address of the source bit corresponding to
-    the pixel painted at (x,y) would be:
-	
-     (srcy * pScrn->displayWidth + srcx) * pScrn->bitsPerPixel + offset
-
-    It should be noted that the offset assumes LSBFIRST hardware.  
-    For MSBFIRST hardware, the driver may need to implement the 
-    offset by bliting only from byte boundaries and hardware clipping.
-
-
-
-2.5.2  CPU To Screen Color Expansion
-
-
-    The CPUToScreenColorExpandFill routines provide an interface for 
-    doing expansion blits from source patterns stored in system memory.
-    There are two varieties of this primitive, a CPUToScreenColorExpandFill
-    and a ScanlineCPUToScreenColorExpandFill.  With the 
-    CPUToScreenColorExpandFill method, the source data is sent serially
-    through a memory mapped aperature.  With the Scanline version, the
-    data is rendered scanline at a time into intermediate buffers with
-    a call to SubsequentColorExpandScanline following each scanline.
-
-    These two methods have separate flags fields, the
-    CPUToScreenColorExpandFillFlags and ScanlineCPUToScreenColorExpandFillFlags
-    respectively.  Flags specific to one method or the other are described 
-    in sections 2.5.2.1 and 2.5.2.2 but for both cases the bit order and
-    transparency restrictions listed at the beginning of section 2.5 are 
-    valid as well as the following:
-    
-    /* clipping  (optional) */
-    
-    LEFT_EDGE_CLIPPING
- 
-      This indicates that the accelerator supports omission of up to
-      31 pixels on the left edge of the rectangle to be filled.  This
-      is beneficial since it allows transfer of the source bitmap to
-      always occur from DWORD boundaries. 
-
-    LEFT_EDGE_CLIPPING_NEGATIVE_X
-
-      This flag indicates that the accelerator can render color expansion
-      rectangles even if the value of x origin is negative (off of
-      the screen on the left edge).
-
-    /* misc */
-
-    TRIPLE_BITS_24BPP
-
-      When enabled (must be in 24bpp mode), color expansion functions
-      are expected to require three times the amount of bits to be
-      transferred so that 24bpp grayscale colors can be used with color
-      expansion in 8bpp coprocessor mode. Each bit is expanded to 3
-      bits when writing the monochrome data.
-
-
- 2.5.1 The Direct Method 
-
-
-    Using the direct method of color expansion XAA will send all
-    bitmap data to the accelerator serially through an memory mapped
-    transfer window defined by the following two fields:
-
-      unsigned char *ColorExpandBase
-
-        This indicates the memory address of the beginning of the aperture.
-
-      int ColorExpandRange
-
-        This indicates the size in bytes of the aperture.
-
-    The driver should specify how the transfered data should be padded.
-    There are options for both the padding of each Y scanline and for the
-    total transfer to the aperature.
-    One of the following two flags must be set:
-
-      CPU_TRANSFER_PAD_DWORD
-
-        This indicates that the total transfer (sum of all scanlines) sent
-        to the aperature must be DWORD padded.  This is the default behavior.
-
-      CPU_TRANSFER_PAD_QWORD 
-
-	This indicates that the total transfer (sum of all scanlines) sent
-	to the aperature must be QWORD padded.  With this set, XAA will send
-        an extra DWORD to the aperature when needed to ensure that only
-        an even number of DWORDs are sent.
-
-    And then there are the flags for padding of each scanline:
-
-      SCANLINE_PAD_DWORD
-
-	This indicates that each Y scanline should be DWORD padded.
-        This is the only option available and is the default.
-
-    Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
-    that the aperture is a single register rather than a range of
-    registers, and XAA should write all of the data to the first DWORD.
-    If the ColorExpandRange is not large enough to accomodate scanlines
-    the width of the screen, this option will be forced. That is, the
-    ColorExpandRange must be:
-
-        ((virtualX + 31)/32) * 4   bytes or more.
-
-        ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
-  
-    If the TRIPLE_BITS_24BPP flag is set, the required area should be 
-    multiplied by three.
-     
-    
-void SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-        		int fg, int bg,
-			int rop,
-			unsigned int planemask)
-
-  
- 
-     Ones in the source bitmap will correspond to the fg color.
-     Zeros in the source bitmap will correspond to the bg color
-     unless bg = -1.  In that case the pixels corresponding to the
-     zeros in the bitmap shall be left unmodified by the accelerator.
-
-
-void SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-			int x, int y, int w, int h,
-			int skipleft )
-
-     When this function is called, the accelerator should be setup
-     to fill a rectangle of dimension "w" by "h" with origin at (x,y)
-     in the fill style prescribed by the last call to 
-     SetupForCPUToScreenColorExpandFill.  XAA will pass the data to 
-     the aperture immediately after this function is called.  If the 
-     skipleft is non-zero (and LEFT_EDGE_CLIPPING has been enabled), then 
-     the accelerator _should_not_ render skipleft pixels on the leftmost
-     edge of the rectangle.  Some engines have an alignment feature
-     like this built in, some others can do this using a clipping
-     window.
-
-     It can be arranged for XAA to call Sync() after it is through 
-     calling the Subsequent function by setting SYNC_AFTER_COLOR_EXPAND 
-     in the  CPUToScreenColorExpandFillFlags.  This can provide the driver 
-     with an oportunity to reset a clipping window if needed.
-
-    
-2.5.2  The Indirect Method 
-
-     Using the indirect method, XAA will render the bitmap data scanline
-     at a time to one or more buffers.  These buffers may be memory
-     mapped apertures or just intermediate storage.
-
-     int NumScanlineColorExpandBuffers
-
-       This indicates the number of buffers available.
-
-     unsigned char **ScanlineColorExpandBuffers
-
-       This is an array of pointers to the memory locations of each buffer.
-       Each buffer is expected to be large enough to accommodate scanlines
-       the width of the screen.  That is:
-
-        ((virtualX + 31)/32) * 4   bytes or more.
-
-        ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
-  
-     Scanlines are always DWORD padded.
-     If the TRIPLE_BITS_24BPP flag is set, the required area should be 
-     multiplied by three.
-
-
-void SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-        		int fg, int bg,
-			int rop,
-			unsigned int planemask)
- 
-     Ones in the source bitmap will correspond to the fg color.
-     Zeros in the source bitmap will correspond to the bg color
-     unless bg = -1.  In that case the pixels corresponding to the
-     zeros in the bitmap shall be left unmodified by the accelerator.
-
-     
-void SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-			int x, int y, int w, int h,
-			int skipleft )
-
-void SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
-
-
-    When SubsequentScanlineCPUToScreenColorExpandFill is called, XAA 
-    will begin transfering the source data scanline at a time, calling  
-    SubsequentColorExpandScanline after each scanline.  If more than
-    one buffer is available, XAA will cycle through the buffers.
-    Subsequent scanlines will use the next buffer and go back to the
-    buffer 0 again when the last buffer is reached.  The index into
-    the ScanlineColorExpandBuffers array is presented as "bufno"
-    with each SubsequentColorExpandScanline call.
-
-    The skipleft field is the same as for the direct method.
-
-    The indirect method can be use to send the source data directly 
-    to a memory mapped aperture represented by a single color expand
-    buffer, scanline at a time, but more commonly it is used to place 
-    the data into offscreen video memory so that the accelerator can 
-    blit it to the visible screen from there.  In the case where the
-    accelerator permits rendering into offscreen video memory while
-    the accelerator is active, several buffers can be used so that
-    XAA can be placing source data into the next buffer while the
-    accelerator is blitting the current buffer.  For cases where
-    the accelerator requires some special manipulation of the source
-    data first, the buffers can be in system memory.  The CPU can
-    manipulate these buffers and then send the data to the accelerator.
-
-
-
-2.6   8x8 Mono Pattern Fills
-
-    XAA provides support for two types of 8x8 hardware patterns -
-    "Mono" patterns and "Color" patterns.  Mono pattern data is
-    64 bits of color expansion data with ones indicating the
-    foreground color and zeros indicating the background color.
-    The source bitmaps for the 8x8 mono patterns can be presented
-    to the graphics accelerator in one of two ways.  They can be
-    passed as two DWORDS to the 8x8 mono pattern functions or
-    they can be cached in offscreen memory and their locations
-    passed to the 8x8 mono pattern functions.  In addition to the
-    GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
-    defined in Section 2.0, the following are defined for the
-    Mono8x8PatternFillFlags:
-
-    HARDWARE_PATTERN_PROGRAMMED_BITS
-
-      This indicates that the 8x8 patterns should be packed into two
-      DWORDS and passed to the 8x8 mono pattern functions.  The default
-      behavior is to cache the patterns in offscreen video memory and
-      pass the locations of these patterns to the functions instead.
-      The pixmap cache must be enabled for the default behavior (8x8 
-      pattern caching) to work.  See Section 3 for how to enable the
-      pixmap cache. The pixmap cache is not necessary for 
-      HARDWARE_PATTERN_PROGRAMMED_BITS.
-
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-
-      If the hardware supports programmable pattern offsets then
-      this option should be set. See the table below for further
-      infomation.
-
-    HARDWARE_PATTERN_SCREEN_ORIGIN
-
-      Some hardware wants the pattern offset specified with respect to the
-      upper left-hand corner of the primitive being drawn.  Other hardware 
-      needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that 
-      all pattern offsets should be referenced to the upper left-hand 
-      corner of the screen.  HARDWARE_PATTERN_SCREEN_ORIGIN is preferable 
-      since this is more natural for the X-Window system and offsets will 
-      have to be recalculated for each Subsequent function otherwise.
-
-    BIT_ORDER_IN_BYTE_MSBFIRST
-    BIT_ORDER_IN_BYTE_LSBFIRST
-
-      As with other color expansion routines this indicates whether the
-      most or the least significant bit in each byte from the pattern is 
-      the leftmost on the screen.
-
-    TRANSPARENCY_ONLY
-    NO_TRANSPARENCY
-
-      This means the same thing as for the color expansion rect routines
-      except that for TRANSPARENCY_ONLY XAA will not render the primitive
-      in two passes since this is more easily handled by the driver.
-      It is recommended that TRANSPARENCY_ONLY hardware handle rendering
-      of opaque patterns in two passes (the background can be filled as
-      a rectangle in GXcopy) in the Subsequent function so that the
-      TRANSPARENCY_ONLY restriction can be removed. 
-
-
-
-    Additional information about cached patterns...
-    For the case where HARDWARE_PATTERN_PROGRAMMED_BITS is not set and 
-    the pattern must be cached in offscreen memory, the first pattern
-    starts at the cache slot boundary which is set by the 
-    CachePixelGranularity field used to configure the pixmap cache.
-    One should ensure that the CachePixelGranularity reflects any 
-    alignment restrictions that the accelerator may put on 8x8 pattern 
-    storage locations.  When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set 
-    there is only one pattern stored.  When this flag is not set,
-    all 64 pre-rotated copies of the pattern are cached in offscreen memory.
-    The MonoPatternPitch field can be used to specify the X position pixel
-    granularity that each of these patterns must align on.  If the
-    MonoPatternPitch is not supplied, the patterns will be densely packed
-    within the cache slot.  The behavior of the default XAA 8x8 pattern
-    caching mechanism to store all 8x8 patterns linearly in video memory.
-    If the accelerator needs the patterns stored in a more unusual fashion,
-    the driver will need to provide its own 8x8 mono pattern caching 
-    routines for XAA to use. 
-
-    The following table describes the meanings of the "patx" and "paty"
-    fields in both the SetupFor and Subsequent functions.
-
-    With HARDWARE_PATTERN_SCREEN_ORIGIN
-    -----------------------------------
-
-    HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-
-	SetupFor: patx and paty are the first and second DWORDS of the
-		  8x8 mono pattern.
-
-	Subsequent: patx and paty are the x,y offset into that pattern.
-		    All Subsequent calls will have the same offset in 
-		    the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
-		    the offset specified by the first Subsequent call 
-		    after a SetupFor call will need to be observed.
-
-    HARDWARE_PATTERN_PROGRAMMED_BITS only
-
-	SetupFor: patx and paty hold the first and second DWORDS of
-		  the 8x8 mono pattern pre-rotated to match the desired
-		  offset.
-
-	Subsequent: These just hold the same patterns and can be ignored.
-
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
-
-	SetupFor: patx and paty hold the x,y coordinates of the offscreen
-		  memory location where the 8x8 pattern is stored.  The
-		  bits are stored linearly in memory at that location.
-
-	Subsequent: patx and paty hold the offset into the pattern.
-		    All Subsequent calls will have the same offset in 
-		    the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
-		    the offset specified by the first Subsequent call 
-		    after a SetupFor call will need to be observed.
-
-    Neither programmed bits or origin
-
-	SetupFor: patx and paty hold the x,y coordinates of the offscreen 	
-		  memory location where the pre-rotated 8x8 pattern is
-		  stored.
-
-	Subsequent: patx and paty are the same as in the SetupFor function
-		    and can be ignored.
-		  
-
-    Without HARDWARE_PATTERN_SCREEN_ORIGIN
-    -------------------------------------- 
-
-    HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-
-	SetupFor: patx and paty are the first and second DWORDS of the
-		  8x8 mono pattern.
-
-	Subsequent: patx and paty are the x,y offset into that pattern.
-
-    HARDWARE_PATTERN_PROGRAMMED_BITS only
-
-	SetupFor: patx and paty holds the first and second DWORDS of
-		  the unrotated 8x8 mono pattern.  This can be ignored. 
-
-	Subsequent: patx and paty hold the rotated 8x8 pattern to be 
-		    rendered.
-
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
-
-	SetupFor: patx and paty hold the x,y coordinates of the offscreen
-		  memory location where the 8x8 pattern is stored.  The
-		  bits are stored linearly in memory at that location.
-
-	Subsequent: patx and paty hold the offset into the pattern.
-
-    Neither programmed bits or origin
-
-	SetupFor: patx and paty hold the x,y coordinates of the offscreen 	
-		  memory location where the unrotated 8x8 pattern is
-		  stored.  This can be ignored.
-
-	Subsequent: patx and paty hold the x,y coordinates of the
-		    rotated 8x8 pattern to be rendered.
-
-
-
-void SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
-        int fg, int bg, int rop, unsigned int planemask)
-
-    SetupForMono8x8PatternFill indicates that any combination of the 
-    following  may follow it.
-
-	SubsequentMono8x8PatternFillRect
-	SubsequentMono8x8PatternFillTrap
-
-    The fg, bg, rop and planemask fields have the same meaning as the
-    ones used for the other color expansion routines.  Patx's and paty's
-    meaning can be determined from the table above.
-
- 
-void SubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn,
-        	int patx, int paty, int x, int y, int w, int h)
-
-     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
-     using the parameters give by the last SetupForMono8x8PatternFill
-     call.  The meanings of patx and paty can be determined by the
-     table above.
-
-void SubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn,
-     			   int patx, int paty, int y, int h, 
-     			   int left, int dxL, int dyL, int eL,
-     			   int right, int dxR, int dyR, int eR )
-
-     The meanings of patx and paty can be determined by the table above.
-     The rest of the fields have the same meanings as those in the 
-     SubsequentSolidFillTrap function. 
-
-
-
-2.7   8x8 Color Pattern Fills
-  
-    8x8 color pattern data is 64 pixels of full color data that
-    is stored linearly in offscreen video memory.  8x8 color patterns 
-    are useful as a substitute for 8x8 mono patterns when tiling,
-    doing opaque stipples, or in the case where transperency is
-    supported, regular stipples.  8x8 color pattern fills also have
-    the additional benefit of being able to tile full color 8x8
-    patterns instead of just 2 color ones like the mono patterns.
-    However, full color 8x8 patterns aren't used very often in the
-    X Window system so you might consider passing this primitive
-    by if you already can do mono patterns, especially if they 
-    require alot of cache area.  Color8x8PatternFillFlags is
-    the flags field for this primitive and the GXCOPY_ONLY,
-    ROP_NEEDS_SOURCE and NO_PLANEMASK flags as described in
-    Section 2.0 are valid as well as the following:
-
-
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN
-
-      If the hardware supports programmable pattern offsets then
-      this option should be set.  
-
-    HARDWARE_PATTERN_SCREEN_ORIGIN
-
-      Some hardware wants the pattern offset specified with respect to the
-      upper left-hand corner of the primitive being drawn.  Other hardware 
-      needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that 
-      all pattern offsets should be referenced to the upper left-hand 
-      corner of the screen.  HARDWARE_PATTERN_SCREEN_ORIGIN is preferable 
-      since this is more natural for the X-Window system and offsets will 
-      have to be recalculated for each Subsequent function otherwise.
-
-    NO_TRANSPARENCY
-    TRANSPARENCY_GXCOPY_ONLY
-
-      These mean the same as for the ScreenToScreenCopy functions.
-
-
-    The following table describes the meanings of patx and paty passed
-    to the SetupFor and Subsequent fields:
-
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN && HARDWARE_PATTERN_SCREEN_ORIGIN
-	
-	SetupFor: patx and paty hold the x,y location of the unrotated 
-		  pattern.
-
-	Subsequent: patx and paty hold the pattern offset.  For the case
-		    of HARDWARE_PATTERN_SCREEN_ORIGIN all Subsequent calls
-		    have the same offset so only the first call will need
-		    to be observed.
-
-    
-    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
-
-	SetupFor: patx and paty hold the x,y location of the unrotated
-		  pattern.
-
-	Subsequent: patx and paty hold the pattern offset. 
-
-    HARDWARE_PATTERN_SCREEN_ORIGIN
-
-	SetupFor: patx and paty hold the x,y location of the rotated pattern.
-
-	Subsequent: patx and paty hold the same location as the SetupFor
-		    function so these can be ignored.
-
-    neither flag
-
-	SetupFor: patx and paty hold the x,y location of the unrotated
-		  pattern.  This can be ignored.
-
-	Subsequent: patx and paty hold the x,y location of the rotated
-		    pattern.
-
-    Additional information about cached patterns...
-    All 8x8 color patterns are cached in offscreen video memory so
-    the pixmap cache must be enabled to use them. The first pattern
-    starts at the cache slot boundary which is set by the 
-    CachePixelGranularity field used to configure the pixmap cache.
-    One should ensure that the CachePixelGranularity reflects any 
-    alignment restrictions that the accelerator may put on 8x8 pattern 
-    storage locations.  When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set 
-    there is only one pattern stored.  When this flag is not set,
-    all 64 rotations off the pattern are accessible but it is assumed
-    that the accelerator is capable of accessing data stored on 8
-    pixel boundaries.  If the accelerator has stricter alignment 
-    requirements than this the dirver will need to provide its own 
-    8x8 color pattern caching routines. 
-
-
-void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
-        	int rop, unsigned int planemask, int trans_color)
-
-    SetupForColor8x8PatternFill indicates that any combination of the 
-    following  may follow it.
-
-	SubsequentColor8x8PatternFillRect
-	SubsequentColor8x8PatternFillTrap	(not implemented yet)
-
-    For the meanings of patx and paty, see the table above.  Trans_color
-    means the same as for the ScreenToScreenCopy functions.
-
-
- 
-void SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
-        	int patx, int paty, int x, int y, int w, int h)
-
-     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
-     using the parameters give by the last SetupForColor8x8PatternFill
-     call.  The meanings of patx and paty can be determined by the
-     table above.
-
-void SubsequentColor8x8PatternFillTrap( ScrnInfoPtr pScrn,
-     			   int patx, int paty, int y, int h, 
-     			   int left, int dxL, int dyL, int eL,
-     			   int right, int dxR, int dyR, int eR )
-
-    For the meanings of patx and paty, see the table above. 
-    The rest of the fields have the same meanings as those in the 
-    SubsequentSolidFillTrap function. 
-
-
-
-2.8  Image Writes
-
-    XAA provides a mechanism for transfering full color pixel data from
-    system memory to video memory through the accelerator.  This is 
-    useful for dealing with alignment issues and performing raster ops
-    on the data when writing it to the framebuffer.  As with color
-    expansion rectangles, there is a direct and indirect method.  The
-    direct method sends all data through a memory mapped aperature.
-    The indirect method sends the data to an intermediated buffer scanline 
-    at a time.
-
-    The direct and indirect methods have separate flags fields, the
-    ImageWriteFlags and ScanlineImageWriteFlags respectively.
-    Flags specific to one method or the other are described in sections 
-    2.8.1 and 2.8.2 but for both cases the GXCOPY_ONLY, ROP_NEEDS_SOURCE
-    and NO_PLANEMASK flags described in Section 2.0 are valid as well as
-    the following:
-
-    NO_GXCOPY
-
-      In order to have accelerated image transfers faster than the 
-      software versions for GXcopy, the engine needs to support clipping,
-      be using the direct method and have a large enough image transfer
-      range so that CPU_TRANSFER_BASE_FIXED doesn't need to be set.
-      If these are not supported, then it is unlikely that transfering
-      the data through the accelerator will be of any advantage for the
-      simple case of GXcopy.  In fact, it may be much slower.  For such
-      cases it's probably best to set the NO_GXCOPY flag so that 
-      Image writes will only be used for the more complicated rops.
-
-    /* transparency restrictions */
-
-    NO_TRANSPARENCY
-     
-      This indicates that the accelerator does not support skipping
-      of color keyed pixels when copying from the source to the destination.
-
-    TRANSPARENCY_GXCOPY_ONLY
-
-      This indicates that the accelerator supports skipping of color keyed
-      pixels only when the rop is GXcopy.
-
-    /* clipping  (optional) */
-    
-    LEFT_EDGE_CLIPPING
- 
-      This indicates that the accelerator supports omission of up to
-      3 pixels on the left edge of the rectangle to be filled.  This
-      is beneficial since it allows transfer from the source pixmap to
-      always occur from DWORD boundaries. 
-
-    LEFT_EDGE_CLIPPING_NEGATIVE_X
-
-      This flag indicates that the accelerator can fill areas with
-      image write data even if the value of x origin is negative (off of
-      the screen on the left edge).
-
-
-2.8.1 The Direct Method
-
-    Using the direct method of ImageWrite XAA will send all
-    bitmap data to the accelerator serially through an memory mapped
-    transfer window defined by the following two fields:
-
-      unsigned char *ImageWriteBase
-
-        This indicates the memory address of the beginning of the aperture.
-
-      int ImageWriteRange
-
-        This indicates the size in bytes of the aperture.
-
-    The driver should specify how the transfered data should be padded.
-    There are options for both the padding of each Y scanline and for the
-    total transfer to the aperature.
-    One of the following two flags must be set:
-
-      CPU_TRANSFER_PAD_DWORD
-
-        This indicates that the total transfer (sum of all scanlines) sent
-        to the aperature must be DWORD padded.  This is the default behavior.
-
-      CPU_TRANSFER_PAD_QWORD 
-
-	This indicates that the total transfer (sum of all scanlines) sent
-	to the aperature must be QWORD padded.  With this set, XAA will send
-        an extra DWORD to the aperature when needed to ensure that only
-        an even number of DWORDs are sent.
-
-    And then there are the flags for padding of each scanline:
-
-      SCANLINE_PAD_DWORD
-
-	This indicates that each Y scanline should be DWORD padded.
-        This is the only option available and is the default.
-
-    Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
-    that the aperture is a single register rather than a range of
-    registers, and XAA should write all of the data to the first DWORD.
-    XAA will automatically select CPU_TRANSFER_BASE_FIXED if the 
-    ImageWriteRange is not large enough to accomodate an entire scanline.   
-
-
-void SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
-        			int trans_color, int bpp, int depth)
-
-     If trans_color is not -1 then trans_color indicates the transparency
-     color key and pixels with color trans_color passed through the 
-     aperature should not be transfered to the screen but should be 
-     skipped.  Bpp and depth indicate the bits per pixel and depth of
-     the source pixmap.  Trans_color is always -1 if the NO_TRANSPARENCY
-     flag is set.
-
-
-void SubsequentImageWriteRect(ScrnInfoPtr pScrn, 
-				int x, int y, int w, int h, int skipleft)
-
-     
-     Data passed through the aperature should be copied to a rectangle
-     of width "w" and height "h" with origin (x,y).  If LEFT_EDGE_CLIPPING
-     has been enabled, skipleft will correspond to the number of pixels
-     on the left edge that should not be drawn.  Skipleft is zero 
-     otherwise.
-
-     It can be arranged for XAA to call Sync() after it is through 
-     calling the Subsequent functions by setting SYNC_AFTER_IMAGE_WRITE 
-     in the  ImageWriteFlags.  This can provide the driver with an
-     oportunity to reset a clipping window if needed.
-
-2.8.2  The Indirect Method
-
-     Using the indirect method, XAA will render the pixel data scanline
-     at a time to one or more buffers.  These buffers may be memory
-     mapped apertures or just intermediate storage.
-
-     int NumScanlineImageWriteBuffers
-
-       This indicates the number of buffers available.
-
-     unsigned char **ScanlineImageWriteBuffers
-
-       This is an array of pointers to the memory locations of each buffer.
-       Each buffer is expected to be large enough to accommodate scanlines
-       the width of the screen.  That is:
-
-         pScrn->VirtualX * pScreen->bitsPerPixel/8   bytes or more.
-
-       If LEFT_EDGE_CLIPPING_NEGATIVE_X is set, add an additional 4
-       bytes to that requirement in 8 and 16bpp, 12 bytes in 24bpp.
-  
-     Scanlines are always DWORD padded.
-
-void SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, 
-				unsigned int planemask, int trans_color, 
-				int bpp, int depth)
-
-     If trans_color is not -1 then trans_color indicates the transparency
-     color key and pixels with color trans_color in the buffer should not 
-     be transfered to the screen but should be skipped.  Bpp and depth 
-     indicate the bits per pixel and depth of the source bitmap.  
-     Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
-
-
-void SubsequentImageWriteRect(ScrnInfoPtr pScrn, 
-				int x, int y, int w, int h, int skipleft)
-
-     
-void SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
-
-
-    When SubsequentImageWriteRect is called, XAA will begin
-    transfering the source data scanline at a time, calling  
-    SubsequentImageWriteScanline after each scanline.  If more than
-    one buffer is available, XAA will cycle through the buffers.
-    Subsequent scanlines will use the next buffer and go back to the
-    buffer 0 again when the last buffer is reached.  The index into
-    the ScanlineImageWriteBuffers array is presented as "bufno"
-    with each SubsequentImageWriteScanline call.
-
-    The skipleft field is the same as for the direct method.
-
-    The indirect method can be use to send the source data directly 
-    to a memory mapped aperture represented by a single image write
-    buffer, scanline at a time, but more commonly it is used to place 
-    the data into offscreen video memory so that the accelerator can 
-    blit it to the visible screen from there.  In the case where the
-    accelerator permits rendering into offscreen video memory while
-    the accelerator is active, several buffers can be used so that
-    XAA can be placing source data into the next buffer while the
-    accelerator is blitting the current buffer.  For cases where
-    the accelerator requires some special manipulation of the source
-    data first, the buffers can be in system memory.  The CPU can
-    manipulate these buffers and then send the data to the accelerator.
-
-
-2.9 Clipping
-
-    XAA supports hardware clipping rectangles.  To use clipping
-    in this way it is expected that the graphics accelerator can
-    clip primitives with verticies anywhere in the 16 bit signed 
-    coordinate system. 
-
-void SetClippingRectangle ( ScrnInfoPtr pScrn,
-        		int left, int top, int right, int bottom)
-
-void DisableClipping (ScrnInfoPtr pScrn)
-
-    When SetClippingRectangle is called, all hardware rendering
-    following it should be clipped to the rectangle specified
-    until DisableClipping is called.
-
-    The ClippingFlags field indicates which operations this sort
-    of Set/Disable pairing can be used with.  Any of the following
-    flags may be OR'd together.
-
-	HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
-	HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
-	HARDWARE_CLIP_MONO_8x8_FILL
-	HARDWARE_CLIP_COLOR_8x8_FILL
-	HARDWARE_CLIP_SOLID_FILL
-	HARDWARE_CLIP_DASHED_LINE
-	HARDWARE_CLIP_SOLID_LINE
-
-
-
-3)  XAA PIXMAP CACHE
-
-   /* NOTE:  XAA has no knowledge of framebuffer particulars so until
-	the framebuffer is able to render into offscreen memory, usage
-	of the pixmap cache requires that the driver provide ImageWrite
-	routines or a WritePixmap or WritePixmapToCache replacement so
-	that patterns can even be placed in the cache.
-
-      ADDENDUM: XAA can now load the pixmap cache without requiring
-	that the driver supply an ImageWrite function, but this can
-	only be done on linear framebuffers.  If you have a linear
-	framebuffer, set LINEAR_FRAMEBUFFER in the XAAInfoRec.Flags
-	field and XAA will then be able to upload pixmaps into the
-	cache without the driver providing functions to do so.
-   */
-
-
-   The XAA pixmap cache provides a mechanism for caching of patterns
-   in offscreen video memory so that tiled fills and in some cases
-   stippling can be done by blitting the source patterns from offscreen
-   video memory. The pixmap cache also provides the mechanism for caching 
-   of 8x8 color and mono hardware patterns.  Any unused offscreen video
-   memory gets used for the pixmap cache and that information is 
-   provided by the XFree86 Offscreen Memory Manager. XAA registers a 
-   callback with the manager so that it can be informed of any changes 
-   in the offscreen memory configuration.  The driver writer does not 
-   need to deal with any of this since it is all automatic.  The driver 
-   merely needs to initialize the Offscreen Memory Manager as described 
-   in the DESIGN document and set the PIXMAP_CACHE flag in the 
-   XAAInfoRec.Flags field.  The Offscreen Memory Manager initialization 
-   must occur before XAA is initialized or else pixmap cache 
-   initialization will fail.  
-
-   PixmapCacheFlags is an XAAInfoRec field which allows the driver to
-   control pixmap cache behavior to some extent.  Currently only one
-   flag is defined:
-
-   DO_NOT_BLIT_STIPPLES
-
-     This indicates that the stippling should not be done by blitting
-     from the pixmap cache.  This does not apply to 8x8 pattern fills. 
-
-
-   CachePixelGranularity is an optional field.  If the hardware requires
-   that a 8x8 patterns have some particular pixel alignment it should
-   be reflected in this field.  Ignoring this field or setting it to
-   zero or one means there are no alignment issues.
-
-
-4)  OFFSCREEN PIXMAPS
-
-   XAA has the ability to store pixmap drawables in offscreen video 
-   memory and render into them with full hardware acceleration.  Placement
-   of pixmaps in the cache is done automatically on a first-come basis and 
-   only if there is room.  To enable this feature, set the OFFSCREEN_PIXMAPS
-   flag in the XAAInfoRec.Flags field.  This is only available when a
-   ScreenToScreenCopy function is provided, when the Offscreen memory 
-   manager has been initialized and when the LINEAR_FRAMEBUFFER flag is
-   also set.
-
-   int maxOffPixWidth
-   int maxOffPixHeight
-
-       These two fields allow the driver to limit the maximum dimensions
-     of an offscreen pixmap.  If one of these is not set, it is assumed
-     that there is no limit on that dimension.  Note that if an offscreen
-     pixmap with a particular dimension is allowed, then your driver will be
-     expected to render primitives as large as that pixmap.  
-
-$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $
+
+
+                          XAA.HOWTO
+
+  This file describes how to add basic XAA support to a chipset driver.
+
+0)  What is XAA
+1)  XAA Initialization and Shutdown
+2)  The Primitives
+  2.0  Generic Flags
+  2.1  Screen to Screen Copies
+  2.2  Solid Fills
+  2.3  Solid Lines
+  2.4  Dashed Lines
+  2.5  Color Expand Fills
+    2.5.1 Screen to Screen Color Expansion
+    2.5.2 CPU to Screen Color Expansion
+      2.5.2.1 The Direct Method
+      2.5.2.2 The Indirect Method
+  2.6  8x8 Mono Pattern Fills
+  2.7  8x8 Color Pattern Fills
+  2.8  Image Writes
+    2.8.1 The Direct Method
+    2.8.2 The Indirect Method
+  2.9 Clipping
+3)  The Pixmap Cache
+4)  Offscreen Pixmaps
+
+/********************************************************************/
+
+0) WHAT IS XAA
+	
+   XAA (the XFree86 Acceleration Architecture) is a device dependent
+layer that encapsulates the unaccelerated framebuffer rendering layer,
+intercepting rendering commands sent to it from higher levels of the
+server.  For rendering tasks where hardware acceleration is not 
+possible, XAA allows the requests to proceed to the software rendering
+code.  Otherwise, XAA breaks the sometimes complicated X primitives
+into simpler primitives more suitable for hardware acceleration and
+will use accelerated functions exported by the chipset driver to 
+render these.
+
+   XAA provides a simple, easy to use driver interface that allows
+the driver to communicate its acceleration capabilities and restrictions
+back to XAA.  XAA will use the information provided by the driver
+to determine whether or not acceleration will be possible for a
+particular X primitive.
+
+
+
+1) XAA INITIALIZATION AND SHUTDOWN
+
+   All relevant prototypes and defines are in xaa.h.
+
+   To Initialize the XAA layer, the driver should allocate an XAAInfoRec
+via XAACreateInfoRec(), fill it out as described in this document
+and pass it to XAAInit().  XAAInit() must be called _after_ the 
+framebuffer initialization (usually cfb?ScreenInit or similar) since 
+it is "wrapping" that layer.  XAAInit() should be called _before_ the 
+cursor initialization (usually miDCInitialize) since the cursor
+layer needs to "wrap" all the rendering code including XAA.
+
+   When shutting down, the driver should free the XAAInfoRec
+structure in its CloseScreen function via XAADestroyInfoRec().
+The prototypes for the functions mentioned above are as follows:
+
+   XAAInfoRecPtr XAACreateInfoRec(void);
+   Bool XAAInit(ScreenPtr, XAAInfoRecPtr);
+   void XAADestroyInfoRec(XAAInfoRec);
+
+   The driver informs XAA of it's acceleration capablities by
+filling out an XAAInfoRec structure and passing it to XAAInit().
+The XAAInfoRec structure contains many fields, most of which are
+function pointers and flags.  Each primitive will typically have
+two functions and a set of flags associated with it, but it may
+have more.  These two functions are the "SetupFor" and "Subsequent" 
+functions.  The "SetupFor" function tells the driver that the 
+hardware should be initialized for a particular type of graphics 
+operation.  After the "SetupFor" function, one or more calls to the 
+"Subsequent" function will be made to indicate that an instance
+of the particular primitive should be rendered by the hardware.
+The details of each instance (width, height, etc...) are given
+with each "Subsequent" function.   The set of flags associated
+with each primitive lets the driver tell XAA what its hardware
+limitations are (eg. It doesn't support a planemask, it can only
+do one of the raster-ops, etc...).
+
+  Of the XAAInfoRec fields, one is required.  This is the
+Sync function.  XAA initialization will fail if this function
+is not provided.
+
+void Sync(ScrnInfoPtr pScrn)			/* Required */
+
+   Sync will be called when XAA needs to be certain that all
+   graphics coprocessor operations are finished, such as when
+   the framebuffer must be written to or read from directly
+   and it must be certain that the accelerator will not be
+   overwriting the area of interest.
+
+   One needs to make certain that the Sync function not only
+   waits for the accelerator fifo to empty, but that it waits for
+   the rendering of that last operation to complete.
+
+   It is guaranteed that no direct framebuffer access will
+   occur after a "SetupFor" or "Subsequent" function without
+   the Sync function being called first.
+
+
+
+2)  THE PRIMITIVES
+
+2.0  Generic Flags
+
+  Each primitive type has a set of flags associated with it which
+allow the driver to tell XAA what the hardware limitations are.
+The common ones are as follows:
+
+/* Foreground, Background, rop and planemask restrictions */
+
+   GXCOPY_ONLY
+
+     This indicates that the accelerator only supports GXcopy
+     for the particular primitive.
+
+   ROP_NEEDS_SOURCE
+
+     This indicates that the accelerator doesn't supports a
+     particular primitive with rops that don't involve the source.
+     These rops are GXclear, GXnoop, GXinvert and GXset. If neither
+     this flag nor GXCOPY_ONLY is defined, it is assumed that the
+     accelerator supports all 16 raster operations (rops) for that
+     primitive.
+
+   NO_PLANEMASK
+
+     This indicates that the accelerator does not support a hardware
+     write planemask for the particular primitive.
+
+   RGB_EQUAL
+
+     This indicates that the particular primitive requires the red, 
+     green and blue bytes of the foreground color (and background color,
+     if applicable) to be equal. This is useful for 24bpp when a graphics
+     coprocessor is used in 8bpp mode, which is not uncommon in older
+     hardware since some have no support for or only limited support for 
+     acceleration at 24bpp. This way, many operations will be accelerated 
+     for the common case of "grayscale" colors.  This flag should only
+     be used in 24bpp.
+
+  In addition to the common ones listed above which are possible for
+nearly all primitives, each primitive may have its own flags specific
+to that primitive.  If such flags exist they are documented in the
+descriptions of those primitives below.
+ 
+
+
+
+2.1  Screen to Screen Copies
+
+   The SetupFor and Subsequent ScreenToScreenCopy functions provide
+   an interface for copying rectangular areas from video memory to
+   video memory.  To accelerate this primitive the driver should
+   provide both the SetupFor and Subsequent functions and indicate
+   the hardware restrictions via the ScreenToScreenCopyFlags.  The
+   NO_PLANEMASK, GXCOPY_ONLY and ROP_NEEDS_SOURCE flags as described
+   in Section 2.0 are valid as well as the following:
+
+    NO_TRANSPARENCY
+     
+      This indicates that the accelerator does not support skipping
+      of color keyed pixels when copying from the source to the destination.
+
+    TRANSPARENCY_GXCOPY_ONLY
+
+      This indicates that the accelerator supports skipping of color keyed
+      pixels only when the rop is GXcopy.
+
+    ONLY_LEFT_TO_RIGHT_BITBLT
+
+      This indicates that the hardware only accepts blitting when the
+      x direction is positive.
+
+    ONLY_TWO_BITBLT_DIRECTIONS
+
+      This indicates that the hardware can only cope with blitting when
+      the direction of x is the same as the direction in y.
+
+
+void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn,
+			int xdir, int ydir,
+			int rop,
+			unsigned int planemask,
+			int trans_color )
+
+    When this is called, SubsequentScreenToScreenCopy will be called
+    one or more times directly after.  If ydir is 1, then the accelerator
+    should copy starting from the top (minimum y) of the source and
+    proceed downward.  If ydir is -1, then the accelerator should copy
+    starting from the bottom of the source (maximum y) and proceed
+    upward.  If xdir is 1, then the accelerator should copy each
+    y scanline starting from the leftmost pixel of the source.  If
+    xdir is -1, it should start from the rightmost pixel.  
+       If trans_color is not -1 then trans_color indicates that the
+    accelerator should not copy pixels with the color trans_color
+    from the source to the destination, but should skip them. 
+    Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
+ 
+
+void SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
+			int x1, int y1,
+			int x2, int y2,
+			int width, int height)
+
+    Copy a rectangle "width" x "height" from the source (x1,y1) to the 
+    destination (x2,y2) using the parameters passed by the last
+    SetupForScreenToScreenCopy call. (x1,y1) and (x2,y2) always denote 
+    the upper left hand corners of the source and destination regardless 
+    of which xdir and ydir values are given by SetupForScreenToScreenCopy.  
+
+
+
+2.2 Solid Fills
+
+   The SetupFor and Subsequent SolidFill(Rect/Trap) functions provide
+   an interface for filling rectangular areas of the screen with a
+   foreground color.  To accelerate this primitive the driver should
+   provide both the SetupForSolidFill and SubsequentSolidFillRect 
+   functions and indicate the hardware restrictions via the SolidFillFlags.
+   The driver may optionally provide a SubsequentSolidFillTrap if
+   it is capable of rendering the primitive correctly.  
+   The GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
+   as described in Section 2.0 are valid.
+
+  
+void SetupForSolidFill(ScrnInfoPtr pScrn, 
+                       int color, int rop, unsigned int planemask)
+
+    SetupForSolidFill indicates that any combination of the following 
+    may follow it.
+
+	SubsequentSolidFillRect
+	SubsequentSolidFillTrap
+
+
+ 
+void SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
+
+     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
+     using the color, rop and planemask given by the last 
+     SetupForSolidFill call.
+
+void SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h, 
+	int left, int dxL, int dyL, int eL,
+	int right, int dxR, int dyR, int eR)
+
+     These parameters describe a trapezoid via a version of
+     Bresenham's parameters. "y" is the top line. "h" is the
+     number of spans to be filled in the positive Y direction.
+     "left" and "right" indicate the starting X values of the
+     left and right edges.  dy/dx describes the edge slope.
+     These are not the deltas between the beginning and ending
+     points on an edge.  They merely describe the slope. "e" is
+     the initial error term.  It's the relationships between dx,
+     dy and e that define the edge.
+	If your engine does not do bresenham trapezoids or does
+     not allow the programmer to specify the error term then
+     you are not expected to be able to accelerate them.
+
+
+2.3  Solid Lines
+
+    XAA provides an interface for drawing thin lines.  In order to
+    draw X lines correctly a high degree of accuracy is required.
+    This usually limits line acceleration to hardware which has a
+    Bresenham line engine, though depending on the algorithm used,
+    other line engines may come close if they accept 16 bit line 
+    deltas.  XAA has both a Bresenham line interface and a two-point
+    line interface for drawing lines of arbitrary orientation.  
+    Additionally there is a SubsequentSolidHorVertLine which will
+    be used for all horizontal and vertical lines.  Horizontal and
+    vertical lines are handled separately since hardware that doesn't
+    have a line engine (or has one that is unusable due to precision
+    problems) can usually draw these lines by some other method such
+    as drawing them as thin rectangles.  Even for hardware that can
+    draw arbitrary lines via the Bresenham or two-point interfaces,
+    the SubsequentSolidHorVertLine is used for horizontal and vertical
+    lines since most hardware is able to render the horizontal lines
+    and sometimes the vertical lines faster by other methods (Hint:
+    try rendering horizontal lines as flattened rectangles).  If you have 
+    not provided a SubsequentSolidHorVertLine but you have provided 
+    Bresenham or two-point lines, a SubsequentSolidHorVertLine function 
+    will be supplied for you.
+
+    The flags field associated with Solid Lines is SolidLineFlags and 
+    the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
+    described in Section 2.0 are valid restrictions.  
+
+    Some line engines have line biases hardcoded to comply with
+    Microsoft line biasing rules.  A tell-tale sign of this is the
+    hardware lines not matching the software lines in the zeroth and
+    fourth octants.  The driver can set the flag:
+	
+	MICROSOFT_ZERO_LINE_BIAS
+
+    in the AccelInfoRec.Flags field to adjust the software lines to
+    match the hardware lines.   This is in the generic flags field
+    rather than the SolidLineFlags since this flag applies to all
+    software zero-width lines on the screen and not just the solid ones.
+
+
+void SetupForSolidLine(ScrnInfoPtr pScrn, 
+                       int color, int rop, unsigned int planemask)
+
+    SetupForSolidLine indicates that any combination of the following 
+    may follow it.
+
+	SubsequentSolidBresenhamLine
+	SubsequentSolidTwoPointLine
+        SubsequentSolidHorVertLine 	
+
+
+void SubsequentSolidHorVertLine( ScrnInfoPtr pScrn,
+        			int x, int y, int len, int dir )
+
+    All vertical and horizontal solid thin lines are rendered with
+    this function.  The line starts at coordinate (x,y) and extends
+    "len" pixels inclusive.  In the direction indicated by "dir."
+    The direction is either DEGREES_O or DEGREES_270.  That is, it
+    always extends to the right or down.
+
+
+
+void SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
+        	int x1, int y1, int x2, int y2, int flags)
+
+    Draw a line from (x1,y1) to (x2,y2).  If the flags field contains
+    the flag OMIT_LAST, the last pixel should not be drawn.  Otherwise,
+    the pixel at (x2,y2) should be drawn.
+
+    If you use the TwoPoint line interface there is a good possibility
+    that your line engine has hard-coded line biases that do not match
+    the default X zero-width lines.  If so, you may need to set the
+    MICROSOFT_ZERO_LINE_BIAS flag described above.  Note that since
+    any vertex in the 16-bit signed coordinate system is valid, your
+    line engine is expected to handle 16-bit values if you have hardware
+    line clipping enabled.  If your engine cannot handle 16-bit values,
+    you should not use hardware line clipping.
+
+
+void SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
+        int x, int y, int major, int minor, int err, int len, int octant)
+
+    "X" and "y" are the starting point of the line.  "Major" and "minor" 
+    are the major and minor step constants.  "Err" is the initial error
+    term.  "Len" is the number of pixels to be drawn (inclusive). "Octant"
+    can be any combination of the following flags OR'd together:
+
+      Y_MAJOR		Y is the major axis (X otherwise)
+      X_DECREASING	The line is drawn from right to left
+      Y_DECREASING	The line is drawn from bottom to top
+	  
+    The major, minor and err terms are the "raw" Bresenham parameters
+    consistent with a line engine that does:
+
+	e = err;
+	while(len--) {
+	   DRAW_POINT(x,y);
+	   e += minor;
+	   if(e >= 0) {
+		e -= major;
+		TAKE_ONE_STEP_ALONG_MINOR_AXIS;
+	   }
+	   TAKE_ONE_STEP_ALONG_MAJOR_AXIS;
+	}
+
+    IBM 8514 style Bresenham line interfaces require their parameters
+    modified in the following way:
+
+	Axial = minor;
+	Diagonal = minor - major;
+	Error = minor + err;
+
+SolidBresenhamLineErrorTermBits
+
+    This field allows the driver to tell XAA how many bits large its
+    Bresenham parameter registers are.  Many engines have registers that
+    only accept 12 or 13 bit Bresenham parameters, and the parameters
+    for clipped lines may overflow these if they are not scaled down.
+    If this field is not set, XAA will assume the engine can accomodate
+    16 bit parameters, otherwise, it will scale the parameters to the
+    size specified.
+
+
+2.4  Dashed Lines
+
+    The same degree of accuracy required by the solid lines is required
+    for drawing dashed lines as well.  The dash pattern itself is a
+    buffer of binary data where ones are expanded into the foreground
+    color and zeros either correspond to the background color or
+    indicate transparency depending on whether or not DoubleDash or
+    OnOffDashes are being drawn.  
+
+    The flags field associated with dashed Lines is DashedLineFlags and 
+    the GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags as
+    described in Section 2.0 are valid restrictions.  Additionally, the
+    following flags are valid:
+
+      NO_TRANSPARENCY
+
+	This indicates that the driver cannot support dashed lines
+	with transparent backgrounds (OnOffDashes).
+
+      TRANSPARENCY_ONLY
+
+	This indicates that the driver cannot support dashes with
+	both a foreground and background color (DoubleDashes).
+
+      LINE_PATTERN_POWER_OF_2_ONLY
+
+	This indicates that only patterns with a power of 2 length
+	can be accelerated.
+
+      LINE_PATTERN_LSBFIRST_MSBJUSTIFIED
+      LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
+      LINE_PATTERN_MSBFIRST_MSBJUSTIFIED
+      LINE_PATTERN_MSBFIRST_LSBJUSTIFIED
+
+	These describe how the line pattern should be packed.
+	The pattern buffer is DWORD padded.  LSBFIRST indicates
+	that the pattern runs from the LSB end to the MSB end.
+	MSBFIRST indicates that the pattern runs from the MSB end
+	to the LSB end.  When the pattern does not completely fill
+	the DWORD padded buffer, the pattern will be justified 
+	towards the MSB or LSB end based on the flags above.
+
+
+    The following field indicates the maximum length dash pattern that
+    should be accelerated.
+
+	int DashPatternMaxLength
+
+
+void SetupForDashedLine(ScrnInfoPtr pScrn,
+		int fg, int bg, int rop, unsigned int planemask,
+        	int length, unsigned char *pattern)
+
+    
+    SetupForDashedLine indicates that any combination of the following 
+    may follow it.
+
+	SubsequentDashedBresenhamLine
+	SubsequentDashedTwoPointLine
+
+    If "bg" is -1, then the background (pixels corresponding to clear
+    bits in the pattern) should remain unmodified. "Bg" indicates the
+    background color otherwise.  "Length" indicates the length of
+    the pattern in bits and "pattern" points to the DWORD padded buffer
+    holding the pattern which has been packed according to the flags
+    set above.  
+
+    
+void SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn,
+        int x1, int y1, int x2, int y2, int flags, int phase)
+
+void SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
+        int x1, int y1, int major, int minor, int err, int len, int octant,
+        int phase)
+  
+    These are the same as the SubsequentSolidTwoPointLine and
+    SubsequentBresenhamLine functions except for the addition
+    of the "phase" field which indicates the offset into the dash 
+    pattern that the pixel at (x1,y1) corresponds to.
+
+    As with the SubsequentBresenhamLine, there is an
+ 
+	int DashedBresenhamLineErrorTermBits 
+   
+    field which indicates the size of the error term registers
+    used with dashed lines.  This is usually the same value as
+    the field for the solid lines (because it's usually the same
+    register).
+       
+      
+
+2.5   Color Expansion Fills
+
+    When filling a color expansion rectangle, the accelerator
+    paints each pixel depending on whether or not a bit in a
+    corresponding bitmap is set or clear. Opaque expansions are 
+    when a set bit corresponds to the foreground color and a clear 
+    bit corresponds to the background color.  A transparent expansion
+    is when a set bit corresponds to the foreground color and a
+    clear bit indicates that the pixel should remain unmodified.
+   
+    The graphics accelerator usually has access to the source 
+    bitmap in one of two ways: 1) the bitmap data is sent serially
+    to the accelerator by the CPU through some memory mapped aperture
+    or 2) the accelerator reads the source bitmap out of offscreen
+    video memory.  Some types of primitives are better suited towards 
+    one method or the other.  Type 2 is useful for reusable patterns
+    such as stipples which can be cached in offscreen memory.  The
+    aperature method can be used for stippling but the CPU must pass
+    the data across the bus each time a stippled fill is to be performed.  
+    For expanding 1bpp client pixmaps or text strings to the screen,
+    the aperature method is usually superior because the intermediate
+    copy in offscreen memory needed by the second method would only be 
+    used once.  Unfortunately, many accelerators can only do one of these
+    methods and not both.  
+
+    XAA provides both ScreenToScreen and CPUToScreen color expansion 
+    interfaces for doing color expansion fills.  The ScreenToScreen
+    functions can only be used with hardware that supports reading
+    of source bitmaps from offscreen video memory, and these are only
+    used for cacheable patterns such as stipples.  There are two
+    variants of the CPUToScreen routines - a direct method intended
+    for hardware that has a transfer aperature, and an indirect method
+    intended for hardware without transfer aperatures or hardware
+    with unusual transfer requirements.  Hardware that can only expand
+    bitmaps from video memory should supply ScreenToScreen routines
+    but also ScanlineCPUToScreen (indirect) routines to optimize transfers 
+    of non-cacheable data.  Hardware that can only accept source bitmaps
+    through an aperature should supply CPUToScreen (or ScanlineCPUToScreen) 
+    routines. Hardware that can do both should provide both ScreenToScreen 
+    and CPUToScreen routines.
+
+    For both ScreenToScreen and CPUToScreen interfaces, the GXCOPY_ONLY,
+    ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags described in
+    Section 2.0 are valid as well as the following:
+
+    /* bit order requirements (one of these must be set) */
+   
+    BIT_ORDER_IN_BYTE_LSBFIRST
+
+      This indicates that least significant bit in each byte of the source
+      data corresponds to the leftmost of that block of 8 pixels.  This
+      is the prefered format.
+
+    BIT_ORDER_IN_BYTE_MSBFIRST    
+
+      This indicates that most significant bit in each byte of the source
+      data corresponds to the leftmost of that block of 8 pixels.
+
+    /* transparency restrictions */
+
+    NO_TRANSPARENCY
+
+      This indicates that the accelerator cannot do a transparent expansion.
+
+    TRANSPARENCY_ONLY
+
+      This indicates that the accelerator cannot do an opaque expansion.
+      In cases where where the background needs to be filled, XAA will
+      render the primitive in two passes when using the CPUToScreen
+      interface, but will not do so with the ScreenToScreen interface 
+      since that would require caching of two patterns.  Some 
+      ScreenToScreen hardware may be able to render two passes at the
+      driver level and remove the TRANSPARENCY_ONLY restriction if
+      it can render pixels corresponding to the zero bits.
+
+
+
+2.5.1  Screen To Screen Color Expansion
+
+    The ScreenToScreenColorExpandFill routines provide an interface
+    for doing expansion blits from source patterns stored in offscreen
+    video memory.
+
+    void SetupForScreenToScreenColorExpandFill (ScrnInfoPtr pScrn,
+        			int fg, int bg, 
+				int rop, unsigned int planemask)
+
+
+    Ones in the source bitmap will correspond to the fg color.
+    Zeros in the source bitmap will correspond to the bg color
+    unless bg = -1.  In that case the pixels corresponding to the
+    zeros in the bitmap shall be left unmodified by the accelerator.
+
+    For hardware that doesn't allow an easy implementation of skipleft, the
+    driver can replace CacheMonoStipple function with one that stores multiple
+    rotated copies of the stipple and select between them. In this case the
+    driver should set CacheColorExpandDensity to tell XAA how many copies of
+    the pattern are stored in the width of a cache slot. For instance if the
+    hardware can specify the starting address in bytes, then 8 rotated copies
+    of the stipple are needed and CacheColorExpandDensity should be set to 8.
+
+    void SubsequentScreenToScreenColorExpandFill( ScrnInfoPtr pScrn,
+				int x, int y, int w, int h,
+				int srcx, int srcy, int offset )
+
+   
+    Fill a rectangle "w" x "h" at location (x,y).  The source pitch
+    between scanlines is the framebuffer pitch (pScrn->displayWidth
+    pixels) and srcx and srcy indicate the start of the source pattern 
+    in units of framebuffer pixels. "Offset" indicates the bit offset
+    into the pattern that corresponds to the pixel being painted at
+    "x" on the screen.  Some hardware accepts source coordinates in
+    units of bits which makes implementation of the offset trivial.
+    In that case, the bit address of the source bit corresponding to
+    the pixel painted at (x,y) would be:
+	
+     (srcy * pScrn->displayWidth + srcx) * pScrn->bitsPerPixel + offset
+
+    It should be noted that the offset assumes LSBFIRST hardware.  
+    For MSBFIRST hardware, the driver may need to implement the 
+    offset by bliting only from byte boundaries and hardware clipping.
+
+
+
+2.5.2  CPU To Screen Color Expansion
+
+
+    The CPUToScreenColorExpandFill routines provide an interface for 
+    doing expansion blits from source patterns stored in system memory.
+    There are two varieties of this primitive, a CPUToScreenColorExpandFill
+    and a ScanlineCPUToScreenColorExpandFill.  With the 
+    CPUToScreenColorExpandFill method, the source data is sent serially
+    through a memory mapped aperature.  With the Scanline version, the
+    data is rendered scanline at a time into intermediate buffers with
+    a call to SubsequentColorExpandScanline following each scanline.
+
+    These two methods have separate flags fields, the
+    CPUToScreenColorExpandFillFlags and ScanlineCPUToScreenColorExpandFillFlags
+    respectively.  Flags specific to one method or the other are described 
+    in sections 2.5.2.1 and 2.5.2.2 but for both cases the bit order and
+    transparency restrictions listed at the beginning of section 2.5 are 
+    valid as well as the following:
+    
+    /* clipping  (optional) */
+    
+    LEFT_EDGE_CLIPPING
+ 
+      This indicates that the accelerator supports omission of up to
+      31 pixels on the left edge of the rectangle to be filled.  This
+      is beneficial since it allows transfer of the source bitmap to
+      always occur from DWORD boundaries. 
+
+    LEFT_EDGE_CLIPPING_NEGATIVE_X
+
+      This flag indicates that the accelerator can render color expansion
+      rectangles even if the value of x origin is negative (off of
+      the screen on the left edge).
+
+    /* misc */
+
+    TRIPLE_BITS_24BPP
+
+      When enabled (must be in 24bpp mode), color expansion functions
+      are expected to require three times the amount of bits to be
+      transferred so that 24bpp grayscale colors can be used with color
+      expansion in 8bpp coprocessor mode. Each bit is expanded to 3
+      bits when writing the monochrome data.
+
+
+ 2.5.1 The Direct Method 
+
+
+    Using the direct method of color expansion XAA will send all
+    bitmap data to the accelerator serially through an memory mapped
+    transfer window defined by the following two fields:
+
+      unsigned char *ColorExpandBase
+
+        This indicates the memory address of the beginning of the aperture.
+
+      int ColorExpandRange
+
+        This indicates the size in bytes of the aperture.
+
+    The driver should specify how the transfered data should be padded.
+    There are options for both the padding of each Y scanline and for the
+    total transfer to the aperature.
+    One of the following two flags must be set:
+
+      CPU_TRANSFER_PAD_DWORD
+
+        This indicates that the total transfer (sum of all scanlines) sent
+        to the aperature must be DWORD padded.  This is the default behavior.
+
+      CPU_TRANSFER_PAD_QWORD 
+
+	This indicates that the total transfer (sum of all scanlines) sent
+	to the aperature must be QWORD padded.  With this set, XAA will send
+        an extra DWORD to the aperature when needed to ensure that only
+        an even number of DWORDs are sent.
+
+    And then there are the flags for padding of each scanline:
+
+      SCANLINE_PAD_DWORD
+
+	This indicates that each Y scanline should be DWORD padded.
+        This is the only option available and is the default.
+
+    Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
+    that the aperture is a single register rather than a range of
+    registers, and XAA should write all of the data to the first DWORD.
+    If the ColorExpandRange is not large enough to accomodate scanlines
+    the width of the screen, this option will be forced. That is, the
+    ColorExpandRange must be:
+
+        ((virtualX + 31)/32) * 4   bytes or more.
+
+        ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
+  
+    If the TRIPLE_BITS_24BPP flag is set, the required area should be 
+    multiplied by three.
+     
+    
+void SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+        		int fg, int bg,
+			int rop,
+			unsigned int planemask)
+
+  
+ 
+     Ones in the source bitmap will correspond to the fg color.
+     Zeros in the source bitmap will correspond to the bg color
+     unless bg = -1.  In that case the pixels corresponding to the
+     zeros in the bitmap shall be left unmodified by the accelerator.
+
+
+void SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+			int x, int y, int w, int h,
+			int skipleft )
+
+     When this function is called, the accelerator should be setup
+     to fill a rectangle of dimension "w" by "h" with origin at (x,y)
+     in the fill style prescribed by the last call to 
+     SetupForCPUToScreenColorExpandFill.  XAA will pass the data to 
+     the aperture immediately after this function is called.  If the 
+     skipleft is non-zero (and LEFT_EDGE_CLIPPING has been enabled), then 
+     the accelerator _should_not_ render skipleft pixels on the leftmost
+     edge of the rectangle.  Some engines have an alignment feature
+     like this built in, some others can do this using a clipping
+     window.
+
+     It can be arranged for XAA to call Sync() after it is through 
+     calling the Subsequent function by setting SYNC_AFTER_COLOR_EXPAND 
+     in the  CPUToScreenColorExpandFillFlags.  This can provide the driver 
+     with an oportunity to reset a clipping window if needed.
+
+    
+2.5.2  The Indirect Method 
+
+     Using the indirect method, XAA will render the bitmap data scanline
+     at a time to one or more buffers.  These buffers may be memory
+     mapped apertures or just intermediate storage.
+
+     int NumScanlineColorExpandBuffers
+
+       This indicates the number of buffers available.
+
+     unsigned char **ScanlineColorExpandBuffers
+
+       This is an array of pointers to the memory locations of each buffer.
+       Each buffer is expected to be large enough to accommodate scanlines
+       the width of the screen.  That is:
+
+        ((virtualX + 31)/32) * 4   bytes or more.
+
+        ((virtualX + 62)/32 * 4) if LEFT_EDGE_CLIPPING_NEGATIVE_X is set.
+  
+     Scanlines are always DWORD padded.
+     If the TRIPLE_BITS_24BPP flag is set, the required area should be 
+     multiplied by three.
+
+
+void SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+        		int fg, int bg,
+			int rop,
+			unsigned int planemask)
+ 
+     Ones in the source bitmap will correspond to the fg color.
+     Zeros in the source bitmap will correspond to the bg color
+     unless bg = -1.  In that case the pixels corresponding to the
+     zeros in the bitmap shall be left unmodified by the accelerator.
+
+     
+void SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+			int x, int y, int w, int h,
+			int skipleft )
+
+void SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
+
+
+    When SubsequentScanlineCPUToScreenColorExpandFill is called, XAA 
+    will begin transfering the source data scanline at a time, calling  
+    SubsequentColorExpandScanline after each scanline.  If more than
+    one buffer is available, XAA will cycle through the buffers.
+    Subsequent scanlines will use the next buffer and go back to the
+    buffer 0 again when the last buffer is reached.  The index into
+    the ScanlineColorExpandBuffers array is presented as "bufno"
+    with each SubsequentColorExpandScanline call.
+
+    The skipleft field is the same as for the direct method.
+
+    The indirect method can be use to send the source data directly 
+    to a memory mapped aperture represented by a single color expand
+    buffer, scanline at a time, but more commonly it is used to place 
+    the data into offscreen video memory so that the accelerator can 
+    blit it to the visible screen from there.  In the case where the
+    accelerator permits rendering into offscreen video memory while
+    the accelerator is active, several buffers can be used so that
+    XAA can be placing source data into the next buffer while the
+    accelerator is blitting the current buffer.  For cases where
+    the accelerator requires some special manipulation of the source
+    data first, the buffers can be in system memory.  The CPU can
+    manipulate these buffers and then send the data to the accelerator.
+
+
+
+2.6   8x8 Mono Pattern Fills
+
+    XAA provides support for two types of 8x8 hardware patterns -
+    "Mono" patterns and "Color" patterns.  Mono pattern data is
+    64 bits of color expansion data with ones indicating the
+    foreground color and zeros indicating the background color.
+    The source bitmaps for the 8x8 mono patterns can be presented
+    to the graphics accelerator in one of two ways.  They can be
+    passed as two DWORDS to the 8x8 mono pattern functions or
+    they can be cached in offscreen memory and their locations
+    passed to the 8x8 mono pattern functions.  In addition to the
+    GXCOPY_ONLY, ROP_NEEDS_SOURCE, NO_PLANEMASK and RGB_EQUAL flags
+    defined in Section 2.0, the following are defined for the
+    Mono8x8PatternFillFlags:
+
+    HARDWARE_PATTERN_PROGRAMMED_BITS
+
+      This indicates that the 8x8 patterns should be packed into two
+      DWORDS and passed to the 8x8 mono pattern functions.  The default
+      behavior is to cache the patterns in offscreen video memory and
+      pass the locations of these patterns to the functions instead.
+      The pixmap cache must be enabled for the default behavior (8x8 
+      pattern caching) to work.  See Section 3 for how to enable the
+      pixmap cache. The pixmap cache is not necessary for 
+      HARDWARE_PATTERN_PROGRAMMED_BITS.
+
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+      If the hardware supports programmable pattern offsets then
+      this option should be set. See the table below for further
+      infomation.
+
+    HARDWARE_PATTERN_SCREEN_ORIGIN
+
+      Some hardware wants the pattern offset specified with respect to the
+      upper left-hand corner of the primitive being drawn.  Other hardware 
+      needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that 
+      all pattern offsets should be referenced to the upper left-hand 
+      corner of the screen.  HARDWARE_PATTERN_SCREEN_ORIGIN is preferable 
+      since this is more natural for the X-Window system and offsets will 
+      have to be recalculated for each Subsequent function otherwise.
+
+    BIT_ORDER_IN_BYTE_MSBFIRST
+    BIT_ORDER_IN_BYTE_LSBFIRST
+
+      As with other color expansion routines this indicates whether the
+      most or the least significant bit in each byte from the pattern is 
+      the leftmost on the screen.
+
+    TRANSPARENCY_ONLY
+    NO_TRANSPARENCY
+
+      This means the same thing as for the color expansion rect routines
+      except that for TRANSPARENCY_ONLY XAA will not render the primitive
+      in two passes since this is more easily handled by the driver.
+      It is recommended that TRANSPARENCY_ONLY hardware handle rendering
+      of opaque patterns in two passes (the background can be filled as
+      a rectangle in GXcopy) in the Subsequent function so that the
+      TRANSPARENCY_ONLY restriction can be removed. 
+
+
+
+    Additional information about cached patterns...
+    For the case where HARDWARE_PATTERN_PROGRAMMED_BITS is not set and 
+    the pattern must be cached in offscreen memory, the first pattern
+    starts at the cache slot boundary which is set by the 
+    CachePixelGranularity field used to configure the pixmap cache.
+    One should ensure that the CachePixelGranularity reflects any 
+    alignment restrictions that the accelerator may put on 8x8 pattern 
+    storage locations.  When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set 
+    there is only one pattern stored.  When this flag is not set,
+    all 64 pre-rotated copies of the pattern are cached in offscreen memory.
+    The MonoPatternPitch field can be used to specify the X position pixel
+    granularity that each of these patterns must align on.  If the
+    MonoPatternPitch is not supplied, the patterns will be densely packed
+    within the cache slot.  The behavior of the default XAA 8x8 pattern
+    caching mechanism to store all 8x8 patterns linearly in video memory.
+    If the accelerator needs the patterns stored in a more unusual fashion,
+    the driver will need to provide its own 8x8 mono pattern caching 
+    routines for XAA to use. 
+
+    The following table describes the meanings of the "patx" and "paty"
+    fields in both the SetupFor and Subsequent functions.
+
+    With HARDWARE_PATTERN_SCREEN_ORIGIN
+    -----------------------------------
+
+    HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+	SetupFor: patx and paty are the first and second DWORDS of the
+		  8x8 mono pattern.
+
+	Subsequent: patx and paty are the x,y offset into that pattern.
+		    All Subsequent calls will have the same offset in 
+		    the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
+		    the offset specified by the first Subsequent call 
+		    after a SetupFor call will need to be observed.
+
+    HARDWARE_PATTERN_PROGRAMMED_BITS only
+
+	SetupFor: patx and paty hold the first and second DWORDS of
+		  the 8x8 mono pattern pre-rotated to match the desired
+		  offset.
+
+	Subsequent: These just hold the same patterns and can be ignored.
+
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+	SetupFor: patx and paty hold the x,y coordinates of the offscreen
+		  memory location where the 8x8 pattern is stored.  The
+		  bits are stored linearly in memory at that location.
+
+	Subsequent: patx and paty hold the offset into the pattern.
+		    All Subsequent calls will have the same offset in 
+		    the case of HARDWARE_PATTERN_SCREEN_ORIGIN so only
+		    the offset specified by the first Subsequent call 
+		    after a SetupFor call will need to be observed.
+
+    Neither programmed bits or origin
+
+	SetupFor: patx and paty hold the x,y coordinates of the offscreen 	
+		  memory location where the pre-rotated 8x8 pattern is
+		  stored.
+
+	Subsequent: patx and paty are the same as in the SetupFor function
+		    and can be ignored.
+		  
+
+    Without HARDWARE_PATTERN_SCREEN_ORIGIN
+    -------------------------------------- 
+
+    HARDWARE_PATTERN_PROGRAMMED_BITS and HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+	SetupFor: patx and paty are the first and second DWORDS of the
+		  8x8 mono pattern.
+
+	Subsequent: patx and paty are the x,y offset into that pattern.
+
+    HARDWARE_PATTERN_PROGRAMMED_BITS only
+
+	SetupFor: patx and paty holds the first and second DWORDS of
+		  the unrotated 8x8 mono pattern.  This can be ignored. 
+
+	Subsequent: patx and paty hold the rotated 8x8 pattern to be 
+		    rendered.
+
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+	SetupFor: patx and paty hold the x,y coordinates of the offscreen
+		  memory location where the 8x8 pattern is stored.  The
+		  bits are stored linearly in memory at that location.
+
+	Subsequent: patx and paty hold the offset into the pattern.
+
+    Neither programmed bits or origin
+
+	SetupFor: patx and paty hold the x,y coordinates of the offscreen 	
+		  memory location where the unrotated 8x8 pattern is
+		  stored.  This can be ignored.
+
+	Subsequent: patx and paty hold the x,y coordinates of the
+		    rotated 8x8 pattern to be rendered.
+
+
+
+void SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+        int fg, int bg, int rop, unsigned int planemask)
+
+    SetupForMono8x8PatternFill indicates that any combination of the 
+    following  may follow it.
+
+	SubsequentMono8x8PatternFillRect
+	SubsequentMono8x8PatternFillTrap
+
+    The fg, bg, rop and planemask fields have the same meaning as the
+    ones used for the other color expansion routines.  Patx's and paty's
+    meaning can be determined from the table above.
+
+ 
+void SubsequentMono8x8PatternFillRect( ScrnInfoPtr pScrn,
+        	int patx, int paty, int x, int y, int w, int h)
+
+     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
+     using the parameters give by the last SetupForMono8x8PatternFill
+     call.  The meanings of patx and paty can be determined by the
+     table above.
+
+void SubsequentMono8x8PatternFillTrap( ScrnInfoPtr pScrn,
+     			   int patx, int paty, int y, int h, 
+     			   int left, int dxL, int dyL, int eL,
+     			   int right, int dxR, int dyR, int eR )
+
+     The meanings of patx and paty can be determined by the table above.
+     The rest of the fields have the same meanings as those in the 
+     SubsequentSolidFillTrap function. 
+
+
+
+2.7   8x8 Color Pattern Fills
+  
+    8x8 color pattern data is 64 pixels of full color data that
+    is stored linearly in offscreen video memory.  8x8 color patterns 
+    are useful as a substitute for 8x8 mono patterns when tiling,
+    doing opaque stipples, or in the case where transperency is
+    supported, regular stipples.  8x8 color pattern fills also have
+    the additional benefit of being able to tile full color 8x8
+    patterns instead of just 2 color ones like the mono patterns.
+    However, full color 8x8 patterns aren't used very often in the
+    X Window system so you might consider passing this primitive
+    by if you already can do mono patterns, especially if they 
+    require alot of cache area.  Color8x8PatternFillFlags is
+    the flags field for this primitive and the GXCOPY_ONLY,
+    ROP_NEEDS_SOURCE and NO_PLANEMASK flags as described in
+    Section 2.0 are valid as well as the following:
+
+
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+
+      If the hardware supports programmable pattern offsets then
+      this option should be set.  
+
+    HARDWARE_PATTERN_SCREEN_ORIGIN
+
+      Some hardware wants the pattern offset specified with respect to the
+      upper left-hand corner of the primitive being drawn.  Other hardware 
+      needs the option HARDWARE_PATTERN_SCREEN_ORIGIN set to indicate that 
+      all pattern offsets should be referenced to the upper left-hand 
+      corner of the screen.  HARDWARE_PATTERN_SCREEN_ORIGIN is preferable 
+      since this is more natural for the X-Window system and offsets will 
+      have to be recalculated for each Subsequent function otherwise.
+
+    NO_TRANSPARENCY
+    TRANSPARENCY_GXCOPY_ONLY
+
+      These mean the same as for the ScreenToScreenCopy functions.
+
+
+    The following table describes the meanings of patx and paty passed
+    to the SetupFor and Subsequent fields:
+
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN && HARDWARE_PATTERN_SCREEN_ORIGIN
+	
+	SetupFor: patx and paty hold the x,y location of the unrotated 
+		  pattern.
+
+	Subsequent: patx and paty hold the pattern offset.  For the case
+		    of HARDWARE_PATTERN_SCREEN_ORIGIN all Subsequent calls
+		    have the same offset so only the first call will need
+		    to be observed.
+
+    
+    HARDWARE_PATTERN_PROGRAMMED_ORIGIN only
+
+	SetupFor: patx and paty hold the x,y location of the unrotated
+		  pattern.
+
+	Subsequent: patx and paty hold the pattern offset. 
+
+    HARDWARE_PATTERN_SCREEN_ORIGIN
+
+	SetupFor: patx and paty hold the x,y location of the rotated pattern.
+
+	Subsequent: patx and paty hold the same location as the SetupFor
+		    function so these can be ignored.
+
+    neither flag
+
+	SetupFor: patx and paty hold the x,y location of the unrotated
+		  pattern.  This can be ignored.
+
+	Subsequent: patx and paty hold the x,y location of the rotated
+		    pattern.
+
+    Additional information about cached patterns...
+    All 8x8 color patterns are cached in offscreen video memory so
+    the pixmap cache must be enabled to use them. The first pattern
+    starts at the cache slot boundary which is set by the 
+    CachePixelGranularity field used to configure the pixmap cache.
+    One should ensure that the CachePixelGranularity reflects any 
+    alignment restrictions that the accelerator may put on 8x8 pattern 
+    storage locations.  When HARDWARE_PATTERN_PROGRAMMED_ORIGIN is set 
+    there is only one pattern stored.  When this flag is not set,
+    all 64 rotations off the pattern are accessible but it is assumed
+    that the accelerator is capable of accessing data stored on 8
+    pixel boundaries.  If the accelerator has stricter alignment 
+    requirements than this the dirver will need to provide its own 
+    8x8 color pattern caching routines. 
+
+
+void SetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+        	int rop, unsigned int planemask, int trans_color)
+
+    SetupForColor8x8PatternFill indicates that any combination of the 
+    following  may follow it.
+
+	SubsequentColor8x8PatternFillRect
+	SubsequentColor8x8PatternFillTrap	(not implemented yet)
+
+    For the meanings of patx and paty, see the table above.  Trans_color
+    means the same as for the ScreenToScreenCopy functions.
+
+
+ 
+void SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
+        	int patx, int paty, int x, int y, int w, int h)
+
+     Fill a rectangle of dimensions "w" by "h" with origin at (x,y) 
+     using the parameters give by the last SetupForColor8x8PatternFill
+     call.  The meanings of patx and paty can be determined by the
+     table above.
+
+void SubsequentColor8x8PatternFillTrap( ScrnInfoPtr pScrn,
+     			   int patx, int paty, int y, int h, 
+     			   int left, int dxL, int dyL, int eL,
+     			   int right, int dxR, int dyR, int eR )
+
+    For the meanings of patx and paty, see the table above. 
+    The rest of the fields have the same meanings as those in the 
+    SubsequentSolidFillTrap function. 
+
+
+
+2.8  Image Writes
+
+    XAA provides a mechanism for transfering full color pixel data from
+    system memory to video memory through the accelerator.  This is 
+    useful for dealing with alignment issues and performing raster ops
+    on the data when writing it to the framebuffer.  As with color
+    expansion rectangles, there is a direct and indirect method.  The
+    direct method sends all data through a memory mapped aperature.
+    The indirect method sends the data to an intermediated buffer scanline 
+    at a time.
+
+    The direct and indirect methods have separate flags fields, the
+    ImageWriteFlags and ScanlineImageWriteFlags respectively.
+    Flags specific to one method or the other are described in sections 
+    2.8.1 and 2.8.2 but for both cases the GXCOPY_ONLY, ROP_NEEDS_SOURCE
+    and NO_PLANEMASK flags described in Section 2.0 are valid as well as
+    the following:
+
+    NO_GXCOPY
+
+      In order to have accelerated image transfers faster than the 
+      software versions for GXcopy, the engine needs to support clipping,
+      be using the direct method and have a large enough image transfer
+      range so that CPU_TRANSFER_BASE_FIXED doesn't need to be set.
+      If these are not supported, then it is unlikely that transfering
+      the data through the accelerator will be of any advantage for the
+      simple case of GXcopy.  In fact, it may be much slower.  For such
+      cases it's probably best to set the NO_GXCOPY flag so that 
+      Image writes will only be used for the more complicated rops.
+
+    /* transparency restrictions */
+
+    NO_TRANSPARENCY
+     
+      This indicates that the accelerator does not support skipping
+      of color keyed pixels when copying from the source to the destination.
+
+    TRANSPARENCY_GXCOPY_ONLY
+
+      This indicates that the accelerator supports skipping of color keyed
+      pixels only when the rop is GXcopy.
+
+    /* clipping  (optional) */
+    
+    LEFT_EDGE_CLIPPING
+ 
+      This indicates that the accelerator supports omission of up to
+      3 pixels on the left edge of the rectangle to be filled.  This
+      is beneficial since it allows transfer from the source pixmap to
+      always occur from DWORD boundaries. 
+
+    LEFT_EDGE_CLIPPING_NEGATIVE_X
+
+      This flag indicates that the accelerator can fill areas with
+      image write data even if the value of x origin is negative (off of
+      the screen on the left edge).
+
+
+2.8.1 The Direct Method
+
+    Using the direct method of ImageWrite XAA will send all
+    bitmap data to the accelerator serially through an memory mapped
+    transfer window defined by the following two fields:
+
+      unsigned char *ImageWriteBase
+
+        This indicates the memory address of the beginning of the aperture.
+
+      int ImageWriteRange
+
+        This indicates the size in bytes of the aperture.
+
+    The driver should specify how the transfered data should be padded.
+    There are options for both the padding of each Y scanline and for the
+    total transfer to the aperature.
+    One of the following two flags must be set:
+
+      CPU_TRANSFER_PAD_DWORD
+
+        This indicates that the total transfer (sum of all scanlines) sent
+        to the aperature must be DWORD padded.  This is the default behavior.
+
+      CPU_TRANSFER_PAD_QWORD 
+
+	This indicates that the total transfer (sum of all scanlines) sent
+	to the aperature must be QWORD padded.  With this set, XAA will send
+        an extra DWORD to the aperature when needed to ensure that only
+        an even number of DWORDs are sent.
+
+    And then there are the flags for padding of each scanline:
+
+      SCANLINE_PAD_DWORD
+
+	This indicates that each Y scanline should be DWORD padded.
+        This is the only option available and is the default.
+
+    Finally, there is the CPU_TRANSFER_BASE_FIXED flag which indicates
+    that the aperture is a single register rather than a range of
+    registers, and XAA should write all of the data to the first DWORD.
+    XAA will automatically select CPU_TRANSFER_BASE_FIXED if the 
+    ImageWriteRange is not large enough to accomodate an entire scanline.   
+
+
+void SetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask,
+        			int trans_color, int bpp, int depth)
+
+     If trans_color is not -1 then trans_color indicates the transparency
+     color key and pixels with color trans_color passed through the 
+     aperature should not be transfered to the screen but should be 
+     skipped.  Bpp and depth indicate the bits per pixel and depth of
+     the source pixmap.  Trans_color is always -1 if the NO_TRANSPARENCY
+     flag is set.
+
+
+void SubsequentImageWriteRect(ScrnInfoPtr pScrn, 
+				int x, int y, int w, int h, int skipleft)
+
+     
+     Data passed through the aperature should be copied to a rectangle
+     of width "w" and height "h" with origin (x,y).  If LEFT_EDGE_CLIPPING
+     has been enabled, skipleft will correspond to the number of pixels
+     on the left edge that should not be drawn.  Skipleft is zero 
+     otherwise.
+
+     It can be arranged for XAA to call Sync() after it is through 
+     calling the Subsequent functions by setting SYNC_AFTER_IMAGE_WRITE 
+     in the  ImageWriteFlags.  This can provide the driver with an
+     oportunity to reset a clipping window if needed.
+
+2.8.2  The Indirect Method
+
+     Using the indirect method, XAA will render the pixel data scanline
+     at a time to one or more buffers.  These buffers may be memory
+     mapped apertures or just intermediate storage.
+
+     int NumScanlineImageWriteBuffers
+
+       This indicates the number of buffers available.
+
+     unsigned char **ScanlineImageWriteBuffers
+
+       This is an array of pointers to the memory locations of each buffer.
+       Each buffer is expected to be large enough to accommodate scanlines
+       the width of the screen.  That is:
+
+         pScrn->VirtualX * pScreen->bitsPerPixel/8   bytes or more.
+
+       If LEFT_EDGE_CLIPPING_NEGATIVE_X is set, add an additional 4
+       bytes to that requirement in 8 and 16bpp, 12 bytes in 24bpp.
+  
+     Scanlines are always DWORD padded.
+
+void SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, 
+				unsigned int planemask, int trans_color, 
+				int bpp, int depth)
+
+     If trans_color is not -1 then trans_color indicates the transparency
+     color key and pixels with color trans_color in the buffer should not 
+     be transfered to the screen but should be skipped.  Bpp and depth 
+     indicate the bits per pixel and depth of the source bitmap.  
+     Trans_color is always -1 if the NO_TRANSPARENCY flag is set.
+
+
+void SubsequentImageWriteRect(ScrnInfoPtr pScrn, 
+				int x, int y, int w, int h, int skipleft)
+
+     
+void SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
+
+
+    When SubsequentImageWriteRect is called, XAA will begin
+    transfering the source data scanline at a time, calling  
+    SubsequentImageWriteScanline after each scanline.  If more than
+    one buffer is available, XAA will cycle through the buffers.
+    Subsequent scanlines will use the next buffer and go back to the
+    buffer 0 again when the last buffer is reached.  The index into
+    the ScanlineImageWriteBuffers array is presented as "bufno"
+    with each SubsequentImageWriteScanline call.
+
+    The skipleft field is the same as for the direct method.
+
+    The indirect method can be use to send the source data directly 
+    to a memory mapped aperture represented by a single image write
+    buffer, scanline at a time, but more commonly it is used to place 
+    the data into offscreen video memory so that the accelerator can 
+    blit it to the visible screen from there.  In the case where the
+    accelerator permits rendering into offscreen video memory while
+    the accelerator is active, several buffers can be used so that
+    XAA can be placing source data into the next buffer while the
+    accelerator is blitting the current buffer.  For cases where
+    the accelerator requires some special manipulation of the source
+    data first, the buffers can be in system memory.  The CPU can
+    manipulate these buffers and then send the data to the accelerator.
+
+
+2.9 Clipping
+
+    XAA supports hardware clipping rectangles.  To use clipping
+    in this way it is expected that the graphics accelerator can
+    clip primitives with verticies anywhere in the 16 bit signed 
+    coordinate system. 
+
+void SetClippingRectangle ( ScrnInfoPtr pScrn,
+        		int left, int top, int right, int bottom)
+
+void DisableClipping (ScrnInfoPtr pScrn)
+
+    When SetClippingRectangle is called, all hardware rendering
+    following it should be clipped to the rectangle specified
+    until DisableClipping is called.
+
+    The ClippingFlags field indicates which operations this sort
+    of Set/Disable pairing can be used with.  Any of the following
+    flags may be OR'd together.
+
+	HARDWARE_CLIP_SCREEN_TO_SCREEN_COLOR_EXPAND
+	HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
+	HARDWARE_CLIP_MONO_8x8_FILL
+	HARDWARE_CLIP_COLOR_8x8_FILL
+	HARDWARE_CLIP_SOLID_FILL
+	HARDWARE_CLIP_DASHED_LINE
+	HARDWARE_CLIP_SOLID_LINE
+
+
+
+3)  XAA PIXMAP CACHE
+
+   /* NOTE:  XAA has no knowledge of framebuffer particulars so until
+	the framebuffer is able to render into offscreen memory, usage
+	of the pixmap cache requires that the driver provide ImageWrite
+	routines or a WritePixmap or WritePixmapToCache replacement so
+	that patterns can even be placed in the cache.
+
+      ADDENDUM: XAA can now load the pixmap cache without requiring
+	that the driver supply an ImageWrite function, but this can
+	only be done on linear framebuffers.  If you have a linear
+	framebuffer, set LINEAR_FRAMEBUFFER in the XAAInfoRec.Flags
+	field and XAA will then be able to upload pixmaps into the
+	cache without the driver providing functions to do so.
+   */
+
+
+   The XAA pixmap cache provides a mechanism for caching of patterns
+   in offscreen video memory so that tiled fills and in some cases
+   stippling can be done by blitting the source patterns from offscreen
+   video memory. The pixmap cache also provides the mechanism for caching 
+   of 8x8 color and mono hardware patterns.  Any unused offscreen video
+   memory gets used for the pixmap cache and that information is 
+   provided by the XFree86 Offscreen Memory Manager. XAA registers a 
+   callback with the manager so that it can be informed of any changes 
+   in the offscreen memory configuration.  The driver writer does not 
+   need to deal with any of this since it is all automatic.  The driver 
+   merely needs to initialize the Offscreen Memory Manager as described 
+   in the DESIGN document and set the PIXMAP_CACHE flag in the 
+   XAAInfoRec.Flags field.  The Offscreen Memory Manager initialization 
+   must occur before XAA is initialized or else pixmap cache 
+   initialization will fail.  
+
+   PixmapCacheFlags is an XAAInfoRec field which allows the driver to
+   control pixmap cache behavior to some extent.  Currently only one
+   flag is defined:
+
+   DO_NOT_BLIT_STIPPLES
+
+     This indicates that the stippling should not be done by blitting
+     from the pixmap cache.  This does not apply to 8x8 pattern fills. 
+
+
+   CachePixelGranularity is an optional field.  If the hardware requires
+   that a 8x8 patterns have some particular pixel alignment it should
+   be reflected in this field.  Ignoring this field or setting it to
+   zero or one means there are no alignment issues.
+
+
+4)  OFFSCREEN PIXMAPS
+
+   XAA has the ability to store pixmap drawables in offscreen video 
+   memory and render into them with full hardware acceleration.  Placement
+   of pixmaps in the cache is done automatically on a first-come basis and 
+   only if there is room.  To enable this feature, set the OFFSCREEN_PIXMAPS
+   flag in the XAAInfoRec.Flags field.  This is only available when a
+   ScreenToScreenCopy function is provided, when the Offscreen memory 
+   manager has been initialized and when the LINEAR_FRAMEBUFFER flag is
+   also set.
+
+   int maxOffPixWidth
+   int maxOffPixHeight
+
+       These two fields allow the driver to limit the maximum dimensions
+     of an offscreen pixmap.  If one of these is not set, it is assumed
+     that there is no limit on that dimension.  Note that if an offscreen
+     pixmap with a particular dimension is allowed, then your driver will be
+     expected to render primitives as large as that pixmap.  
+
+$XFree86: xc/programs/Xserver/hw/xfree86/xaa/XAA.HOWTO,v 1.12 2000/04/12 14:44:42 tsi Exp $
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index 48d0605fa..f146f3adf 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -27,7 +27,7 @@
 
 #define MIN_OFFPIX_SIZE		(320*200)
 
-static Bool XAACloseScreen(int i, ScreenPtr pScreen);
+static Bool XAACloseScreen(ScreenPtr pScreen);
 static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
                         unsigned int format, unsigned long planemask,
                         char *pdstLine);
@@ -36,10 +36,10 @@ static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
 static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
                                  unsigned usage_hint);
 static Bool XAADestroyPixmap(PixmapPtr pPixmap);
-static Bool XAAEnterVT(int index, int flags);
-static void XAALeaveVT(int index, int flags);
-static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
-static void XAAEnableDisableFBAccess(int index, Bool enable);
+static Bool XAAEnterVT(ScrnInfoPtr pScrn);
+static void XAALeaveVT(ScrnInfoPtr pScrn);
+static int XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet);
+static void XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
 static Bool XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask);
 
 static DevPrivateKeyRec XAAScreenKeyRec;
@@ -214,7 +214,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 }
 
 static Bool
-XAACloseScreen(int i, ScreenPtr pScreen)
+XAACloseScreen(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     XAAScreenPtr pScreenPriv =
@@ -238,7 +238,7 @@ XAACloseScreen(int i, ScreenPtr pScreen)
 
     free((pointer) pScreenPriv);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static void
@@ -509,26 +509,24 @@ XAAChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
 /*  These two aren't really needed for anything */
 
 static Bool
-XAAEnterVT(int index, int flags)
+XAAEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
     Bool ret;
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XAAScreenPtr pScreenPriv =
         (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
 
     pScrn->EnterVT = pScreenPriv->EnterVT;
-    ret = ((*pScreenPriv->EnterVT) (index, flags));
+    ret = ((*pScreenPriv->EnterVT) (pScrn));
     pScreenPriv->EnterVT = pScrn->EnterVT;
     pScrn->EnterVT = XAAEnterVT;
     return ret;
 }
 
 static void
-XAALeaveVT(int index, int flags)
+XAALeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[index];
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XAAScreenPtr pScreenPriv =
         (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
     XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
@@ -539,7 +537,7 @@ XAALeaveVT(int index, int flags)
     }
 
     pScrn->LeaveVT = pScreenPriv->LeaveVT;
-    (*pScreenPriv->LeaveVT) (index, flags);
+    (*pScreenPriv->LeaveVT) (pScrn);
     pScreenPriv->LeaveVT = pScrn->LeaveVT;
     pScrn->LeaveVT = XAALeaveVT;
 }
@@ -551,9 +549,9 @@ typedef struct {
 } SavedCacheState, *SavedCacheStatePtr;
 
 static int
-XAASetDGAMode(int index, int num, DGADevicePtr devRet)
+XAASetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
     XAAScreenPtr pScreenPriv =
         (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
@@ -569,7 +567,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
         infoRec->dgaSaves = NULL;
     }
 
-    ret = (*pScreenPriv->SetDGAMode) (index, num, devRet);
+    ret = (*pScreenPriv->SetDGAMode) (pScrn, num, devRet);
     if (ret != Success)
         return ret;
 
@@ -612,9 +610,9 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
 }
 
 static void
-XAAEnableDisableFBAccess(int index, Bool enable)
+XAAEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
 {
-    ScreenPtr pScreen = screenInfo.screens[index];
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
     XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
     XAAScreenPtr pScreenPriv =
         (XAAScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
@@ -627,7 +625,7 @@ XAAEnableDisableFBAccess(int index, Bool enable)
         SwitchedOut = TRUE;
     }
 
-    (*pScreenPriv->EnableDisableFBAccess) (index, enable);
+    (*pScreenPriv->EnableDisableFBAccess) (pScrn, enable);
 
     if (enable) {
         if ((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
diff --git a/xorg-server/hw/xfree86/xaa/xaalocal.h b/xorg-server/hw/xfree86/xaa/xaalocal.h
index c028ef033..61d9eebe5 100644
--- a/xorg-server/hw/xfree86/xaa/xaalocal.h
+++ b/xorg-server/hw/xfree86/xaa/xaalocal.h
@@ -47,10 +47,10 @@ typedef struct _XAAScreen {
     DestroyPixmapProcPtr DestroyPixmap;
     ChangeWindowAttributesProcPtr ChangeWindowAttributes;
     XAAInfoRecPtr AccelInfoRec;
-    Bool (*EnterVT) (int, int);
-    void (*LeaveVT) (int, int);
-    int (*SetDGAMode) (int, int, DGADevicePtr);
-    void (*EnableDisableFBAccess) (int, Bool);
+    Bool (*EnterVT) (ScrnInfoPtr);
+    void (*LeaveVT) (ScrnInfoPtr);
+    int (*SetDGAMode) (ScrnInfoPtr, int, DGADevicePtr);
+    void (*EnableDisableFBAccess) (ScrnInfoPtr, Bool);
     CompositeProcPtr Composite;
     GlyphsProcPtr Glyphs;
 } XAAScreenRec, *XAAScreenPtr;
-- 
cgit v1.2.3