xserver: Branch 'transform-proposal' - 167 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Sep 22 12:43:45 PDT 2008


 .gitignore                                     |   88 
 Makefile.am                                    |   12 
 XTrap/Makefile.am                              |    5 
 XTrap/xtrapddmi.c                              |  161 
 XTrap/xtrapdi.c                                | 2154 ---------
 XTrap/xtrapdiswp.c                             |  937 ----
 XTrap/xtrapditbl.c                             |  243 -
 Xext/saver.c                                   |    8 
 Xext/security.c                                |   14 
 Xext/shape.c                                   |    2 
 Xext/shm.c                                     |  113 
 Xext/sync.c                                    |    2 
 Xext/xevie.c                                   |    1 
 Xext/xselinux.c                                |    4 
 Xext/xtest.c                                   |    8 
 Xi/chdevhier.c                                 |    2 
 Xi/exevents.c                                  |   68 
 Xi/extgrbdev.c                                 |   15 
 Xi/gtmotion.c                                  |    2 
 Xi/queryst.c                                   |    6 
 Xi/selectev.c                                  |    4 
 composite/compalloc.c                          |    3 
 composite/compext.c                            |   10 
 configure.ac                                   |  134 
 dbe/dbe.c                                      |   53 
 dix/cursor.c                                   |    8 
 dix/deprecated.c                               |   34 
 dix/devices.c                                  |   21 
 dix/dispatch.c                                 |   48 
 dix/dixfonts.c                                 |    2 
 dix/dixutils.c                                 |    4 
 dix/events.c                                   |   40 
 dix/gc.c                                       |    8 
 dix/getevents.c                                |    8 
 dix/main.c                                     |    1 
 dix/privates.c                                 |   65 
 dix/protocol.txt                               |   28 
 dix/registry.c                                 |   44 
 dix/resource.c                                 |   39 
 dix/window.c                                   |   10 
 exa/exa.c                                      |   14 
 exa/exa_unaccel.c                              |    4 
 fb/fb.h                                        |    5 
 fb/fb24_32.c                                   |   10 
 fb/fbwindow.c                                  |    2 
 glx/glapi.c                                    |    3 
 glx/glxcmds.c                                  |   15 
 glx/glxdri.c                                   |    4 
 glx/glxdri2.c                                  |    6 
 glx/glxdriswrast.c                             |    7 
 glx/indirect_dispatch.h                        |    4 
 glx/indirect_size_get.c                        |   12 
 hw/Makefile.am                                 |    7 
 hw/dmx/dmxcursor.c                             |   13 
 hw/dmx/dmxgc.c                                 |    2 
 hw/dmx/dmxinit.c                               |    5 
 hw/dmx/glxProxy/glxcmds.c                      |   15 
 hw/dmx/input/dmxevents.c                       |    2 
 hw/dmx/input/dmxinputinit.c                    |   33 
 hw/dmx/input/dmxxinput.c                       |    3 
 hw/kdrive/ephyr/Makefile.am                    |    2 
 hw/kdrive/ephyr/ephyrinit.c                    |   22 
 hw/kdrive/ephyr/hostx.c                        |   30 
 hw/kdrive/fake/Makefile.am                     |    2 
 hw/kdrive/fbdev/Makefile.am                    |    2 
 hw/kdrive/sdl/Makefile.am                      |    2 
 hw/kdrive/src/Makefile.am                      |   13 
 hw/kdrive/src/kaa.c                            | 1081 ----
 hw/kdrive/src/kaa.h                            |  120 
 hw/kdrive/src/kaapict.c                        |  719 ---
 hw/kdrive/src/kasync.c                         |  341 -
 hw/kdrive/src/kdrive.h                         |  142 
 hw/kdrive/src/kinput.c                         |    2 
 hw/kdrive/src/koffscreen.c                     |   24 
 hw/kdrive/vesa/Makefile.am                     |    2 
 hw/vfb/Makefile.am                             |    1 
 hw/xfree86/Makefile.am                         |    8 
 hw/xfree86/common/compiler.h                   |    2 
 hw/xfree86/common/extramodes                   |    6 
 hw/xfree86/common/xf86.h                       |    1 
 hw/xfree86/common/xf86AutoConfig.c             |  223 
 hw/xfree86/common/xf86Config.c                 |   55 
 hw/xfree86/common/xf86Events.c                 |   43 
 hw/xfree86/common/xf86Globals.c                |    1 
 hw/xfree86/common/xf86Helper.c                 |   14 
 hw/xfree86/common/xf86Init.c                   |    4 
 hw/xfree86/common/xf86Module.h                 |   10 
 hw/xfree86/common/xf86Priv.h                   |    2 
 hw/xfree86/common/xf86Privstr.h                |    1 
 hw/xfree86/common/xf86RandR.c                  |   21 
 hw/xfree86/common/xf86Xinput.c                 |    7 
 hw/xfree86/ddc/edid.h                          |    5 
 hw/xfree86/ddc/interpret_edid.c                |   14 
 hw/xfree86/ddc/print_edid.c                    |   28 
 hw/xfree86/ddc/xf86DDC.c                       |   32 
 hw/xfree86/ddc/xf86DDC.h                       |    6 
 hw/xfree86/dixmods/Makefile.am                 |   20 
 hw/xfree86/dixmods/extmod/Makefile.am          |    1 
 hw/xfree86/dixmods/extmod/modinit.h            |    4 
 hw/xfree86/dixmods/mfbmodule.c                 |   47 
 hw/xfree86/dixmods/xf86XTrapModule.c           |   45 
 hw/xfree86/doc/man/xorg.conf.man.pre           |    3 
 hw/xfree86/dri/dri.c                           |    2 
 hw/xfree86/dri2/dri2.c                         |   28 
 hw/xfree86/dri2/dri2.h                         |    3 
 hw/xfree86/dri2/dri2ext.c                      |    9 
 hw/xfree86/exa/examodule.c                     |    7 
 hw/xfree86/int10/xf86int10.c                   |   12 
 hw/xfree86/loader/dixsym.c                     |    5 
 hw/xfree86/loader/dlloader.c                   |    9 
 hw/xfree86/loader/loader.c                     |    2 
 hw/xfree86/loader/misym.c                      |    1 
 hw/xfree86/loader/xf86sym.c                    |    1 
 hw/xfree86/modes/xf86Crtc.c                    |   65 
 hw/xfree86/modes/xf86Modes.c                   |    3 
 hw/xfree86/os-support/README.OS-lib            |  287 -
 hw/xfree86/os-support/bsd/bsdResource.c        |    2 
 hw/xfree86/os-support/bsd/bsd_axp.c            |    2 
 hw/xfree86/os-support/bsd/bsd_init.c           |   19 
 hw/xfree86/os-support/bus/Makefile.am          |    4 
 hw/xfree86/os-support/bus/Pci.h                |   77 
 hw/xfree86/os-support/bus/axpPci.c             |  415 -
 hw/xfree86/os-support/misc/SlowBcopy.c         |    4 
 hw/xfree86/os-support/shared/sigio.c           |    3 
 hw/xfree86/ramdac/xf86Cursor.c                 |    3 
 hw/xfree86/utils/Makefile.am                   |    3 
 hw/xfree86/utils/kbd_mode/Makefile.am          |    1 
 hw/xfree86/utils/xorgcfg/loadmod.c             |  183 
 hw/xfree86/utils/xorgconfig/.gitignore         |    1 
 hw/xfree86/utils/xorgconfig/Cards              | 3135 -------------
 hw/xfree86/utils/xorgconfig/Cards98            |  647 --
 hw/xfree86/utils/xorgconfig/Makefile.am        |   70 
 hw/xfree86/utils/xorgconfig/cards.c            |  278 -
 hw/xfree86/utils/xorgconfig/cards.h            |   30 
 hw/xfree86/utils/xorgconfig/xorgconfig.c       | 2890 ------------
 hw/xfree86/utils/xorgconfig/xorgconfig.man.pre |   22 
 hw/xfree86/x86emu/ops2.c                       |   63 
 hw/xfree86/x86emu/prim_ops.c                   |    2 
 hw/xfree86/x86emu/x86emu/prim_x86_gcc.h        |    2 
 hw/xfree86/x86emu/x86emu/types.h               |    2 
 hw/xfree86/xaa/Makefile.am                     |    2 
 hw/xfree86/xf1bpp/Makefile.am                  |  178 
 hw/xfree86/xf1bpp/mfbmap.h                     |  122 
 hw/xfree86/xf1bpp/mfbmap.sh                    |   25 
 hw/xfree86/xf1bpp/mfbmodule.c                  |   47 
 hw/xfree86/xf1bpp/mfbunmap.h                   |  114 
 hw/xfree86/xf1bpp/mfbunmap.sh                  |   23 
 hw/xfree86/xf1bpp/xf1bpp.h                     |   36 
 hw/xfree86/xf4bpp/Makefile.am                  |   57 
 hw/xfree86/xf4bpp/NOTES                        |  194 
 hw/xfree86/xf4bpp/OScompiler.h                 |   58 
 hw/xfree86/xf4bpp/emulOpStip.c                 |  102 
 hw/xfree86/xf4bpp/emulRepAre.c                 |   69 
 hw/xfree86/xf4bpp/emulTile.c                   |  352 -
 hw/xfree86/xf4bpp/ibmTrace.h                   |    1 
 hw/xfree86/xf4bpp/mfbbres.c                    |  164 
 hw/xfree86/xf4bpp/mfbbresd.c                   |  205 
 hw/xfree86/xf4bpp/mfbfillarc.c                 |  301 -
 hw/xfree86/xf4bpp/mfbhrzvert.c                 |  135 
 hw/xfree86/xf4bpp/mfbimggblt.c                 |  505 --
 hw/xfree86/xf4bpp/mfbline.c                    |  976 ----
 hw/xfree86/xf4bpp/mfbzerarc.c                  |  267 -
 hw/xfree86/xf4bpp/offscreen.c                  |  342 -
 hw/xfree86/xf4bpp/ppcArea.c                    |   97 
 hw/xfree86/xf4bpp/ppcCReduce.c                 |  237 -
 hw/xfree86/xf4bpp/ppcClip.c                    |  157 
 hw/xfree86/xf4bpp/ppcCpArea.c                  |  470 --
 hw/xfree86/xf4bpp/ppcDepth.c                   |   53 
 hw/xfree86/xf4bpp/ppcFillRct.c                 |  215 
 hw/xfree86/xf4bpp/ppcGC.c                      |  446 -
 hw/xfree86/xf4bpp/ppcGCstr.h                   |   71 
 hw/xfree86/xf4bpp/ppcGetSp.c                   |  141 
 hw/xfree86/xf4bpp/ppcIO.c                      |  233 -
 hw/xfree86/xf4bpp/ppcImg.c                     |  122 
 hw/xfree86/xf4bpp/ppcPixFS.c                   |  502 --
 hw/xfree86/xf4bpp/ppcPixmap.c                  |  151 
 hw/xfree86/xf4bpp/ppcPolyPnt.c                 |  143 
 hw/xfree86/xf4bpp/ppcQuery.c                   |   46 
 hw/xfree86/xf4bpp/ppcRslvC.c                   |  177 
 hw/xfree86/xf4bpp/ppcSetSp.c                   |  319 -
 hw/xfree86/xf4bpp/ppcSpMcro.h                  |   43 
 hw/xfree86/xf4bpp/ppcWinFS.c                   |  280 -
 hw/xfree86/xf4bpp/ppcWindow.c                  |  220 
 hw/xfree86/xf4bpp/vgaBitBlt.c                  |  749 ---
 hw/xfree86/xf4bpp/vgaGC.c                      |  213 
 hw/xfree86/xf4bpp/vgaImages.c                  |  460 -
 hw/xfree86/xf4bpp/vgaReg.h                     |  137 
 hw/xfree86/xf4bpp/vgaSolid.c                   |  574 --
 hw/xfree86/xf4bpp/vgaStipple.c                 |  720 ---
 hw/xfree86/xf4bpp/vgaVideo.h                   |   93 
 hw/xfree86/xf4bpp/vgamodule.c                  |   57 
 hw/xfree86/xf4bpp/wm3.c                        |  203 
 hw/xfree86/xf4bpp/wm3.h                        |   73 
 hw/xfree86/xf4bpp/xf4bpp.h                     |  622 --
 hw/xgl/Makefile.am                             |   83 
 hw/xgl/egl/Makefile.am                         |   44 
 hw/xgl/egl/evdev.c                             |  646 --
 hw/xgl/egl/kinput.c                            | 1670 -------
 hw/xgl/egl/kkeymap.h                           |   55 
 hw/xgl/egl/module/Makefile.am                  |   15 
 hw/xgl/egl/module/xeglmodule.c                 |  104 
 hw/xgl/egl/xegl.c                              |  303 -
 hw/xgl/egl/xegl.h                              |  214 
 hw/xgl/egl/xeglinit.c                          |  131 
 hw/xgl/egl/xeglinput.c                         |  168 
 hw/xgl/glx/Makefile.am                         |   48 
 hw/xgl/glx/module/Makefile.am                  |   21 
 hw/xgl/glx/module/xglxmodule.c                 |  104 
 hw/xgl/glx/xglx.c                              | 1444 ------
 hw/xgl/glx/xglx.h                              |  138 
 hw/xgl/glx/xglxinit.c                          |  168 
 hw/xgl/glx/xglxorg.c                           |  674 --
 hw/xgl/glxext/Makefile.am                      |   21 
 hw/xgl/glxext/module/Makefile.am               |   22 
 hw/xgl/glxext/module/glcoremodule.c            |   38 
 hw/xgl/glxext/module/glxmodule.c               |   38 
 hw/xgl/glxext/xglglxext.c                      | 5772 -------------------------
 hw/xgl/glxext/xglglxext.h                      |   41 
 hw/xgl/glxext/xglglxlog.c                      | 4519 -------------------
 hw/xgl/xgl.h                                   | 1474 ------
 hw/xgl/xglarea.c                               |  323 -
 hw/xgl/xglcmap.c                               |  466 --
 hw/xgl/xglcompose.c                            |  281 -
 hw/xgl/xglcopy.c                               |  130 
 hw/xgl/xglfill.c                               |  742 ---
 hw/xgl/xglgc.c                                 |  645 --
 hw/xgl/xglgeometry.c                           |  724 ---
 hw/xgl/xglget.c                                |   88 
 hw/xgl/xglglx.c                                |  260 -
 hw/xgl/xglglx.h                                |   79 
 hw/xgl/xglglyph.c                              | 1170 -----
 hw/xgl/xglhash.c                               |  134 
 hw/xgl/xglinit.c                               |  332 -
 hw/xgl/xglinput.c                              |  263 -
 hw/xgl/xglloader.c                             |  130 
 hw/xgl/xglmodule.h                             |   45 
 hw/xgl/xgloutput.c                             |  181 
 hw/xgl/xglparse.c                              |  257 -
 hw/xgl/xglpict.c                               |  787 ---
 hw/xgl/xglpixmap.c                             |  744 ---
 hw/xgl/xglscreen.c                             |  473 --
 hw/xgl/xglshm.c                                |  123 
 hw/xgl/xglsolid.c                              |  159 
 hw/xgl/xglsync.c                               |  453 -
 hw/xgl/xgltile.c                               |  268 -
 hw/xgl/xgltrap.c                               |  481 --
 hw/xgl/xglwindow.c                             |  166 
 hw/xgl/xglxv.c                                 |  634 --
 hw/xnest/Cursor.c                              |   34 
 hw/xnest/Events.c                              |   14 
 hw/xnest/Init.c                                |    7 
 hw/xnest/Screen.c                              |   12 
 hw/xnest/XNCursor.h                            |   33 
 hw/xquartz/Makefile.am                         |    3 
 hw/xquartz/bundle/Info.plist                   |    2 
 hw/xquartz/bundle/Resources/X11.icns           |binary
 hw/xquartz/darwinEvents.c                      |   59 
 hw/xquartz/mach-startup/Makefile.am            |   19 
 hw/xquartz/mach-startup/bundle-main.c          |  111 
 hw/xquartz/mach-startup/stub.c                 |  116 
 hw/xquartz/quartzForeground.c                  |   47 
 hw/xquartz/quartzForeground.h                  |   37 
 hw/xquartz/quartzStartup.c                     |    1 
 hw/xwin/Makefile.am                            |    1 
 hw/xwin/wingc.c                                |    2 
 hw/xwin/winpushpxl.c                           |  225 
 include/Makefile.am                            |    3 
 include/dix-config.h.in                        |    6 
 include/input.h                                |    5 
 include/inputstr.h                             |    7 
 include/privates.h                             |   61 
 include/resource.h                             |   39 
 include/servermd.h                             |  176 
 include/xgl-config.h.in                        |   14 
 include/xorg-server.h.in                       |    3 
 mfb/Makefile.am                                |  133 
 mfb/fastblt.h                                  |   96 
 mfb/maskbits.c                                 | 1059 ----
 mfb/maskbits.h                                 |  689 --
 mfb/mergerop.h                                 |  398 -
 mfb/mfb.h                                      | 1112 ----
 mfb/mfbbitblt.c                                |  500 --
 mfb/mfbblt.c                                   |  589 --
 mfb/mfbbres.c                                  |  368 -
 mfb/mfbbresd.c                                 |  207 
 mfb/mfbclip.c                                  |  280 -
 mfb/mfbcmap.c                                  |  162 
 mfb/mfbfillarc.c                               |  334 -
 mfb/mfbfillrct.c                               |  227 
 mfb/mfbfillsp.c                                | 1029 ----
 mfb/mfbfont.c                                  |   87 
 mfb/mfbgc.c                                    | 1120 ----
 mfb/mfbgetsp.c                                 |  157 
 mfb/mfbhrzvert.c                               |  177 
 mfb/mfbimage.c                                 |  177 
 mfb/mfbimggblt.c                               |  444 -
 mfb/mfbline.c                                  |  759 ---
 mfb/mfbmisc.c                                  |   99 
 mfb/mfbpixmap.c                                |  298 -
 mfb/mfbply1rct.c                               |  261 -
 mfb/mfbplygblt.c                               |  397 -
 mfb/mfbpntarea.c                               |  299 -
 mfb/mfbpolypnt.c                               |  144 
 mfb/mfbpushpxl.c                               |  287 -
 mfb/mfbscrclse.c                               |   64 
 mfb/mfbscrinit.c                               |  183 
 mfb/mfbsetsp.c                                 |  281 -
 mfb/mfbtegblt.c                                |  366 -
 mfb/mfbtile.c                                  |  238 -
 mfb/mfbwindow.c                                |  168 
 mfb/mfbzerarc.c                                |  259 -
 mi/micoord.h                                   |    2 
 mi/midispcur.c                                 |    6 
 mi/mieq.c                                      |    6 
 mi/miinitext.c                                 |    6 
 mi/mipointer.c                                 |    8 
 mi/mipointer.h                                 |    8 
 mi/mipointrst.h                                |    4 
 mi/misprite.c                                  |   83 
 os/access.c                                    |    3 
 os/connection.c                                |    2 
 os/rpcauth.c                                   |    1 
 os/xdmauth.c                                   |   14 
 randr/rrmode.c                                 |    3 
 randr/rrpointer.c                              |    5 
 randr/rrproperty.c                             |   38 
 record/record.c                                |   16 
 render/picture.c                               |   25 
 render/render.c                                |   37 
 xfixes/cursor.c                                |    4 
 xfixes/region.c                                |    6 
 xkb/XKBMisc.c                                  |    2 
 xkb/ddxLoad.c                                  |    2 
 xkb/xkbAccessX.c                               |    3 
 xkb/xkbActions.c                               |    4 
 xkb/xkbEvents.c                                |    9 
 xkb/xkbInit.c                                  |    3 
 337 files changed, 1493 insertions(+), 70059 deletions(-)

New commits:
commit b84acf64101d4fd4c40e2f619cc4c5f3bd82fd01
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Sep 11 17:06:07 2008 -0700

    fix stale dri2 build

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 9a3bc1f..441a423 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -471,7 +471,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     char filename[128];
     size_t buffer_size;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-    unsigned int sareaHandle;
+    drm_handle_t sareaHandle;
+    unsigned int sareaSize;
     const __DRIextension **extensions;
     const __DRIconfig **driConfigs;
     int i;
@@ -482,7 +483,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     memset(screen, 0, sizeof *screen);
 
     if (!xf86LoaderCheckSymbol("DRI2Connect") ||
-	!DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) {
+	!DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle, &sareaSize)) {
 	LogMessage(X_INFO,
 		   "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
 	return NULL;
@@ -530,6 +531,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 	(*screen->core->createNewScreen)(pScreen->myNum,
 					 screen->fd,
 					 sareaHandle,
+					 sareaSize,
 					 loader_extensions,
 					 &driConfigs,
 					 screen);
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 74aef71..cf895bc 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -57,8 +57,8 @@ typedef struct _DRI2DrawablePriv {
 
 typedef struct _DRI2Screen {
     int				 fd;
-    drmBO			 sareaBO;
     void			*sarea;
+    drm_handle_t		 sareaHandle;
     unsigned int		 sareaSize;
     const char			*driverName;
     unsigned int		 nextHandle;
@@ -257,8 +257,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
     pScreen->ClipNotify		= ds->ClipNotify;
     pScreen->HandleExposures	= ds->HandleExposures;
 
-    drmBOUnmap(ds->fd, &ds->sareaBO);
-    drmBOUnreference(ds->fd, &ds->sareaBO);
+    drmRmMap(ds->fd, ds->sareaHandle);
 
     xfree(ds);
     dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
@@ -350,7 +349,8 @@ DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
 
 Bool
 DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
-	    unsigned int *sareaHandle)
+	    drm_handle_t *sareaHandle,
+	    drmSize *sareaSize)
 {
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
 
@@ -359,7 +359,8 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
 
     *fd = ds->fd;
     *driverName = ds->driverName;
-    *sareaHandle = ds->sareaBO.handle;
+    *sareaHandle = ds->sareaHandle;
+    *sareaSize = ds->sareaSize;
 
     return TRUE;
 }
@@ -387,7 +388,7 @@ static void *
 DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
 {
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
-    unsigned long mask;
+
     const size_t event_buffer_size = 32 * 1024;
 
     ds->sareaSize = 
@@ -395,21 +396,18 @@ DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize)
 	driverSareaSize +
 	sizeof (unsigned int);
 
-    mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE |
-	DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE;
-
-    if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO))
+    if (drmAddMap(ds->fd, 1, ds->sareaSize, DRM_SHM,
+		  DRM_CONTAINS_LOCK, &ds->sareaHandle) != 0)
 	return NULL;
 
-    if (drmBOMap(ds->fd, &ds->sareaBO,
-		 DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) {
-	drmBOUnreference(ds->fd, &ds->sareaBO);
+    if (drmMap(ds->fd, ds->sareaHandle, ds->sareaSize, &ds->sarea)) {
+	drmRmMap (ds->fd, ds->sareaHandle);
 	return NULL;
     }
 
     xf86DrvMsg(pScreen->myNum, X_INFO,
-	       "[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n",
-	       ds->sareaSize, ds->sareaBO.handle);
+	       "[DRI2] Allocated %d byte SAREA, handle 0x%08x\n",
+	       ds->sareaSize, ds->sareaHandle);
     memset(ds->sarea, 0, ds->sareaSize);
 
     ds->buffer = ds->sarea;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 85b3da4..f49d746 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -56,7 +56,8 @@ void DRI2CloseScreen(ScreenPtr pScreen);
 Bool DRI2Connect(ScreenPtr pScreen,
 		 int *fd,
 		 const char **driverName,
-		 unsigned int *sareaHandle);
+		 drm_handle_t *sareaHandle,
+		 drmSize *sareaSize);
 
 Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
 
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4ae0fda..d3c4a6a 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -115,7 +115,8 @@ ProcDRI2Connect(ClientPtr client)
     int fd;
     const char *driverName;
     char *busId = NULL;
-    unsigned int sareaHandle;
+    drm_handle_t sareaHandle;
+    unsigned int sareaSize;
 
     REQUEST_SIZE_MATCH(xDRI2ConnectReq);
     if (!validScreen(client, stuff->screen, &pScreen))
@@ -127,8 +128,9 @@ ProcDRI2Connect(ClientPtr client)
     rep.driverNameLength = 0;
     rep.busIdLength = 0;
     rep.sareaHandle = 0;
+    rep.sareaSize = 0;
 
-    if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
+    if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle, &sareaSize))
 	goto fail;
 
     busId = drmGetBusid(fd);
@@ -137,7 +139,8 @@ ProcDRI2Connect(ClientPtr client)
 
     rep.driverNameLength = strlen(driverName);
     rep.busIdLength = strlen(busId);
-    rep.sareaHandle = sareaHandle;
+    rep.sareaHandle = (CARD32) sareaHandle;
+    rep.sareaSize = (CARD32) sareaSize;
     rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
 
  fail:
diff --git a/randr/rrmode.c b/randr/rrmode.c
index d507208..7121036 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -320,6 +320,9 @@ ProcRRCreateMode (ClientPtr client)
 	swapl(&rep.mode, n);
     }
     WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
+
+    /* Drop our reference to this mode */
+    RRModeDestroy (mode);
     
     return client->noClientException;
 }
commit 40b3d2972dbafefae38759666ed49c66cc797889
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Aug 6 15:26:24 2008 -0700

    Replace dixLookupResource by dixLookupResourceBy{Type,Class}
    
    dixLookupResource attempted to automatically detect whether the caller
    wanted a lookup by-type or by-class, unfortunately, it guessed wrong for
    RT_NONE. Instead of trying to make the guess better, this patch just reverts
    the unification and creates separate functions for each operation.

diff --git a/Xext/saver.c b/Xext/saver.c
index 69a5fa1..c1f0382 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1064,7 +1064,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	    }
             else
 	    {	
-		ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+		ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
 					client, DixReadAccess);
 		if (ret == Success)
 		{
@@ -1102,7 +1102,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	    }
 	    else
 	    {	
-		ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+		ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
 					client, DixReadAccess);
 		if (ret == Success)
 		{
@@ -1196,7 +1196,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	    break;
 	case CWColormap:
 	    cmap = (Colormap) *pVlist;
-	    ret = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP,
+	    ret = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
 				    client, DixUseAccess);
 	    if (ret != Success)
 	    {
@@ -1220,7 +1220,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	    }
 	    else
 	    {
-		ret = dixLookupResource((pointer *)&pCursor, cursorID,
+		ret = dixLookupResourceByType((pointer *)&pCursor, cursorID,
 					RT_CURSOR, client, DixUseAccess);
 	    	if (ret != Success)
 	    	{
diff --git a/Xext/security.c b/Xext/security.c
index bd92600..c865d65 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -1014,7 +1014,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
     case ClientStateRunning:
 	state->authId = AuthorizationIDOfClient(pci->client);
-	rc = dixLookupResource((pointer *)&pAuth, state->authId,
+	rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
 			       SecurityAuthorizationResType, serverClient,
 			       DixGetAttrAccess);
 	if (rc == Success) {
@@ -1029,7 +1029,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 
     case ClientStateGone:
     case ClientStateRetained:
-	rc = dixLookupResource((pointer *)&pAuth, state->authId,
+	rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
 			       SecurityAuthorizationResType, serverClient,
 			       DixGetAttrAccess);
 	if (rc == Success) {
diff --git a/Xext/shape.c b/Xext/shape.c
index 6857c28..d03b644 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -438,7 +438,7 @@ ProcShapeMask (client)
     if (stuff->src == None)
 	srcRgn = 0;
     else {
-	rc = dixLookupResource((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
+	rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
 			       client, DixReadAccess);
         if (rc != Success)
 	    return (rc == BadValue) ? BadPixmap : rc;
diff --git a/Xext/sync.c b/Xext/sync.c
index ce04702..50b2caa 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -440,7 +440,7 @@ SyncInitTrigger(client, pTrigger, counter, changes)
     {
 	if (counter == None)
 	    pCounter = NULL;
-	else if (Success != (rc = dixLookupResource((pointer *)&pCounter,
+	else if (Success != (rc = dixLookupResourceByType ((pointer *)&pCounter,
 				counter, RTCounter, client, DixReadAccess)))
 	{
 	    client->errorValue = counter;
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index a47df03..3c74574 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -555,7 +555,7 @@ SELinuxLabelInitial(void)
 	SELinuxScreen(NULL, NULL, &srec);
 
 	/* Do the default colormap */
-	dixLookupResource(&unused, screenInfo.screens[i]->defColormap,
+	dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
 			  RT_COLORMAP, serverClient, DixCreateAccess);
     }
 }
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 8e96f65..2dd61a3 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -135,8 +135,8 @@ ProcXTestCompareCursor(client)
     else if (stuff->cursor == XTestCurrentCursor)
         pCursor = GetSpriteCursor(ptr);
     else {
-        rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
-                client, DixReadAccess);
+        rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
+				     client, DixReadAccess);
         if (rc != Success)
         {
             client->errorValue = stuff->cursor;
@@ -169,7 +169,7 @@ ProcXTestFakeInput(client)
     int numValuators = 0;
     int firstValuator = 0;
     EventListPtr events;
-    int nevents;
+    int nevents = 0;
     int i;
     int base = 0;
 
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 35d8bb5..ef53506 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1369,7 +1369,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
     if (rcursor == None)
 	cursor = NullCursor;
     else {
-	rc = dixLookupResource((pointer *)&cursor, rcursor, RT_CURSOR,
+	rc = dixLookupResourceByType((pointer *)&cursor, rcursor, RT_CURSOR,
 			       client, DixUseAccess);
 	if (rc != Success)
 	{
diff --git a/composite/compext.c b/composite/compext.c
index e720f6c..2a7c227 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -148,7 +148,7 @@ ProcCompositeRedirectWindow (ClientPtr client)
     REQUEST(xCompositeRedirectWindowReq);
 
     REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
 			   DixSetAttrAccess|DixManageAccess|DixBlendAccess);
     if (rc != Success)
     {
@@ -166,7 +166,7 @@ ProcCompositeRedirectSubwindows (ClientPtr client)
     REQUEST(xCompositeRedirectSubwindowsReq);
 
     REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
 			   DixSetAttrAccess|DixManageAccess|DixBlendAccess);
     if (rc != Success)
     {
@@ -218,7 +218,7 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
     REQUEST(xCompositeCreateRegionFromBorderClipReq);
 
     REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
 			   DixGetAttrAccess);
     if (rc != Success)
     {
@@ -254,7 +254,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
     REQUEST(xCompositeNameWindowPixmapReq);
 
     REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
 			   DixGetAttrAccess);
     if (rc != Success)
     {
@@ -302,7 +302,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
     int rc;
 
     REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
 			   DixGetAttrAccess);
     if (rc != Success)
     {
diff --git a/dix/cursor.c b/dix/cursor.c
index 81540fd..0017c66 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -298,15 +298,15 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     GlyphSharePtr pShare;
     DeviceIntPtr pDev;
 
-    rc = dixLookupResource((pointer *)&sourcefont, source, RT_FONT, client,
-			   DixUseAccess);
+    rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client,
+				 DixUseAccess);
     if (rc != Success)
     {
 	client->errorValue = source;
 	return (rc == BadValue) ? BadFont : rc;
     }
-    rc = dixLookupResource((pointer *)&maskfont, mask, RT_FONT, client,
-			   DixUseAccess);
+    rc = dixLookupResourceByType((pointer *)&maskfont, mask, RT_FONT, client,
+				 DixUseAccess);
     if (rc != Success && mask != None)
     {
 	client->errorValue = mask;
diff --git a/dix/deprecated.c b/dix/deprecated.c
index 2bb8119..4e20d60 100644
--- a/dix/deprecated.c
+++ b/dix/deprecated.c
@@ -115,48 +115,66 @@ LookupClient(XID id, ClientPtr client)
     return (i == Success) ? pClient : NULL;
 }
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
 _X_EXPORT pointer
 SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
 		       Mask access_mode)
 {
     pointer retval;
-    int i = dixLookupResource(&retval, id, rtype, client, access_mode);
+    int i = dixLookupResourceByType(&retval, id, rtype, client, access_mode);
     static int warn = 1;
     if (warn > 0 && --warn)
 	ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
 	       "are deprecated.  Please convert your driver/module "
-	       "to use dixLookupResource().\n");
+	       "to use dixLookupResourceByType().\n");
     return (i == Success) ? retval : NULL;
 }
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
 _X_EXPORT pointer
 SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
 			Mask access_mode)
 {
     pointer retval;
-    int i = dixLookupResource(&retval, id, classes, client, access_mode);
+    int i = dixLookupResourceByClass(&retval, id, classes, client, access_mode);
     static int warn = 1;
     if (warn > 0 && --warn)
 	ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
 	       "are deprecated.  Please convert your driver/module "
-	       "to use dixLookupResource().\n");
+	       "to use dixLookupResourceByClass().\n");
     return (i == Success) ? retval : NULL;
 }
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
 _X_EXPORT pointer
 LookupIDByType(XID id, RESTYPE rtype)
 {
     return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess);
 }
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
 _X_EXPORT pointer
 LookupIDByClass(XID id, RESTYPE classes)
 {
     return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess);
 }
 
+/* replaced by dixLookupResourceBy{Type,Class} */
+_X_EXPORT int
+dixLookupResource (pointer *result, XID id, RESTYPE rtype,
+		   ClientPtr client, Mask mode)
+{
+    Bool istype = ((rtype & TypeMask) && (rtype != RC_ANY)) || (rtype == RT_NONE);
+
+    static int warn = 1;
+    if (warn > 0 && --warn)
+	ErrorF("Warning: dixLookupResource() "
+	       "is deprecated.  Please convert your driver/module "
+	       "to use dixLookupResourceByType/dixLookupResourceByClass().\n");
+    if (istype)
+	return dixLookupResourceByType (result, id, rtype, client, mode);
+    else
+	return dixLookupResourceByClass (result, id, rtype, client, mode);
+}
+
 /* end deprecated functions */
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 8b21690..d1531fc 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1136,11 +1136,11 @@ ProcQueryFont(ClientPtr client)
     REQUEST_SIZE_MATCH(xResourceReq);
 
     client->errorValue = stuff->id;		/* EITHER font or gc */
-    rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client,
-			   DixGetAttrAccess);
+    rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client,
+				 DixGetAttrAccess);
     if (rc == BadValue) {
-	rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client,
-			       DixGetAttrAccess);
+	rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client,
+				     DixGetAttrAccess);
 	if (rc == Success)
 	    pFont = pGC->font;
     }
@@ -1194,10 +1194,10 @@ ProcQueryTextExtents(ClientPtr client)
     REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
         
     client->errorValue = stuff->fid;		/* EITHER font or gc */
-    rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client,
-			   DixGetAttrAccess);
+    rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client,
+				 DixGetAttrAccess);
     if (rc == BadValue) {
-	rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client,
+	rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client,
 			       DixGetAttrAccess);
 	if (rc == Success)
 	    pFont = pGC->font;
@@ -1342,7 +1342,7 @@ ProcFreePixmap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResource((pointer *)&pMap, stuff->id, RT_PIXMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pMap, stuff->id, RT_PIXMAP, client,
 			   DixDestroyAccess);
     if (rc == Success)
     {
@@ -2288,7 +2288,7 @@ ProcFreeColormap(ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResource((pointer *)&pmap, stuff->id, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pmap, stuff->id, RT_COLORMAP, client,
 			   DixDestroyAccess);
     if (rc == Success)
     {
@@ -2316,7 +2316,7 @@ ProcCopyColormapAndFree(ClientPtr client)
     REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
     mid = stuff->mid;
     LEGAL_NEW_RESOURCE(mid, client);
-    rc = dixLookupResource((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
+    rc = dixLookupResourceByType((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
 			   client, DixReadAccess|DixRemoveAccess);
     if (rc == Success)
     {
@@ -2341,7 +2341,7 @@ ProcInstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
 			   DixInstallAccess);
     if (rc != Success)
 	goto out;
@@ -2366,7 +2366,7 @@ ProcUninstallColormap(ClientPtr client)
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
 			   DixUninstallAccess);
     if (rc != Success)
 	goto out;
@@ -2433,7 +2433,7 @@ ProcAllocColor (ClientPtr client)
     REQUEST(xAllocColorReq);
 
     REQUEST_SIZE_MATCH(xAllocColorReq);
-    rc = dixLookupResource((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client,
 			   DixAddAccess);
     if (rc == Success)
     {
@@ -2474,7 +2474,7 @@ ProcAllocNamedColor (ClientPtr client)
     REQUEST(xAllocNamedColorReq);
 
     REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixAddAccess);
     if (rc == Success)
     {
@@ -2525,7 +2525,7 @@ ProcAllocColorCells (ClientPtr client)
     REQUEST(xAllocColorCellsReq);
 
     REQUEST_SIZE_MATCH(xAllocColorCellsReq);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixAddAccess);
     if (rc == Success)
     {
@@ -2592,7 +2592,7 @@ ProcAllocColorPlanes(ClientPtr client)
     REQUEST(xAllocColorPlanesReq);
 
     REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixAddAccess);
     if (rc == Success)
     {
@@ -2657,7 +2657,7 @@ ProcFreeColors(ClientPtr client)
     REQUEST(xFreeColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixRemoveAccess);
     if (rc == Success)
     {
@@ -2692,7 +2692,7 @@ ProcStoreColors (ClientPtr client)
     REQUEST(xStoreColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixWriteAccess);
     if (rc == Success)
     {
@@ -2726,7 +2726,7 @@ ProcStoreNamedColor (ClientPtr client)
     REQUEST(xStoreNamedColorReq);
 
     REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixWriteAccess);
     if (rc == Success)
     {
@@ -2760,7 +2760,7 @@ ProcQueryColors(ClientPtr client)
     REQUEST(xQueryColorsReq);
 
     REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixReadAccess);
     if (rc == Success)
     {
@@ -2812,7 +2812,7 @@ ProcLookupColor(ClientPtr client)
     REQUEST(xLookupColorReq);
 
     REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
-    rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+    rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
 			   DixReadAccess);
     if (rc == Success)
     {
@@ -2861,14 +2861,14 @@ ProcCreateCursor (ClientPtr client)
     REQUEST_SIZE_MATCH(xCreateCursorReq);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
 
-    rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client,
+    rc = dixLookupResourceByType((pointer *)&src, stuff->source, RT_PIXMAP, client,
 			   DixReadAccess);
     if (rc != Success) {
 	client->errorValue = stuff->source;
 	return (rc == BadValue) ? BadPixmap : rc;
     }
 
-    rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
+    rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
 			   DixReadAccess);
     if (rc != Success)
     {
@@ -2968,7 +2968,7 @@ ProcFreeCursor (ClientPtr client)
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
+    rc = dixLookupResourceByType((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
 			   DixDestroyAccess);
     if (rc == Success) 
     {
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 22935ce..1d43d44 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -216,7 +216,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
     if (id == INVALID)
 	return BadDrawable;
 
-    rc = dixLookupResource((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
+    rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
 
     if (rc == BadValue)
 	return BadDrawable;
@@ -259,7 +259,7 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
     if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT))
 	goto bad;
 
-    rc = dixLookupResource(&pRes, rid, RC_ANY, client, DixGetAttrAccess);
+    rc = dixLookupResourceByClass(&pRes, rid, RC_ANY, client, DixGetAttrAccess);
     if (rc != Success)
 	goto bad;
 
diff --git a/dix/events.c b/dix/events.c
index a4deaaa..b8dd680 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5091,7 +5091,7 @@ ProcGrabPointer(ClientPtr client)
 	cursor = NullCursor;
     else
     {
-	rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR,
+	rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
 			       client, DixUseAccess);
 	if (rc != Success)
 	{
@@ -5191,8 +5191,8 @@ ProcChangeActivePointerGrab(ClientPtr client)
 	newCursor = NullCursor;
     else
     {
-	int rc = dixLookupResource((pointer *)&newCursor, stuff->cursor,
-				   RT_CURSOR, client, DixUseAccess);
+	int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor,
+					 RT_CURSOR, client, DixUseAccess);
 	if (rc != Success)
 	{
 	    client->errorValue = stuff->cursor;
@@ -5798,7 +5798,7 @@ ProcGrabButton(ClientPtr client)
 	cursor = NullCursor;
     else
     {
-	rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR,
+	rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
 			       client, DixUseAccess);
 	if (rc != Success)
 	if (!cursor)
@@ -6048,7 +6048,7 @@ ProcRecolorCursor(ClientPtr client)
     REQUEST(xRecolorCursorReq);
 
     REQUEST_SIZE_MATCH(xRecolorCursorReq);
-    rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
+    rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
 			   client, DixWriteAccess);
     if (rc != Success)
     {
diff --git a/dix/gc.c b/dix/gc.c
index 83f48d4..1a5fb3e 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -273,7 +273,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		else
 		{
 		    NEXTVAL(XID, newpix);
-		    rc = dixLookupResource((pointer *)&pPixmap, newpix,
+		    rc = dixLookupResourceByType((pointer *)&pPixmap, newpix,
 					   RT_PIXMAP, client, DixReadAccess);
 		}
 		if (rc == Success)
@@ -310,7 +310,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		else
 		{
 		    NEXTVAL(XID, newstipple)
-		    rc = dixLookupResource((pointer *)&pPixmap, newstipple,
+		    rc = dixLookupResourceByType((pointer *)&pPixmap, newstipple,
 					   RT_PIXMAP, client, DixReadAccess);
 		}
 		if (rc == Success)
@@ -353,7 +353,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		else
 		{
 		    NEXTVAL(XID, newfont)
-		    rc = dixLookupResource((pointer *)&pFont, newfont,
+		    rc = dixLookupResourceByType((pointer *)&pFont, newfont,
 					   RT_FONT, client, DixUseAccess);
 		}
 		if (rc == Success)
@@ -420,7 +420,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 			pPixmap = NullPixmap;
 		    }
 		    else {
-			rc = dixLookupResource((pointer *)&pPixmap, pid,
+			rc = dixLookupResourceByType((pointer *)&pPixmap, pid,
 					       RT_PIXMAP, client,
 					       DixReadAccess);
 			if (rc != Success) {
diff --git a/dix/resource.c b/dix/resource.c
index 81b2e95..6d7f816 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -846,11 +846,10 @@ LegalNewID(XID id, ClientPtr client)
 }
 
 _X_EXPORT int
-dixLookupResource(pointer *result, XID id, RESTYPE rtype,
-		  ClientPtr client, Mask mode)
+dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
+			ClientPtr client, Mask mode)
 {
     int cid = CLIENT_ID(id);
-    int istype = (rtype & TypeMask) && (rtype != RC_ANY);
     ResourcePtr res = NULL;
 
     *result = NULL;
@@ -859,8 +858,38 @@ dixLookupResource(pointer *result, XID id, RESTYPE rtype,
 	res = clientTable[cid].resources[Hash(cid, id)];
 
 	for (; res; res = res->next)
-	    if ((res->id == id) && ((istype && res->type == rtype) ||
-				    (!istype && res->type & rtype)))
+	    if (res->id == id && res->type == rtype)
+		break;
+    }
+    if (!res)
+	return BadValue;
+
+    if (client) {
+	client->errorValue = id;
+	cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+		       res->value, RT_NONE, NULL, mode);
+	if (cid != Success)
+	    return cid;
+    }
+
+    *result = res->value;
+    return Success;
+}
+
+_X_EXPORT int
+dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
+			 ClientPtr client, Mask mode)
+{
+    int cid = CLIENT_ID(id);
+    ResourcePtr res = NULL;
+
+    *result = NULL;
+
+    if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
+	res = clientTable[cid].resources[Hash(cid, id)];
+
+	for (; res; res = res->next)
+	    if (res->id == id && (res->type & rclass))
 		break;
     }
     if (!res)
diff --git a/dix/window.c b/dix/window.c
index 541d199..5810030 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1086,7 +1086,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 	    }
 	    else
 	    {	
-		rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+		rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
 				       client, DixReadAccess);
 		if (rc == Success)
 		{
@@ -1146,7 +1146,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 		    pixID = pWin->parent->border.pixmap->drawable.id;
 		}
 	    }
-	    rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+	    rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
 				   client, DixReadAccess);
 	    if (rc == Success)
 	    {
@@ -1348,7 +1348,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 		error = BadMatch;
 		goto PatchUp;
 	    }
-	    rc = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP,
+	    rc = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
 				   client, DixUseAccess);
 	    if (rc != Success)
 	    {
@@ -1424,7 +1424,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 	    }
 	    else
 	    {
-		rc = dixLookupResource((pointer *)&pCursor, cursorID,
+		rc = dixLookupResourceByType((pointer *)&pCursor, cursorID,
 				       RT_CURSOR, client, DixUseAccess);
 		if (rc != Success)
 		{
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 5713ca1..58d813e 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -276,6 +276,8 @@ _X_HIDDEN void *dixLookupTab[] = {
     SYMFUNC(ChangeResourceValue)
     SYMFUNC(CreateNewResourceClass)
     SYMFUNC(CreateNewResourceType)
+    SYMFUNC(dixLookupResourceByType)
+    SYMFUNC(dixLookupResourceByClass)
     SYMFUNC(dixLookupResource)
     SYMFUNC(FakeClientID)
     SYMFUNC(FreeResource)
diff --git a/include/resource.h b/include/resource.h
index b8105d4..ad51424 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -218,13 +218,20 @@ extern pointer LookupClientResourceComplex(
     FindComplexResType func,
     pointer cdata);
 
-extern int dixLookupResource(
+extern int dixLookupResourceByType(
     pointer *result,
     XID id,
     RESTYPE rtype,
     ClientPtr client,
     Mask access_mode);
 
+extern int dixLookupResourceByClass(
+    pointer *result,
+    XID id,
+    RESTYPE rclass,
+    ClientPtr client,
+    Mask access_mode);
+
 extern void GetXIDRange(
     int /*client*/,
     Bool /*server*/,
@@ -244,29 +251,43 @@ extern RESTYPE TypeMask;
  * Please use the noted replacements instead.
  */
 
-/* replaced by dixLookupResource */
+#ifdef __GNUC__
+#define X_DEPRECATED __attribute__((deprecated))
+#else
+#define X_DEPRECATED
+#endif
+
+/* replaced by dixLookupResourceByType or dixLookupResourceByClass */
+extern int dixLookupResource(
+    pointer *result,
+    XID id,
+    RESTYPE rtype,
+    ClientPtr client,
+    Mask access_mode) X_DEPRECATED;
+
+/* replaced by dixLookupResourceByType */
 extern pointer SecurityLookupIDByType(
     ClientPtr client,
     XID id,
     RESTYPE rtype,
-    Mask access_mode);
+    Mask access_mode) X_DEPRECATED;
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
 extern pointer SecurityLookupIDByClass(
     ClientPtr client,
     XID id,
     RESTYPE classes,
-    Mask access_mode);
+    Mask access_mode) X_DEPRECATED;
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
 extern pointer LookupIDByType(
     XID id,
-    RESTYPE rtype);
+    RESTYPE rtype) X_DEPRECATED;
 
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
 extern pointer LookupIDByClass(
     XID id,
-    RESTYPE classes);
+    RESTYPE classes) X_DEPRECATED;
 
 #endif /* RESOURCE_H */
 
diff --git a/render/picture.c b/render/picture.c
index 723f337..93952c8 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1069,7 +1069,7 @@ ChangePicture (PicturePtr	pPicture,
 			pAlpha = 0;
 		    else
 		    {
-			error = dixLookupResource((pointer *)&pAlpha, pid,
+			error = dixLookupResourceByType((pointer *)&pAlpha, pid,
 						  PictureType, client,
 						  DixReadAccess);
 			if (error != Success)
@@ -1130,7 +1130,7 @@ ChangePicture (PicturePtr	pPicture,
 		    else
 		    {
 			clipType = CT_PIXMAP;
-			error = dixLookupResource((pointer *)&pPixmap, pid,
+			error = dixLookupResourceByType((pointer *)&pPixmap, pid,
 						  RT_PIXMAP, client,
 						  DixReadAccess);
 			if (error != Success)
diff --git a/render/render.c b/render/render.c
index 638aa46..db340dc 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1018,7 +1018,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
 
     LEGAL_NEW_RESOURCE(stuff->gsid, client);
 
-    rc = dixLookupResource((pointer *)&glyphSet, stuff->existing, GlyphSetType,
+    rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->existing, GlyphSetType,
 			   client, DixGetAttrAccess);
     if (rc != Success)
     {
@@ -1042,7 +1042,7 @@ ProcRenderFreeGlyphSet (ClientPtr client)
     REQUEST(xRenderFreeGlyphSetReq);
 
     REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
-    rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+    rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
 			   client, DixDestroyAccess);
     if (rc != Success)
     {
@@ -1081,7 +1081,7 @@ ProcRenderAddGlyphs (ClientPtr client)
     CARD32	    component_alpha;
 
     REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
-    err = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+    err = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
 			    client, DixAddAccess);
     if (err != Success)
     {
@@ -1271,7 +1271,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
     CARD32	    glyph;
 
     REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
-    rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+    rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
 			   client, DixRemoveAccess);
     if (rc != Success)
     {
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 0834d88..6853168 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -850,7 +850,7 @@ ProcXFixesHideCursor (ClientPtr client)
 
     REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
 
-    ret = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+    ret = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
 			    client, DixGetAttrAccess);
     if (ret != Success) {
 	client->errorValue = stuff->window;
@@ -908,7 +908,7 @@ ProcXFixesShowCursor (ClientPtr client)
 
     REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
 
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
 			   client, DixGetAttrAccess);
     if (rc != Success) {
 	client->errorValue = stuff->window;
diff --git a/xfixes/region.c b/xfixes/region.c
index d90b1e0..b927631 100755
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -115,7 +115,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client)
     REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
     LEGAL_NEW_RESOURCE (stuff->region, client);
 
-    rc = dixLookupResource((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
+    rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
 			   client, DixReadAccess);
     if (rc != Success)
     {
@@ -160,7 +160,7 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client)
     
     REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
     LEGAL_NEW_RESOURCE (stuff->region, client);
-    rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
 			   client, DixGetAttrAccess);
     if (rc != Success)
     {
@@ -687,7 +687,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
     REQUEST(xXFixesSetWindowShapeRegionReq);
 
     REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
-    rc = dixLookupResource((pointer *)&pWin, stuff->dest, RT_WINDOW,
+    rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW,
 			   client, DixSetAttrAccess);
     if (rc != Success)
     {
commit bda289b0aea7be39c73066b993ce9e4bf9df7d54
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jul 29 11:58:16 2008 -0700

    Reset lastSlave when disabling devices

diff --git a/dix/devices.c b/dix/devices.c
index 0a68c0e..82bcc64 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -315,6 +315,14 @@ DisableDevice(DeviceIntPtr dev)
                 AttachDevice(NULL, other, NULL);
         }
     }
+    else
+    {
+        for (other = inputInfo.devices; other; other = other->next)
+        {
+	    if (other->isMaster && other->u.lastSlave == dev)
+		other->u.lastSlave = NULL;
+	}
+    }
 
     if (dev->isMaster && dev->spriteInfo->sprite)
     {
commit 2386c9a4654950fabaa2ab7c68ce3fd21faca026
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jul 29 11:57:52 2008 -0700

    Implement RandR output property events

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 9bb7081..ac44568 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -24,10 +24,36 @@
 #include "propertyst.h"
 #include "swaprep.h"
 
-static void
-RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask)
+static int
+DeliverPropertyEvent (WindowPtr pWin, pointer value)
 {
+    xRROutputPropertyNotifyEvent    *event = value;
+    RREventPtr			    *pHead, pRREvent;
+    ClientPtr			    client;
+
+    pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType);
+    if (!pHead)
+	return WT_WALKCHILDREN;
+
+    for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) 
+    {
+	client = pRREvent->client;
+	if (client == serverClient || client->clientGone)
+	    continue;
+
+	if (!(pRREvent->mask & RROutputPropertyNotifyMask))
+	    continue;
+
+	event->window = pRREvent->window->drawable.id;
+	WriteEventsToClient(pRREvent->client, 1, (xEvent *) event);
+    }
+    return WT_WALKCHILDREN;
+}
 
+static void
+RRDeliverPropertyEvent (ScreenPtr pScreen, xEvent *event)
+{
+    WalkTree (pScreen, DeliverPropertyEvent, (pointer) event);
 }
 
 void
@@ -45,7 +71,7 @@ RRDeleteAllOutputProperties (RROutputPtr output)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
 	if (prop->current.data)
 	    xfree(prop->current.data);
 	if (prop->pending.data)
@@ -113,7 +139,7 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
 	RRDestroyOutputProperty (prop);
     }
 }
@@ -238,7 +264,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
 	event.state = PropertyNewValue;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
     }
     return(Success);
 }
@@ -674,7 +700,7 @@ ProcRRGetOutputProperty (ClientPtr client)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
     }
 
     WriteReplyToClient(client, sizeof(xGenericReply), &reply);
commit f209924c36b98c6c8562e0093a50d723146ba289
Merge: dfb622f... 5e847c1...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jul 8 13:57:30 2008 -0700

    Merge commit 'origin/master' into transform-proposal
    
    Conflicts:
    
    	Xi/exevents.c
    	configure.ac
    	hw/xfree86/modes/xf86Rotate.c
    
    All of these merges were of differently formated but equivalent code.

diff --cc configure.ac
index 2200770,fed8037..71d372d
--- a/configure.ac
+++ b/configure.ac
@@@ -1226,7 -1219,7 +1219,7 @@@ AC_MSG_RESULT([$XNEST]
  AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
  
  if test "x$XNEST" = xyes; then
- 	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
 -	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
++	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
  	XNEST_SYS_LIBS="$XNESTMODULES_LIBS"
  	AC_SUBST([XNEST_LIBS])
  	AC_SUBST([XNEST_SYS_LIBS])
commit 5e847c1d4fc30a0d263a861a76982660f11998cd
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Jul 7 17:08:01 2008 -0700

    Improved driver selection when autoconfiguring driver without xorg.conf
    
    - Allow returning multiple drivers to try for a given PCI id (for instance,
      try "geode" then "amd" for AMD Geode hardware)
    - On Solaris, use VIS_GETIDENTIFIER ioctl as well as PCI id to choose drivers
    - Use wsfb instead of fbdev as a fallback on non-Linux SPARC platforms

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index a786eed..45c42e1 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -41,6 +41,11 @@
 #include "xf86_OSlib.h"
 #include "dirent.h"
 
+#ifdef sun
+# include <sys/visual_io.h>
+# include <ctype.h>
+#endif
+
 /* Sections for the default built-in configuration. */
 
 #define BUILTIN_DEVICE_NAME \
@@ -79,11 +84,8 @@
 
 static const char **builtinConfig = NULL;
 static int builtinLines = 0;
-static const char *deviceList[] = {
-	"fbdev",
-	"vesa",
-	NULL
-};
+
+static void listPossibleVideoDrivers(char *matches[], int nmatches);
 
 /*
  * A built-in config file is stored as an array of strings, with each string
@@ -135,87 +137,91 @@ AppendToConfig(const char *s)
     AppendToList(s, &builtinConfig, &builtinLines);
 }
 
-static const char *
-videoPtrToDriverName(struct pci_device *dev)
+static int
+videoPtrToDriverList(struct pci_device *dev,
+		     char *returnList[], int returnListMax)
 {
     /*
      * things not handled yet:
      * cyrix/nsc.  should be merged into geode anyway.
      * xgi.
      */
+    int i;
+    /* Add more entries here if we ever return more than 4 drivers for
+       any device */
+    char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
 
     switch (dev->vendor_id)
     {
 	case 0x1022:
-		if (dev->device_id == 0x2081)
-			return "geode";
-		else
-			return NULL;
-	case 0x1142:		    return "apm";
-	case 0xedd8:		    return "ark";
-	case 0x1a03:		    return "ast";
-	case 0x1002:		    return "ati";
-	case 0x102c:		    return "chips";
-	case 0x1013:		    return "cirrus";
+	    if (dev->device_id == 0x2081) {
+		driverList[0] = "geode";
+		driverList[1] = "amd";
+	    }
+	    break;
+	case 0x1142:		    driverList[0] = "apm"; break;
+	case 0xedd8:		    driverList[0] = "ark"; break;
+	case 0x1a03:		    driverList[0] = "ast"; break;
+	case 0x1002:		    driverList[0] = "ati"; break;
+	case 0x102c:		    driverList[0] = "chips"; break;
+	case 0x1013:		    driverList[0] = "cirrus"; break;
 	case 0x8086:
-	    if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800))
-		return "i740";
-	    else return "intel";
-	case 0x102b:		    return "mga";
-	case 0x10c8:		    return "neomagic";
-	case 0x105d:		    return "i128";
-	case 0x10de: case 0x12d2:   return "nv";
-	case 0x1163:		    return "rendition";
+	    if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
+		driverList[0] = "i740";
+	    } else {
+		driverList[0] = "intel";
+		driverList[1] = "i810";
+	    }
+	    break;
+	case 0x102b:		    driverList[0] = "mga";	break;
+	case 0x10c8:		    driverList[0] = "neomagic"; break;
+	case 0x105d:		    driverList[0] = "i128";	break;
+	case 0x10de: case 0x12d2:   driverList[0] = "nv";	break;
+	case 0x1163:		    driverList[0] = "rendition"; break;
 	case 0x5333:
 	    switch (dev->device_id)
 	    {
 		case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811:
 		case 0x8812: case 0x8814: case 0x8901:
-		    return "s3";
+		    driverList[0] = "s3"; break;
 		case 0x5631: case 0x883d: case 0x8a01: case 0x8a10:
 		case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13:
-		    return "s3virge";
+		    driverList[0] = "s3virge"; break;
 		default:
-		    return "savage";
+		    driverList[0] = "savage"; break;
 	    }
-	case 0x1039:		    return "sis";
-	case 0x126f:		    return "siliconmotion";
+	    break;
+	case 0x1039:		    driverList[0] = "sis";	break;
+	case 0x126f:		    driverList[0] = "siliconmotion"; break;
 	case 0x121a:
 	    if (dev->device_id < 0x0003)
-	        return "voodoo";
+	        driverList[0] = "voodoo";
 	    else
-	        return "tdfx";
-	case 0x3d3d:		    return "glint";
-	case 0x1023:		    return "trident";
-	case 0x100c:		    return "tseng";
-	case 0x1106:		    return "openchrome";
-	case 0x15ad:		    return "vmware";
+	        driverList[0] = "tdfx";
+	    break;
+	case 0x3d3d:		    driverList[0] = "glint";	break;
+	case 0x1023:		    driverList[0] = "trident"; break;
+	case 0x100c:		    driverList[0] = "tseng";	break;
+	case 0x1106:		    driverList[0] = "openchrome"; break;
+	case 0x15ad:		    driverList[0] = "vmware";	break;
 	default: break;
     }
-    return NULL;
+    for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) {
+	returnList[i] = xnfstrdup(driverList[i]);
+    }
+    return i;	/* Number of entries added */
 }
 
 Bool
 xf86AutoConfig(void)
 {
-    const char **p;
+    char *deviceList[20];
+    char **p;
+    const char **cp;
     char buf[1024];
-    const char *driver = NULL;
     ConfigStatus ret;
 
-    driver = chooseVideoDriver();
-
-    if (driver) {
-	snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
-		 driver, 0, driver);
-	AppendToConfig(buf);
-	ErrorF("New driver is \"%s\"\n", driver);
-	buf[0] = '\t';
-	AppendToConfig(BUILTIN_DEVICE_SECTION_POST);
-	snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
-		 driver, 0, driver, 0);
-	AppendToConfig(buf);
-    }
+    listPossibleVideoDrivers(deviceList, 20);
 
     for (p = deviceList; *p; p++) {
 	snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
@@ -225,23 +231,23 @@ xf86AutoConfig(void)
     }
 
     AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
-    if (driver) {
-	snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, driver, 0);
-	AppendToConfig(buf);
-    }
     for (p = deviceList; *p; p++) {
 	snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
 	AppendToConfig(buf);
     }
     AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
 
+    for (p = deviceList; *p; p++) {
+	xfree(*p);
+    }
+
     xf86MsgVerb(X_DEFAULT, 0,
 		"Using default built-in configuration (%d lines)\n",
 		builtinLines);
 
     xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
-    for (p = builtinConfig; *p; p++)
-	xf86ErrorFVerb(3, "\t%s", *p);
+    for (cp = builtinConfig; *cp; cp++)
+	xf86ErrorFVerb(3, "\t%s", *cp);
     xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
     
     xf86setBuiltinConfig(builtinConfig);
@@ -416,17 +422,51 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
 }
 #endif /* __linux__ */
 
-char*
-chooseVideoDriver(void)
+static void
+listPossibleVideoDrivers(char *matches[], int nmatches)
 {
     struct pci_device * info = NULL;
     struct pci_device_iterator *iter;
-    char *chosen_driver = NULL;
     int i;
-    char *matches[20]; /* If we have more than 20 drivers we're in trouble */
     
-    for (i=0 ; i<20 ; i++)
+    for (i = 0 ; i < nmatches ; i++) {
         matches[i] = NULL;
+    }
+    i = 0;
+
+#ifdef sun
+    /* Check for driver type based on /dev/fb type and if valid, use
+       it instead of PCI bus probe results */
+    if (xf86Info.consoleFd >= 0) {
+	struct vis_identifier   visid;
+	const char *cp;
+
+	if (ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid) >= 0) {
+	    xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
+
+	    /* Special case from before the general case was set */
+	    if (strcmp(visid.name, "NVDAnvda") == 0) {
+		matches[i++] = xnfstrdup("nvidia");
+	    }
+
+	    /* General case - split into vendor name (initial all-caps
+	       prefix) & driver name (rest of the string). */
+	    if (strcmp(visid.name, "SUNWtext") != 0) {
+		for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
+		    /* find end of all uppercase vendor section */
+		}
+		if ((cp != visid.name) && (*cp != '\0')) {
+		    char *driverName = xnfstrdup(cp);
+		    char *vendorName = xnfstrdup(visid.name);
+		    vendorName[cp - visid.name] = '\0';
+
+		    matches[i++] = vendorName;
+		    matches[i++] = driverName;
+		}
+	    }
+	}
+    }
+#endif
 
     /* Find the primary device, and get some information about it. */
     iter = pci_slot_match_iterator_create(NULL);
@@ -447,31 +487,52 @@ chooseVideoDriver(void)
     }
 #endif /* __linux__ */
 
-    /* TODO Handle multiple drivers claiming to support the same PCI ID */
-    if (matches[0]) {
-        chosen_driver = matches[0];
-    } else {
-	if (info != NULL)
-	    chosen_driver = videoPtrToDriverName(info);
-	if (chosen_driver == NULL) {
-#if defined  __i386__ || defined __amd64__ || defined __hurd__
-	    chosen_driver = "vesa";
-#elif defined __sparc__
-	    chosen_driver = "sunffb";
+    for (i = 0; (i < nmatches) && (matches[i]); i++) {
+	/* find end of matches list */
+    }
+
+    if ((info != NULL) && (i < nmatches)) {
+	i += videoPtrToDriverList(info, &(matches[i]), nmatches - i);
+    }
+
+    /* Fallback to platform default hardware */
+    if (i < (nmatches - 1)) {
+#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
+	matches[i++] = xnfstrdup("vesa");
+#elif defined(__sparc__) && !defined(sun)
+	matches[i++] = xnfstrdup("sunffb");
+#endif
+    }
+
+    /* Fallback to platform default frame buffer driver */
+    if (i < (nmatches - 1)) {
+#if !defined(__linux__) && defined(__sparc__)
+	matches[i++] = xnfstrdup("wsfb");
 #else
-	    chosen_driver = "fbdev";
+	matches[i++] = xnfstrdup("fbdev");
 #endif
-	}
     }
+}
+
+char*
+chooseVideoDriver(void)
+{
+    char *chosen_driver = NULL;
+    int i;
+    char *matches[20]; /* If we have more than 20 drivers we're in trouble */
 
-    xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver);
+    listPossibleVideoDrivers(matches, 20);
 
-    i = 0;
-    while (matches[i]) {
+    /* TODO Handle multiple drivers claiming to support the same PCI ID */
+    chosen_driver = matches[0];
+
+    xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n",
+	    chosen_driver);
+
+    for (i = 0; matches[i] ; i++) {
         if (matches[i] != chosen_driver) {
             xfree(matches[i]);
         }
-        i++;
     }
 
     return chosen_driver;
commit 235fea0e1a2101fb76a54e6505db321674530c60
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Mon Jul 7 15:21:59 2008 -0700

    Update bsd & solaris descriptions in README.OS-lib

diff --git a/hw/xfree86/os-support/README.OS-lib b/hw/xfree86/os-support/README.OS-lib
index c815cb0..308d762 100644
--- a/hw/xfree86/os-support/README.OS-lib
+++ b/hw/xfree86/os-support/README.OS-lib
@@ -34,11 +34,11 @@ have been made in implementation.
 			at build time via Imakefile rules.  This is alway
 			preferable to reproducing functions in more than one
 			OS library.
-		bsd/	OS support for the 386BSD/NetBSD/FreeBSD operating 
+		bsd/	OS support for the NetBSD/FreeBSD/OpenBSD operating 
 			systems.
 		linux/	OS support for the Linux operating system.
 		sco/	OS support for the SCO SVR3.x operating system.
-		solx86/	OS support for the Solaris x86 operating system.
+		solaris/ OS support for the Solaris operating system.
 		sysv/	OS support for all SVR4.0 and SVR4.2, and for
 			ISC and AT&T SVR3.2 operating systems.
 
commit d8af9d9ab1cd98c07fdf42490dcc0cab3c655b89
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Jul 7 13:14:49 2008 +0200

    Export xkbfile.h in the SDK
    
    It's needed by xkbsrv.h

diff --git a/include/Makefile.am b/include/Makefile.am
index 7d5fee7..5edefe7 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -50,6 +50,7 @@ sdk_HEADERS =		\
 	validate.h	\
 	window.h	\
 	windowstr.h	\
+	xkbfile.h	\
 	xkbsrv.h	\
 	xkbstr.h	\
 	xorg-server.h
@@ -58,4 +59,4 @@ endif
 AM_CFLAGS = $(DIX_CFLAGS)
 
 EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h \
-	xkb-config.h xkbfile.h
+	xkb-config.h
commit d78bebb20a00e8519788c75c90b467a5750c78be
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 04:04:19 2008 -0300

    Remove unused function and variables.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index b98e903..498f797 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -467,7 +467,6 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
     LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
     InputDriverPtr drv;
     IDevRec *idev;
-    BOOL found;
     IDevPtr *it;
 
     if (pInfo) /* need to get these before RemoveDevice */
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index 63ea8c5..4a8d8f2 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -179,13 +179,6 @@ exaDDXDriverInit(ScreenPtr pScreen)
     
 }
 
-/*ARGSUSED*/
-static const OptionInfoRec *
-EXAAvailableOptions(void *unused)
-{
-    return (EXAOptions);
-}
-
 static XF86ModuleVersionInfo exaVersRec =
 {
 	"exa",
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 3a9f3ff..dd5ce64 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -526,7 +526,6 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 _X_EXPORT void
 xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList)
 {
-    Bool mode_is_reduced = FALSE;
     DisplayModePtr mode;
 
     for (mode = modeList; mode != NULL; mode = mode->next) {
@@ -682,7 +681,7 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
 _X_EXPORT DisplayModePtr
 xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
 {
-    DisplayModePtr  head = NULL, prev = NULL, mode;
+    DisplayModePtr  head = NULL, mode;
     int		    i;
 
     for (i = 0; i < xf86NumDefaultModes; i++)
diff --git a/mi/misprite.c b/mi/misprite.c
index 6f0cbe7..122cea4 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -268,7 +268,6 @@ static Bool
 miSpriteCloseScreen (int i, ScreenPtr pScreen)
 {
     miSpriteScreenPtr   pScreenPriv;
-    DeviceIntPtr        pDev;
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						      miSpriteScreenKey);
commit a8c4727f01949da0ae266369f0d12a96c2bf0da5
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 04:03:46 2008 -0300

    Fix typo in the last commit.

diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index b71924f..f30674f 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -243,7 +243,7 @@ xf86RandRSetConfig (ScreenPtr		pScreen,
     Bool		    useVirtual = FALSE;
     Rotation		    oldRotation = randrp->rotation;
 
-    miPointerGetPosition(inputInfo.pointermi, &px, &py);
+    miPointerGetPosition(inputInfo.pointer, &px, &py);
     for (mode = scrp->modes; ; mode = mode->next)
     {
 	if (mode->HDisplay == pSize->width &&
commit 3164288b121990a5990747c0f92d4af13b1c929a
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 03:55:59 2008 -0300

    Remove deprecated function miPointerPosition().

diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 4702392..b71924f 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -243,7 +243,7 @@ xf86RandRSetConfig (ScreenPtr		pScreen,
     Bool		    useVirtual = FALSE;
     Rotation		    oldRotation = randrp->rotation;
 
-    miPointerPosition (&px, &py);
+    miPointerGetPosition(inputInfo.pointermi, &px, &py);
     for (mode = scrp->modes; ; mode = mode->next)
     {
 	if (mode->HDisplay == pSize->width &&
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index ae88189..ac40e0f 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -2301,7 +2301,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags)
 	pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1;
 
 				/* Fix up cursor */
-	miPointerPosition(&px, &py);
+    miPointerGetPosition(inputInfo.pointer, &px, &py);
 	if (px < pScrn->frameX0) px = pScrn->frameX0;
 	if (px > pScrn->frameX1) px = pScrn->frameX1;
 	if (py < pScrn->frameY0) py = pScrn->frameY0;
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index aa712c0..c754228 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -160,7 +160,6 @@ _X_HIDDEN void *miLookupTab[] = {
     SYMFUNC(miPutImage)
     SYMFUNC(miPushPixels)
     SYMFUNC(miPointerInitialize)
-    SYMFUNC(miPointerPosition)
     SYMFUNC(miRecolorCursor)
     SYMFUNC(miPointerWarpCursor)
     SYMFUNC(miDCInitialize)
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 4763e12..809ce5e 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -560,12 +560,6 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
 }
 
 _X_EXPORT void
-miPointerPosition (int *x, int *y)
-{
-    miPointerGetPosition(inputInfo.pointer, x, y);
-}
-
-_X_EXPORT void
 miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
 {
     *x = MIPOINTER(pDev)->x;
diff --git a/mi/mipointer.h b/mi/mipointer.h
index d2e4455..179e4f3 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -134,12 +134,6 @@ extern void miPointerAbsoluteCursor(
     unsigned long /*time*/
 ) _X_DEPRECATED;
 
-/* Deprecated in favour of miPointerGetPosition. */
-extern void miPointerPosition(
-    int * /*x*/,
-    int * /*y*/
-) _X_DEPRECATED;
-
 /* Deprecated in favour of miPointerSetScreen. */
 extern void miPointerSetNewScreen(
     int, /*screen_no*/
commit d1031a8972490ebf0ef6dc2762036a7a7172466b
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 03:46:21 2008 -0300

    Update README.OS-lib to reflect reality.

diff --git a/hw/xfree86/os-support/README.OS-lib b/hw/xfree86/os-support/README.OS-lib
index e410906..c815cb0 100644
--- a/hw/xfree86/os-support/README.OS-lib
+++ b/hw/xfree86/os-support/README.OS-lib
@@ -36,7 +36,6 @@ have been made in implementation.
 			OS library.
 		bsd/	OS support for the 386BSD/NetBSD/FreeBSD operating 
 			systems.
-		bsdi/	OS support for the BSD/386 operating system.
 		linux/	OS support for the Linux operating system.
 		sco/	OS support for the SCO SVR3.x operating system.
 		solx86/	OS support for the Solaris x86 operating system.
@@ -214,288 +213,6 @@ void xf86UseMsg(void)
 	 */
 }
 
-void xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
-	/*
-	 * Sound the keyboard bell.  pitch is in Hz, duration in ms,
-	 * loudness is in the range 0-100 (0 -> off).  For systems
-	 * where the loudness can't be controlled, scale the duration
-	 * by loudness/50.
-	 */
-}
-
-void xf86SetKbdLeds(int leds)
-{
-	/*
-	 * Set the keyboard LEDs to the state indicated in leds
-	 */
-}
-
-int xf86GetKbdLeds(void)
-{
-	/*
-	 * Return the state of the keyboard LEDs.  If the OS doesn't
-	 * support this, return 0.
-	 */
-}
-
-void xf86SetKbdRepeat(char rad)
-{
-	/*
-	 * Set the keyboard repeat rate and delay according the
-	 * the rad value.  The lower 5 bits determine the repeat
-	 * rate (lower value -> higher rate).  The next 2 bits
-	 * determine the delay.
-	 * This should possibly be changed to take separate rate and
-	 * delay parameters.
-	 */
-}
-
-void xf86KbdInit(void)
-{
-	/*
-	 * Save initial keyboard state.  This is called at the start of
-	 * each server generation.
-	 */
-}
-
-int xf86KbdOn(void)
-{
-	/*
-	 * Set the keyboard up for use with X.  This is called whenever
-	 * the server becomes active (ie at the start of each generation and
-	 * whenever its VT becomes active).  Return the file descriptor
-	 * for keyboard input.  Return -1 if there is no file descriptor
-	 * to add as an input device.  If there are errors encountered,
-	 * call FatalError().  A return value of -1 is not considered an
-	 * error condition.
-	 */
-}
-
-int xf86KbdOff(void)
-{
-	/*
-	 * Return the keyboard to the state saved by xf86KbdInit().  This is
-	 * called at the end of a server generation, and also when the
-	 * server's VT ceases being active.  Returns the keyboard file
-	 * descriptor.  Returns -1 if there is no file descriptor to be
-	 * removed as an input device.  Errors should be handled the same
-	 * way as in xf86KbdOn().
-	 */
-}
-
-void xf86KbdEvents(void)
-{
-	/*
-	 * Read characters from the keyboard device, and post the events
-	 * by calling xf86PostKbdEvent().  Read as much as is available
-	 * without waiting.
-	 */
-}
-
-void xf86SetMouseSpeed(int old, int new, unsigned cflag)
-{
-	/*
-	 * Set the speed of the mouse port.  old is the previous speed,
-	 * new is the new speed, and cflag is the value of the termio[s]
-	 * c_cflag field.  For mice that have programmable speed operation,
-	 * this should send the appropriate commands to the mouse.
-	 */
-}
-
-void xf86MouseInit(void)
-{
-	/*
-	 * This is called at the start of each server generation.  In most
-	 * cases this is a noop.  If the mouse must not be opened/closed
-	 * when VT switching, the open should be done here.
-	 */
-}
-
-int xf86MousedOn(void)
-{
-	/*
-	 * Set the mouse up for use with X.  This is called whenever
-	 * the server becomes active (ie at the start of each generation and
-	 * whenever its VT becomes active).  This function normally opens
-	 * the mouse device, and may call xf86SetupMouse() to initialise
-	 * the mouse parameters.  Return the file descriptor for mouse input.
-	 * Return -1 if there is no file descriptor to add as an input
-	 * device.  If there are errors encountered, call FatalError().
-	 * A return value of -1 is not considered an error condition.
-	 */
-}
-
-int xf86MouseOff(Bool doclose)
-{
-	/*
-	 * Release the mouse from use with X.  This is called at the end
-	 * of a server generation (with doclose==TRUE), and also when the
-	 * server's VT ceases being active (with doclose==FALSE).  If the
-	 * mouse should not be opened/closed when VT switching, the close
-	 * should be done here when doclose==TRUE.  For other systems, the
-	 * mouse device should be closed regardless of the doclose value.
-	 * Returns the mouse file descriptor.  Returns -1 if there is no
-	 * file descriptor to be removed as an input device.  Errors
-	 * should be handled the same way as in xf86MouseOn().
-	 */
-}
-
-void xf86MouseEvents(void)
-{
-	/*
-	 * Read characters from the mouse device, and post the events
-	 * by calling xf86PostMseEvent().  Read as much as is available
-	 * without waiting.  If the OS doesn't handle the mouse protocol
-	 * translation, xf86MouseProtocol() may be called to do the
-	 * translation and event posting.  If the OS does handle the protocol
-	 * translation, MOUSE_PROTOCOL_IN_KERNEL should be #define'd in
-	 * xf86_OSlib.h.
-	 */
-}
-
-int xf86OsMouseProc(DevicePtr pPointer, int what)
-{
-	/*
-	 * Implements the device-proc for the pointer device when an
-	 * OS-based mouse driver is being used (as opposed to the
-	 * server's internal mouse driver).  Implemented as any other
-	 * device-proc in the server.
-	 *
-	 * This function only needs to be implemented if USE_OSMOUSE is
-	 * defined for the OS.
-	 */
-}
-
-int xf86OsMouseEvents(void)
-{
-	/*
-	 * When supporting an OS-based mouse driver (as opposed to the
-	 * server's internal mouse driver), read some events from the device
-	 * and post them to the DIX layer through xf86PostMseEvent().
-	 *
-	 * This function only needs to be implemented if USE_OSMOUSE is
-	 * defined for the OS.
-	 */
-}
-
-void xf86OsMouseOption(int token, pointer lex_ptr)
-{
-	/*
-	 * Used in parsing an OsMouse keyword from the Xconfig file.
-	 * Passed the token type and a pointer to the token value.
-	 * The function should do whatever is appropriate for the OS's
-	 * mouse driver.
-	 *
-	 * This function only needs to be implemented if USE_OSMOUSE is
-	 * defined for the OS.
-	 */
-}
-
-/*
- * The following functions are simply wrappers around the OS specific
- * libc functions
- */
-
-void *
-xf86memmove(void * dest, const void * src, INT32 n)
-{
-	return(memmove(dest,src,n));
-}
-
-void *
-xf86memset(void * s, int c, INT32 n)
-{
-	return(memset(s,c,n));
-}
-
-void *
-xf86memcpy(void * dest, const void * src, INT32 n)
-{
-	return(memcpy(dest,src,n));
-}
-
-int
-xf86memcmp(const void * s1, const void * s2, INT32 n)
-{
-	return(memcmp(s1,s2,n));
-}
-
-char *
-xf86strcat(char * dest, const char * src)
-{
-	return(strcat(dest,src));
-}
-
-char *
-xf86strcpy(char * dest, const char * src)
-{
-	return(strcpy(dest,src));
-}
-
-int
-xf86strcmp(const char * s1, const char * s2)
-{
-	return(strcmp(s1,s2));
-}
-
-int
-xf86strncmp(const char * s1, const char * s2, INT32 n)
-{
-	return(strncmp(s1,s2,n));
-}
-
-size_t
-xf86strlen(const char * s)
-{
-	return(strlen(s));
-}
-
-void
-xf86getsecs(INT32 * secs, INT32 * usecs)
-{
-	struct timeval tv;
-
-	gettimeofday(&tv, NULL);
-	*secs = tv.tv_sec;
-	*usecs= tv.tv_usec;
-
-	return;
-}
-
-double 
-xf86exp(double x)
-{
-	return(exp(x));
-}
-
-double 
-xf86log(double x)
-{
-	return(log(x));
-}
-
-double 
-xf86pow(double x, double y)
-{
-	return(pow(x,y));
-}
-
-double 
-xf86sqrt(double x)
-{
-	return(sqrt(x));
-}
-
-double 
-xf86cos(double x)
-{
-	return(cos(x));
-}
-
-
-
-
 $XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $
 
 
commit f72500c4a09cce5dbbd16639b1951a4bf943e4ac
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 03:45:18 2008 -0300

    Nuke libc wrapper remaining stuffs.

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 065102f..70b32b9 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -340,7 +340,6 @@ Bool xf86IsUnblank(int mode);
 
 _X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module);
 _X_DEPRECATED void xf86DeleteModuleInfo(int idx);
-void xf86getsecs(long *, long *);
 
 /* xf86Debug.c */
 #ifdef BUILDDEBUG
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index eaa6c76..d58ce93 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -2937,17 +2937,3 @@ xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
 {
     return GetMotionHistory(pDev, buff, start, stop, pScreen, core);
 }
-
-_X_EXPORT void
-xf86getsecs(long * secs, long * usecs)
-{
-    struct timeval tv;
-
-    X_GETTIMEOFDAY(&tv);
-    if (secs)
-	*secs = tv.tv_sec;
-    if (usecs)
-	*usecs= tv.tv_usec;
-
-    return;
-}
diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c
index 748bd3a..6dbc65e 100644
--- a/hw/xfree86/utils/xorgcfg/loadmod.c
+++ b/hw/xfree86/utils/xorgcfg/loadmod.c
@@ -110,189 +110,6 @@ LOOKUP xfree86LookupTab[] = {
    SYMFUNC(LoaderFreeDirList)
    SYMFUNC(LoaderGetOS)
 
-   /*
-    * these here are our own interfaces to libc functions
-    */
-   SYMFUNC(xf86abort)
-   SYMFUNC(xf86abs)
-   SYMFUNC(xf86acos)
-   SYMFUNC(xf86asin)
-   SYMFUNC(xf86atan)
-   SYMFUNC(xf86atan2)
-   SYMFUNC(xf86atof)
-   SYMFUNC(xf86atoi)
-   SYMFUNC(xf86atol)
-   SYMFUNC(xf86bsearch)
-   SYMFUNC(xf86ceil)
-   SYMFUNC(xf86calloc)
-   SYMFUNC(xf86clearerr)
-   SYMFUNC(xf86close)
-   SYMFUNC(xf86cos)
-   SYMFUNC(xf86exit)
-   SYMFUNC(xf86exp)
-   SYMFUNC(xf86fabs)
-   SYMFUNC(xf86fclose)
-   SYMFUNC(xf86feof)
-   SYMFUNC(xf86ferror)
-   SYMFUNC(xf86fflush)
-   SYMFUNC(xf86fgetc)
-   SYMFUNC(xf86fgetpos)
-   SYMFUNC(xf86fgets)
-   SYMFUNC(xf86finite)
-   SYMFUNC(xf86floor)
-   SYMFUNC(xf86fmod)
-   SYMFUNC(xf86fopen)
-   SYMFUNC(xf86fprintf)
-   SYMFUNC(xf86fputc)
-   SYMFUNC(xf86fputs)
-   SYMFUNC(xf86fread)
-   SYMFUNC(xf86free)
-   SYMFUNC(xf86freopen)
-   SYMFUNC(xf86frexp)
-   SYMFUNC(xf86fscanf)
-   SYMFUNC(xf86fseek)
-   SYMFUNC(xf86fsetpos)
-   SYMFUNC(xf86ftell)
-   SYMFUNC(xf86fwrite)
-   SYMFUNC(xf86getc)
-   SYMFUNC(xf86getenv)
-   SYMFUNC(xf86getpagesize)
-   SYMFUNC(xf86hypot)
-   SYMFUNC(xf86ioctl)
-   SYMFUNC(xf86isalnum)
-   SYMFUNC(xf86isalpha)
-   SYMFUNC(xf86iscntrl)
-   SYMFUNC(xf86isdigit)
-   SYMFUNC(xf86isgraph)
-   SYMFUNC(xf86islower)
-   SYMFUNC(xf86isprint)
-   SYMFUNC(xf86ispunct)
-   SYMFUNC(xf86isspace)
-   SYMFUNC(xf86isupper)
-   SYMFUNC(xf86isxdigit)
-   SYMFUNC(xf86labs)
-   SYMFUNC(xf86ldexp)
-   SYMFUNC(xf86log)
-   SYMFUNC(xf86log10)
-   SYMFUNC(xf86lseek)
-   SYMFUNC(xf86malloc)
-   SYMFUNC(xf86memchr)
-   SYMFUNC(xf86memcmp)
-   SYMFUNC(xf86memcpy)
-#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \
-    defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \
-    defined (__amd64__)
-   /*
-    * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
-    * structure copies.  This causes a problem both here and in shared
-    * libraries as there is no way to map the name of the call to the
-    * correct function.
-    */
-   SYMFUNC(memcpy)
-   /*
-    * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle 
-    * aggregate initializations.
-    */
-   SYMFUNC(memset)
-#endif
-   SYMFUNC(xf86memmove)
-   SYMFUNC(xf86memset)
-   SYMFUNC(xf86mmap)
-   SYMFUNC(xf86modf)
-   SYMFUNC(xf86munmap)
-   SYMFUNC(xf86open)
-   SYMFUNC(xf86perror)
-   SYMFUNC(xf86pow)
-   SYMFUNC(xf86printf)
-   SYMFUNC(xf86qsort)
-   SYMFUNC(xf86read)
-   SYMFUNC(xf86realloc)
-   SYMFUNC(xf86remove)
-   SYMFUNC(xf86rename)
-   SYMFUNC(xf86rewind)
-   SYMFUNC(xf86setbuf)
-   SYMFUNC(xf86setvbuf)
-   SYMFUNC(xf86sin)
-   SYMFUNC(xf86snprintf)
-   SYMFUNC(xf86sprintf)
-   SYMFUNC(xf86sqrt)
-   SYMFUNC(xf86sscanf)
-   SYMFUNC(xf86strcat)
-   SYMFUNC(xf86strcmp)
-   SYMFUNC(xf86strcasecmp)
-   SYMFUNC(xf86strcpy)
-   SYMFUNC(xf86strcspn)
-   SYMFUNC(xf86strerror)
-   SYMFUNC(xf86strlen)
-   SYMFUNC(xf86strncmp)
-   SYMFUNC(xf86strncasecmp)
-   SYMFUNC(xf86strncpy)
-   SYMFUNC(xf86strpbrk)
-   SYMFUNC(xf86strchr)
-   SYMFUNC(xf86strrchr)
-   SYMFUNC(xf86strspn)
-   SYMFUNC(xf86strstr)
-   SYMFUNC(xf86strtod)
-   SYMFUNC(xf86strtok)
-   SYMFUNC(xf86strtol)
-   SYMFUNC(xf86strtoul)
-   SYMFUNC(xf86tan)
-   SYMFUNC(xf86tmpfile)
-   SYMFUNC(xf86tolower)
-   SYMFUNC(xf86toupper)
-   SYMFUNC(xf86ungetc)
-   SYMFUNC(xf86vfprintf)
-   SYMFUNC(xf86vsnprintf)
-   SYMFUNC(xf86vsprintf)
-   SYMFUNC(xf86write)
-  
-/* non-ANSI C functions */
-   SYMFUNC(xf86opendir)
-   SYMFUNC(xf86closedir)
-   SYMFUNC(xf86readdir)
-   SYMFUNC(xf86rewinddir)
-   SYMFUNC(xf86ffs)
-   SYMFUNC(xf86strdup)
-   SYMFUNC(xf86bzero)
-   SYMFUNC(xf86usleep)
-   SYMFUNC(xf86execl)
-
-   SYMFUNC(xf86getsecs)
-   SYMFUNC(xf86fpossize)      /* for returning sizeof(fpos_t) */
-
-   SYMFUNC(xf86stat)
-   SYMFUNC(xf86fstat)
-   SYMFUNC(xf86access)
-   SYMFUNC(xf86geteuid)
-   SYMFUNC(xf86getegid)
-   SYMFUNC(xf86getpid)
-   SYMFUNC(xf86mknod)
-   SYMFUNC(xf86chmod)
-   SYMFUNC(xf86chown)
-   SYMFUNC(xf86sleep)
-   SYMFUNC(xf86mkdir)
-   SYMFUNC(xf86shmget)
-   SYMFUNC(xf86shmat)
-   SYMFUNC(xf86shmdt)
-   SYMFUNC(xf86shmctl)
-#ifdef HAS_GLIBC_SIGSETJMP
-   SYMFUNC(xf86setjmp)
-   SYMFUNC(xf86setjmp0)
-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
-   SYMFUNCALIAS("xf86setjmp1",__sigsetjmp)
-#else
-   SYMFUNC(xf86setjmp1)
-#endif
-#else
-   SYMFUNCALIAS("xf86setjmp",setjmp)
-   SYMFUNCALIAS("xf86setjmp0",setjmp)
-   SYMFUNC(xf86setjmp1)
-#endif
-   SYMFUNCALIAS("xf86longjmp",longjmp)
-   SYMFUNC(xf86getjmptype)
-   SYMFUNC(xf86setjmp1_arg2)
-   SYMFUNC(xf86setjmperror)
-
     SYMFUNC(xf86AddDriver)
     SYMFUNC(xf86ServerIsOnlyDetecting)
     SYMFUNC(xf86AddInputDriver)
commit 3fd5fab5663fbdce2fc0b5377155aedf9a70b6c2
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Fri Jul 4 02:51:42 2008 -0300

    Remove inexistent function headers.

diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 88b80be..a29f22c 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -163,8 +163,6 @@ void DoConfigure(void);
 
 /* xf86Events.c */
 
-void xf86PostKbdEvent(unsigned key);
-void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy);
 void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
 void xf86SigHandler(int signo);
 void xf86HandlePMEvents(int fd, pointer data);
commit 0b9ef835a0fe900c121b84e43989591e58ab1126
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Jul 4 07:29:32 2008 +1000

    modes: fix initial xorg.conf mode selection.
    
    This was all kinds of broken, we ignored user preferred modes for multiple
    monitors and also for side-by-side configurations.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 733106c..a5a0a63 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1006,6 +1006,54 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
 
 #define POSITION_UNSET	-100000
 
+/*
+ * check if the user configured any outputs at all 
+ * with either a position or a relative setting or a mode.
+ */
+static Bool
+xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+    int o;
+    Bool user_conf = FALSE;
+
+    for (o = 0; o < config->num_output; o++)
+    {
+	xf86OutputPtr output = config->output[o];
+	char	    *position;
+	char	    *relative_name;
+	OutputOpts	    relation;
+	int r;
+	static const OutputOpts	relations[] = {
+	    OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+	};
+
+	position = xf86GetOptValString (output->options,
+					OPTION_POSITION);
+	if (position)
+	    user_conf = TRUE;
+
+	relation = 0;
+	relative_name = NULL;
+	for (r = 0; r < 4; r++)
+	{
+	    relation = relations[r];
+	    relative_name = xf86GetOptValString (output->options,
+						     relation);
+	    if (relative_name)
+		break;
+	}
+	if (relative_name)
+	    user_conf = TRUE;
+
+	modes[o] = xf86OutputHasUserPreferredMode(output);
+	if (modes[o])
+	    user_conf = TRUE;
+    }
+
+    return user_conf;
+}
+
 static Bool
 xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
 {
@@ -1993,6 +2041,9 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
 {
     int o;
 
+    if (xf86UserConfiguredOutputs(scrn, modes))
+	return xf86TargetFallback(scrn, config, modes, enabled, width, height);
+    
     for (o = -1; nextEnabledOutput(config, enabled, &o); )
 	if (xf86OutputHasUserPreferredMode(config->output[o]))
 	    return 
commit e317943c125d7fdbe62c750324640eb30c88fa15
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jul 2 12:23:03 2008 +0930

    xfree86: AllowEmptyInput is now enabled by default if hotplugging is enabled.
    
    Remove AEI check from configImpliedLayout as the setting isn't actually parsed
    at this point anyway (written by Sasha Hlusiak).
    
    Resurrect checkInput() and check for devices there if AEI is false (this also
    creates the default devices if required).
    
    Set AllowEmptyInput to enabled by default if hotplugging is enabled.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 35a48ee..bea2130 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1087,9 +1087,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
     }
 #endif
 
-    xf86Info.allowEmptyInput = FALSE;
-    if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
-        xf86Info.allowEmptyInput = TRUE;
+    /* AllowEmptyInput is automatically true if we're hotplugging */
+    xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
+    xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
 
     xf86Info.useDefaultFontPath = TRUE;
     xf86Info.useDefaultFontPathFrom = X_DEFAULT;
@@ -1874,9 +1874,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
     indp = xnfalloc(sizeof(IDevPtr));
     *indp = NULL;
     servlayoutp->inputs = indp;
-    if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE))
-	return FALSE;
-    
+
     return TRUE;
 }
 
@@ -2479,6 +2477,12 @@ addDefaultModes(MonPtr monitorp)
     return TRUE;
 }
 
+static void
+checkInput(serverLayoutPtr layout) {
+    if (!xf86Info.allowEmptyInput)
+        checkCoreInputDevices(layout, FALSE);
+}
+
 /*
  * load the config file and fill the global data structure
  */
@@ -2599,6 +2603,8 @@ xf86HandleConfigFile(Bool autoconfig)
     configDRI(xf86configptr->conf_dri);
 #endif
 
+    checkInput(&xf86ConfigLayout);
+
     /*
      * Handle some command line options that can override some of the
      * ServerFlags settings.
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 8b66f89..3af1b78 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -696,7 +696,8 @@ the X server to load. Disabled by default.
 .TP 7
 .BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
 If enabled, don't add the standard keyboard and mouse drivers, if there are no
-input devices in the config file.  Disabled by default.
+input devices in the config file.  Enabled by default if AutoAddDevices and
+AutoEnableDevices is enabled, otherwise disabled.
 .TP 7
 .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
 If this option is disabled, then no devices will be added from HAL events.
commit fe5cf7cb00fd926cefff933adbdbceea7353f4c2
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jul 1 13:18:54 2008 +0930

    xfree86: handle missing Screen lines in the ServerLayout #16301
    
    If no Screen is specified in the ServerLayout section, either take the first
    one from the config file or autogenerate a default screen.
    
    X.Org Bug 16301 <http://bugs.freedesktop.org/show_bug.cgi?id=16301>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6fd0273..35a48ee 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1608,10 +1608,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
         count++;
         adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
     }
+
 #ifdef DEBUG
     ErrorF("Found %d screens in the layout section %s",
            count, conf_layout->lay_identifier);
 #endif
+    if (!count) /* alloc enough storage even if no screen is specified */
+        count = 1;
+
     slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
     slp[count].screen = NULL;
     /*
@@ -1666,6 +1670,20 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
         adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
     }
 
+    /* No screen was specified in the layout. take the first one from the
+     * config file, or - if it is NULL - configScreen autogenerates one for
+     * us */
+    if (!count)
+    {
+        slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
+	if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
+                          0, X_CONFIG)) {
+	    xfree(slp[0].screen);
+	    xfree(slp);
+	    return FALSE;
+	}
+    }
+
     /* XXX Need to tie down the upper left screen. */
 
     /* Fill in the refscreen and top/bottom/left/right values */
commit 6674b87a7dca7d6ffd9dd9af888c5256b13d7877
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 29 20:05:27 2008 +0930

    xfree86: move declaration of configured_device to start of function.
    
    Last I checked C doesn't allow declarations halfway down a block.

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 46c4a96..5418ca0 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -472,6 +472,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
   MessageType		 pix24From = X_DEFAULT;
   Bool			 pix24Fail = FALSE;
   Bool			 autoconfig = FALSE;
+  GDevPtr		 configured_device;
   
   xf86Initialising = TRUE;
 
@@ -555,7 +556,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /* If there aren't any specified in the config file, autoconfig them */
     /* FIXME: Does not handle multiple active screen sections, but I'm not
      * sure if we really want to handle that case*/
-    GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;
+    configured_device = xf86ConfigLayout.screens->screen->device;
     if ((!configured_device) || (!configured_device->driver)) {
         if (!autoConfigDevice(configured_device)) {
             xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
commit 1e96782011f0b4ba6ed1d3d3df118964a58d15fd
Author: Dave Airlie <airlied at linux.ie>
Date:   Thu Jul 3 20:00:22 2008 +1000

    dri2: bump libdrm numbers as 2.3.1 is released without ttm interface

diff --git a/configure.ac b/configure.ac
index d7a3d68..fed8037 100644
--- a/configure.ac
+++ b/configure.ac
@@ -381,7 +381,7 @@ case $host_os in
 	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
 	AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
 	DRI=yes
-	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
+	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
 	;;
   *netbsd*)
 	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@@ -389,7 +389,7 @@ case $host_os in
 	AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
 	AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
 	DRI=yes
-	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
+	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
 	;;
   *openbsd*)
 	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@@ -398,7 +398,7 @@ case $host_os in
 	;;
   *linux*)
 	DRI=yes
-	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
+	PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
 	KDRIVE_HW=yes
 	;;
   *solaris*)
@@ -882,7 +882,7 @@ if test "x$DRI2" = xyes; then
 	# FIXME: Bump the versions once we have releases of these.
 	AC_DEFINE(DRI2, 1, [Build DRI2 extension])
 	PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
-	PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
+	PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.2])
 fi
 
 AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
commit 1771edcb44b564f83f509748b4e4cd5b7586e2a8
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jul 3 18:57:09 2008 +1000

    modes: check the crtc is valid before using its desired modes.
    
    this fixes a crash I was getting on radeon rotate when gnome is running.
    I'm sure g-s-d was doing something bad, but really not crashing ftw.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 5a71bcf..733106c 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1714,9 +1714,11 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
     /* Set scrn->modes to the mode list for the 'compat' output */
     scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
 
-    for (mode = scrn->modes; mode; mode = mode->next)
-	if (xf86ModesEqual (mode, &crtc->desiredMode))
-	    break;
+    if (crtc) {
+	for (mode = scrn->modes; mode; mode = mode->next)
+	    if (xf86ModesEqual (mode, &crtc->desiredMode))
+		break;
+    }
 
     if (scrn->modes != NULL) {
 	/* For some reason, scrn->modes is circular, unlike the other mode
commit 689292e58cc5242cbfeaa29fcf65b6dcd9dfabb9
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jul 2 11:25:50 2008 -0400

    Fix GLX in Xvfb and kdrive.

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 140cccb..bf1f475 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -78,6 +78,8 @@ Xephyr_DEPENDENCIES =	\
 	$(LIBXEPHYR_HOSTDRI)				\
 	@KDRIVE_LOCAL_LIBS@
 
+Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
 relink:
 	rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
 
diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am
index 09d179e..76ed9fc 100644
--- a/hw/kdrive/fake/Makefile.am
+++ b/hw/kdrive/fake/Makefile.am
@@ -21,6 +21,8 @@ Xfake_LDADD = 						\
 	@KDRIVE_LIBS@					\
         @XSERVER_LIBS@
 
+Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
 Xfake_DEPENDENCIES =	\
 	libfake.a					\
 	@KDRIVE_LOCAL_LIBS@
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
index 420855b..cb12928 100644
--- a/hw/kdrive/fbdev/Makefile.am
+++ b/hw/kdrive/fbdev/Makefile.am
@@ -22,6 +22,8 @@ Xfbdev_DEPENDENCIES =	\
 	libfbdev.a					\
 	$(KDRIVE_PURE_LIBS)
 
+Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
 relink:
 	rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
 endif
diff --git a/hw/kdrive/sdl/Makefile.am b/hw/kdrive/sdl/Makefile.am
index fe9309e..0973cb4 100644
--- a/hw/kdrive/sdl/Makefile.am
+++ b/hw/kdrive/sdl/Makefile.am
@@ -13,5 +13,7 @@ Xsdl_LDADD = \
 
 Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
 
+Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
 relink:
 	rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am
index ac50d2b..4225dcf 100644
--- a/hw/kdrive/vesa/Makefile.am
+++ b/hw/kdrive/vesa/Makefile.am
@@ -27,5 +27,7 @@ Xvesa_DEPENDENCIES =	\
 	libvesa.a 				\
 	@KDRIVE_LOCAL_LIBS@
 
+Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
 relink:
 	rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
index 9ceeccc..a4a120a 100644
--- a/hw/vfb/Makefile.am
+++ b/hw/vfb/Makefile.am
@@ -26,6 +26,7 @@ XVFB_LIBS = \
 
 Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
 Xvfb_DEPENDENCIES = $(XVFB_LIBS)
+Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
 
 # Man page
 include $(top_srcdir)/cpprules.in
commit 9a73bca859be12721ef62304b1422c455d4aec49
Author: Chris Ball <cjb at laptop.org>
Date:   Wed Jul 2 09:46:06 2008 -0400

    Remove KdOffscreenMarkUsed() as all its callers are gone.

diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 3e5af3a..212e016 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -843,9 +843,6 @@ KdOffscreenArea *
 KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
 
 void
-KdOffscreenMarkUsed (PixmapPtr pPixmap);
-
-void
 KdOffscreenSwapOut (ScreenPtr pScreen);
 
 void
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
index f6ef52f..24ba7ff 100644
--- a/hw/kdrive/src/koffscreen.c
+++ b/hw/kdrive/src/koffscreen.c
@@ -309,29 +309,6 @@ KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
     return area;
 }
 
-void
-KdOffscreenMarkUsed (PixmapPtr pPixmap)
-{
-    KaaPixmapPriv (pPixmap);
-    KdScreenPriv (pPixmap->drawable.pScreen);
-    static int iter = 0;
-
-    if (!pKaaPixmap->area)
-	return;
-
-    /* The numbers here are arbitrary.  We may want to tune these. */
-    pKaaPixmap->area->score += 100;
-    if (++iter == 10) {
-	KdOffscreenArea *area;
-	for (area = pScreenPriv->off_screen_areas; area != NULL;
-	     area = area->next)
-	{
-	    if (area->state == KdOffscreenRemovable)
-		area->score = (area->score * 7) / 8;
-	}
-    }
-}
-
 Bool
 KdOffscreenInit (ScreenPtr pScreen)
 {
commit b84a27fd9fdcb579437cfa38f10cb12cf55dc7c3
Author: Ian Romanick <idr at us.ibm.com>
Date:   Wed Jul 2 06:25:03 2008 -0700

    VBO: Regenerate files based on recent changes to gl_API.xml
    
    Since GL_ARB_vertex_buffer_object protocol isn't supported yet, these
    changes are innocuous.

diff --git a/glx/indirect_dispatch.h b/glx/indirect_dispatch.h
index e81c382..014e417 100644
--- a/glx/indirect_dispatch.h
+++ b/glx/indirect_dispatch.h
@@ -251,8 +251,6 @@ extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GL
 extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
 extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
 extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
-extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
-extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
 extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
 extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc);
 extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc);
@@ -423,6 +421,8 @@ extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
 extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
 extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
 extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
+extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
 extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc);
 extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc);
 extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc);
diff --git a/glx/indirect_size_get.c b/glx/indirect_size_get.c
index 8f72690..80f81de 100644
--- a/glx/indirect_size_get.c
+++ b/glx/indirect_size_get.c
@@ -714,6 +714,17 @@ __glGetBooleanv_size(GLenum e)
     case GL_MAX_TEXTURE_COORDS_ARB:
     case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
     case GL_DEPTH_BOUNDS_TEST_EXT:
+    case GL_ARRAY_BUFFER_BINDING_ARB:
+    case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+    case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+    case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+    case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+    case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+    case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+    case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+    case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+    case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+    case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
     case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
     case GL_STENCIL_TEST_TWO_SIDE_EXT:
     case GL_ACTIVE_STENCIL_FACE_EXT:
@@ -1072,6 +1083,7 @@ __glGetVertexAttribdvARB_size(GLenum e)
     case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
     case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
     case GL_CURRENT_VERTEX_ATTRIB_ARB:
+    case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
         return 1;
     default:
         return 0;
commit 703a9645f3d547144ea62dd81c41f5356a5f87d8
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 1 17:50:48 2008 -0400

    Auf wiedersehen, KAA.

diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index 29098c3..fbb5e51 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -20,10 +20,6 @@ endif
 
 libkdrive_a_SOURCES =	\
 	fourcc.h	\
-	kaa.c		\
-	kaa.h		\
-	kaapict.c	\
-	kasync.c	\
 	kcmap.c		\
 	kcurscol.c	\
 	kdrive.c	\
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
deleted file mode 100644
index db09e9d..0000000
--- a/hw/kdrive/src/kaa.c
+++ /dev/null
@@ -1,1081 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © The XFree86 Project Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-#include "dixfontstr.h"
-
-#define DEBUG_MIGRATE 0
-#define DEBUG_PIXMAP 0
-#if DEBUG_MIGRATE
-#define DBG_MIGRATE(a) ErrorF a
-#else
-#define DBG_MIGRATE(a)
-#endif
-#if DEBUG_PIXMAP
-#define DBG_PIXMAP(a) ErrorF a
-#else
-#define DBG_PIXMAP(a)
-#endif
- 
-DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey;
-DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey;
-
-#define KAA_PIXMAP_SCORE_MOVE_IN    10
-#define KAA_PIXMAP_SCORE_MAX	    20
-#define KAA_PIXMAP_SCORE_MOVE_OUT   -10
-#define KAA_PIXMAP_SCORE_MIN	    -20
-#define KAA_PIXMAP_SCORE_PINNED	    1000
-#define KAA_PIXMAP_SCORE_INIT	    1001
-
-void
-kaaDrawableDirty (DrawablePtr pDrawable)
-{
-    PixmapPtr pPixmap;
-    KaaPixmapPrivPtr pKaaPixmap;
-
-    if (pDrawable->type == DRAWABLE_WINDOW)
-	pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable);
-    else
-	pPixmap = (PixmapPtr)pDrawable;
-
-    pKaaPixmap = KaaGetPixmapPriv(pPixmap);
-    if (pKaaPixmap != NULL)
-	pKaaPixmap->dirty = TRUE;
-}
-
-static void
-kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area)
-{
-    PixmapPtr pPixmap = area->privData;
-    KaaPixmapPriv(pPixmap);
-    int dst_pitch, src_pitch, bytes;
-    unsigned char *dst, *src;
-    int i; 
-    
-    DBG_MIGRATE (("Save 0x%08x (0x%x) (%dx%d)\n",
-		  pPixmap->drawable.id,
-		  KaaGetPixmapPriv(pPixmap)->area ? 
-		  KaaGetPixmapPriv(pPixmap)->area->offset : -1,
-		  pPixmap->drawable.width,
-		  pPixmap->drawable.height));
-		  
-    src_pitch = pPixmap->devKind;
-    dst_pitch = pKaaPixmap->devKind;
-
-    src = pPixmap->devPrivate.ptr;
-    dst = pKaaPixmap->devPrivate.ptr;
-    
-    pPixmap->devKind = dst_pitch;
-    pPixmap->devPrivate.ptr = dst;
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    pKaaPixmap->area = NULL;
-
-#if 0
-    if (!pKaaPixmap->dirty)
-	return;
-#endif
-
-    kaaWaitSync (pPixmap->drawable.pScreen);
-
-    bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
-    i = pPixmap->drawable.height;
-    while (i--) {
-	memcpy (dst, src, bytes);
-	dst += dst_pitch;
-	src += src_pitch;
-    }
-}
-
-static int
-kaaLog2(int val)
-{
-    int bits;
-
-    if (!val)
-	return 0;
-    for (bits = 0; val != 0; bits++)
-	val >>= 1;
-    return bits - 1;
-}
-
-static Bool
-kaaPixmapAllocArea (PixmapPtr pPixmap)
-{
-    ScreenPtr	pScreen = pPixmap->drawable.pScreen;
-    KaaScreenPriv (pScreen);
-    KaaPixmapPriv (pPixmap);
-    KdScreenPriv  (pScreen);
-    int		bpp = pPixmap->drawable.bitsPerPixel;
-    CARD16	h = pPixmap->drawable.height;
-    CARD16	w = pPixmap->drawable.width;
-    int		pitch;
-
-    if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1)
-	w = 1 << (kaaLog2(w - 1) + 1);
-    pitch = (w * bpp / 8 + pKaaScr->info->pitchAlign - 1) &
-            ~(pKaaScr->info->pitchAlign - 1);
-    
-    pKaaPixmap->devKind = pPixmap->devKind;
-    pKaaPixmap->devPrivate = pPixmap->devPrivate;
-    pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h,
-					 pKaaScr->info->offsetAlign,
-					 FALSE, 
-					 kaaPixmapSave, (pointer) pPixmap);
-    if (!pKaaPixmap->area)
-	return FALSE;
-    
-    DBG_PIXMAP(("++ 0x%08x (0x%x) (%dx%d)\n",
-		  pPixmap->drawable.id,
-		  KaaGetPixmapPriv(pPixmap)->area ? 
-		  KaaGetPixmapPriv(pPixmap)->area->offset : -1,
-		  pPixmap->drawable.width,
-		  pPixmap->drawable.height));
-    pPixmap->devKind = pitch;
-    pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset);
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    return TRUE;
-}
-
-void
-kaaMoveInPixmap (PixmapPtr pPixmap)
-{
-    ScreenPtr	pScreen = pPixmap->drawable.pScreen;
-    KaaScreenPriv (pScreen);
-    KaaPixmapPriv (pPixmap);
-    int dst_pitch, src_pitch, bytes;
-    unsigned char *dst, *src;
-    int i;
-
-    DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n",
-		  pPixmap->drawable.id,
-		  KaaGetPixmapPriv(pPixmap)->area ? 
-		  KaaGetPixmapPriv(pPixmap)->area->offset : -1,
-		  pPixmap->drawable.width,
-		  pPixmap->drawable.height));
-
-    src = pPixmap->devPrivate.ptr;
-    src_pitch = pPixmap->devKind;
-    
-    if (!kaaPixmapAllocArea (pPixmap))
-	return;
-
-    pKaaPixmap->dirty = FALSE;
-
-    if (pKaaScr->info->UploadToScreen)
-    {
-	if (pKaaScr->info->UploadToScreen(pPixmap, (char *) src, src_pitch))
-	    return;
-    }
-
-    dst = pPixmap->devPrivate.ptr;
-    dst_pitch = pPixmap->devKind;
-    
-    bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch;
-
-    kaaWaitSync (pPixmap->drawable.pScreen);
-
-    i = pPixmap->drawable.height;
-    while (i--) {
-	memcpy (dst, src, bytes);
-	dst += dst_pitch;
-	src += src_pitch;
-    }
-}
-
-static void
-kaaMoveOutPixmap (PixmapPtr pPixmap)
-{
-    KaaPixmapPriv (pPixmap);
-    KdOffscreenArea *area = pKaaPixmap->area;
-
-    DBG_MIGRATE (("<- 0x%08x (0x%x) (%dx%d)\n",
-		  pPixmap->drawable.id,
-		  KaaGetPixmapPriv(pPixmap)->area ? 
-		  KaaGetPixmapPriv(pPixmap)->area->offset : -1,
-		  pPixmap->drawable.width,
-		  pPixmap->drawable.height));
-    if (area)
-    {
-	kaaPixmapSave (pPixmap->drawable.pScreen, area);
-	KdOffscreenFree (pPixmap->drawable.pScreen, area);
-    }
-}
-
-void
-kaaPixmapUseScreen (PixmapPtr pPixmap)
-{
-    KaaPixmapPriv (pPixmap);
-
-    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
-	return;
-
-    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT) {
-	kaaMoveInPixmap(pPixmap);
-	pKaaPixmap->score = 0;
-    }
-
-    if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX)
-    {
-	pKaaPixmap->score++;
-	if (!kaaPixmapIsOffscreen(pPixmap) &&
-	    pKaaPixmap->score >= KAA_PIXMAP_SCORE_MOVE_IN)
-	    kaaMoveInPixmap (pPixmap);
-    }
-    KdOffscreenMarkUsed (pPixmap);
-}
-
-void
-kaaPixmapUseMemory (PixmapPtr pPixmap)
-{
-    KaaPixmapPriv (pPixmap);
-
-    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED)
-	return;
-
-    if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT)
-	pKaaPixmap->score = 0;
-
-    if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN)
-    {
-	pKaaPixmap->score--;
-	if (pKaaPixmap->area &&
-	    pKaaPixmap->score <= KAA_PIXMAP_SCORE_MOVE_OUT)
-	    kaaMoveOutPixmap (pPixmap);
-    }
-}
-
-static Bool
-kaaDestroyPixmap (PixmapPtr pPixmap)
-{
-    if (pPixmap->refcnt == 1)
-    {
-	KaaPixmapPriv (pPixmap);
-	if (pKaaPixmap->area)
-	{
-	    DBG_PIXMAP(("-- 0x%08x (0x%x) (%dx%d)\n",
-			 pPixmap->drawable.id,
-			 KaaGetPixmapPriv(pPixmap)->area->offset,
-			 pPixmap->drawable.width,
-			 pPixmap->drawable.height));
-	    /* Free the offscreen area */
-	    KdOffscreenFree (pPixmap->drawable.pScreen, pKaaPixmap->area);
-	    pPixmap->devPrivate = pKaaPixmap->devPrivate;
-	    pPixmap->devKind = pKaaPixmap->devKind;
-	}
-    }
-    return fbDestroyPixmap (pPixmap);
-}
-
-static PixmapPtr 
-kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
-{
-    PixmapPtr		pPixmap;
-    KaaPixmapPrivPtr	pKaaPixmap;
-    int			bpp;
-    
-    bpp = BitsPerPixel (depth);
-    if (bpp == 32 && depth == 24)
-    {
-	int fb;
-	KdScreenPriv (pScreen);
-	
-	for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
-	    if (pScreenPriv->screen->fb[fb].depth == 24)
-	    {
-		bpp = pScreenPriv->screen->fb[fb].bitsPerPixel;
-		break;
-	    }
-    }
-
-    pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp, usage_hint);
-    if (!pPixmap)
-	return NULL;
-    pKaaPixmap = KaaGetPixmapPriv(pPixmap);
-    if (!w || !h)
-	pKaaPixmap->score = KAA_PIXMAP_SCORE_PINNED;
-    else
-	pKaaPixmap->score = KAA_PIXMAP_SCORE_INIT;
-    
-    pKaaPixmap->area = NULL;
-    pKaaPixmap->dirty = FALSE;
-
-    return pPixmap;
-}
-
-Bool
-kaaPixmapIsOffscreen(PixmapPtr p)
-{
-    ScreenPtr	pScreen = p->drawable.pScreen;
-    KdScreenPriv(pScreen);
-
-    return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - 
-			     (CARD8 *) pScreenPriv->screen->memory_base) <
-	    pScreenPriv->screen->memory_size);
-}
-
-PixmapPtr
-kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
-{
-    PixmapPtr	pPixmap;
-    int		x, y;
-    
-    if (pDrawable->type == DRAWABLE_WINDOW) {
-	pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
-#ifdef COMPOSITE
-	x = -pPixmap->screen_x;
-	y = -pPixmap->screen_y;
-#else
-	x = 0;
-	y = 0;
-#endif
-    }
-    else
-    {
-	pPixmap = (PixmapPtr) pDrawable;
-	x = 0;
-	y = 0;
-    }
-    *xp = x;
-    *yp = y;
-    if (kaaPixmapIsOffscreen (pPixmap))
-	return pPixmap;
-    else
-	return NULL;
-}
-
-Bool
-kaaDrawableIsOffscreen (DrawablePtr pDrawable)
-{
-    PixmapPtr	pPixmap;
-    if (pDrawable->type == DRAWABLE_WINDOW)
-	pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable);
-    else
-	pPixmap = (PixmapPtr) pDrawable;
-    return kaaPixmapIsOffscreen (pPixmap);
-}
-
-#if 0
-static void
-kaaFillTiled(int	dst_x,
-	     int	dst_y,
-	     int	width,
-	     int	height,
-	     int	src_x,
-	     int	src_y,
-	     int	src_width,
-	     int	src_height,
-	     void	(*Copy) (int	srcX,
-				 int	srcY,
-				 int	dstX,
-				 int	dstY,
-				 int	width,
-				 int	height))
-{
-    modulus (src_x, src_width, src_x);
-    modulus (src_y, src_height, src_y);
-    
-    while (height)
-    {
-	int dst_x_tmp = dst_x;
-	int src_x_tmp = src_x;
-	int width_tmp = width;
-	int height_left = src_height - src_y;
-	int height_this = min (height, height_left);
-	
-	while (width_tmp)
-	{
-	    int width_left = src_width - src_x_tmp;
-	    int width_this = min (width_tmp, width_left);
-
-	    (*Copy) (src_x_tmp, src_y,
-		     dst_x_tmp, dst_y,
-		     width_this, height_this);
-
-	    width_tmp -= width_this;
-	    dst_x_tmp += width_this;
-	}
-	height -= height_this;
-	dst_y += height_this;
-	src_y = 0;
-    }
-}
-#endif
-
-static void
-kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, 
-	     DDXPointPtr ppt, int *pwidth, int fSorted)
-{
-    ScreenPtr	    pScreen = pDrawable->pScreen;
-    KdScreenPriv (pScreen);
-    KaaScreenPriv (pScreen);
-    RegionPtr	    pClip = fbGetCompositeClip(pGC);
-    PixmapPtr	    pPixmap;    
-    BoxPtr	    pextent, pbox;
-    int		    nbox;
-    int		    extentX1, extentX2, extentY1, extentY2;
-    int		    fullX1, fullX2, fullY1;
-    int		    partX1, partX2;
-    int		    off_x, off_y;
-
-    if (!pScreenPriv->enabled ||
-	pGC->fillStyle != FillSolid ||
-	!(pPixmap = kaaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) ||
-	!(*pKaaScr->info->PrepareSolid) (pPixmap,
-					 pGC->alu,
-					 pGC->planemask,
-					 pGC->fgPixel))
-    {
-	KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
-	return;
-    }
-    
-    pextent = REGION_EXTENTS(pGC->pScreen, pClip);
-    extentX1 = pextent->x1;
-    extentY1 = pextent->y1;
-    extentX2 = pextent->x2;
-    extentY2 = pextent->y2;
-    while (n--)
-    {
-	fullX1 = ppt->x;
-	fullY1 = ppt->y;
-	fullX2 = fullX1 + (int) *pwidth;
-	ppt++;
-	pwidth++;
-	
-	if (fullY1 < extentY1 || extentY2 <= fullY1)
-	    continue;
-	
-	if (fullX1 < extentX1)
-	    fullX1 = extentX1;
-
-	if (fullX2 > extentX2)
-	    fullX2 = extentX2;
-	
-	if (fullX1 >= fullX2)
-	    continue;
-	
-	nbox = REGION_NUM_RECTS (pClip);
-	if (nbox == 1)
-	{
-	    (*pKaaScr->info->Solid) (fullX1 + off_x, fullY1 + off_y,
-				     fullX2 + off_x, fullY1 + 1 + off_y);
-	}
-	else
-	{
-	    pbox = REGION_RECTS(pClip);
-	    while(nbox--)
-	    {
-		if (pbox->y1 <= fullY1 && fullY1 < pbox->y2)
-		{
-		    partX1 = pbox->x1;
-		    if (partX1 < fullX1)
-			partX1 = fullX1;
-		    partX2 = pbox->x2;
-		    if (partX2 > fullX2)
-			partX2 = fullX2;
-		    if (partX2 > partX1)
-			(*pKaaScr->info->Solid) (partX1 + off_x, fullY1 + off_y,
-						 partX2 + off_x, fullY1 + 1 + off_y);
-		}
-		pbox++;
-	    }
-	}
-    }
-    (*pKaaScr->info->DoneSolid) ();
-    kaaDrawableDirty (pDrawable);
-    kaaMarkSync (pDrawable->pScreen);
-}
-
-void
-kaaCopyNtoN (DrawablePtr    pSrcDrawable,
-	     DrawablePtr    pDstDrawable,
-	     GCPtr	    pGC,
-	     BoxPtr	    pbox,
-	     int	    nbox,
-	     int	    dx,
-	     int	    dy,
-	     Bool	    reverse,
-	     Bool	    upsidedown,
-	     Pixel	    bitplane,
-	     void	    *closure)
-{
-    KdScreenPriv (pDstDrawable->pScreen);
-    KaaScreenPriv (pDstDrawable->pScreen);
-    PixmapPtr pSrcPixmap, pDstPixmap;
-    int	    src_off_x, src_off_y;
-    int	    dst_off_x, dst_off_y;
-
-    /* Migrate pixmaps to same place as destination */
-    if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) {
-	if (kaaDrawableIsOffscreen (pDstDrawable))
-	    kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable);
-	else
-	    kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable);
-    }
-
-    if (pScreenPriv->enabled &&
-	(pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
-	(pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && 
-	(*pKaaScr->info->PrepareCopy) (pSrcPixmap,
-				       pDstPixmap,
-				       dx,
-				       dy,
-				       pGC ? pGC->alu : GXcopy,
-				       pGC ? pGC->planemask : FB_ALLONES))
-    {
-	while (nbox--)
-	{
-	    (*pKaaScr->info->Copy) (pbox->x1 + dx + src_off_x,
-				    pbox->y1 + dy + src_off_y,
-				    pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
-				    pbox->x2 - pbox->x1,
-				    pbox->y2 - pbox->y1);
-	    pbox++;
-	}
-	(*pKaaScr->info->DoneCopy) ();
-	kaaMarkSync (pDstDrawable->pScreen);
-    }
-    else
-    {
-	kaaWaitSync (pDstDrawable->pScreen);
-	fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, 
-		    pbox, nbox, dx, dy, reverse, upsidedown, 
-		    bitplane, closure);
-    }
-    kaaDrawableDirty (pDstDrawable);
-}
-
-static RegionPtr
-kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
-	    int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
-    return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, 
-		     srcx, srcy, width, height, 
-		     dstx, dsty, kaaCopyNtoN, 0, 0);
-}
-
-static void
-kaaPolyFillRect(DrawablePtr pDrawable, 
-		GCPtr	    pGC, 
-		int	    nrect,
-		xRectangle  *prect)
-{
-    KdScreenPriv (pDrawable->pScreen);
-    KaaScreenPriv (pDrawable->pScreen);
-    RegionPtr	    pClip = fbGetCompositeClip(pGC);
-    PixmapPtr	    pPixmap;
-    register BoxPtr pbox;
-    BoxPtr	    pextent;
-    int		    extentX1, extentX2, extentY1, extentY2;
-    int		    fullX1, fullX2, fullY1, fullY2;
-    int		    partX1, partX2, partY1, partY2;
-    int		    xoff, yoff;
-    int		    xorg, yorg;
-    int		    n;
-    
-    if (!pScreenPriv->enabled ||
-	pGC->fillStyle != FillSolid ||
-	!(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || 
-	!(*pKaaScr->info->PrepareSolid) (pPixmap,
-					 pGC->alu,
-					 pGC->planemask,
-					 pGC->fgPixel))
-    {
-	KdCheckPolyFillRect (pDrawable, pGC, nrect, prect);
-	return;
-    }
-    
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    
-    pextent = REGION_EXTENTS(pGC->pScreen, pClip);
-    extentX1 = pextent->x1;
-    extentY1 = pextent->y1;
-    extentX2 = pextent->x2;
-    extentY2 = pextent->y2;
-    while (nrect--)
-    {
-	fullX1 = prect->x + xorg;
-	fullY1 = prect->y + yorg;
-	fullX2 = fullX1 + (int) prect->width;
-	fullY2 = fullY1 + (int) prect->height;
-	prect++;
-	
-	if (fullX1 < extentX1)
-	    fullX1 = extentX1;
-
-	if (fullY1 < extentY1)
-	    fullY1 = extentY1;
-
-	if (fullX2 > extentX2)
-	    fullX2 = extentX2;
-	
-	if (fullY2 > extentY2)
-	    fullY2 = extentY2;
-
-	if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
-	    continue;
-	n = REGION_NUM_RECTS (pClip);
-	if (n == 1)
-	{
-	    (*pKaaScr->info->Solid) (fullX1 + xoff, fullY1 + yoff,
-				     fullX2 + xoff, fullY2 + yoff);
-	}
-	else
-	{
-	    pbox = REGION_RECTS(pClip);
-	    /* 
-	     * clip the rectangle to each box in the clip region
-	     * this is logically equivalent to calling Intersect()
-	     */
-	    while(n--)
-	    {
-		partX1 = pbox->x1;
-		if (partX1 < fullX1)
-		    partX1 = fullX1;
-		partY1 = pbox->y1;
-		if (partY1 < fullY1)
-		    partY1 = fullY1;
-		partX2 = pbox->x2;
-		if (partX2 > fullX2)
-		    partX2 = fullX2;
-		partY2 = pbox->y2;
-		if (partY2 > fullY2)
-		    partY2 = fullY2;
-    
-		pbox++;
-		
-		if (partX1 < partX2 && partY1 < partY2)
-		    (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
-					     partX2 + xoff, partY2 + yoff);
-	    }
-	}
-    }
-    (*pKaaScr->info->DoneSolid) ();
-    kaaDrawableDirty (pDrawable);
-    kaaMarkSync (pDrawable->pScreen);
-}
-    
-static void
-kaaSolidBoxClipped (DrawablePtr	pDrawable,
-		    RegionPtr	pClip,
-		    FbBits	pm,
-		    FbBits	fg,
-		    int		x1,
-		    int		y1,
-		    int		x2,
-		    int		y2)
-{
-    KdScreenPriv (pDrawable->pScreen);
-    KaaScreenPriv (pDrawable->pScreen);
-    PixmapPtr   pPixmap;        
-    BoxPtr	pbox;
-    int		nbox;
-    int		xoff, yoff;
-    int		partX1, partX2, partY1, partY2;
-
-    if (!pScreenPriv->enabled ||
-	!(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) ||
-	!(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
-    {
-	kaaWaitSync (pDrawable->pScreen);
-	fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
-	fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2,
-			   fbAnd (GXcopy, fg, pm),
-			   fbXor (GXcopy, fg, pm));
-	kaaDrawableDirty (pDrawable);
-	return;
-    }
-    for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); 
-	 nbox--; 
-	 pbox++)
-    {
-	partX1 = pbox->x1;
-	if (partX1 < x1)
-	    partX1 = x1;
-	
-	partX2 = pbox->x2;
-	if (partX2 > x2)
-	    partX2 = x2;
-	
-	if (partX2 <= partX1)
-	    continue;
-	
-	partY1 = pbox->y1;
-	if (partY1 < y1)
-	    partY1 = y1;
-	
-	partY2 = pbox->y2;
-	if (partY2 > y2)
-	    partY2 = y2;
-	
-	if (partY2 <= partY1)
-	    continue;
-	
-	(*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff,
-				 partX2 + xoff, partY2 + yoff);
-    }
-    (*pKaaScr->info->DoneSolid) ();
-    kaaDrawableDirty (pDrawable);
-    kaaMarkSync (pDrawable->pScreen);
-}
-
-static void
-kaaImageGlyphBlt (DrawablePtr	pDrawable,
-		  GCPtr		pGC,
-		  int		x, 
-		  int		y,
-		  unsigned int	nglyph,
-		  CharInfoPtr	*ppciInit,
-		  pointer	pglyphBase)
-{
-    FbGCPrivPtr	    pPriv = fbGetGCPrivate(pGC);
-    CharInfoPtr	    *ppci;
-    CharInfoPtr	    pci;
-    unsigned char   *pglyph;		/* pointer bits in glyph */
-    int		    gWidth, gHeight;	/* width and height of glyph */
-    FbStride	    gStride;		/* stride of glyph */
-    Bool	    opaque;
-    int		    n;
-    int		    gx, gy;
-    void	    (*glyph) (FbBits *,
-			      FbStride,
-			      int,
-			      FbStip *,
-			      FbBits,
-			      int,
-			      int);
-    FbBits	    *dst;
-    FbStride	    dstStride;
-    int		    dstBpp;
-    int		    dstXoff, dstYoff;
-    FbBits	    depthMask;
-    
-    depthMask = FbFullMask(pDrawable->depth);
-    if ((pGC->planemask & depthMask) != depthMask)
-    {
-	KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
-	return;
-    }
-    glyph = 0;
-    fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
-    switch (dstBpp) {
-    case 8:	glyph = fbGlyph8; break;
-    case 16:    glyph = fbGlyph16; break;
-    case 24:    glyph = fbGlyph24; break;
-    case 32:    glyph = fbGlyph32; break;
-    }
-    
-    x += pDrawable->x;
-    y += pDrawable->y;
-
-    if (TERMINALFONT (pGC->font) && !glyph)
-    {
-	opaque = TRUE;
-    }
-    else
-    {
-	int		xBack, widthBack;
-	int		yBack, heightBack;
-	
-	ppci = ppciInit;
-	n = nglyph;
-	widthBack = 0;
-	while (n--)
-	    widthBack += (*ppci++)->metrics.characterWidth;
-	
-        xBack = x;
-	if (widthBack < 0)
-	{
-	    xBack += widthBack;
-	    widthBack = -widthBack;
-	}
-	yBack = y - FONTASCENT(pGC->font);
-	heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
-        kaaSolidBoxClipped (pDrawable,
-			    fbGetCompositeClip(pGC),
-			    pGC->planemask,
-			    pGC->bgPixel,
-			    xBack,
-			    yBack,
-			    xBack + widthBack,
-			    yBack + heightBack);
-	opaque = FALSE;
-    }
-
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    
-    ppci = ppciInit;
-    while (nglyph--)
-    {
-	pci = *ppci++;
-	pglyph = FONTGLYPHBITS(pglyphBase, pci);
-	gWidth = GLYPHWIDTHPIXELS(pci);
-	gHeight = GLYPHHEIGHTPIXELS(pci);
-	if (gWidth && gHeight)
-	{
-	    gx = x + pci->metrics.leftSideBearing;
-	    gy = y - pci->metrics.ascent; 
-	    if (glyph && gWidth <= sizeof (FbStip) * 8 &&
-		fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
-	    {
-		(*glyph) (dst + (gy + dstYoff) * dstStride,
-			  dstStride,
-			  dstBpp,
-			  (FbStip *) pglyph,
-			  pPriv->fg,
-			  gx + dstXoff,
-			  gHeight);
-	    }
-	    else
-	    {
-		gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
-		fbPutXYImage (pDrawable,
-			      fbGetCompositeClip(pGC),
-			      pPriv->fg,
-			      pPriv->bg,
-			      pPriv->pm,
-			      GXcopy,
-			      opaque,
-    
-			      gx,
-			      gy,
-			      gWidth, gHeight,
-    
-			      (FbStip *) pglyph,
-			      gStride,
-			      0);
-	    }
-	}
-	x += pci->metrics.characterWidth;
-    }
-}
-
-static const GCOps	kaaOps = {
-    kaaFillSpans,
-    KdCheckSetSpans,
-    KdCheckPutImage,
-    kaaCopyArea,
-    KdCheckCopyPlane,
-    KdCheckPolyPoint,
-    KdCheckPolylines,
-    KdCheckPolySegment,
-    miPolyRectangle,
-    KdCheckPolyArc,
-    miFillPolygon,
-    kaaPolyFillRect,
-    miPolyFillArc,
-    miPolyText8,
-    miPolyText16,
-    miImageText8,
-    miImageText16,
-    kaaImageGlyphBlt,
-    KdCheckPolyGlyphBlt,
-    KdCheckPushPixels,
-};
-
-static void
-kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
-{
-    fbValidateGC (pGC, changes, pDrawable);
-
-    if (kaaDrawableIsOffscreen (pDrawable))
-	pGC->ops = (GCOps *) &kaaOps;
-    else
-	pGC->ops = (GCOps *) &kdAsyncPixmapGCOps;
-}
-
-GCFuncs	kaaGCFuncs = {
-    kaaValidateGC,
-    miChangeGC,
-    miCopyGC,
-    miDestroyGC,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip
-};
-
-static int
-kaaCreateGC (GCPtr pGC)
-{
-    if (!fbCreateGC (pGC))
-	return FALSE;
-
-    pGC->funcs = &kaaGCFuncs;
-
-    return TRUE;
-}
-
-
-static void
-kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
-    RegionRec	rgnDst;
-    int		dx, dy;
-    PixmapPtr	pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
-
-    dx = ptOldOrg.x - pWin->drawable.x;
-    dy = ptOldOrg.y - pWin->drawable.y;
-    REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
-    REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-    
-    REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-#ifdef COMPOSITE
-    if (pPixmap->screen_x || pPixmap->screen_y)
-	REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, 
-			  -pPixmap->screen_x, -pPixmap->screen_y);
-#endif
-
-    fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable,
-		  0,
-		  &rgnDst, dx, dy, kaaCopyNtoN, 0, 0);
-    
-    REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
-}
-
-static void
-kaaFillRegionSolid (DrawablePtr	pDrawable,
-		    RegionPtr	pRegion,
-		    Pixel	pixel)
-{
-    KdScreenPriv(pDrawable->pScreen);
-    KaaScreenPriv(pDrawable->pScreen);
-    PixmapPtr pPixmap;
-    int xoff, yoff;
-
-    if (pScreenPriv->enabled &&
-	(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
-	(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
-    {
-	int	nbox = REGION_NUM_RECTS (pRegion);
-	BoxPtr	pBox = REGION_RECTS (pRegion);
-	
-	while (nbox--)
-	{
-	    (*pKaaScr->info->Solid) (pBox->x1 + xoff, pBox->y1 + yoff,
-				     pBox->x2 + xoff, pBox->y2 + yoff);
-	    pBox++;
-	}
-	(*pKaaScr->info->DoneSolid) ();
-	kaaMarkSync (pDrawable->pScreen);
-    }
-    else
-    {
-	kaaWaitSync (pDrawable->pScreen);
-	fbFillRegionSolid (pDrawable, pRegion, 0,
-			   fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
-    }
-    kaaDrawableDirty (pDrawable);
-}
-
-Bool
-kaaDrawInit (ScreenPtr		pScreen,
-	     KaaScreenInfoPtr	pScreenInfo)
-{
-    KaaScreenPrivPtr pKaaScr;
-    KdScreenPriv(pScreen);
-    KdScreenInfo *screen = pScreenPriv->screen;
-#ifdef RENDER
-    PictureScreenPtr	ps = GetPictureScreenIfSet(pScreen);
-#endif
-    
-    pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
-
-    if (!pKaaScr)
-	return FALSE;
-    
-    pKaaScr->info = pScreenInfo;
-    
-    dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr);
-    
-    /*
-     * Hook up asynchronous drawing
-     */
-    KdScreenInitAsync (pScreen);
-    /*
-     * Replace various fb screen functions
-     */
-    pScreen->CreateGC = kaaCreateGC;
-    pScreen->CopyWindow = kaaCopyWindow;
-#ifdef RENDER
-    if (ps) {
-	ps->Composite = kaaComposite;
-	ps->RasterizeTrapezoid = kaaRasterizeTrapezoid;
-    }
-#endif
-
-    /*
-     * Hookup offscreen pixmaps
-     */
-    if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
-	screen->off_screen_base < screen->memory_size)
-    {
-	if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec)))
-	    return FALSE;
-	pScreen->CreatePixmap = kaaCreatePixmap;
-	pScreen->DestroyPixmap = kaaDestroyPixmap;
-    }
-
-    return TRUE;
-}
-
-void
-kaaDrawFini (ScreenPtr pScreen)
-{
-    KaaScreenPriv(pScreen);
-
-    xfree (pKaaScr);
-}
-
-void
-kaaMarkSync (ScreenPtr pScreen)
-{
-    KdScreenPriv(pScreen);
-    KaaScreenPriv(pScreen);
-
-    pScreenPriv->card->needSync = TRUE;
-    if (pKaaScr->info->markSync != NULL) {
-	pScreenPriv->card->lastMarker = (*pKaaScr->info->markSync) (pScreen);
-    }
-}
-
-void
-kaaWaitSync (ScreenPtr pScreen)
-{
-    KdScreenPriv(pScreen);
-    KaaScreenPriv(pScreen);
-    KdCardInfo *card = pScreenPriv->card;
-
-    if (card->needSync) {
-	(*pKaaScr->info->waitMarker) (pScreen, card->lastMarker);
-	card->needSync = FALSE;
-    }
-}
diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h
deleted file mode 100644
index 90b963b..0000000
--- a/hw/kdrive/src/kaa.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © The XFree86 Project Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
- 
-#ifndef _KAA_H_
-#define _KAA_H_
-
-#include "picturestr.h"
-
-#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
-    dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
-#define KaaScreenPriv(s)	KaaScreenPrivPtr    pKaaScr = KaaGetScreenPriv(s)
-
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
-    dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
-#define KaaSetPixmapPriv(p,a) \
-    dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a)
-#define KaaPixmapPriv(p)	KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
-
-typedef struct {
-    KaaScreenInfoPtr info;
-} KaaScreenPrivRec, *KaaScreenPrivPtr;
-
-typedef struct {
-    KdOffscreenArea *area;
-    int		    score;
-    int		    devKind;
-    DevUnion	    devPrivate;
-    Bool	    dirty;
-} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
-
-extern DevPrivateKey kaaScreenPrivateKey;
-extern DevPrivateKey kaaPixmapPrivateKey;
-
-
-void
-kaaPixmapUseScreen (PixmapPtr pPixmap);
-
-void
-kaaPixmapUseMemory (PixmapPtr pPixmap);
-
-void
-kaaDrawableDirty(DrawablePtr pDrawable);
-
-Bool
-kaaDrawableIsOffscreen (DrawablePtr pDrawable);
-
-Bool
-kaaPixmapIsOffscreen(PixmapPtr p);
-
-PixmapPtr
-kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
-
-void
-kaaMoveInPixmap (PixmapPtr pPixmap);
-
-void
-kaaMarkSync (ScreenPtr pScreen);
-
-void
-kaaWaitSync (ScreenPtr pScreen);
-
-void
-kaaCopyNtoN (DrawablePtr    pSrcDrawable,
-	     DrawablePtr    pDstDrawable,
-	     GCPtr	    pGC,
-	     BoxPtr	    pbox,
-	     int	    nbox,
-	     int	    dx,
-	     int	    dy,
-	     Bool	    reverse,
-	     Bool	    upsidedown,
-	     Pixel	    bitplane,
-	     void	    *closure);
-
-void
-kaaComposite(CARD8	op,
-	     PicturePtr pSrc,
-	     PicturePtr pMask,
-	     PicturePtr pDst,
-	     INT16	xSrc,
-	     INT16	ySrc,
-	     INT16	xMask,
-	     INT16	yMask,
-	     INT16	xDst,
-	     INT16	yDst,
-	     CARD16	width,
-	     CARD16	height);
-
-void
-kaaRasterizeTrapezoid(PicturePtr pPict,
-		      xTrapezoid *trap,
-		      int xoff,
-		      int yoff);
-
-void
-kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
-		   float x_offset, float y_offset);
-
-#endif /* _KAA_H_ */
diff --git a/hw/kdrive/src/kaapict.c b/hw/kdrive/src/kaapict.c
deleted file mode 100644
index 501b6b9..0000000
--- a/hw/kdrive/src/kaapict.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * Copyright © 2001 Keith Packard
- *
- * Partly based on code that is Copyright © The XFree86 Project Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-
-#ifdef RENDER
-#include "mipict.h"
-
-#define KAA_DEBUG_FALLBACKS 0
-
-#if KAA_DEBUG_FALLBACKS
-static void kaaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
-{
-    char format[20];
-    char size[20];
-    char loc;
-    int temp;
-
-    if (!pict) {
-	snprintf(string, n, "None");
-	return;
-    }
-
-    switch (pict->format)
-    {
-    case PICT_a8r8g8b8:
-	snprintf(format, 20, "ARGB8888");
-	break;
-    case PICT_r5g6b5:
-	snprintf(format, 20, "RGB565  ");
-	break;
-    case PICT_x1r5g5b5:
-	snprintf(format, 20, "RGB555  ");
-	break;
-    case PICT_a8:
-	snprintf(format, 20, "A8      ");
-	break;
-    case PICT_a1:
-	snprintf(format, 20, "A1      ");
-	break;
-    default:
-	snprintf(format, 20, "0x%x", (int)pict->format);
-	break;
-    }
-
-    loc = kaaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
-
-    snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
-	     pict->pDrawable->height, pict->repeat ?
-	     " R" : "");
-    
-    snprintf(string, n, "0x%lx:%c fmt %s (%s)", (long)pict, loc, format, size);
-}
-
-static void
-kaaPrintCompositeFallback(CARD8 op,
-			  PicturePtr pSrc,
-			  PicturePtr pMask,
-			  PicturePtr pDst)
-{
-    char sop[20];
-    char srcdesc[40], maskdesc[40], dstdesc[40];
-
-    switch(op)
-    {
-    case PictOpSrc:
-	sprintf(sop, "Src");
-	break;
-    case PictOpOver:
-	sprintf(sop, "Over");
-	break;
-    default:
-	sprintf(sop, "0x%x", (int)op);
-	break;
-    }
-    
-    kaaCompositeFallbackPictDesc(pSrc, srcdesc, 40);
-    kaaCompositeFallbackPictDesc(pMask, maskdesc, 40);
-    kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
-
-    ErrorF("Composite fallback: op %s, \n"
-	   "                    src  %s, \n"
-	   "                    mask %s, \n"
-	   "                    dst  %s, \n", 
-	   sop, srcdesc, maskdesc, dstdesc);
-}
-
-static void
-kaaPrintTrapezoidFallback(PicturePtr pDst)
-{
-    char dstdesc[40];
-
-    kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
-
-    ErrorF("Trapezoid fallback: dst  %s, %c/%s\n", 
-	   dstdesc,
-	   (pDst->polyMode == PolyModePrecise) ? 'p' : 'i',
-	   (pDst->polyEdge == PolyEdgeSharp) ? "a" : "aa");
-}
-#endif
-
-static Bool
-kaaGetPixelFromRGBA(CARD32	*pixel,
-		    CARD16	red,
-		    CARD16	green,
-		    CARD16	blue,
-		    CARD16	alpha,
-		    CARD32	format)
-{
-    int rbits, bbits, gbits, abits;
-    int rshift, bshift, gshift, ashift;
-
-    *pixel = 0;
-
-    if (!PICT_FORMAT_COLOR(format))
-	return FALSE;
-
-    rbits = PICT_FORMAT_R(format);
-    gbits = PICT_FORMAT_G(format);
-    bbits = PICT_FORMAT_B(format);
-    abits = PICT_FORMAT_A(format);
-
-    if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
-	bshift = 0;
-	gshift = bbits;
-	rshift = gshift + gbits;
-	ashift = rshift + rbits;
-    } else {  /* PICT_TYPE_ABGR */
-	rshift = 0;
-	gshift = rbits;
-	bshift = gshift + gbits;
-	ashift = bshift + bbits;
-    }
-
-    *pixel |=  ( blue >> (16 - bbits)) << bshift;
-    *pixel |=  (  red >> (16 - rbits)) << rshift;
-    *pixel |=  (green >> (16 - gbits)) << gshift;
-    *pixel |=  (alpha >> (16 - abits)) << ashift;
-
-    return TRUE;
-}
-
-
-static Bool
-kaaGetRGBAFromPixel(CARD32	pixel,
-		    CARD16	*red,
-		    CARD16	*green,
-		    CARD16	*blue,
-		    CARD16	*alpha,
-		    CARD32	format)
-{
-    int rbits, bbits, gbits, abits;
-    int rshift, bshift, gshift, ashift;
-    
-    if (!PICT_FORMAT_COLOR(format))
-	return FALSE;
-
-    rbits = PICT_FORMAT_R(format);
-    gbits = PICT_FORMAT_G(format);
-    bbits = PICT_FORMAT_B(format);
-    abits = PICT_FORMAT_A(format);
-
-    if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
-	bshift = 0;
-	gshift = bbits;
-	rshift = gshift + gbits;
-	ashift = rshift + rbits;
-    } else {  /* PICT_TYPE_ABGR */
-	rshift = 0;
-	gshift = rbits;
-	bshift = gshift + gbits;
-	ashift = bshift + bbits;
-    }
- 
-    *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
-    while (rbits < 16) {
-	*red |= *red >> rbits;
-	rbits <<= 1;
-    }
-
-    *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
-    while (gbits < 16) {
-	*green |= *green >> gbits;
-	gbits <<= 1;
-    }
- 
-    *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
-    while (bbits < 16) {
-	*blue |= *blue >> bbits;
-	bbits <<= 1;
-    }  
-
-    if (abits) {
-	*alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
-	while (abits < 16) {
-	    *alpha |= *alpha >> abits;
-	    abits <<= 1;
-	}     
-    } else
-	*alpha = 0xffff;
-
-    return TRUE;
-}
-
-static int
-kaaTryDriverSolidFill(PicturePtr	pSrc,
-		      PicturePtr	pDst,
-		      INT16		xSrc,
-		      INT16		ySrc,
-		      INT16		xDst,
-		      INT16		yDst,
-		      CARD16		width,
-		      CARD16		height)
-{
-    KaaScreenPriv (pDst->pDrawable->pScreen);
-    RegionRec region;
-    BoxPtr pbox;
-    int nbox;
-    int dst_off_x, dst_off_y;
-    PixmapPtr pSrcPix, pDstPix;
-    CARD32 pixel;
-    CARD16 red, green, blue, alpha;
-
-    xDst += pDst->pDrawable->x;
-    yDst += pDst->pDrawable->y;
-    xSrc += pSrc->pDrawable->x;
-    ySrc += pSrc->pDrawable->y;
-
-    if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
-				   xSrc, ySrc, 0, 0, xDst, yDst,
-				   width, height))
-	return 1;
-
-    if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
-    if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-
-    pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-    if (!pDstPix) {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return 0;
-    }
-
-    if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
-	pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
-	    (WindowPtr) (pSrc->pDrawable));
-    else
-	pSrcPix = (PixmapPtr) (pSrc->pDrawable);
-
-    /* If source is offscreen, we need to sync the accelerator
-     * before accessing it.  We'd prefer for it to be in memory.
-     */
-    if (kaaPixmapIsOffscreen(pSrcPix)) {
-	kaaWaitSync(pDst->pDrawable->pScreen);
-    }
-
-    pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
-    if (!kaaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
-			 pSrc->format))
-    {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return -1;
-    }
-    kaaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
-			pDst->format);
-
-    if (!(*pKaaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
-    {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return -1;
-    }
-
-    nbox = REGION_NUM_RECTS(&region);
-    pbox = REGION_RECTS(&region);
-    while (nbox--)
-    {
-	(*pKaaScr->info->Solid) (pbox->x1 + dst_off_x,
-				 pbox->y1 + dst_off_y,
-				 pbox->x2 + dst_off_x,
-				 pbox->y2 + dst_off_y);
-	pbox++;
-    }
-
-    (*pKaaScr->info->DoneSolid) ();
-    kaaMarkSync (pDst->pDrawable->pScreen);
-    kaaDrawableDirty (pDst->pDrawable);
-
-    REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-    return 1;
-}
-
-static int
-kaaTryDriverBlend(CARD8		op,
-		  PicturePtr	pSrc,
-		  PicturePtr	pDst,
-		  INT16		xSrc,
-		  INT16		ySrc,
-		  INT16		xDst,
-		  INT16		yDst,
-		  CARD16	width,
-		  CARD16	height)
-{
-    KaaScreenPriv (pDst->pDrawable->pScreen);
-    RegionRec region;
-    BoxPtr pbox;
-    int nbox;
-    int src_off_x, src_off_y, dst_off_x, dst_off_y;
-    PixmapPtr pSrcPix, pDstPix;
-    struct _Pixmap srcScratch;
-
-    xDst += pDst->pDrawable->x;
-    yDst += pDst->pDrawable->y;
-
-    xSrc += pSrc->pDrawable->x;
-    ySrc += pSrc->pDrawable->y;
-
-    if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
-				   xSrc, ySrc, 0, 0, xDst, yDst,
-				   width, height))
-	return 1;
-
-
-    if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
-    if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-    
-    pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
-    pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-
-    if (!pDstPix) {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return 0;
-    }
-
-    if (!pSrcPix && pKaaScr->info->UploadToScratch) {
-	if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable,
-					       &srcScratch))
-	    pSrcPix = &srcScratch;
-    }
-
-    if (!pSrcPix) {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return 0;
-    }
-
-    if (!(*pKaaScr->info->PrepareBlend) (op, pSrc, pDst, pSrcPix,
-					 pDstPix))
-    {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return -1;
-    }
-    
-    nbox = REGION_NUM_RECTS(&region);
-    pbox = REGION_RECTS(&region);
-
-    xSrc -= xDst;
-    ySrc -= yDst;
-
-    while (nbox--)
-    {
-	(*pKaaScr->info->Blend) (pbox->x1 + xSrc + src_off_x,
-				 pbox->y1 + ySrc + src_off_y,
-				 pbox->x1 + dst_off_x,
-				 pbox->y1 + dst_off_y,
-				 pbox->x2 - pbox->x1,
-				 pbox->y2 - pbox->y1);
-	pbox++;
-    }
-    
-    (*pKaaScr->info->DoneBlend) ();
-    kaaMarkSync (pDst->pDrawable->pScreen);
-    kaaDrawableDirty (pDst->pDrawable);
-
-    REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-    return 1;
-}
-
-static int
-kaaTryDriverComposite(CARD8		op,
-		      PicturePtr	pSrc,
-		      PicturePtr	pMask,
-		      PicturePtr	pDst,
-		      INT16		xSrc,
-		      INT16		ySrc,
-		      INT16		xMask,
-		      INT16		yMask,
-		      INT16		xDst,
-		      INT16		yDst,
-		      CARD16		width,
-		      CARD16		height)
-{
-    KaaScreenPriv (pDst->pDrawable->pScreen);
-    RegionRec region;
-    BoxPtr pbox;
-    int nbox;
-    int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
-    PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
-    struct _Pixmap scratch;
-
-    xDst += pDst->pDrawable->x;
-    yDst += pDst->pDrawable->y;
-
-    if (pMask) {
-	xMask += pMask->pDrawable->x;
-	yMask += pMask->pDrawable->y;
-    }
-
-    xSrc += pSrc->pDrawable->x;
-    ySrc += pSrc->pDrawable->y;
-
-    if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-				   xSrc, ySrc, xMask, yMask, xDst, yDst,
-				   width, height))
-	return 1;
-
-    if (pKaaScr->info->CheckComposite &&
-	!(*pKaaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
-    {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return -1;
-    }
-
-    if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
-    if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pMask->pDrawable);
-    if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
-	kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
-
-    pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
-    if (pMask)
-	pMaskPix = kaaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x,
-					  &mask_off_y);
-    pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
-
-    if (!pDstPix) {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return 0;
-    }
-
-    if (!pSrcPix && (!pMask || pMaskPix) && pKaaScr->info->UploadToScratch) {
-	if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
-	    pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
-		(WindowPtr) pSrc->pDrawable);
-	else
-	    pSrcPix = (PixmapPtr) pSrc->pDrawable;
-	if ((*pKaaScr->info->UploadToScratch) (pSrcPix, &scratch))
-	    pSrcPix = &scratch;
-    } else if (pSrcPix && pMask && !pMaskPix && pKaaScr->info->UploadToScratch) {
-	if (pMask->pDrawable->type == DRAWABLE_WINDOW)
-	    pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
-		(WindowPtr) pMask->pDrawable);
-	else
-	    pMaskPix = (PixmapPtr) pMask->pDrawable;
-	if ((*pKaaScr->info->UploadToScratch) (pMaskPix, &scratch))
-	    pMaskPix = &scratch;
-    }
-
-    if (!pSrcPix || (pMask && !pMaskPix)) {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return 0;
-    }
-
-    if (!(*pKaaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
-					     pMaskPix, pDstPix))
-    {
-	REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-	return -1;
-    }
-
-    nbox = REGION_NUM_RECTS(&region);
-    pbox = REGION_RECTS(&region);
-
-    xMask -= xDst;
-    yMask -= yDst;
-
-    xSrc -= xDst;
-    ySrc -= yDst;
-
-    while (nbox--)
-    {
-	(*pKaaScr->info->Composite) (pbox->x1 + xSrc + src_off_x,
-				     pbox->y1 + ySrc + src_off_y,
-				     pbox->x1 + xMask + mask_off_x,
-				     pbox->y1 + yMask + mask_off_y,
-				     pbox->x1 + dst_off_x,
-				     pbox->y1 + dst_off_y,
-				     pbox->x2 - pbox->x1,
-				     pbox->y2 - pbox->y1);
-	pbox++;
-    }
-
-    (*pKaaScr->info->DoneComposite) ();
-    kaaMarkSync (pDst->pDrawable->pScreen);
-    kaaDrawableDirty (pDst->pDrawable);
-
-    REGION_UNINIT(pDst->pDrawable->pScreen, &region);
-    return 1;
-}
-
-
-void
-kaaComposite(CARD8	op,
-	     PicturePtr pSrc,
-	     PicturePtr pMask,
-	     PicturePtr pDst,
-	     INT16	xSrc,
-	     INT16	ySrc,
-	     INT16	xMask,
-	     INT16	yMask,
-	     INT16	xDst,
-	     INT16	yDst,
-	     CARD16	width,
-	     CARD16	height)
-{
-    KdScreenPriv (pDst->pDrawable->pScreen);
-    KaaScreenPriv (pDst->pDrawable->pScreen);
-    int ret = -1;
-
-    if (!pMask && pSrc->pDrawable)
-    {
-	if (op == PictOpSrc)
-	{
-	    if (pScreenPriv->enabled && pSrc->pDrawable && pSrc->pDrawable->width == 1 &&
-		pSrc->pDrawable->height == 1 && pSrc->repeat)
-	    {
-		ret = kaaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
-					    width, height);
-		if (ret == 1)
-		    return;
-	    }
-	    else if (!pSrc->repeat && !pSrc->transform &&
-		     pSrc->format == pDst->format)
-	    {
-		RegionRec	region;
-
-		xDst += pDst->pDrawable->x;
-		yDst += pDst->pDrawable->y;
-		xSrc += pSrc->pDrawable->x;
-		ySrc += pSrc->pDrawable->y;
-
-		if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-					       xSrc, ySrc, xMask, yMask, xDst,
-					       yDst, width, height))
-		    return;
-
-
-		kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
-			     REGION_RECTS(&region), REGION_NUM_RECTS(&region),
-			     xSrc - xDst, ySrc - yDst,
-			     FALSE, FALSE, 0, 0);
-		return;
-	    }
-	}
-
-	if (pScreenPriv->enabled && pKaaScr->info->PrepareBlend &&
-	    !pSrc->alphaMap && !pDst->alphaMap)
-	{
-	    ret = kaaTryDriverBlend(op, pSrc, pDst, xSrc, ySrc, xDst, yDst,
-				    width, height);
-	    if (ret == 1)
-		return;
-	}
-    }
-
-    if (pSrc->pDrawable && (!pMask || pMask->pDrawable) &&
-        pScreenPriv->enabled && pKaaScr->info->PrepareComposite &&
-	!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
-    {
-	ret = kaaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
-				    yMask, xDst, yDst, width, height);
-	if (ret == 1)
-	    return;
-    }
-
-    if (ret != 0) {
-	/* failure to accelerate was not due to pixmaps being in the wrong
-	 * locations.
-	 */
-	if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
-	    kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
-	if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
-	    kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
-	if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
-	    kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
-    }
-
-#if KAA_DEBUG_FALLBACKS
-    kaaPrintCompositeFallback (op, pSrc, pMask, pDst);
-#endif
-
-    KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, 
-		      xMask, yMask, xDst, yDst, width, height);
-}
-#endif
-
-static xFixed
-miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
-{
-    xFixed	    dx = l->p2.x - l->p1.x;
-    xFixed_32_32    ex = (xFixed_32_32) (y - l->p1.y) * dx;
-    xFixed	    dy = l->p2.y - l->p1.y;
-    if (ceil)
-	ex += (dy - 1);
-    return l->p1.x + (xFixed) (ex / dy);
-}
-
-/* Need to decide just how much to trim, to maintain translation independence
- * when converted to floating point.
- */
-#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0)
-
-/* This is just to allow us to work on the hardware side of the problem while
- * waiting for cairo to get a new tesselator.  We may not be able to support
- * RasterizeTrapezoid at all due to the abutting edges requirement, but it might
- * be technically legal if we widened the trap by some epsilon, so that alpha
- * values at abutting edges were a little too big and capped at one, rather than
- * a little too small and looked bad.
- */
-void kaaRasterizeTrapezoid(PicturePtr pDst,
-			   xTrapezoid *trap,
-			   int xoff,
-			   int yoff)
-{
-    KdScreenPriv (pDst->pDrawable->pScreen);
-    KaaScreenPriv (pDst->pDrawable->pScreen);
-    KaaTrapezoid ktrap;
-    PixmapPtr pPix;
-    xFixed x1, x2;
-
-    if (!pScreenPriv->enabled ||
-	!pKaaScr->info->PrepareTrapezoids ||
-	pDst->pDrawable->type != DRAWABLE_PIXMAP ||
-        pDst->alphaMap || pDst->format != PICT_a8)
-    {
-	KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
-#if KAA_DEBUG_FALLBACKS
-	kaaPrintTrapezoidFallback (pDst);
-#endif
-	return;
-    }
-    pPix = (PixmapPtr)pDst->pDrawable;
-
-    kaaPixmapUseScreen (pPix);
-
-    if (!kaaPixmapIsOffscreen (pPix) ||
-	!(*pKaaScr->info->PrepareTrapezoids) (pDst, pPix))
-    {
-#if KAA_DEBUG_FALLBACKS
-	kaaPrintTrapezoidFallback (pDst);
-#endif
-	KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
-	return;
-    }
-
-    ktrap.ty = XFIXED_TO_FLOAT(trap->top) + yoff;
-    x1 = miLineFixedX (&trap->left, trap->top, FALSE);
-    x2 = miLineFixedX (&trap->right, trap->top, TRUE);
-    ktrap.tl = XFIXED_TO_FLOAT(x1) + xoff;
-    ktrap.tr = XFIXED_TO_FLOAT(x2) + xoff;
-    ktrap.by = XFIXED_TO_FLOAT(trap->bottom) + yoff;
-    x1 = miLineFixedX (&trap->left, trap->bottom, FALSE);
-    x2 = miLineFixedX (&trap->right, trap->bottom, TRUE);
-    ktrap.bl = XFIXED_TO_FLOAT(x1) + xoff;
-    ktrap.br = XFIXED_TO_FLOAT(x2) + xoff;
-
-    (*pKaaScr->info->Trapezoids) (&ktrap, 1);
-    (*pKaaScr->info->DoneTrapezoids) ();
-}
-
-void
-kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
-		   float x_offset, float y_offset)
-{
-    int i = 0;
-    float x, y, x_count, y_count;
-
-    x_count = (1 << (grid_order / 2)) + 1;
-    y_count = (1 << (grid_order / 2)) - 1;
-
-    x_offset += 1.0 / x_count / 2.0;
-    y_offset += 1.0 / y_count / 2.0;
-
-    for (x = 0; x < x_count; x++) {
-	for (y = 0; y < y_count; y++) {
-	    x_offsets[i] = x / x_count + x_offset;
-	    y_offsets[i] = y / y_count + y_offset;
-	    i++;
-	}
-    }
-}
-
diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c
deleted file mode 100644
index 5388f21..0000000
--- a/hw/kdrive/src/kasync.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright © 1999 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "kaa.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "fbpict.h"
-
-/*
- * These functions wrap the low-level fb rendering functions and
- * synchronize framebuffer/accelerated drawing by stalling until
- * the accelerator is idle
- */
-
-void
-KdCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans,
-		   DDXPointPtr ppt, int *pwidth, int fSorted)
-{
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
-}
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
-		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
-{
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
-}
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
-		 int x, int y, int w, int h, int leftPad, int format,
-		 char *bits)
-{
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
-}
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
-		 int srcx, int srcy, int w, int h, int dstx, int dsty)
-{
-    kaaWaitSync (pSrc->pScreen);
-    kaaDrawableDirty (pDst);
-    return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
-}
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
-		  int srcx, int srcy, int w, int h, int dstx, int dsty,
-		  unsigned long bitPlane)
-{
-    kaaWaitSync (pSrc->pScreen);
-    kaaDrawableDirty (pDst);
-    return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
-			bitPlane);
-}
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
-		  DDXPointPtr pptInit)
-{
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
-}
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
-		  int mode, int npt, DDXPointPtr ppt)
-{
-
-    if (pGC->lineWidth == 0) {
-	kaaWaitSync(pDrawable->pScreen);
-	kaaDrawableDirty (pDrawable);
-    }
-    kaaDrawableDirty (pDrawable);
-    fbPolyLine (pDrawable, pGC, mode, npt, ppt);
-}
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC, 
-		    int nsegInit, xSegment *pSegInit)
-{
-    if (pGC->lineWidth == 0) {
-	kaaWaitSync(pDrawable->pScreen);
-	kaaDrawableDirty (pDrawable);
-    }
-    kaaDrawableDirty (pDrawable);
-    fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, 
-		      int nrects, xRectangle *prect)
-{
-    if (pGC->lineWidth == 0) {
-	kaaWaitSync(pDrawable->pScreen);
-	kaaDrawableDirty (pDrawable);
-    }
-    fbPolyRectangle (pDrawable, pGC, nrects, prect);
-}
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, 
-		int narcs, xArc *pArcs)
-{
-    if (pGC->lineWidth == 0)
-    {
-	kaaWaitSync(pDrawable->pScreen);
-	kaaDrawableDirty (pDrawable);
-	fbPolyArc (pDrawable, pGC, narcs, pArcs);
-    }
-    else
-	miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-#if 0
-void
-KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC, 
-		    int shape, int mode, int count, DDXPointPtr pPts)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbFillPolygon (pDrawable, pGC, mode, count, pPts);
-}
-#endif
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
-		     int nrect, xRectangle *prect)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPolyFillRect (pDrawable, pGC, nrect, prect);
-}
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC, 
-		    int narcs, xArc *pArcs)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
-		      int x, int y, unsigned int nglyph,
-		      CharInfoPtr *ppci, pointer pglyphBase)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
-		     int x, int y, unsigned int nglyph,
-		     CharInfoPtr *ppci, pointer pglyphBase)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-}
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
-		   DrawablePtr pDrawable,
-		   int w, int h, int x, int y)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
-}
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
-		 int x, int y, int w, int h,
-		 unsigned int format, unsigned long planeMask,
-		 char *d)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
-}
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
-		 int wMax,
-		 DDXPointPtr ppt,
-		 int *pwidth,
-		 int nspans,
-		 char *pdstStart)
-{
-    kaaWaitSync(pDrawable->pScreen);
-    fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
-}
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
-    kaaWaitSync (pWin->drawable.pScreen);
-    kaaDrawableDirty ((DrawablePtr)pWin);
-    fbCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-
-#if KD_MAX_FB > 1
-void
-KdCheckPaintKey(DrawablePtr  pDrawable,
-		RegionPtr    pRegion,
-		CARD32       pixel,
-		int          layer)
-{
-    kaaWaitSync (pDrawable->pScreen);
-    kaaDrawableDirty (pDrawable);
-    fbOverlayPaintKey (pDrawable,  pRegion, pixel, layer);
-}
-
-void
-KdCheckOverlayCopyWindow  (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
-    kaaWaitSync (pWin->drawable.pScreen);
-    kaaDrawableDirty ((DrawablePtr)pWin);
-    fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
-}
-#endif
-
-void
-KdScreenInitAsync (ScreenPtr pScreen)
-{
-    pScreen->GetImage = KdCheckGetImage;
-    pScreen->GetSpans = KdCheckGetSpans;
-    pScreen->CopyWindow = KdCheckCopyWindow;
-#ifdef RENDER
-    KdPictureInitAsync (pScreen);
-#endif
-}
-
-void
-KdCheckComposite (CARD8      op,
-		  PicturePtr pSrc,
-		  PicturePtr pMask,
-		  PicturePtr pDst,
-		  INT16      xSrc,
-		  INT16      ySrc,
-		  INT16      xMask,
-		  INT16      yMask,
-		  INT16      xDst,
-		  INT16      yDst,
-		  CARD16     width,
-		  CARD16     height)
-{
-    kaaWaitSync (pDst->pDrawable->pScreen);
-    kaaDrawableDirty (pDst->pDrawable);
-    fbComposite (op,
-		 pSrc,
-		 pMask,
-		 pDst,
-		 xSrc,
-		 ySrc,
-		 xMask,
-		 yMask,
-		 xDst,
-		 yDst,
-		 width,
-		 height);
-}
-
-void
-KdCheckRasterizeTrapezoid(PicturePtr	pMask,
-			  xTrapezoid	*trap,
-			  int		x_off,
-			  int		y_off)
-{
-    kaaWaitSync (pMask->pDrawable->pScreen);
-    kaaDrawableDirty (pMask->pDrawable);
-    fbRasterizeTrapezoid (pMask, trap, x_off, y_off);
-}
-
-/*
- * Only need to stall for copyarea/copyplane
- */
-const GCOps kdAsyncPixmapGCOps = {
-    fbFillSpans,
-    fbSetSpans,
-    fbPutImage,
-    KdCheckCopyArea,
-    KdCheckCopyPlane,
-    fbPolyPoint,
-    fbPolyLine,
-    fbPolySegment,
-    fbPolyRectangle,
-    fbPolyArc,
-    fbFillPolygon,
-    fbPolyFillRect,
-    fbPolyFillArc,
-    miPolyText8,
-    miPolyText16,
-    miImageText8,
-    miImageText16,
-    fbImageGlyphBlt,
-    fbPolyGlyphBlt,
-    fbPushPixels
-};
-
-void
-KdPictureInitAsync (ScreenPtr pScreen)
-{
-    PictureScreenPtr    ps;
-
-    ps = GetPictureScreen(pScreen);
-    ps->Composite = KdCheckComposite;
-    ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid;
-}
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 4e04b59..3e5af3a 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -515,119 +515,6 @@ extern KdOsFuncs	*kdOsFuncs;
     dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
 #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
 
-/* kaa.c */
-Bool
-kaaDrawInit (ScreenPtr	        pScreen,
-	     KaaScreenInfoPtr   pScreenInfo);
-
-void
-kaaDrawFini (ScreenPtr	        pScreen);
-
-void
-kaaWrapGC (GCPtr pGC);
-
-void
-kaaUnwrapGC (GCPtr pGC);
-
-/* kasync.c */
-void
-KdCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans,
-		   DDXPointPtr ppt, int *pwidth, int fSorted);
-
-void
-KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
-		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
-
-void
-KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
-		 int x, int y, int w, int h, int leftPad, int format,
-		 char *bits);
-
-RegionPtr
-KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
-		 int srcx, int srcy, int w, int h, int dstx, int dsty);
-
-RegionPtr
-KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
-		  int srcx, int srcy, int w, int h, int dstx, int dsty,
-		  unsigned long bitPlane);
-
-void
-KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
-		  DDXPointPtr pptInit);
-
-void
-KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
-		  int mode, int npt, DDXPointPtr ppt);
-
-void
-KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
-		    int nsegInit, xSegment *pSegInit);
-
-void
-KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, 
-		      int nrects, xRectangle *prect);
-
-void
-KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, 
-		int narcs, xArc *pArcs);
-
-#define KdCheckFillPolygon	miFillPolygon
-
-void
-KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
-		     int nrect, xRectangle *prect);
-
-void
-KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC, 
-		    int narcs, xArc *pArcs);
-
-void
-KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
-		      int x, int y, unsigned int nglyph,
-		      CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
-		     int x, int y, unsigned int nglyph,
-		     CharInfoPtr *ppci, pointer pglyphBase);
-
-void
-KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
-		   DrawablePtr pDrawable,
-		   int w, int h, int x, int y);
-
-void
-KdCheckGetImage (DrawablePtr pDrawable,
-		 int x, int y, int w, int h,
-		 unsigned int format, unsigned long planeMask,
-		 char *d);
-
-void
-KdCheckGetSpans (DrawablePtr pDrawable,
-		 int wMax,
-		 DDXPointPtr ppt,
-		 int *pwidth,
-		 int nspans,
-		 char *pdstStart);
-
-void
-KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdCheckPaintKey(DrawablePtr  pDrawable,
-		RegionPtr    pRegion,
-		CARD32       pixel,
-		int          layer);
-
-void
-KdCheckOverlayCopyWindow  (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-void
-KdScreenInitAsync (ScreenPtr pScreen);
-    
-extern const GCOps	kdAsyncPixmapGCOps;
-
 /* knoop.c */
 extern GCOps		kdNoopOps;
 
@@ -921,32 +808,6 @@ KdRandRGetTiming (ScreenPtr	    pScreen,
 		  RRScreenSizePtr   pSize);
 #endif
 
-/* kpict.c */
-void
-KdPictureInitAsync (ScreenPtr pScreen);
-
-#ifdef RENDER
-void
-KdCheckComposite (CARD8      op,
-		  PicturePtr pSrc,
-		  PicturePtr pMask,
-		  PicturePtr pDst,
-		  INT16      xSrc,
-		  INT16      ySrc,
-		  INT16      xMask,
-		  INT16      yMask,
-		  INT16      xDst,
-		  INT16      yDst,
-		  CARD16     width,
-		  CARD16     height);
-
-void
-KdCheckRasterizeTrapezoid(PicturePtr	pMask,
-			  xTrapezoid	*trap,
-			  int		x_off,
-			  int		y_off);
-#endif
-
 /* kshadow.c */
 Bool
 KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
index efe0364..f6ef52f 100644
--- a/hw/kdrive/src/koffscreen.c
+++ b/hw/kdrive/src/koffscreen.c
@@ -24,7 +24,6 @@
 #include <kdrive-config.h>
 #endif
 #include "kdrive.h"
-#include "kaa.h"
 
 #define DEBUG_OFFSCREEN 0
 #if DEBUG_OFFSCREEN
commit c8216aede6c4ac41976947521d884fa010913204
Author: Jeremy Uejio <jeremy.uejio at sun.com>
Date:   Tue Jul 1 13:37:12 2008 -0700

    Sun bug #6685465: Xephyr uses wrong or bad colortable in 8-bit mode
    
    <http://bugs.opensolaris.org/view_bug.do?bug_id=6685465>
    
    This bug is caused by Xephyr not handling the RGB byte order correctly
    of the server where Xephyr is displaying on. The previous code just
    assumed that the order was RGB and did not take into account that
    Xservers may use different order (such as BGR).
    
    The fix is to add a function to calculate the byte order and bits
    to shift based on the visual mask and the visual bits_per_rgb (which
    is usually 8, but could be server dependent).  Since the shifts won't
    change once the display connection has been made, I can cache these
    values so that Xephyr doesn't have to keep recalculating them everytime
    it tries to translate the Xephyr colormap entries for Xephyr clients to
    the actual server colormap entries (i.e. calling the function
    hostx_set_cmap_entry() repeatedly for every colormap entry).

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 74f9f16..171d78c 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -565,14 +565,40 @@ hostx_get_visual_masks (EphyrScreenInfo screen,
     }
 }
 
+static int 
+hostx_calculate_color_shift(unsigned long mask,
+			    int bits_per_rgb)
+{
+    int shift = 0;
+    while(mask) {
+	mask = mask >> bits_per_rgb;
+	if (mask) shift += bits_per_rgb;
+    }
+    return shift;
+}
+
 void
 hostx_set_cmap_entry(unsigned char idx,
 		     unsigned char r,
 		     unsigned char g,
 		     unsigned char b)
 {
-  /* XXX Will likely break for 8 on 16, not sure if this is correct */
-  HostX.cmap[idx] = (r << 16) | (g << 8) | (b);
+/* need to calculate the shifts for RGB because server could be BGR. */
+/* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/
+    static int rshift, bshift, gshift = 0;
+    static int first_time = 1;
+    if (first_time) {
+	first_time = 0;
+	rshift = hostx_calculate_color_shift(HostX.visual->red_mask,
+					     HostX.visual->bits_per_rgb);
+	gshift = hostx_calculate_color_shift(HostX.visual->green_mask,
+					     HostX.visual->bits_per_rgb);
+	bshift = hostx_calculate_color_shift(HostX.visual->blue_mask,
+					     HostX.visual->bits_per_rgb);
+    }
+    HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
+		      ((g << gshift) & HostX.visual->green_mask) |
+		      ((b << bshift) & HostX.visual->blue_mask);
 }
 
 /**
commit 2e8daee05343b2853b677acf4554def0ceeada00
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Mon Jun 30 17:29:35 2008 -0700

    Work around the DIX losing mmWidth/mmHeight for RandR 1.1 DDXen.
    
    RandR 1.1 has a physical size for each mode.  It used to be that the DIX would
    remember these modes and pass them back up to the DDX when changing the screen
    configuration.  The DDX uses RR_GET_MODE_MM to query the driver for the physical
    dimensions of the screen, allowing it to preserve the DPI.
    
    With RandR 1.2, the physical dimensions are stored as part of the output, rather
    than per mode.  The DIX only uses the sizes passed in from the DDX to select the
    mode pool for the "default" output, and forgets the physical sizes.  Then, when
    reconfiguring the screen, it makes up a new RRScreenSizeRec using the dimensions
    from the output, screwing up the DPI.
    
    This change works around this problem by ignoring the DIX and querying the real
    size from the driver.

diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index f615751..4702392 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -171,6 +171,25 @@ xf86RandRSetMode (ScreenPtr	    pScreen,
 	scrp->virtualX = mode->HDisplay;
 	scrp->virtualY = mode->VDisplay;
     }
+
+    /*
+     * The DIX forgets the physical dimensions we passed into RRRegisterSize, so
+     * reconstruct them if possible.
+     */
+    if(scrp->DriverFunc) {
+	xorgRRModeMM RRModeMM;
+
+	RRModeMM.mode = mode;
+	RRModeMM.virtX = scrp->virtualX;
+	RRModeMM.virtY = scrp->virtualY;
+	RRModeMM.mmWidth = mmWidth;
+	RRModeMM.mmHeight = mmHeight;
+
+	(*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM);
+
+	mmWidth = RRModeMM.mmWidth;
+	mmHeight = RRModeMM.mmHeight;
+    }
     if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
     {
 	/* If the screen is rotated 90 or 270 degrees, swap the sizes. */
commit e2bbf2d248a2d2a2db4adfe9d1bda94cf184d8bd
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 1 12:01:56 2008 -0400

    Don't try to load DRI2 if built without it.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index ee018eb..6fd0273 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -121,7 +121,9 @@ static ModuleDefault ModuleDefaults[] = {
     {.name = "record",   .toLoad = TRUE,    .load_opt=NULL},
 #endif
     {.name = "dri",      .toLoad = TRUE,    .load_opt=NULL},
+#ifdef DRI2
     {.name = "dri2",     .toLoad = TRUE,    .load_opt=NULL},
+#endif
     {.name = NULL,       .toLoad = FALSE,   .load_opt=NULL}
 };
 
commit 66d7c9de82b5e733e4995f079a96efe612fca881
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 1 10:55:54 2008 -0400

    Declare xf86InterpretEEDID() properly.

diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 8e1eaac..42d9ce6 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -45,6 +45,10 @@ extern xf86MonPtr xf86InterpretEDID(
     int screenIndex, Uchar *block
 );
 
+extern xf86MonPtr xf86InterpretEEDID(
+    int screenIndex, Uchar *block
+);
+
 extern void 
 xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
 
commit e4335e876d254e446a965259e845ad955da5b5c2
Author: root <root at samich.home.cworth.org>
Date:   Mon Jun 30 15:29:04 2008 -0700

    Revert "XInput ABI is 2.1, not 3.1."
    
    This reverts commit 76576c87b0de106e006d1cfa59d42d3a483e966c.
    which was an incorrect revert of previous ABI bumps. Those
    responsible for the accidental ABI bumps in both directions
    have all been sacked.
    
    This allows xf86-input-mouse to build again, for example.

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 5ce6e8a..fdcd567 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -84,7 +84,7 @@ typedef enum {
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
 #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(4, 1)
-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(2, 1)
+#define ABI_XINPUT_VERSION	SET_ABI_VERSION(3, 1)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(1, 1)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
 
commit 6447f80c17077f924b2d58e07b38d32429edcb9b
Author: Carl Worth <cworth at samich.home.cworth.org>
Date:   Mon Jun 30 13:16:49 2008 -0700

    Use AC_CHECK_LIB before PKG_CHECK_MODULES for openssl
    
    Previously, the code was using PKG_CHECK_EXISTS before PKG_CHECK_MODULES,
    (to cater to OpenBSD systems that include openssl by default but without
    a .pc file). But this meant that systems that didn't have openssl installed
    at all would not get any error message at configure time.
    
    Now, if the SHA1_Init function is found in -lcrypto without any additional
    flags, then that's used. Otherwise, pkg-config is used to find the right
    flags to link against libcrypto. And if that fails, a nice error message
    is now generated.

diff --git a/configure.ac b/configure.ac
index 8abc9a9..d7a3d68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1110,7 +1110,7 @@ if test "x$SHA1_LIB" = "x" ; then
 	   [Define to use libmd SHA1 functions instead of OpenSSL libcrypto])])
 fi
 if test "x$SHA1_LIB" = "x" ; then
- PKG_CHECK_EXISTS([openssl],
+ AC_CHECK_LIB([crypto], [SHA1_Init], [],
   [PKG_CHECK_MODULES([OPENSSL], [openssl],
    [OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])])
  SHA1_LIB="$OPENSSL_LIB_FLAGS -lcrypto"
commit 76576c87b0de106e006d1cfa59d42d3a483e966c
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 30 16:10:37 2008 -0400

    XInput ABI is 2.1, not 3.1.

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index fdcd567..5ce6e8a 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -84,7 +84,7 @@ typedef enum {
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
 #define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(4, 1)
-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(3, 1)
+#define ABI_XINPUT_VERSION	SET_ABI_VERSION(2, 1)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(1, 1)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
 
commit bed12dd3df0129b7f28d0a42d470266bd3ae6b38
Author: Adam Jackson <ajax at redhat.com>
Date:   Sat Jun 21 16:07:54 2008 -0400

    Do EEDID in RANDR 1.2.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index fd72053..5a71bcf 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2625,15 +2625,16 @@ xf86OutputGetEDIDModes (xf86OutputPtr output)
     return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
 }
 
+/* maybe we should care about DDC1?  meh. */
 _X_EXPORT xf86MonPtr
 xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
 {
     ScrnInfoPtr	scrn = output->scrn;
     xf86MonPtr mon;
 
-    mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
+    mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE);
     if (mon)
-        xf86DDCApplyQuirks (scrn->scrnIndex, mon);
+        xf86DDCApplyQuirks(scrn->scrnIndex, mon);
 
     return mon;
 }
commit 4fc18b5fc31aa287e807ee520dc9117296e3d306
Author: Adam Jackson <ajax at redhat.com>
Date:   Sat Jun 21 16:07:36 2008 -0400

    Hexdump the whole EDID block if extensions present.

diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index f5442ad..5e89b40 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -462,22 +462,28 @@ print_number_sections(int scrnIndex, int num)
 xf86MonPtr
 xf86PrintEDID(xf86MonPtr m)
 {
-    CARD16 i, j;
+    CARD16 i, j, n;
     char buf[EDID_WIDTH * 2 + 1];
 
-    if (!(m)) return NULL;
+    if (!m) return NULL;
 
-    print_vendor(m->scrnIndex,&m->vendor);
-    print_version(m->scrnIndex,&m->ver);
-    print_display(m->scrnIndex,&m->features, &m->ver);
-    print_established_timings(m->scrnIndex,&m->timings1);
-    print_std_timings(m->scrnIndex,m->timings2);
-    print_detailed_monitor_section(m->scrnIndex,m->det_mon);
-    print_number_sections(m->scrnIndex,m->no_sections);
+    print_vendor(m->scrnIndex, &m->vendor);
+    print_version(m->scrnIndex, &m->ver);
+    print_display(m->scrnIndex, &m->features, &m->ver);
+    print_established_timings(m->scrnIndex, &m->timings1);
+    print_std_timings(m->scrnIndex, m->timings2);
+    print_detailed_monitor_section(m->scrnIndex, m->det_mon);
+    print_number_sections(m->scrnIndex, m->no_sections);
+
+    /* extension block section stuff */
 
     xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n");
- 
-    for (i = 0; i < 128; i += j) {
+
+    n = 128;
+    if (m->flags & EDID_COMPLETE_RAWDATA)
+	n += m->no_sections * 128;
+
+    for (i = 0; i < n; i += j) {
 	for (j = 0; j < EDID_WIDTH; ++j) {
 	    sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
 	}
commit b4fbc31e109f1efe78613597f9a91d5363523493
Author: Adam Jackson <ajax at redhat.com>
Date:   Sat Jun 21 16:00:05 2008 -0400

    Actually fetch all blocks of EEDID if asked to.

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index a4e79da..45caf6e 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -531,6 +531,9 @@ struct detailed_monitor_section {
   } section;				/* max: 80 */
 };
 
+/* flags */
+#define EDID_COMPLETE_RAWDATA	0x1
+
 typedef struct {
   int scrnIndex;
   struct vendor vendor;
@@ -539,7 +542,7 @@ typedef struct {
   struct established_timings timings1;
   struct std_timings timings2[8];
   struct detailed_monitor_section det_mon[4];
-  void *vdif; /* unused */
+  unsigned long flags;
   int no_sections;
   Uchar *rawData;
 } xf86Monitor, *xf86MonPtr;
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index b319699..941fec2 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -118,6 +118,20 @@ xf86InterpretEDID(int scrnIndex, Uchar *block)
     return NULL;
 }
 
+xf86MonPtr
+xf86InterpretEEDID(int scrnIndex, Uchar *block)
+{
+    xf86MonPtr m;
+
+    m = xf86InterpretEDID(scrnIndex, block);
+    if (!m)
+	return NULL;
+
+    /* extension parse */
+
+    return m;
+}
+
 static void
 get_vendor_section(Uchar *c, struct vendor *r)
 {
diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c
index 8dda35a..0d86776 100644
--- a/hw/xfree86/ddc/xf86DDC.c
+++ b/hw/xfree86/ddc/xf86DDC.c
@@ -197,21 +197,17 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
  * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
  * unset.  EDID information blocks are interpreted and the results returned in
  * an xf86MonPtr.  Unlike xf86DoEDID_DDC[12](), this function will return
- * the complete EDID data, including all extension blocks.
+ * the complete EDID data, including all extension blocks, if the 'complete'
+ * parameter is TRUE;
  *
  * This function does not affect the list of modes used by drivers -- it is up
  * to the driver to decide policy on what to do with EDID information.
  *
  * @return pointer to a new xf86MonPtr containing the EDID information.
  * @return NULL if no monitor attached or failure to interpret the EDID.
- *
- * nblocks is an in/out parameter.  If non-zero, it defines the number of
- * blocks to read from the monitor; zero (or NULL pointer) means read all.
- * If non-NULL, on return it will be filled in with the number of blocks
- * read.
  */
 xf86MonPtr
-xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
+xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
 {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     unsigned char *EDID_block = NULL;
@@ -242,16 +238,21 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
 	return NULL;
 
     if (DDC2Read(dev, 0, EDID_block)) {
-	tmp = xf86InterpretEDID(scrnIndex, EDID_block);
-    }
+	int i, n = EDID_block[0x7e];
+
+	if (complete && n) {
+	    EDID_block = xrealloc(EDID_block, EDID1_LEN * (1+n));
 
-    if (nblocks) {
-	if (tmp)
-	    *nblocks = tmp->no_sections;
-	else
-	    *nblocks = 0;
+	    for (i = 0; i < n; i++)
+		DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i)));
+	}
+
+	tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
     }
 
+    if (tmp && complete)
+	tmp->flags |= EDID_COMPLETE_RAWDATA;
+
     return tmp;
 }
 
@@ -269,8 +270,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks)
 xf86MonPtr
 xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
 {
-    int nblocks = 1;
-    return xf86DoEEDID(scrnIndex, pBus, &nblocks);
+    return xf86DoEEDID(scrnIndex, pBus, FALSE);
 }
 
 /* 
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 6e5bf6f..8e1eaac 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -35,7 +35,7 @@ extern xf86MonPtr xf86DoEDID_DDC2(
    I2CBusPtr pBus
 );
 
-extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks);
+extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool);
 
 extern xf86MonPtr xf86PrintEDID(
     xf86MonPtr monPtr
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 91ca4f7..6576fe8 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -1007,6 +1007,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86DoEDID_DDC2)
     SYMFUNC(xf86InterpretEDID)
     SYMFUNC(xf86PrintEDID)
+    SYMFUNC(xf86DoEEDID)
     SYMFUNC(xf86DDCMonitorSet)
     SYMFUNC(xf86SetDDCproperties)
 
commit 211e2bdcc677122145998829a7f26610c7c567e6
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 30 10:29:17 2008 -0400

    Bump ABI minor numbers for the devPrivate ABI functions.

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 78a22ec..fdcd567 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -82,11 +82,11 @@ typedef enum {
  * changed.  The minor revision mask is 0x0000FFFF and the major revision
  * mask is 0xFFFF0000.
  */
-#define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 3)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(4, 0)
-#define ABI_XINPUT_VERSION	SET_ABI_VERSION(3, 0)
-#define ABI_EXTENSION_VERSION	SET_ABI_VERSION(1, 0)
-#define ABI_FONT_VERSION	SET_ABI_VERSION(0, 5)
+#define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(4, 1)
+#define ABI_XINPUT_VERSION	SET_ABI_VERSION(3, 1)
+#define ABI_EXTENSION_VERSION	SET_ABI_VERSION(1, 1)
+#define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
 
 #define MODINFOSTRING1	0xef23fdc5
 #define MODINFOSTRING2	0x10dc023a
commit d6b8d9eaffaf3f976db330bc35da3d30eb656bac
Author: Dan Nicholson <dbn.lists at gmail.com>
Date:   Fri Jun 27 17:16:35 2008 -0700

    DRI: Ensure we have the DRI headers from Mesa
    
    Change the DRI configure check to look for the dri pkg-config file. This
    prevents people who built an Xlib libGL from bombing later in the build.

diff --git a/configure.ac b/configure.ac
index 6b2f6ac..8abc9a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -867,7 +867,7 @@ if test "x$DRI" = xyes; then
 	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
 	PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
 	PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
-	PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 gl >= 7.1.0])
+	PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 dri >= 7.1.0])
 	PKG_CHECK_EXISTS(libdrm >= 2.2.0,
 			 [AC_DEFINE([HAVE_LIBDRM_2_2], 1,
 			 [Has version 2.2 (or newer) of the drm library])])
commit 7ddfb2f1587da3ec1cd27ae270e42700adf4f560
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Jun 26 21:23:31 2008 -0400

    Fix a leak of window devPrivates in window.c/CrushTree().

diff --git a/dix/window.c b/dix/window.c
index 137afa0..541d199 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -929,6 +929,7 @@ CrushTree(WindowPtr pWin)
 		(*UnrealizeWindow)(pChild);
 	    }
 	    FreeWindowResources(pChild);
+	    dixFreePrivates(pChild->devPrivates);
 	    xfree(pChild);
 	    if ( (pChild = pSib) )
 		break;
commit 15e4b6c57484b6afb790c7dc1db9f529ba2219cf
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 24 13:46:40 2008 +0930

    input: for non-device events (e.g. DevicePresence) use MAX_DEVICES as id.
    
    Using id = 0 only worked pre-MPX since XInput didn't allow XOpenDevice for the
    core devices (0 and 1). Now we can now legally register for events so we may
    overwrite our device-independent classes with the ones selected for the VCP.
    
    So, increase the EMASKSIZE to MAX_DEVICES + 1 and use MAX_DEVICES as the ID
    when we don't have a device.

diff --git a/Xi/selectev.c b/Xi/selectev.c
index d3670ab..53d8f74 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -106,10 +106,10 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
     if (mask == 0)
         return Success;
 
-    /* We always only use mksidx = 0 for events not bound to
+    /* We always only use mksidx = MAX_DEVICES for events not bound to
      * devices */
 
-    if (AddExtensionClient (win, client, mask, 0) != Success)
+    if (AddExtensionClient (win, client, mask, MAX_DEVICES) != Success)
         return BadAlloc;
 
     RecalculateDeviceDeliverableEvents(win);
diff --git a/dix/devices.c b/dix/devices.c
index 91a43f3..0a68c0e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -275,7 +275,7 @@ EnableDevice(DeviceIntPtr dev)
     ev.time = currentTime.milliseconds;
     ev.devchange = DeviceEnabled;
     ev.deviceid = dev->id;
-    dummyDev.id = 0;
+    dummyDev.id = MAX_DEVICES;
     SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
                           (xEvent *) &ev, 1);
 
@@ -339,7 +339,7 @@ DisableDevice(DeviceIntPtr dev)
     ev.time = currentTime.milliseconds;
     ev.devchange = DeviceDisabled;
     ev.deviceid = dev->id;
-    dummyDev.id = 0;
+    dummyDev.id = MAX_DEVICES;
     SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
                           (xEvent *) &ev, 1);
 
@@ -379,6 +379,7 @@ ActivateDevice(DeviceIntPtr dev)
     ev.deviceid = dev->id;
 
     memset(&dummyDev, 0, sizeof(DeviceIntRec));
+    dummyDev.id = MAX_DEVICES;
     SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
                           (xEvent *) &ev, 1);
 
@@ -937,7 +938,7 @@ RemoveDevice(DeviceIntPtr dev)
         ev.time = currentTime.milliseconds;
         ev.devchange = DeviceRemoved;
         ev.deviceid = deviceid;
-        dummyDev.id = 0;
+        dummyDev.id = MAX_DEVICES;
         SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
                               (xEvent *) &ev, 1);
     }
diff --git a/include/inputstr.h b/include/inputstr.h
index 4c7ec2e..e5de6fc 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -66,7 +66,7 @@ SOFTWARE.
 
 #define MAX_DEVICES	20
 
-#define EMASKSIZE	MAX_DEVICES
+#define EMASKSIZE	MAX_DEVICES + 1
 
 extern DevPrivateKey CoreDevicePrivateKey;
 
commit f0c56ffd980db19bea271aeebf118bd931f6f40d
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 24 12:58:49 2008 +0930

    dix: don't dereference dev->key if it doesn't exist.
    
    This may happen if we check for a passive grab on a floating pointer device.

diff --git a/dix/events.c b/dix/events.c
index f6309f2..a4deaaa 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3389,7 +3389,7 @@ CheckPassiveGrabsOnWindow(
             else
                 gdev = device;
         }
-        if (gdev)
+        if (gdev && gdev->key)
             xkbi= gdev->key->xkbInfo;
 #endif
 	tempGrab.modifierDevice = grab->modifierDevice;
commit 01f0b9c9784c55c94104bafa6dd545b373c64104
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jun 25 19:23:20 2008 -0700

    xf86GetOptValFreq wants a pointer to double, but maxPixClock is an int

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index f0ae730..ee018eb 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2041,6 +2041,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
     XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
     Gamma zeros = {0.0, 0.0, 0.0};
     float badgamma = 0.0;
+    double maxPixClock;
     
     xf86Msg(X_CONFIG, "|   |-->Monitor \"%s\"\n",
 	    conf_monitor->mon_identifier);
@@ -2175,8 +2176,11 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
     xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
     xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
                       &monitorp->reducedblanking);
-    xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
-		      &monitorp->maxPixClock);
+    if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
+			  &maxPixClock) == TRUE) {
+	monitorp->maxPixClock = (int) maxPixClock;
+    }
+	
     return TRUE;
 }
 
commit 7ce6dcef118139d0ccfc136b9a07f5bf0c078d70
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Jun 25 15:06:49 2008 -0700

    Don't log null device name in XkbDDXLoadKeymapByNames

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index ade13c3..d6b5f75 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -351,7 +351,7 @@ unsigned	missing;
 	(names->compat==NULL)&&(names->symbols==NULL)&&
 	(names->geometry==NULL)) {
         LogMessage(X_ERROR, "XKB: No components provided for device %s\n",
-                   keybd->name);
+                   keybd->name ? keybd->name : "(unnamed keyboard)");
         return 0;
     }
     else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
commit cbc20d92de92aad5ca240310a9156ccf97c24a01
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jun 25 09:52:36 2008 -0400

    XTrap delenda est.

diff --git a/Makefile.am b/Makefile.am
index 116e4fe..aa9c8b6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,10 +5,6 @@ if COMPOSITE
 COMPOSITE_DIR=composite
 endif
 
-if XTRAP
-XTRAP_DIR=XTrap
-endif
-
 if GLX
 GLX_DIR=glx
 endif
@@ -38,7 +34,6 @@ SUBDIRS = \
 	$(RECORD_DIR) \
 	xfixes \
 	damageext \
-	$(XTRAP_DIR) \
 	$(COMPOSITE_DIR) \
 	$(GLX_DIR) \
 	exa \
@@ -80,7 +75,6 @@ DIST_SUBDIRS = \
 	record \
 	xfixes \
 	damageext \
-	XTrap \
 	composite \
 	glx \
 	exa \
diff --git a/XTrap/Makefile.am b/XTrap/Makefile.am
deleted file mode 100644
index 1eddd4f..0000000
--- a/XTrap/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-noinst_LTLIBRARIES = libxtrap.la
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-libxtrap_la_SOURCES = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c
diff --git a/XTrap/xtrapddmi.c b/XTrap/xtrapddmi.c
deleted file mode 100644
index 8ce9954..0000000
--- a/XTrap/xtrapddmi.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*****************************************************************************/
-/*
- *  ABSTRACT:
- *
- *      This module is the platform-specific but conditionally independent
- *      code for the XTrap extension (usually I/O or platform setup).
- *      This is shared code and is subject to change only by team approval.
- *
- *  CONTRIBUTORS:
- *
- *      Dick Annicchiarico
- *      Robert Chesler
- *      Gene Durso
- *      Marc Evans
- *      Alan Jamison
- *      Mark Henry
- *      Ken Miller
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <errno.h>
-#include <X11/Xos.h>
-#ifdef PC
-# include "fcntl.h"
-# include "io.h"
-# define O_NDELAY 0L
-#endif
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>        /* From library include environment */
-#include "inputstr.h"    /* From server include env. (must be before Xlib.h!) */
-#ifdef PC
-# include "scrintst.h"          /* Screen struct */
-# include "extnsist.h"
-#else
-# include "extnsionst.h"        /* Server ExtensionEntry definitions */
-# include "scrnintstr.h"        /* Screen struct */
-#endif
-#include "inputstr.h"
-
-#include <X11/extensions/xtrapdi.h>
-#include <X11/extensions/xtrapddmi.h>
-#include <X11/extensions/xtrapproto.h>
-
-extern int XETrapErrorBase;
-extern xXTrapGetAvailReply XETrap_avail;
-extern DevicePtr XETrapKbdDev;
-extern DevicePtr XETrapPtrDev;
-
-/*
- *  DESCRIPTION:
- *
- *      This function performs the platform specific setup for server
- *      extension implementations.
- */
-void XETrapPlatformSetup()
-{
-}
-
-
-#if !defined _XINPUT
-/*
- *  DESCRIPTION:
- *
- *  This routine processes the simulation of some input event.
- *
- */
-int XETrapSimulateXEvent(register xXTrapInputReq *request,
-    register ClientPtr client)
-{
-    ScreenPtr pScr = NULL;
-    int status = Success;
-    xEvent xev;
-    register int x = request->input.x;
-    register int y = request->input.y;
-    DevicePtr keydev = (DevicePtr)PickKeyboard(client);
-    DevicePtr ptrdev = (DevicePtr)PickPointer(client);
-
-    if (request->input.screen < screenInfo.numScreens)
-    {
-        pScr = screenInfo.screens[request->input.screen];
-    }
-    else
-    {   /* Trying to play bogus events to this WS! */
-#ifdef VERBOSE
-        ErrorF("%s:  Trying to send events to screen %d!\n", XTrapExtName,
-            request->input.screen);
-#endif
-        status = XETrapErrorBase + BadScreen;
-    }
-    /* Fill in the event structure with the information
-     * Note:  root, event, child, eventX, eventY, state, and sameScreen
-     *        are all updated by FixUpEventFromWindow() when the events
-     *        are delivered via DeliverDeviceEvents() or whatever.  XTrap
-     *        needs to only concern itself with type, detail, time, rootX, 
-     *        and rootY.
-     */
-    if (status == Success)
-    {
-        xev.u.u.type   = request->input.type;
-        xev.u.u.detail = request->input.detail;
-        xev.u.keyButtonPointer.time   = GetTimeInMillis();
-        xev.u.keyButtonPointer.rootX = x;
-        xev.u.keyButtonPointer.rootY = y;
-
-        if (request->input.type == MotionNotify)
-        {   /* Set new cursor position on screen */
-            XETrap_avail.data.cur_x = x;
-            XETrap_avail.data.cur_y = y;
-          NewCurrentScreen (inputInfo.pointer, pScr, x, y); /* fix from amnonc at mercury.co.il */
-            if (!(*pScr->SetCursorPosition)(inputInfo.pointer, pScr, x, y, xFalse))
-            {
-                status = BadImplementation;
-            }
-        }
-    }
-    if (status == Success)
-    {
-        switch(request->input.type)
-        {   /* Now process the event appropriately */
-            case KeyPress:
-            case KeyRelease:
-                (*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L);
-                break;
-            case MotionNotify:
-            case ButtonPress:
-            case ButtonRelease:
-                (*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L);
-                break;
-            default:
-                status = BadValue;
-                break;
-        }
-    }
-    return(status);
-}
-#endif /* _XINPUT */
diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c
deleted file mode 100644
index a4ba45b..0000000
--- a/XTrap/xtrapdi.c
+++ /dev/null
@@ -1,2154 +0,0 @@
-/*****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-*****************************************************************************/
-/*
- *  ABSTRACT:
- *
- *      This module is the main module for extension initialization and setup.
- *      It is called by the server and by clients using the extension.
- *      This is shared code and is subject to change only by team approval.
- *
- *  CONTRIBUTORS:
- *
- *      Dick Annicchiarico
- *      Robert Chesler
- *      Gene Durso
- *      Marc Evans
- *      Alan Jamison
- *      Mark Henry
- *      Ken Miller
- *
- *  CHANGES:
- *
- *	Robert Chesler - grab-impreviousness patch to improve grab behavior
- *	Robert Chesler - add client arg to swapping routines for X11R6 port
- *
- */
-
-/*-----------------*
- *  Include Files  *
- *-----------------*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <errno.h>
-#include <X11/Xos.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"           /* Server DevicePtr definitions */
-#include "misc.h"               /* Server swapping macros */
-#include "dixstruct.h"          /* Server ClientRec definitions */
-#include "resource.h"           /* Used with the MakeAtom call */
-#ifdef PC
-# include "scrintst.h"          /* Screen struct */
-# include "extnsist.h"
-#else
-# include "extnsionst.h"        /* Server ExtensionEntry definitions */
-# include "scrnintstr.h"        /* Screen struct */
-#endif
-#include "pixmapstr.h"          /* DrawableRec */
-#include "windowstr.h"          /* Drawable Lookup structures */
-#include "inputstr.h"
-#include <X11/extensions/xtrapdi.h>
-#include <X11/extensions/xtrapddmi.h>
-#include <X11/extensions/xtrapproto.h>
-#include "colormapst.h"
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#include "cursor.h"
-#endif
-
-
-/*----------------------------*
- *  Global Data Declarations  *
- *----------------------------*/
-
-DevicePtr XETrapKbdDev                       = NULL;
-DevicePtr XETrapPtrDev                       = NULL;
-int    XETrapErrorBase                       = 0L;
-xXTrapGetAvailReply XETrap_avail;            /* What's available to clients */
-
-globalref int_function XETrapDispatchVector[10L]; /* Vector of XTrap Rtns */
-globalref int_function XETSwDispatchVector[10L];  /* Swapped XTrap Rtns */
-
-globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */
-    /* The "real" EventVector (XTrap creates it till events 
-     * truly become vectored
-     */
-#ifndef VECTORED_EVENTS
-globalref int_function EventProcVector[XETrapCoreEvents];
-#else
-extern WindowPtr GetCurrentRootWindow(DeviceIntPtr);
-globalref int_function EventProcVector[128L];
-#endif
-static int_function keybd_process_inp = NULL;  /* Used for VECTORED_EVENTS */
-    /* The "shadowed" Event Vector */
-globalref int_function XETrapEventProcVector[XETrapCoreEvents];
-
-globalref void_function XETSwProcVector[256L];/* Vector of Req swapping rtns */
-
-/* This macro returns a true/false indicator based on whether it changes the
- * environment state bits local to the server extension. This is based on the
- * idea that if a valid flag is set and the corresponding data bit is not in
- * the same state as desired, then true is returned, otherwise false is
- * returned.
- */
-#define _CheckChangeBit(valid,data,local,bit) \
-    (BitIsFalse(valid,bit) ? 0L :                                \
-        (((BitIsTrue(data,bit) && BitIsTrue(local,bit)) ||       \
-         (BitIsFalse(data,bit) && BitIsFalse(local,bit))) ? 0L : \
-         (BitToggle(local,bit), 1L)))
-
-/* This macro is designed to return the number of elements in an
- * automatically allocated array.
- */
-#ifndef ASIZE
-#define ASIZE(array)    (sizeof(array)/sizeof(array[0L]))
-#endif
-
-/* This macro is designed to return the number of long words beyond
- * XETrapMinRepSize contained in a data structure.
- */
-#ifndef XEXTRA
-#define XEXTRA(s) \
-    ((sizeof(s)+(sizeof(CARD32)-1L)-XETrapMinRepSize)/sizeof(CARD32))
-#endif
-
-/* Static Declarations known to XTrap Only
- * All XTrap clients refer to these single copies!
- */
-/* This carries all of the information XTrap uses for internal information */
-static XETrapEnv *XETenv[MAXCLIENTS]         = {NULL};
-#ifndef RESTYPE
-#define RESTYPE unsigned long
-#endif
-static RESTYPE   XETrapClass = 0L;      /* Resource class for this extension */
-static RESTYPE   XETrapType  = 0L;      /* Resource type for this extension */
-static Bool      gate_closed = False;   /* The global "gatekeeper" */
-static Bool      key_ignore  = False;   /* The global "keymaster" */
-static Bool      ignore_grabs = False;
-static CARD8     next_key = XEKeyIsClear; /* Echo, Clear, or Other */
-#ifdef VECTORED_EVENTS
-static INT16     current_screen = -1L;   /* Current screen for events */
-#endif
-static INT16     vectored_requests[256L] = {0L}; /* cnt of vectoring clients */
-static INT16     vectored_events[KeyPress+MotionNotify]  = {0L};
-typedef struct _client_list
-{
-    struct _client_list    *next;
-    ClientPtr              client;
-} ClientList;
-static ClientList io_clients;  /* Linked-list of clients currently doing I/O */
-static ClientList stats_clients;  /* Linked-list of clients collecting stats */
-static ClientList cmd_clients;   /* Linked-list of clients using command key */
-
-/*----------------------------*
- *  Forward Declarations
- *----------------------------*/
-static void _SwapProc (int (**f1 )(void), int (**f2 )(void));
-static void sXETrapEvent (xETrapDataEvent *from , xETrapDataEvent *to );
-static int add_accelerator_node (ClientPtr client , ClientList *accel );
-static void remove_accelerator_node (ClientPtr client , ClientList *accel );
-static void update_protocol (xXTrapGetReq *reqptr , ClientPtr client );
-#ifdef COLOR_REPLIES
-static void GetSendColorRep (ClientPtr client , xResourceReq *req );
-static void GetSendNamedColorRep (ClientPtr client , xResourceReq *req );
-static void GetSendColorCellsRep (ClientPtr client , xResourceReq *req );
-static void GetSendColorPlanesRep (ClientPtr client , xResourceReq *req );
-#endif
-
-/*
- *  DESCRIPTION:
- *
- *      This routine is called by the server when a given client
- *      goes away (as identified by the first argument). All
- *      memory allocations, misc. values specific to a given
- *      client would be reset here.
- *
- */
-int XETrapDestroyEnv(pointer value, XID id)
-{
-    xXTrapReq request;
-    XETrapEnv *penv = XETenv[(long)value];
-
-    XETrapReset(&request,penv->client);
-    /* Free any memory malloc'd for a particular client here */
-    /* In case stop I/O wasn't received for this client */
-    if (penv->stats)
-    {   /* Remove from client accelerator list */
-        remove_accelerator_node(penv->client, &stats_clients);
-        Xfree(penv->stats);     /* Free the stats buckets */
-    }
-    if (cmd_clients.next == NULL)
-    { /* No more command key clients!  Let's reset the gate */
-        gate_closed = False;
-        key_ignore  = False;
-        next_key = XEKeyIsClear;
-    }
-
-#ifdef VECTORED_EVENTS
-    current_screen = -1L;       /* Invalidate current screen */
-#endif
-
-#ifdef VERBOSE
-    ErrorF("%s:  Client '%d' Disconnected\n", XTrapExtName, 
-        penv->client->index);
-#endif
-
-    Xfree(penv);
-    XETenv[(long)value] = NULL;
-
-    return 0;
-}                       
-
-/*
- *  DESCRIPTION:
- *
- *      This routine is called by the server when the last client
- *      (the session manager in most cases) goes away. This is server
- *      reset. When the server comes back up, this extension will not
- *      be loaded unless this routine makes the proper arrangements.
- *
- *      The real concern here is to unload the extension
- *      and possibly make arragements to be called upon
- *      server restart.
- *
- */
-void XETrapCloseDown(ExtensionEntry *extEntry)
-{                                           
-    long i;
-
-    for (i=0L; i<MAXCLIENTS; i++)
-    {
-        if (XETenv[i] != NULL)
-        {
-            XETrapDestroyEnv((pointer)i,0L);
-        }
-    }
-    ignore_grabs = False;
-    return;
-}                       
-
-/*
- *
- *  DESCRIPTION:
- *
- *      This routine has been created because of the initialization
- *      order that X uses, such that extensions are initialized before
- *      devices. This means that this extension must perform a second
- *      level of initialization to obtain the device references at some
- *      point after they have been initialized. It is assumed that when
- *      a client establishes communication with the extension that the
- *      devices havae been initialized, and therefore this function can
- *      obtain the information it needs.
- *
- *      In obtaining the information, this function also places its own
- *      functions in place of the *standard* functions. The original
- *      functions are retained for vectoring purposes.
- */
-
-Bool XETrapRedirectDevices()
-{
-    Bool retval = True;
-
-    /* Do we need to redirect the keyboard device? */
-    if (XETrapKbdDev == NULL)
-    {
-        if ((XETrapKbdDev = (DevicePtr)inputInfo.keyboard) == NULL)
-        {
-            retval = False;
-        }
-        else
-        {
-            EventProcVector[KeyPress] =
-                (int_function)XETrapKbdDev->realInputProc;
-            EventProcVector[KeyRelease] =
-                (int_function)XETrapKbdDev->realInputProc;
-        }
-#ifdef VECTORED_EVENTS
-        keybd_process_inp = EventProcVector[KeyPress];
-        EventProcVector[KeyPress] = EventProcVector[KeyRelease] = NULL;
-        XETrapEventProcVector[KeyPress]   = XETrapEventVector;
-        XETrapEventProcVector[KeyRelease] = XETrapEventVector;
-#else   /* !VECTORED_EVENTS */
-        XETrapEventProcVector[KeyPress]   = XETrapKeyboard;
-        XETrapEventProcVector[KeyRelease] = XETrapKeyboard;
-#endif /* !VECTORED_EVENTS */
-    }
-    /* Do we need to redirect the pointer device? */
-#ifndef VECTORED_EVENTS
-    if (XETrapPtrDev == NULL)
-    {
-        if ((XETrapPtrDev = (DevicePtr)inputInfo.pointer) == 0L)
-        {
-            retval = False;
-        }
-        else
-        {
-            EventProcVector[ButtonPress] = 
-                (int_function)XETrapPtrDev->realInputProc;
-            EventProcVector[ButtonRelease] = 
-                (int_function)XETrapPtrDev->realInputProc;
-            EventProcVector[MotionNotify] = 
-                (int_function)XETrapPtrDev->realInputProc;
-        }
-        XETrapEventProcVector[ButtonPress]   = XETrapPointer;
-        XETrapEventProcVector[ButtonRelease] = XETrapPointer;
-        XETrapEventProcVector[MotionNotify]  = XETrapPointer;
-    }
-#endif /* !VECTORED_EVENTS */
-    return(retval);
-}
-
-/*
- *
- *  DESCRIPTION:
- *
- *      This routine is the main entry point for the Xtrap extension. It is
- *      called by the server to inititalize the Xtrap extension.  Once the
- *      extension is initialized, life is controlled by the XtrapDispatch
- *      routine by the requests it will handle.
- *
- *      Initializes all the XTrap data structures with the proper
- *      addresses of defined routines that will help control the extension.
- *      It is vital that the extension state be kept accurate so that only
- *      one call to this routine be made.
- *
- */
-
-void DEC_XTRAPInit()
-{
-    register ExtensionEntry *extEntry;
-    unsigned int i;
-    Atom a;
-
-    /* Make the extension known to the server. Must be done every time
-     * DEC_XTRAPInit is called, else server will think it failed.
-     */
-    if ((extEntry = AddExtension(XTrapExtName,XETrapNumEvents,
-        XETrapNumErrors,XETrapDispatch,sXETrapDispatch,XETrapCloseDown
-        ,StandardMinorOpcode)) == NULL)
-    {                                        
-        ErrorF("%s:  AddExtension Failed!\n", XTrapExtName); 
-        return;
-    }
-#ifdef VERBOSE
-        ErrorF("%s:  AddExtension assigned Major Opcode '%d'\n",
-            XTrapExtName, extEntry->base);
-#endif
-    XETrap_avail.data.major_opcode = extEntry->base;
-    XETrapErrorBase                = extEntry->errorBase;
-    XETrap_avail.data.event_base   = extEntry->eventBase;
-
-    /* Set up our swapped reply vector */
-    ReplySwapVector[XETrap_avail.data.major_opcode] = 
-	(void_function) sReplyXTrapDispatch;
-
-    /* Set up our swapped event vector */
-    EventSwapVector[extEntry->eventBase + XETrapData] = 
-	(EventSwapPtr) sXETrapEvent;
-
-    /* make an atom saying that the extension is present.  The 
-     * adding of the resource occurs during XETrapCreateEnv().
-     */
-    if ((a = MakeAtom(XTrapExtName,strlen(XTrapExtName),1L)) == None ||
-        (XETrapType  = CreateNewResourceType(XETrapDestroyEnv)) == 0L)
-    {
-        ErrorF("%s:  Setup can't create new resource type (%d,%d,%d)\n",
-          XTrapExtName, (int)a,(int)XETrapClass,(int)XETrapType);
-        return;
-    }
-    /* initialize the GetAvailable info reply here */
-    XETrap_avail.hdr.type        = X_Reply;
-    XETrap_avail.hdr.length      = XEXTRA(xXTrapGetAvailReply);
-    XETrap_avail.data.xtrap_release  = XETrapRelease;
-    XETrap_avail.data.xtrap_version  = XETrapVersion;
-    XETrap_avail.data.xtrap_revision = XETrapRevision;
-    XETrap_avail.data.pf_ident       = XETrapPlatform;
-    XETrap_avail.data.max_pkt_size   = 0xFFFF;    /* very large number */
-    for (i=0L; i<ASIZE(XETrap_avail.data.valid); i++)
-    {
-        XETrap_avail.data.valid[i] = 0L; /* Clear bits initially */
-    }
-    BitTrue(XETrap_avail.data.valid,XETrapTimestamp);
-    BitTrue(XETrap_avail.data.valid,XETrapCmd);
-    BitTrue(XETrap_avail.data.valid,XETrapCmdKeyMod);
-    BitTrue(XETrap_avail.data.valid,XETrapRequest);
-    BitTrue(XETrap_avail.data.valid,XETrapEvent);
-    BitTrue(XETrap_avail.data.valid,XETrapMaxPacket);
-    BitTrue(XETrap_avail.data.valid,XETrapStatistics);
-    BitTrue(XETrap_avail.data.valid,XETrapWinXY);
-    /* Not yet implemented */
-    BitFalse(XETrap_avail.data.valid,XETrapCursor);
-#ifndef _XINPUT
-    BitFalse(XETrap_avail.data.valid,XETrapXInput);
-#else
-    BitTrue(XETrap_avail.data.valid,XETrapXInput);
-#endif
-#ifndef VECTORED_EVENTS
-    BitFalse(XETrap_avail.data.valid,XETrapVectorEvents);
-#else
-    BitTrue(XETrap_avail.data.valid,XETrapVectorEvents);
-#endif  /* VECTORED_EVENTS */
-#ifndef COLOR_REPLIES
-    BitFalse(XETrap_avail.data.valid,XETrapColorReplies);
-#else
-    BitTrue(XETrap_avail.data.valid,XETrapColorReplies);
-#endif  /* COLOR_REPLIES */
-    BitTrue(XETrap_avail.data.valid,XETrapGrabServer);
-    /* initialize multi-client accelerator lists */
-    io_clients.next = NULL;
-    stats_clients.next = NULL;
-    cmd_clients.next = NULL;
-    for (i=0L; i<256L; i++)
-    {
-        vectored_requests[i] = 0L;
-    }
-    for (i=KeyPress; i<=MotionNotify; i++)
-    {
-        vectored_events[i] = 0L;
-    }
-    gate_closed = False;
-    key_ignore  = False;
-    next_key = XEKeyIsClear;
-        
-    XETrapPlatformSetup();
-    /* Initialize any local memory we use */
-    for (i=0L; i<ASIZE(EventProcVector); i++)
-    {
-        EventProcVector[i] = NULL;
-#ifndef VECTORED_EVENTS
-        XETrapEventProcVector[i] = NULL;
-#else
-        XETrapEventProcVector[i] = XETrapEventVector;
-#endif
-    }
-    XETrapKbdDev = NULL;
-    XETrapPtrDev = NULL;
-    for (i=0L; i<ASIZE(XETrapProcVector); i++)
-    {
-        XETrapProcVector[i] = XETrapRequestVector;
-    }
-    for (i=128L; i<=255L; i++)
-    {   /* Extension "swapped" requests are not implemented */
-        XETSwProcVector[i] = NotImplemented;
-    }
-#ifdef VERBOSE
-    ErrorF("%s:  Vers. %d.%d-%d successfully loaded\n", XTrapExtName,
-        XETrap_avail.data.xtrap_release, 
-        XETrap_avail.data.xtrap_version,
-        XETrap_avail.data.xtrap_revision);
-#endif
-
-    return;
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This procedure is called upon dispatch to allocate an
- *      environment structure for a new XTrap client.  The XETenv[]
- *      entry is allocated and initialized with default values.
- *      XETrapDestroyEnv() is responsible for deallocating this memory
- *      upon client termination.
- *
- *      Note: the status of this routine is returned to the caller of
- *      the Dispatch routine which will in turn SendErrorToClient if
- *      necessary.
- *
- */
-
-int XETrapCreateEnv(ClientPtr client)
-{
-    XETrapEnv *penv = NULL;
-    int status = Success;
-
-    if (client->index >= MAXCLIENTS)
-    {
-        status = BadImplementation;
-    }
-    else if ((XETenv[client->index] = (XETrapEnv *)Xcalloc(sizeof(XETrapEnv)))
-        == NULL)
-    {
-        status = BadAlloc;
-    }
-    if (status == Success)
-    {
-        penv = XETenv[client->index];
-        penv->client = client;
-        penv->protocol = 31;    /* default to backwards compatibility */
-        /* prep for client's departure (for memory dealloc, cleanup) */
-        AddResource(FakeClientID(client->index),XETrapType,
-            (pointer)(long)(client->index));
-        if (XETrapRedirectDevices() == False)
-        {
-            status = XETrapErrorBase + BadDevices;
-        }
-        /* Initialize the current state */
-        if (status == Success)
-        {
-            status = XETrapReset(NULL, penv->client);
-        }
-    }
-
-#ifdef VECTORED_EVENTS
-    current_screen = -1L;       /* Invalidate current screen */
-#endif
-
-#ifdef VERBOSE
-    if (status == Success)
-    {
-        ErrorF("%s:  Client '%d' Connection Accepted\n", XTrapExtName, 
-            penv->client->index);
-    }
-#endif
-
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This procedure is defined for the call to AddExtension()
- *      in which it is expected to be a parameter of the call.
- *
- *      This routine will be called by the server dispatcher
- *      when a client makes a request that is handled
- *      by the extension and the byte ordering of the client is the
- *      SAME as that of the extension.
- *
- *      Note: the status of the requests is returned to the caller of
- *      the Dispatch routine which will in turn SendErrorToClient if
- *      necessary.
- */
-
-int XETrapDispatch(ClientPtr client)
-{
-
-    REQUEST(xXTrapReq);
-    register int status = Success;
-
-    REQUEST_AT_LEAST_SIZE(xXTrapReq);
-
-    /* Have we seen this client before? */
-    if (XETenv[client->index] == NULL)
-    {
-        status = XETrapCreateEnv(client);
-    }
-    /* Do we have a valid request? */
-    if (status == Success)
-    {
-        if (stuff->minor_opcode < ASIZE(XETrapDispatchVector))
-        {
-            /* Then vector to the pointed to function */
-            status = 
-                (*(XETrapDispatchVector[stuff->minor_opcode]))(stuff,client);
-        }
-        else
-        {
-            status = BadRequest;
-        }
-    }
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *                     
- *        This procedure is defined for the call to AddExtension()
- *        in which it is expected to be a parameter of the call.
- *
- *        This routine would ordinarily be called by the server
- *        dispatcher when a client makes a request that is handled
- *        by the extension and the byte ordering of the client is
- *        DIFFERENT than that of the extension.
- */
-
-int sXETrapDispatch(ClientPtr client)
-{
-
-    REQUEST(xXTrapReq);
-    register int status = Success;
-
-    REQUEST_AT_LEAST_SIZE(xXTrapReq);
-
-    /* Have we seen this client before? */
-    if (XETenv[client->index] == NULL)
-    {
-        status = XETrapCreateEnv(client);
-    }
-    /* Do we have a valid request? */
-    if (status == Success)
-    {
-        if (stuff->minor_opcode < ASIZE(XETSwDispatchVector))
-        {
-            /* Then vector to the pointed to function */
-            status = 
-                (*(XETSwDispatchVector[stuff->minor_opcode]))(stuff,client);
-        }
-        else
-        {
-            status = BadRequest;
-        }
-    }
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This routine will place the extension in a steady and known 
- *      state.  Any current state will be reset.  This is called either
- *      by a client request (dispatched) or when a new client environment
- *      is created.
- *
- */
-int XETrapReset(xXTrapReq *request, ClientPtr client)
-{
-    static xXTrapConfigReq DummyReq;
-    register int i;
-    register int status = Success;
-    XETrapEnv *penv = XETenv[client->index];
-
-    /* in case any i/o's pending */
-    (void)XETrapStopTrap((xXTrapReq *)NULL, client);
-    penv->cur.hdr.type        = X_Reply;
-    penv->cur.hdr.length      = XEXTRA(xXTrapGetCurReply);
-    /* Fill in a dummy config request to clear all elements */
-    for (i=0L; i<ASIZE(DummyReq.config_flags_valid); i++)
-    {
-        DummyReq.config_flags_valid[i]  = 0xFFL;  /* set all the valid flags */
-        DummyReq.config_flags_data[i]   = 0L;     /* clear all data flags */
-    }
-    /* Don't reset grab server arbitrarily, it must be explicitly 
-     * de-configured.
-     */
-    BitSet(DummyReq.config_flags_data, XETrapGrabServer, ignore_grabs);
-    for (i=0L; i< ASIZE(DummyReq.config_flags_req); i++)
-    {
-       DummyReq.config_flags_req[i] = 0xFF; /* Clear all protocol requests */
-    }
-    for (i=0L; i< ASIZE(DummyReq.config_flags_event); i++)
-    {
-        DummyReq.config_flags_event[i] = 0xFF;  /* Clear all protocol events */
-    }
-    /* Call config routine to clear all configurable fields */
-    status = XETrapConfig(&DummyReq, client);
-    /* reset the environment */
-    for (i=0L; i<ASIZE(penv->cur.data_state_flags); i++)
-    {
-        penv->cur.data_state_flags[i] = 0L; /* Clear all env flags */
-    }
-    penv->cur.data_config_max_pkt_size  = XETrap_avail.data.max_pkt_size;
-   
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sends a reply back to the requesting client indicating
- *      the available states of the extension can be configured for.
- */
-int XETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
-{
-    XETrapEnv *penv = XETenv[client->index];
-    update_protocol(request, client);
-    /* Initialize the reply as needed */
-    XETrap_avail.data.xtrap_protocol = penv->protocol;
-    XETrap_avail.hdr.detail = XETrap_GetAvailable;
-    XETrap_avail.hdr.sequenceNumber = client->sequence;
-    WriteReplyToClient(client, sizeof(xXTrapGetAvailReply), &XETrap_avail);
-    return(Success);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sends a reply back to the requesting client indicating
- *      the current state of the extension.
- */
-int XETrapGetCurrent(xXTrapReq *request, ClientPtr client)
-{
-    XETrapEnv *penv = XETenv[client->index];
-    int rep_size = (penv->protocol == 31 ? 284 : sz_xXTrapGetCurReply);
-    penv->cur.hdr.length      = (rep_size - 32L) / SIZEOF(CARD32);
-
-    /* Initialize the reply as needed */
-    penv->cur.hdr.detail = XETrap_GetCurrent;
-    penv->cur.hdr.sequenceNumber  = client->sequence;
-    WriteReplyToClient(client, rep_size, &(penv->cur));
-
-    return(Success);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sends a reply back to the requesting client dumping
- *      statistics (counts) of requests and events.  If stat's isn't
- *      configured, return failure.
- */
-int XETrapGetStatistics(xXTrapReq *request, ClientPtr client)
-{
-    int status = Success;
-    XETrapEnv *penv = XETenv[client->index];
-
-    if ((BitIsTrue(penv->cur.data_config_flags_data, XETrapStatistics)) &&
-        (penv->stats))
-    {
-        /* Initialize the reply as needed */
-        int rep_size = sizeof(xXTrapGetStatsReply);
-        penv->stats->detail = XETrap_GetStatistics;
-        penv->stats->sequenceNumber = client->sequence;
-        if (penv->protocol == 31)
-        {
-            xXTrapGetStatsReply  rep_stats;
-            rep_stats = *penv->stats;
-#ifndef VECTORED_EVENTS
-            rep_size         = 1060;
-#else
-            rep_size         = 1544;
-#endif
-            rep_stats.length = (rep_size - 32L) / SIZEOF(CARD32);
-            /* 
-             * Now we need to shift the data *into* the header area 
-             * for bug compatibility.
-             */
-            memcpy(&(rep_stats.pad0),&(penv->stats->data), 
-                sizeof(XETrapGetStatsRep));
-            WriteReplyToClient(client, rep_size, &rep_stats);
-        }
-        else
-        {
-            WriteReplyToClient(client, rep_size, penv->stats);
-        }
-    }
-    else
-    {
-        status = XETrapErrorBase + BadStatistics;
-    }
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function is dispatched when a client requests the extension to
- *      be configured in some manner.
- */
-int XETrapConfig(xXTrapConfigReq *request, ClientPtr client)
-{
-    UByteP vflags       = request->config_flags_valid;
-    UByteP dflags       = request->config_flags_data;
-    UByteP req_flags    = request->config_flags_req;
-    UByteP event_flags  = request->config_flags_event;
-    XETrapEnv *penv     = XETenv[client->index];
-    UByteP bit_flags    = penv->cur.data_config_flags_data;
-    int status          = Success;
-    CARD32 i            = 0L;
-
-    /* Check events and swap if desired */
-    if (BitIsTrue(vflags,XETrapEvent))
-    {   /* Loop through all of the events */
-        for (i=0L; i<ASIZE(EventProcVector); i++)
-        {
-            if (BitIsTrue(event_flags,i) &&    /* Do we care about this one? */
-                (BitValue(dflags,XETrapEvent) ^           /* Exclusive Or */
-                (BitValue(penv->cur.data_config_flags_event,i))))
-            {   /* At this point we *know* there's a change.  The
-                 * only question remaining is are there any more
-                 * clients interested in this specific event.  If
-                 * so, *don't* swap this process!
-                 */
-                if (BitIsTrue(dflags,XETrapEvent))
-                {   /* Client wants the XTrap rtn */
-                    if (++(vectored_events[i]) <= 1L)
-                    {   /* first client, so do it */
-                        _SwapProc(&(XETrapEventProcVector[i]), 
-                            &(EventProcVector[i]));
-                    }
-                }
-                else
-                {   /* Client wants the *real* rtn */
-                    if (--(vectored_events[i]) <= 0L)
-                    {   /* No more clients using, so do it */
-                        _SwapProc(&(XETrapEventProcVector[i]), 
-                            &(EventProcVector[i]));
-                    }
-                }
-                switch(i)
-                {
-                    case KeyPress:  /* needed for command key processing */
-                    case KeyRelease:
-                        XETrapKbdDev->processInputProc = 
-                            (void_function)(EventProcVector[i] ? 
-                            (void_function)EventProcVector[i] : 
-                            (void_function)keybd_process_inp);
-                        XETrapKbdDev->realInputProc = 
-                            (void_function)(EventProcVector[i] ?
-                            (void_function)EventProcVector[i] : 
-                            (void_function)keybd_process_inp);
-                        break;
-#ifndef VECTORED_EVENTS
-                    case ButtonPress: /* hack until events become vectored */
-                    case ButtonRelease:
-                    case MotionNotify:
-                        XETrapPtrDev->processInputProc = 
-                            (void_function)EventProcVector[i];
-                        XETrapPtrDev->realInputProc = 
-                            (void_function)EventProcVector[i];
-                        break;
-                    default:
-                        status = BadImplementation;
-                        break;
-#endif /* !VECTORED_EVENTS */
-                }
-                BitToggle(penv->cur.data_config_flags_event,i);
-            }
-        }
-    }
-    if ((status == Success) && 
-        (_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmd)))
-    {
-        if (BitIsTrue(dflags, XETrapCmd))
-        {   /* Add accelerator entry to cmd_clients list iff necessary */
-            penv->cur.data_config_cmd_key = request->config_cmd_key;
-            status = add_accelerator_node(penv->client, &cmd_clients);
-        }
-        else
-        {
-            penv->cur.data_config_cmd_key = 0L; /* default no KeyCode */
-            remove_accelerator_node(penv->client, &cmd_clients);
-        }
-    }
-    if ((status == Success) &&
-        (_CheckChangeBit(vflags,dflags,bit_flags,XETrapMaxPacket)))
-    {
-        if (BitIsTrue(dflags,XETrapMaxPacket))
-        {   /* Set size to what's passed in */
-            if (request->config_max_pkt_size < XETrapMinPktSize)
-            {   /* Tell them the value is too small */
-                status = BadValue;
-            }
-            else
-            {
-                penv->cur.data_config_max_pkt_size = 
-                    request->config_max_pkt_size;
-            }
-        }
-        else
-        {   /* Set it to the default (a *very* big number) */
-            penv->cur.data_config_max_pkt_size = 0xFFFF;
-        }
-    }
-    /* If the valid flag is set for requests, then each of the 
-     * requests is swapped if it's different from current state.
-     */
-    if (BitIsTrue(vflags,XETrapRequest) && status == Success)
-    {   /* Loop through all of the core requests */
-        for (i=0L; i<ASIZE(XETrapProcVector); i++)
-        {
-            if (BitIsTrue(req_flags,i) &&     /* Do we care about this one? */
-                (BitValue(dflags,XETrapRequest) ^          /* Exclusive Or */
-                (BitValue(penv->cur.data_config_flags_req,i))))
-            {   /* At this point we *know* there's a change.  The
-                 * only question remaining is are there any more
-                 * clients interested in this specific request.  If
-                 * so, *don't* swap this process!
-                 */
-                if (BitIsTrue(dflags,XETrapRequest))
-                {   /* Client wants the XTrap rtn */
-                    if (++(vectored_requests[i]) <= 1L)
-                    {   /* first client, so do it */
-                        _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i]));
-                    }
-                }
-                else
-                {   /* Client wants the *real* rtn */
-                    if (--(vectored_requests[i]) <= 0L)
-                    {   /* No more clients using, so do it */
-                        _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i]));
-                    }
-                }
-                if (status == Success)
-                {
-                    BitToggle(penv->cur.data_config_flags_req,i);
-                }
-            }
-        }
-    }
-    /* Check & Set the boolean flags */
-    if (status == Success)
-    {
-        _CheckChangeBit(vflags,dflags,bit_flags,XETrapCmdKeyMod);
-        _CheckChangeBit(vflags,dflags,bit_flags,XETrapTimestamp);
-        _CheckChangeBit(vflags,dflags,bit_flags,XETrapWinXY);
-/*        _CheckChangeBit(vflags,dflags,bit_flags,XETrapCursor); */
-#ifdef COLOR_REPLIES
-        _CheckChangeBit(vflags,dflags,bit_flags,XETrapColorReplies);
-#endif /* COLOR_REPLIES */
-        if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapGrabServer))
-        {   /* Let any client uncoditionally set/clear Grabs */
-            ignore_grabs = BitValue(dflags, XETrapGrabServer);
-        }
-    }
-    /* The statistics vflag/dflag mechanism is a little different
-     * from most.  The dflag is initially set to 0 to indicate no
-     * statistics.  When a config request comes in to request
-     * statistics, memory's allocated and the dflag is set.
-     * Thereafter, whenever a client wants to clear the counters, he
-     * simply sets the vflag and clears the dflag.  Multiple requests
-     * for statistics configuration are ignored, and the stats memory is
-     * free'd only when the client disconnects.
-     */
-    if (status == Success)
-    {
-        if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapStatistics))
-        {
-            if (BitIsTrue(dflags,XETrapStatistics))
-            {   /* Do we need to allocate memory? */
-                if (penv->stats == NULL && (penv->stats =
-                    (xXTrapGetStatsReply *)Xcalloc(sizeof(xXTrapGetStatsReply)))
-                    != NULL)
-                {   /* Set up the reply header  */
-                    penv->stats->type  = X_Reply;
-                    penv->stats->length = XEXTRA(xXTrapGetStatsReply);
-                    /* add accelerator node for stats clients list */
-                    status = add_accelerator_node(penv->client, &stats_clients);
-                }
-                else if (penv->stats == NULL)
-                {   /* No Memory! */
-                    status = BadAlloc;
-                }
-            }
-            else
-            {   /* Zero out counters */
-                (void)memset(penv->stats->data.requests, 0L, 
-                    sizeof(penv->stats->data.requests));
-                (void)memset(penv->stats->data.events, 0L,
-                    sizeof(penv->stats->data.events));
-                /* Re-cock the Stat's flag so that it'll
-                 * sense a change for next zero'ing out
-                 * of the counters.
-                 */
-                BitTrue(penv->cur.data_config_flags_data, XETrapStatistics);
-            }
-        }
-    }    
-    return(status);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sets the XETrapTrapActive bit to indicate that Trapping
- *      of requests and/or core events to the client may take place.
- *
- */
-int XETrapStartTrap(xXTrapReq *request, ClientPtr client)
-{
-    XETrapEnv *penv = XETenv[client->index];
-    int status = add_accelerator_node(penv->client, &io_clients);
-    if (status == Success)
-    {
-        BitTrue(penv->cur.data_state_flags, XETrapTrapActive);
-    }
-    return(status);
-}
-/*
- *  DESCRIPTION:
- *
- *      This function clears the XETrapTrapActive bit to indicate that Trapping
- *      of requests and/or core events to the client may *not* take place.
- *
- */
-int XETrapStopTrap(xXTrapReq *request, ClientPtr client)
-{
-    XETrapEnv *penv = XETenv[client->index];
-
-    remove_accelerator_node(penv->client, &io_clients);
-    BitFalse(penv->cur.data_state_flags, XETrapTrapActive);
-    return(Success);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sends a reply back to the requesting client indicating
- *      the specific XTrap version of this extension.
- */
-int XETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
-{
-    xXTrapGetVersReply ver_rep;
-    XETrapEnv *penv = XETenv[client->index];
-
-    update_protocol(request,client);    /* to agree on protocol version */
-    /* Initialize the reply as needed */
-    ver_rep.hdr.type = X_Reply;
-    ver_rep.hdr.detail = XETrap_GetVersion;
-    ver_rep.hdr.sequenceNumber = client->sequence;
-    ver_rep.hdr.length = XEXTRA(xXTrapGetVersReply);
-    ver_rep.data.xtrap_release = XETrap_avail.data.xtrap_release;
-    ver_rep.data.xtrap_version = XETrap_avail.data.xtrap_version;
-    ver_rep.data.xtrap_revision = XETrap_avail.data.xtrap_revision;
-    ver_rep.data.xtrap_protocol = penv->protocol; /* return agreed protocol */
-    WriteReplyToClient(client, sizeof(xXTrapGetVersReply), &ver_rep);
-    return(Success);
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function sends a reply back to the requesting client indicating
- *      the specific XTrap version of this extension.
- */
-int XETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
-{
-    xXTrapGetLITimReply tim_rep;
-    XETrapEnv *penv = XETenv[client->index];
-
-    /* Initialize the reply as needed */
-    tim_rep.hdr.type = X_Reply;
-    tim_rep.hdr.detail = XETrap_GetLastInpTime;
-    tim_rep.hdr.sequenceNumber = client->sequence;
-    tim_rep.hdr.length = XEXTRA(xXTrapGetLITimReply);
-    tim_rep.data_last_time = penv->last_input_time;
-    WriteReplyToClient(client, sizeof(xXTrapGetLITimReply), &tim_rep);
-    return(Success);
-}
-
-/*
- *  DESCRIPTION:
- *
- *  This routine is swapped in for the server's output request vectors.   
- *  After writing the request to one (or more) XTrap client(s), this
- *  routine ALWAYS returns by calling the REAL output request vector rtn.
- * 
- *  Note: Swapped Requests are handled automatically since the unswapped
- *        vectored routine is called after the request has been swapped.
- *        IOW, all requests are directed through ProcVector eventually and are
- *        "unswapped" at that point.  It is necessary to swap the data
- *        back if writing to a swapped client, however, and this is done
- *        by calling the appropriate XETSwProcVector[] routine.
- */
-int XETrapRequestVector(ClientPtr client)
-{
-    int status = True;
-    XETrapDatum *pdata, *spdata = NULL;
-    REQUEST(xResourceReq);
-    WindowPtr window_ptr;
-    XETrapEnv *penv;
-    BYTE *tptr;
-    ClientList *ioc = &io_clients;
-    ClientList *stc = &stats_clients;
-    INT32 asize = sizeof(pdata->hdr) + stuff->length * sizeof(CARD32);
-    INT32 size = MAX(asize,XETrapMinPktSize); /* Must be at least */
-    INT32 csize;    /* size of request to send to the XTrap client */
-
-    /* Get memory for the data to be sent */
-    if ((pdata = (XETrapDatum *)Xcalloc(size)) == NULL)
-    {   /* Can't do anything accept set a flag since we don't
-         * know who to send the error to yet.
-         */
-        status = False;
-    }
-
-    while (ioc->next != NULL)
-    {
-        ioc = ioc->next;
-        penv = XETenv[ioc->client->index];
-        if (status == False)
-        {   /* We didn't get the memory! Complain */
-            SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
-                stuff->reqType, 0L, BadAlloc);
-            break;
-        }
-        if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
-        {   /* This particular client is interested in *this* request */
-            pdata->hdr.client = client->index;  /* stuff client index in hdr */
-            if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
-            {
-		if (Success != dixLookupDrawable(&window_ptr, stuff->id,
-						 client, 0, DixUnknownAccess))
-                {   /* Failed...invalidate the X and Y coordinate data. */
-                    pdata->hdr.win_x = -1L;
-                    pdata->hdr.win_y = -1L;
-                }
-                else
-                {
-                    pdata->hdr.screen = window_ptr->drawable.pScreen->myNum;
-                    pdata->hdr.win_x = window_ptr->drawable.x;
-                    pdata->hdr.win_y = window_ptr->drawable.y;
-                }
-            }
-            if (BitIsTrue(penv->cur.data_config_flags_data,XETrapTimestamp))
-            {
-                pdata->hdr.timestamp = GetTimeInMillis();
-            }
-            /* Copy the information to a location we can write it from */
-            (void) memcpy(&(pdata->u.req),stuff,stuff->length*sizeof(CARD32));
-            pdata->hdr.count = MIN(penv->cur.data_config_max_pkt_size,asize);
-            XETrapSetHeaderRequest(&(pdata->hdr));
-    
-            /* Perform any needed byte/word swapping. NOTE: This is not
-             * the "normal" technique that should be used to perform the
-             * swapping. The reason that we do it here is to be sure to
-             * do it only once in a controlled manner, which we can not
-             * guarentee in the case of the Xlib transport. Notice that
-             * we don't swap the XTRAP EVENT information.  This is done
-             * in the XETrapWriteXLib() routine.
-             */
-
-            if (penv->client->swapped)
-            {   /* need to deal with swapped clients */
-                if (spdata == NULL)
-                {   /* Get memory for the swapped data to be sent */
-                    if ((spdata = (XETrapDatum *)Xcalloc(size)) == NULL)
-                    {
-                        SendErrorToClient(penv->client,
-                            XETrap_avail.data.major_opcode,
-                            stuff->reqType, 0L, BadAlloc);
-                        break;
-                    }
-
-                    memcpy(spdata,pdata,size);  /* fill in the info */
-                    /* Now call the request-specific rtn to swap the request */
-                    if (stuff->reqType < 128)
-                    {   /* a core request, good */
-                        (*XETSwProcVector[stuff->reqType])(&(spdata->u.req),
-			    penv->client);	/* RTC X11R6 */
-                    }
-                    else if (penv->cur.data_config_max_pkt_size == 
-                        XETrapMinPktSize)
-                    {   /* Minimum size, so swap it as an ResourceReq */
-                        XETSwResourceReq(&(spdata->u.req));
-                    }
-                    else
-                    {   /* trying to swap an extension request! */
-                        SendErrorToClient(penv->client,
-                            XETrap_avail.data.major_opcode,
-                            stuff->reqType, 0L, XETrapErrorBase + BadSwapReq);
-                    }
-                }
-                /* need to stow in the latest header (count) */
-                memcpy(spdata,pdata,SIZEOF(XETrapHeader));
-                sXETrapHeader(&(spdata->hdr));  /* swap the XTrap Header */
-            }
-            /* Write as many bytes of information as the client wants */
-            tptr = (BYTE *)(penv->client->swapped ? spdata : pdata);
-            csize = MAX(pdata->hdr.count, XETrapMinPktSize);
-            if (XETrapWriteXLib(penv, tptr, csize) != csize)
-            {
-                SendErrorToClient(penv->client,XETrap_avail.data.major_opcode,
-                    stuff->reqType, 0L, XETrapErrorBase + BadIO);
-            }
-#ifdef COLOR_REPLIES
-            /* Process Color Replies, if desired, and applicable */
-            if (BitIsTrue(penv->cur.data_config_flags_data,XETrapColorReplies))
-            {    /* wants color replies */
-                switch(stuff->reqType)
-                {
-                    case X_AllocColor:
-                        GetSendColorRep(client, stuff);
-                        break;
-                    case X_AllocNamedColor:
-                        GetSendNamedColorRep(client, stuff);
-                        break;
-                    case X_AllocColorCells:
-                        GetSendColorCellsRep(client, stuff);
-                        break;
-                    case X_AllocColorPlanes:
-                        GetSendColorPlanesRep(client, stuff);
-                        break;
-                    default:
-                        break;
-                }
-            }
-#endif /* COLOR_REPLIES */
-        }
-    }
-    while (stc->next != NULL)
-    {   /* increment appropriate stats bucket for each interested client */
-        stc = stc->next;
-        penv = XETenv[stc->client->index];
-        if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType))
-        {   /* This particular client would like this particular stat */
-            penv->stats->data.requests[stuff->reqType]++;
-        }
-    }
-
-    if (pdata)
-    {
-        Xfree(pdata);
-    }
-    if (spdata)
-    {
-        Xfree(spdata);
-    }
-    if (ignore_grabs == True &&
-        (stuff->reqType == X_GrabServer || stuff->reqType == X_UngrabServer))
-    {    /* doesn't want Grab's! Note: this is a "last configured" setting */
-#ifndef NO_NEW_XTRAP
-	int status;
-
-	if (stuff->reqType == X_GrabServer)
-	{
-	    ClientList *pclient;
-
-	    /* first call grab server procedure */
-	    status = (*XETrapProcVector[stuff->reqType])(client);
-
-	    /* then add XTrap controlling clients */
-	    for (pclient = &io_clients; pclient; pclient = pclient->next)
-		if (pclient->client)
-		    MakeClientGrabImpervious(pclient->client);
-	}
-	else
-	{
-	    ClientList *pclient;
-
-	    /* first drop XTrap controlling clients */
-	    for (pclient = &io_clients; pclient; pclient = pclient->next)
-		if (pclient->client)
-		    MakeClientGrabPervious(pclient->client);
-
-	    /* then call ungrab server procedure */
-	    status = (*XETrapProcVector[stuff->reqType])(client);
-	}
-	return status;
-#else /* NO_NEW_XTRAP */
-        return(Success);
-#endif /* NO_NEW_XTRAP */
-    }
-    else
-    {
-        return((*XETrapProcVector[stuff->reqType])(client));
-    }
-}
-/*
- *
- *  DESCRIPTION:
- *
- *      This routine intercepts input xEvents from the keyboard.
- *      if XETrapTrapActive, will write record to client(s)
- *      and then pass the event to the server iff not command
- *      key and gate is open.  If it's a command key, then twiddle
- *      the gate state as required (optional, see below).
- *
- *      This routine implements an optional user specified command key
- *      that can be used to close the input pipe into the server
- *      while a client command is generated.  The keypress of the
- *      command key places this routine in command mode, the keyrelease
- *      exits command mode.  
- *
- *      A keypress of the command key followed by the
- *      optionally specified lock key will place this routine in continuous
- *      command mode until the command key and lock key are pressed again
- *      to exit command mode.  In the locked state, the client interprets
- *      keystrokes as it wishes, as commands or as input to a prior command.
- *
- *      Both mechanisms can be used alternately.
- *
- *  IMPLICIT INPUTS :
- *
- *      penv->cur.data_config_cmd_key :
- *                    This is the keycode of the key that is used to stop
- *                    and restart the transmission of intercepted input 
- *                    events to the server.  If specified, the gate_state
- *                    flag will be set or cleared depending on the state of
- *                    the command_key.
- *
- *      penv->cur.data_config_flags_data.XETrapCmdKeyMod:
- *                    This is the value of the mode in which the command_key
- *                    will operate.  It currently has two values: MODIFIER and
- *                    COMMAND_LOCK.  MODIFIER mode clears gate_state on
- *                    keypress, and sets gate_state on keyrelease.
- *                    COMMAND_LOCK mode toggles gate_state on
- *                    or off.
- *
- *      gate_closed:
- *                    A flag that is set/cleared in the xtrap_keyboard
- *                    routine that indicates whether intercepted input
- *                    should be passed to the server at any particular
- *                    instance.
- *
- *
- *      next_key:
- *                    This variable tracks the state of the next key to be
- *                    pressed or released.  It allows the checking of double
- *                    presses of the command key to be sent to the server and
- *                    keeps good state order when the command key is used.
- *
- *      key_ignore:
- *                   This variable indicates whether or not the specific
- *                   key should be ignored for subsequent server processing.
- *
- */
-int XETrapKeyboard(xEvent *x_event, DevicePtr keybd, int count)
-{                     
-    register BYTE  type   = x_event->u.u.type;
-    register BYTE  detail = x_event->u.u.detail;
-    XETrapEnv *penv;
-    ClientList *stc = &stats_clients;
-    ClientList *cmc = &cmd_clients;
-    int_function cur_func = XETrapKeyboard;
-
-#ifdef VERBOSE
-    if (count != 1L)
-    {   /* We haven't coded for this situation yet! */
-        ErrorF("Warning! Event count != 1 (%d)\n", count);
-    }
-#endif
-    while (stc->next != NULL)
-    {   /* increment appropriate stats bucket for each interested client */
-        stc = stc->next;
-        penv = XETenv[stc->client->index];
-        if (BitIsTrue(penv->cur.data_config_flags_event,type))
-        {   /* This particular client would like this particular stat */
-            penv->stats->data.events[type]++;
-        }
-    }
-#ifndef VECTORED_EVENTS
-    /* We *only* StampAndMail command keys with vectored events since
-     * we get much more data by waiting till we get called in XETrapEventVector
-     */
-    XETrapStampAndMail(x_event);  /* send to XTrap client if necessry */
-#endif
-    while (cmc->next != NULL)
-    {
-        cmc = cmc->next;
-        penv = XETenv[cmc->client->index];
-        key_ignore = False;
-        if (detail == penv->cur.data_config_cmd_key)
-        {
-            if (BitIsTrue(penv->cur.data_config_flags_data, XETrapCmdKeyMod))
-            {
-                switch (type) 
-                {
-                    case KeyPress:
-                        if (next_key == XEKeyIsEcho)
-                        {
-                            break;
-                        }
-                        gate_closed = True;
-                        next_key = XEKeyIsClear;
-                        break;
-    
-                    case KeyRelease:
-                        if (next_key == XEKeyIsEcho)
-                        {
-                            next_key = XEKeyIsClear;
-                            break;
-                        }
-                        if (next_key == XEKeyIsClear)
-                        {
-                            next_key = XEKeyIsEcho;
-                        }
-                        else
-                        {   /* it's Other, so Clear it */
-                            next_key = XEKeyIsClear;
-                        }
-                        gate_closed = False;
-                        key_ignore = True;
-                        break;
-    
-                    default: break;
-                }
-            }
-            else
-            {
-                switch (type)
-                {
-                    case KeyPress:
-                        if (next_key == XEKeyIsEcho)
-                        {
-                            gate_closed = False;
-                            break;
-                        }
-                        /* Open gate on cmd key release */
-                        if ((next_key == XEKeyIsOther) && 
-                            gate_closed == True)
-                        {
-                            break;
-                        }
-                        gate_closed = True;
-                        next_key = XEKeyIsClear;
-                        break;
-    
-                    case KeyRelease:
-                        if (next_key == XEKeyIsClear)
-                        {
-                            next_key = XEKeyIsEcho;
-                            break;
-                        }
-    
-                        if (next_key == XEKeyIsEcho)
-                        {
-                            next_key = XEKeyIsClear;
-                            break;
-                        }
-    
-                        gate_closed = False;
-                        key_ignore = True;
-                        next_key = XEKeyIsClear;
-                        break;
-    
-                    default: 
-                        break;
-                }
-            }
-        }
-        else
-        {
-            next_key = XEKeyIsOther;
-        }
-    }            
-
-    /*
-     *  If the gate to the server is open, 
-     *  and we are not ignoring a keyrelease,
-     *  pass the event to the server for normal processing.
-     */
-#ifndef VECTORED_EVENTS
-    if ((gate_closed == False) && (key_ignore == False))
-    {
-        if (XETrapEventProcVector[type] != cur_func)
-        {   /* to protect us from infinite loops */
-            (void)(*XETrapEventProcVector[type])(x_event,keybd,count);
-        }
-        else
-        {
-            (void)(*EventProcVector[type])(x_event,keybd,count);
-        }
-    }
-#else  /* VECTORED_EVENTS */
-    if ((gate_closed == False) && (key_ignore == False))
-    {   /* send event on to server to be trapped again in XETrapEventVector */
-        (void)(*keybd_process_inp)(x_event,keybd,count);
-    }
-    else
-    {
-        XETrapStampAndMail(x_event);  /* send to XTrap client if necessry */
-    }
-#endif
-    key_ignore = False; /* reset for next time around */
-    return 0;
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This routine intercepts input xEvents from the pointer device
- *      and passes the input event back to the server for normal processing.
- *
- *      This routine is sensitive to whether input is being passed
- *      up to the server or not.  This state is set by the keyboard
- *      input routine.
- *
- *
- */
-#ifndef VECTORED_EVENTS
-int XETrapPointer(xEvent *x_event, DevicePtr ptrdev, int count)
-{
-    XETrapEnv *penv;
-    ClientList *stc = &stats_clients;
-    int_function cur_func = XETrapPointer;
-
-#ifdef VERBOSE
-    if (count != 1L)
-    {   /* We haven't coded for this situation yet! */
-        ErrorF("Warning! Event count != 1 (%d)\n", count);
-    }
-#endif
-    while (stc->next != NULL)
-    {   /* increment appropriate stats bucket for each interested client */
-        stc = stc->next;
-        penv = XETenv[stc->client->index];
-        if (BitIsTrue(penv->cur.data_config_flags_event,x_event->u.u.type))
-        {   /* This particular client would like this particular stat */
-            penv->stats->data.events[x_event->u.u.type]++;
-        }
-    }
-    XETrapStampAndMail(x_event);  /* send to XTrap client if necessry */
-    /*
-     *  If the gate to the server is open,
-     *  pass the event up like nothing has happened.
-     */
-    if (gate_closed == False)
-    {
-        if (XETrapEventProcVector[x_event->u.u.type] != cur_func)
-        {   /* to protect us from infinite loops */
-            (void)(*XETrapEventProcVector[x_event->u.u.type])(x_event,ptrdev,
-                count);
-        }
-        else
-        {
-            (void)(*EventProcVector[x_event->u.u.type])(x_event,ptrdev,count);
-        }
-    }
-    return 0;
-}
-#endif /* !VECTORED_EVENTS */
-
-
-/*
- *  DESCRIPTION:
- *
- *      This routine determines whether it needs to send event data
- *      to the XTrap Client(s).  If so, it timestamps it appropriately
- *      and writes out both the header and detail information.
- *
- */
-void XETrapStampAndMail(xEvent *x_event)
-{
-    XETrapDatum data;
-    register CARD32 size;
-    XETrapEnv *penv;
-    ClientList *ioc = &io_clients;
-
-    /* Currently, we're intercepting core events *before* most
-     * of the event information's filled in.  Specifically, the
-     * only fields that are valid at this level are: type, detail,
-     * time, rootX, rootY, and state.
-     */
-    /* Loop through all clients wishing I/O */
-    while (ioc->next != NULL)
-    {
-        ioc = ioc->next;
-        penv = XETenv[ioc->client->index];
-        /* Do we have a valid fd? Do we care about this event? */
-        if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
-        {
-            XETrapSetHeaderEvent(&(data.hdr));
-            data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
-            data.hdr.screen = 0L;   /* not till Events are vectored! */
-            data.hdr.client = 0L;   /* not till Events are vectored! */
-            if (BitIsTrue(penv->cur.data_config_flags_data,
-                XETrapTimestamp))
-            {
-                data.hdr.timestamp = GetTimeInMillis();
-            }
-            size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
-            penv->last_input_time = x_event->u.keyButtonPointer.time;
-            /* Copy the event information into our local memory */
-            (void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
-
-#ifdef PANORAMIX
-	    if (!noPanoramiXExtension &&
-                (data.u.event.u.u.type == MotionNotify ||
-                data.u.event.u.u.type == ButtonPress ||
-                data.u.event.u.u.type == ButtonRelease ||
-                data.u.event.u.u.type == KeyPress ||
-                data.u.event.u.u.type == KeyRelease)) {
-		    int scr = XineramaGetCursorScreen(inputInfo.pointer);
-		    data.u.event.u.keyButtonPointer.rootX +=
-			panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x;
-		    data.u.event.u.keyButtonPointer.rootY +=
-			panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y;
-	    }
-#endif
-
-            if (penv->client->swapped)
-            {   /* 
-                 * Notice that we don't swap the XTRAP EVENT information.  
-                 * This is done in the XETrapWriteXLib() routine.
-                 */
-                xEvent ToEvent;
-                (*EventSwapVector[data.u.event.u.u.type & 0177])
-                    (&data.u.event,&ToEvent);
-                (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
-                sXETrapHeader(&(data.hdr));  /* swap the XTrap Header */
-            }
-            /* From this point on, the contents of data is swapped and
-             * therefore we should not refer to it for information.
-             */
-            if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
-            {
-                SendErrorToClient(penv->client,
-                    XETrap_avail.data.major_opcode,
-                    x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
-            }
-        }
-    }
-    return;
-}
-#ifdef VECTORED_EVENTS
-int XETrapEventVector(ClientPtr client, xEvent *x_event)
-{
-    XETrapDatum data;
-    register CARD32 size;
-    XETrapEnv *penv;
-    ClientList *ioc = &io_clients;
-
-    /* Loop through all clients wishing I/O */
-    while (ioc->next != NULL)
-    {
-        ioc = ioc->next;
-        penv = XETenv[ioc->client->index];
-        /* Do we care about this event? */
-        if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type))
-        {
-            XETrapSetHeaderEvent(&(data.hdr));
-            data.hdr.client = client->index;
-            data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */
-            if ((current_screen < 0L) || ((x_event->u.u.type >= KeyPress) && 
-                (x_event->u.u.type <= MotionNotify) && 
-                (!x_event->u.keyButtonPointer.sameScreen)))
-            {   /* we've moved/warped to another screen */
-		/* XXX: we're getting the client's pointer root window.
-		 * is this correct?  Should it be the client's keyboard? */
-                WindowPtr root_win = GetCurrentRootWindow(PickPointer(client));
-                current_screen = root_win->drawable.pScreen->myNum;
-            }
-            data.hdr.screen = current_screen;
-            if (BitIsTrue(penv->cur.data_config_flags_data,
-                XETrapTimestamp))
-            {
-                data.hdr.timestamp = GetTimeInMillis();
-            }
-            size = data.hdr.count = XETrapMinPktSize; /* Always for evts */
-            penv->last_input_time = x_event->u.keyButtonPointer.time;
-            /* Copy the event information into our local memory */
-            (void)memcpy(&(data.u.event),x_event,sizeof(xEvent));
-    
-            if (penv->client->swapped)
-            {
-                xEvent ToEvent;
-                (*EventSwapVector[data.u.event.u.u.type & 0177])
-                    (&data.u.event,&ToEvent);
-                (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent));
-                sXETrapHeader(&(data.hdr));  /* swap the XTrap Header */
-            }
-            /* From this point on, the contents of pdata is swapped and
-             * therefore we should not refer to it for information.
-             */
-            if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size)
-            {
-                SendErrorToClient(penv->client,
-                    XETrap_avail.data.major_opcode,
-                    x_event->u.u.type, 0L, XETrapErrorBase + BadIO);
-            }
-        }
-    }
-    return;
-}
-#endif /* VECTORED_EVENTS */
-void sReplyXTrapDispatch(ClientPtr client, int size, char *reply)
-{
-    register XETrapRepHdr *rep = (XETrapRepHdr *)reply;
-
-    switch(rep->detail)
-    {   
-        case XETrap_GetAvailable:
-            {   
-                xXTrapGetAvailReply lrep;
-                (void)memcpy((char *)&lrep,reply,sizeof(lrep));
-                sReplyXETrapGetAvail(client,size,(char *)&lrep);
-            }
-            break;
-        case XETrap_GetCurrent:
-            {   
-                xXTrapGetCurReply lrep;
-                (void)memcpy((char *)&lrep,reply,sizeof(lrep));
-                sReplyXETrapGetCur(client,size,(char *)&lrep);
-            }
-            break;
-        case XETrap_GetStatistics:
-            {   
-                xXTrapGetStatsReply lrep;
-                (void)memcpy((char *)&lrep,reply,sizeof(lrep));
-                sReplyXETrapGetStats(client,size,(char *)&lrep);
-            }
-            break;
-        case XETrap_GetVersion:
-            {   
-                xXTrapGetVersReply lrep;
-                (void)memcpy((char *)&lrep,reply,sizeof(lrep));
-                sReplyXETrapGetVers(client,size,(char *)&lrep);
-            }
-            break;
-        case XETrap_GetLastInpTime:
-            {   
-                xXTrapGetLITimReply lrep;
-                (void)memcpy((char *)&lrep,reply,sizeof(lrep));
-                sReplyXETrapGetLITim(client,size,(char *)&lrep);
-            }
-            break;
-        default:
-            SendErrorToClient(client,XETrap_avail.data.major_opcode,
-                rep->detail, 0L, BadImplementation);
-            break;
-    }
-    return;
-}
-
-/* 
- * XLib communications routines 
- */
-
-/*
- *  DESCRIPTION:
- *
- *      This function performs the transport specific functions required
- *      for writing data back to an XTrap client over XLib.  The trick is
- *      packaging the data into <=32 byte packets to conform to the sizeof
- *      an X Event.  nbytes must be at least equal to XETrapMinPktSize
- *
- */
-int XETrapWriteXLib(XETrapEnv *penv, BYTE *data, CARD32 nbytes)
-{
-    CARD32 size, total = 0L;
-    xETrapDataEvent event;
-
-    /* Initialize the detail field to show the beginning of a datum */
-    event.detail = XETrapDataStart;
-    event.idx = 0L;
-
-    /* This loop could be optimized by not calling Write until after all
-     * of the events are packaged. However, this would require memory
-     * games, and may not therefore be a win.
-     */
-    while (nbytes > 0L)
-    {   /* How many bytes can we send in this packet */
-        size = (nbytes > sz_EventData) ? sz_EventData : nbytes;
-
-        /* Initialize the event */
-        event.type = XETrapData + XETrap_avail.data.event_base;
-        event.sequenceNumber = penv->client->sequence;
-
-        /* Copy the data we are sending */
-        (void)memcpy(event.data,data,size);
-        if (size < sz_EventData)
-            (void)memset(event.data+size,0L,sz_EventData-size);
-        data += size;
-        nbytes -= size;
-        total += size;
-
-        /* Set the detail field to show the continuation of datum */
-        if (total != size)
-        {   /* this is not the first one */
-            event.detail = (nbytes > 0) ? XETrapDataContinued : XETrapDataLast;
-        }
-
-        /* Send this part to the client */
-        WriteEventsToClient(penv->client, 1L, (xEvent *) &event);
-        event.idx++;      /* Bump the index for the next event */
-    }
-    return(total);
-}
-
-/*----------------------------*
- *  Static Functions
- *----------------------------*/
-
-static void update_protocol(xXTrapGetReq *reqptr, ClientPtr client)
-{
-    XETrapEnv *penv = XETenv[client->index];
-    /* update protocol number */
-    switch (reqptr->protocol)
-    {
-        /* known acceptable protocols */
-        case 31:
-        case XETrapProtocol:
-            penv->protocol = reqptr->protocol;
-            break;
-        /* all else */
-        default:    /* stay backwards compatible */
-            penv->protocol = 31;
-            break;
-    }
-}
-
-/* Swap 2 functions. This is a function instead of a macro to help to keep
- * lint from complaining about mixed types. It seems to work, but I would
- * probably classify this as a hack.
- */
-static void _SwapProc( register int (**f1)(void), register int (**f2)(void))
-{
-    register int (*t1)(void) = *f1;
-    *f1 = *f2;
-    *f2 = t1;
-
-    return;
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function swaps the byte order of fields within
- *      the XTrap Event Header.  It assumes the data will be
- *	swapped by code in XETrapRequestVector().
- *
- */
-static void sXETrapEvent(xETrapDataEvent *from, xETrapDataEvent *to)
-{
-    to->type = from->type;
-    to->detail = from->detail;
-    cpswaps(from->sequenceNumber,to->sequenceNumber);
-    cpswapl(from->idx,to->idx);
-    /* Assumes that the data's already been swapped by XETrapRequestVector */
-    memcpy(to->data, from->data, SIZEOF(EventData));
-}
-
-/*
- *  DESCRIPTION:
- *
- *      This function adds a node from an accelerator linked-list
- *      (either io_clients, stats_clients, or cmd_clients).
- *
- */
-static int add_accelerator_node(ClientPtr client, ClientList *accel)
-{
-    Bool found = False;
-    int status = Success;
-
-    while (accel->next != NULL)
-    {
-        if (accel->client == client)
-        {
-            found = True;   /* Client's already known */
-            break;
-        }
-        else
-        {
-            accel = accel->next;
-        }
-    }
-    if (found == False)
-    {
-        if ((accel->next = (ClientList *)Xcalloc(sizeof(ClientList))) == NULL)
-        {
-            status = BadAlloc;
-        }
-        else
-        {   /* fill in the node */
-            accel = accel->next;
-            accel->next   = NULL;
-            accel->client = client;
-        }
-    }
-    return(status);
-}
-/*
- *  DESCRIPTION:
- *
- *      This function removes a node from an accelerator linked-list
- *      (either io_clients, stats_clients, or cmd_clients).
- *
- */
-static void remove_accelerator_node(ClientPtr client, ClientList *accel)
-{
-    while (accel->next != NULL)
-    {
-        if (accel->next->client == client)
-        {
-            ClientList *tmp = accel->next->next;
-            Xfree(accel->next);
-            accel->next = tmp;
-            break;
-        }
-        else
-        {
-            accel = accel->next;
-        }
-    }
-
-    return;
-}
-
-#ifdef COLOR_REPLIES
-static void GetSendColorRep(ClientPtr client, xResourceReq *req)
-{   /* adapted from ProcAllocColor() in dispatch.c */
-    XETrapDatum data;
-    int retval;
-    XETrapEnv *penv = XETenv[client->index];
-    xAllocColorReply *crep = (xAllocColorReply *)&(data.u.reply);
-    xAllocColorReq   *creq = (xAllocColorReq *)req;
-    ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
-    /* Fill in the header fields */
-    data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
-    XETrapSetHeaderReply(&(data.hdr));
-    /* Hack alert:
-     * We need to pass the "reply" type in the header since replies don't
-     * contain the id's themselves.  However, we're not changing the
-     * protocol to support this until we decide exactly how we want to
-     * do *all* replies (e.g. not just ColorReplies).  So until then, stow
-     * the reply id in the screen field which wouldn't normally be used in
-     * this context.
-     */
-    data.hdr.screen = req->reqType;
-    if (!pmap)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadColor);
-        return;
-    }
-    crep->red   = creq->red;
-    crep->green = creq->green;
-    crep->blue  = creq->blue;
-    crep->pixel = 0;
-    if ((retval = AllocColor(pmap, &(crep->red), &(crep->green),
-        &(crep->blue), &(crep->pixel), client->index)) != Success)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, retval);
-        return;
-    }
-    /* Swap data if necessary */
-    if (client->swapped)
-    {
-        INT32 n;
-        swaps(&(crep->red), n);
-        swaps(&(crep->green), n);
-        swaps(&(crep->blue), n);
-        swapl(&(crep->pixel), n);
-    }
-    /* Send data to client */
-    if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) 
-        != XETrapMinPktSize)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, XETrapErrorBase + BadIO);
-    }
-}
-
-static void GetSendNamedColorRep(ClientPtr client, xResourceReq *req)
-{   /* adapted from ProcAllocNamedColor() in dispatch.c */
-    XETrapDatum data;
-    XETrapEnv *penv = XETenv[client->index];
-    int retval;
-    xAllocNamedColorReply *nrep = (xAllocNamedColorReply *)&(data.u.reply);
-    xAllocNamedColorReq   *nreq = (xAllocNamedColorReq *)req;
-    ColormapPtr pcmp = (ColormapPtr )LookupIDByType(nreq->cmap, RT_COLORMAP);
-
-    data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */
-    XETrapSetHeaderReply(&(data.hdr));
-    /* Hack alert:
-     * We need to pass the "reply" type in the header since replies don't
-     * contain the id's themselves.  However, we're not changing the
-     * protocol to support this until we decide exactly how we want to
-     * do *all* replies (e.g. not just ColorReplies).  So until then, stow
-     * the reply id in the screen field which wouldn't normally be used in
-     * this context.
-     */
-    data.hdr.screen = req->reqType;
-    if (!pcmp)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadColor);
-        return;
-    }
-    if (!OsLookupColor(pcmp->pScreen->myNum, (char *)&nreq[1], 
-        nreq->nbytes, &(nrep->exactRed), &(nrep->exactGreen), 
-        &(nrep->exactBlue)))
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadName);
-        return;
-    }
-    nrep->screenRed     = nrep->exactRed;
-    nrep->screenGreen   = nrep->exactGreen;
-    nrep->screenBlue    = nrep->exactBlue;
-    nrep->pixel         = 0;
-    if ((retval = AllocColor(pcmp, &(nrep->screenRed), 
-        &(nrep->screenGreen), &(nrep->screenBlue), &(nrep->pixel), 
-        client->index)) != Success)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, retval);
-        return;
-    }
-    /* Swap data if necessary */
-    if (client->swapped)
-    {
-        INT32 n;
-        swapl(&(nrep->pixel), n);
-        swaps(&(nrep->exactRed), n);
-        swaps(&(nrep->exactGreen), n);
-        swaps(&(nrep->exactBlue), n);
-        swaps(&(nrep->screenRed), n);
-        swaps(&(nrep->screenGreen), n);
-        swaps(&(nrep->screenBlue), n);
-    }
-
-    /* Send data to client */
-    if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) 
-        != XETrapMinPktSize)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, XETrapErrorBase + BadIO);
-    }
-}
-
-static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req)
-{   /* adapted from ProcAllocColorCells() in dispatch.c */
-    int                   retval;
-    int                   npixels, nmasks;
-    unsigned long         *ppixels, *pmasks;
-    long                  length;
-    XETrapDatum           *data;
-    XETrapEnv             *penv = XETenv[client->index];
-    xAllocColorCellsReply *crep;
-    xAllocColorCellsReq   *creq = (xAllocColorCellsReq *)req;
-    ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
-    if (!pmap)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadColor);
-        return;
-    }
-    npixels = creq->colors;
-    if (!npixels)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadValue);
-        return;
-    }
-    nmasks = creq->planes;
-    length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
-    data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length);
-    if (!data)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadAlloc);
-        return;
-    }
-    data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
-        sizeof(XETrapDatum)+length);
-    XETrapSetHeaderReply(&(data->hdr));
-    data->hdr.screen = req->reqType;    /* hack! but necessary */
-    ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
-    pmasks = ppixels + npixels;
-    if ((retval = AllocColorCells(client->index, pmap, npixels, 
-        nmasks, (Bool)creq->contiguous, ppixels, pmasks)) != Success)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, retval);
-        xfree(data);
-        return;
-    }
-    crep = (xAllocColorCellsReply *)&(data->u.reply);
-    crep->nPixels = npixels;
-    crep->nMasks  = nmasks;
-    /* Swap data if necessary */
-    if (client->swapped)
-    {
-        INT32 n, i, *ptr;
-        ptr=(INT32 *)ppixels;
-        swaps(&(crep->nPixels), n);
-        swaps(&(crep->nMasks), n);
-        for (i=0; i<length; i++)
-        {
-            swapl(&(ptr[i]), n);
-        }
-    }
-    /* Send data to client */
-    if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count) 
-        != data->hdr.count)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, XETrapErrorBase + BadIO);
-    }
-    xfree(data);
-}
-static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req)
-{   /* adapted from ProcAllocColorPlanes() in dispatch.c */
-    int                   retval;
-    int                   npixels, nmasks;
-    unsigned long         *ppixels, *pmasks;
-    long                  length;
-    XETrapDatum           *data;
-    XETrapEnv             *penv = XETenv[client->index];
-    xAllocColorPlanesReply *crep;
-    xAllocColorPlanesReq   *creq = (xAllocColorPlanesReq *)req;
-    ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP);
-
-    if (!pmap)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadColor);
-        return;
-    }
-    npixels = creq->colors;
-    if (!npixels)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadValue);
-        return;
-    }
-    length = (long)npixels * sizeof(Pixel);
-    data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length);
-    if (!data)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, BadAlloc);
-        return;
-    }
-    data->hdr.count = MIN(penv->cur.data_config_max_pkt_size,
-        sizeof(XETrapDatum)+length);
-    XETrapSetHeaderReply(&(data->hdr));
-    data->hdr.screen = req->reqType;    /* hack! but necessary */
-    ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum));
-    crep = (xAllocColorPlanesReply *)&(data->u.reply);
-    if ((retval = AllocColorPlanes(client->index, pmap, npixels, 
-        (int)creq->red, (int)creq->green, (int)creq->blue, 
-        (int)creq->contiguous, ppixels, &(crep->redMask), &(crep->greenMask),
-        &(crep->blueMask))) != Success)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, retval);
-        xfree(data);
-        return;
-    }
-    crep->nPixels = npixels;
-    /* Swap data if necessary */
-    if (client->swapped)
-    {
-        INT32 n, i, *ptr;
-        ptr=(INT32 *)ppixels;
-        swaps(&(crep->nPixels), n);
-        swapl(&(crep->redMask), n);
-        swapl(&(crep->greenMask), n);
-        swapl(&(crep->blueMask), n);
-        for (i=0; i<length; i++)
-        {
-            swapl(&(ptr[i]), n);
-        }
-    }
-    /* Send data to client */
-    if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count) 
-        != data->hdr.count)
-    {
-        SendErrorToClient(penv->client, XETrap_avail.data.major_opcode,
-            req->reqType, 0L, XETrapErrorBase + BadIO);
-    }
-    xfree(data);
-}
-#endif /* COLOR_REPLIES */
diff --git a/XTrap/xtrapdiswp.c b/XTrap/xtrapdiswp.c
deleted file mode 100644
index 86c2403..0000000
--- a/XTrap/xtrapdiswp.c
+++ /dev/null
@@ -1,937 +0,0 @@
-/****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991, 1992 by 
-
-	Digital Equipment Corp., Maynard, MA
-
-X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-*****************************************************************************/
-/*
- *  ABSTRACT:
- *
- *      This module is the device independent module responsible for all
- *      routines required for proper communication in a heterogeneous
- *      networking environment (i.e. client & server on different endian
- *      machines).  The bulk of this module is patterned after X11/R4's
- *      server/dix/swapreq.c ; however, they infact swap fields
- *      in the exact opposite order since XTrap requires "unswapped" data
- *      to become "swapped" before sending it to a "swapped" client.
- *
- *  CONTRIBUTORS:
- *
- *      Ken Miller
- *      Marc Evans
- *
- * CHANGES:
- *
- *	Robert Chesler - added client arg for X11R6 port in many spots
- *
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xprotostr.h>
-#include <X11/extensions/xtrapdi.h>
-#include "input.h"          /* Server DevicePtr definitions */
-#include "misc.h"
-#include "dixstruct.h"
-#ifdef PC
-# include "extnsist.h"
-#else
-# include "extnsionst.h"        /* Server ExtensionEntry definitions */
-#endif
-# include "swapreq.h"        /* Server SwapColorItem definition */
-#include <X11/extensions/xtrapddmi.h>
-#include <X11/extensions/xtrapproto.h>
-
-/* In-coming XTrap requests needing to be swapped to native format */
-
-int sXETrapReset(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapReset(request,client));
-}
-
-int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    swaps(&(request->protocol),n);
-    return(XETrapGetAvailable(request,client));
-}
-
-int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    swaps(&(request->config_max_pkt_size),n);
-    return(XETrapConfig(request,client));
-}
-
-int sXETrapStartTrap(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapStartTrap(request,client));
-}
-
-int sXETrapStopTrap(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapStopTrap(request,client));
-}
-
-int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapGetCurrent(request,client));
-}
-
-int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapGetStatistics(request,client));
-}
-
-#ifndef _XINPUT
-int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->input.x),n);
-    swaps(&(request->input.y),n);
-    return(XETrapSimulateXEvent(request,client));
-}
-#endif
-
-int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    swaps(&(request->protocol),n);
-    return(XETrapGetVersion(request,client));
-}
-
-int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
-{
-    register char n;
-    swaps(&(request->length),n);
-    return(XETrapGetLastInpTime(request,client));
-}
-
-
-/* Out-going XTrap replies needing to be swapped *from* native format */
-
-void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply)
-{
-    xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply;
-    register char n;
-    swaps(&(rep->hdr.sequenceNumber),n);
-    swapl(&(rep->hdr.length),n);
-    swapl(&(rep->data.pf_ident),n);
-    swaps(&(rep->data.xtrap_release),n);
-    swaps(&(rep->data.xtrap_version),n);
-    swaps(&(rep->data.xtrap_revision),n);
-    swaps(&(rep->data.max_pkt_size),n);
-    swapl(&(rep->data.major_opcode),n);
-    swapl(&(rep->data.event_base),n);
-    swaps(&(rep->data.cur_x),n);
-    swaps(&(rep->data.cur_y),n);
-    (void)WriteToClient(client,size,reply);
-    return;
-}
-void sReplyXETrapGetVers(ClientPtr client, int size, char *reply)
-{
-    xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply;
-    register char n;
-    swaps(&(rep->hdr.sequenceNumber),n);
-    swapl(&(rep->hdr.length),n);
-    swaps(&(rep->data.xtrap_release),n);
-    swaps(&(rep->data.xtrap_version),n);
-    swaps(&(rep->data.xtrap_revision),n);
-    (void)WriteToClient(client,size,reply);
-    return;
-}
-void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply)
-{
-    xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply;
-    register char n;
-    swaps(&(rep->hdr.sequenceNumber),n);
-    swapl(&(rep->hdr.length),n);
-    swapl(&(rep->data_last_time),n);
-    (void)WriteToClient(client,size,reply);
-    return;
-}
-void sReplyXETrapGetCur(ClientPtr client, int size, char *reply)
-{
-    xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply;
-    register char n;
-    swaps(&(rep->hdr.sequenceNumber),n);
-    swapl(&(rep->hdr.length),n);
-    swaps(&(rep->data_config_max_pkt_size),n);
-    (void)WriteToClient(client,size,reply);
-    return;
-}
-void sReplyXETrapGetStats(ClientPtr client, int size, char *reply)
-{
-    xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply;
-    register char n;
-    register int i;
-    long *p;
-
-    swaps(&(rep->sequenceNumber),n);
-    swapl(&(rep->length),n);
-    for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++)
-    { 
-        swapl(p,n);
-    }
-    for (i=0L, p = (long *)rep->data.events; i<XETrapCoreEvents; i++, p++)
-    {
-        swapl(p,n); 
-    }
-    (void)WriteToClient(client,size,reply);
-    return;
-}
-
-/* Out-going XTrap I/O header needing to be swapped *from* native format */
-
-void sXETrapHeader(XETrapHeader *hdr)
-{
-    register char n;
-
-    swapl(&(hdr->count), n);
-    swapl(&(hdr->timestamp), n);
-    swaps(&(hdr->win_x), n);
-    swaps(&(hdr->win_y), n);
-    swaps(&(hdr->client), n);
-}
-
-    /* Out-going requests needing to be swapped *from* native format
-     * aka swapreq.c "equivalents" 
-     */
-
-/* The following is used for all requests that have
-   no fields to be swapped (except "length") */
-void XETSwSimpleReq(register xReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-}
-
-/* The following is used for all requests that have
-   only a single 32-bit field to be swapped, coming
-   right after the "length" field */
-
-void XETSwResourceReq(register xResourceReq *data)
-{
-    register char n;
-
-    swaps(&(data->length), n);
-    swapl(&(data->id), n);
-}
-
-void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client)
-{
-    register char n;
-
-    swapl(&(data->wid), n);
-    swapl(&(data->parent), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-    swaps(&(data->borderWidth), n);
-    swaps(&(data->class), n);
-    swapl(&(data->visual), n);
-    swapl(&(data->mask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data,
-ClientPtr client)
-{
-    register char n;
-
-    swapl(&(data->window), n);
-    swapl(&(data->valueMask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwReparentWindow(register xReparentWindowReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->parent), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-}
-
-void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client)
-{
-    register char n;
-    swapl(&(data->window), n);
-    swaps(&(data->mask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-
-void XETSwInternAtom(register xInternAtomReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwChangeProperty(register xChangePropertyReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->property), n);
-    swapl(&(data->type), n);
-    switch ( data->format ) {
-        case 8L : break;
-        case 16L:
-            SwapShorts((short *)(data + 1), data->nUnits);
-        break;
-    case 32L:
-            SwapLongs((CARD32 *)(data + 1), data->nUnits);
-        break;
-    }
-    swapl(&(data->nUnits), n);
-}
-
-void XETSwDeleteProperty(register xDeletePropertyReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->property), n);
-              
-}
-void XETSwGetProperty(register xGetPropertyReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->property), n);
-    swapl(&(data->type), n);
-    swapl(&(data->longOffset), n);
-    swapl(&(data->longLength), n);
-}
-
-void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->selection), n);
-    swapl(&(data->time), n);
-}
-
-void XETSwConvertSelection(register xConvertSelectionReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->requestor), n);
-    swapl(&(data->selection), n);
-    swapl(&(data->target), n);
-    swapl(&(data->property), n);
-    swapl(&(data->time), n);
-}
-
-void XETSwSendEvent(register xSendEventReq *data)
-{
-    register char n;
-    xEvent eventT;
-    EventSwapPtr proc;
-    swapl(&(data->destination), n);
-    swapl(&(data->eventMask), n);
-
-    /* Swap event */
-    proc = EventSwapVector[data->event.u.u.type & 0177];
-    if (!proc || proc == NotImplemented)
-        (*proc)(&(data->event), &eventT);
-    data->event = eventT;
-    swaps(&(data->length), n);
-}
-
-void XETSwGrabPointer(register xGrabPointerReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swaps(&(data->eventMask), n);
-    swapl(&(data->confineTo), n);
-    swapl(&(data->cursor), n);
-    swapl(&(data->time), n);
-}
-
-void XETSwGrabButton(register xGrabButtonReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swaps(&(data->eventMask), n);
-    swapl(&(data->confineTo), n);
-    swapl(&(data->cursor), n);
-    swaps(&(data->modifiers), n);
-}
-
-void XETSwUngrabButton(register xUngrabButtonReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swaps(&(data->modifiers), n);
-}
-
-void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cursor), n);
-    swapl(&(data->time), n);
-    swaps(&(data->eventMask), n);
-}
-
-void XETSwGrabKeyboard(register xGrabKeyboardReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swapl(&(data->time), n);
-}
-
-void XETSwGrabKey(register xGrabKeyReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swaps(&(data->modifiers), n);
-}
-
-void XETSwUngrabKey(register xUngrabKeyReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->grabWindow), n);
-    swaps(&(data->modifiers), n);
-}
-
-void XETSwGetMotionEvents(register xGetMotionEventsReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swapl(&(data->start), n);
-    swapl(&(data->stop), n);
-}
-
-void XETSwTranslateCoords(register xTranslateCoordsReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->srcWid), n);
-    swapl(&(data->dstWid), n);
-    swaps(&(data->srcX), n);
-    swaps(&(data->srcY), n);
-}
-
-void XETSwWarpPointer(register xWarpPointerReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->srcWid), n);
-    swapl(&(data->dstWid), n);
-    swaps(&(data->srcX), n);
-    swaps(&(data->srcY), n);
-    swaps(&(data->srcWidth), n);
-    swaps(&(data->srcHeight), n);
-    swaps(&(data->dstX), n);
-    swaps(&(data->dstY), n);
-}
-
-void XETSwSetInputFocus(register xSetInputFocusReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->focus), n);
-    swapl(&(data->time), n);
-}
-
-void XETSwOpenFont(register xOpenFontReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->fid), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwListFonts(register xListFontsReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->maxNames), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->maxNames), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwSetFontPath(register xSetFontPathReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->nFonts), n);
-}
-
-void XETSwCreatePixmap(register xCreatePixmapReq *data)
-{
-    register char n;
-
-    swaps(&(data->length), n);
-    swapl(&(data->pid), n);
-    swapl(&(data->drawable), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-}
-
-void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client)
-{
-    register char n;
-    swapl(&(data->gc), n);
-    swapl(&(data->drawable), n);
-    swapl(&(data->mask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client)
-{
-    register char n;
-    swapl(&(data->gc), n);
-    swapl(&(data->mask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwCopyGC(register xCopyGCReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->srcGC), n);
-    swapl(&(data->dstGC), n);
-    swapl(&(data->mask), n);
-}
-
-void XETSwSetDashes(register xSetDashesReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->dashOffset), n);
-    swaps(&(data->nDashes), n);
-}
-
-void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr
-client)
-{
-    register char n;
-    swapl(&(data->gc), n);
-    swaps(&(data->xOrigin), n);
-    swaps(&(data->yOrigin), n);
-    SwapRestS(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwClearToBackground(register xClearAreaReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->window), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-}
-
-void XETSwCopyArea(register xCopyAreaReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->srcDrawable), n);
-    swapl(&(data->dstDrawable), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->srcX), n);
-    swaps(&(data->srcY), n);
-    swaps(&(data->dstX), n);
-    swaps(&(data->dstY), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-}
-
-void XETSwCopyPlane(register xCopyPlaneReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->srcDrawable), n);
-    swapl(&(data->dstDrawable), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->srcX), n);
-    swaps(&(data->srcY), n);
-    swaps(&(data->dstX), n);
-    swaps(&(data->dstY), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-    swapl(&(data->bitPlane), n);
-}
-
-/* The following routine is used for all Poly drawing requests
-   (except FillPoly, which uses a different request format) */
-void XETSwPoly(register xPolyPointReq *data, ClientPtr client)
-{
-    register char n;
-
-    swapl(&(data->drawable), n);
-    swapl(&(data->gc), n);
-    SwapRestS(data);
-    swaps(&(data->length), n);
-}
-     /* cannot use XETSwPoly for this one, because xFillPolyReq
-      * is longer than xPolyPointReq, and we don't want to swap
-      * the difference as shorts! 
-      */
-void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client)
-{
-    register char n;
-
-    swapl(&(data->drawable), n);
-    swapl(&(data->gc), n);
-    SwapRestS(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwPutImage(register xPutImageReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->drawable), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-    swaps(&(data->dstX), n);
-    swaps(&(data->dstY), n);
-    /* Image should already be swapped */
-}
-
-void XETSwGetImage(register xGetImageReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->drawable), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-    swapl(&(data->planeMask), n);
-}
-
-/* ProcPolyText used for both PolyText8 and PolyText16 */
-
-void XETSwPolyText(register xPolyTextReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->drawable), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-}
-
-/* ProcImageText used for both ImageText8 and ImageText16 */
-
-void XETSwImageText(register xImageTextReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->drawable), n);
-    swapl(&(data->gc), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-}
-
-void XETSwCreateColormap(register xCreateColormapReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->mid), n);
-    swapl(&(data->window), n);
-    swapl(&(data->visual), n);
-}
-
-
-void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->mid), n);
-    swapl(&(data->srcCmap), n);
-
-}
-
-void XETSwAllocColor                (register xAllocColorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swaps(&(data->red), n);
-    swaps(&(data->green), n);
-    swaps(&(data->blue), n);
-}
-
-void XETSwAllocNamedColor           (register xAllocNamedColorReq *data)
-{
-    register char n;
-
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwAllocColorCells           (register xAllocColorCellsReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swaps(&(data->colors), n);
-    swaps(&(data->planes), n);
-}
-
-void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swaps(&(data->colors), n);
-    swaps(&(data->red), n);
-    swaps(&(data->green), n);
-    swaps(&(data->blue), n);
-}
-
-void XETSwFreeColors          (register xFreeColorsReq *data, ClientPtr
-client)
-{
-    register char n;
-    swapl(&(data->cmap), n);
-    swapl(&(data->planeMask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-
-}
-
-void XETSwStoreColors               (register xStoreColorsReq *data,ClientPtr
-client)
-{
-    register char n;
-    unsigned long count;
-    xColorItem     *pItem;
-
-    swapl(&(data->cmap), n);
-    pItem = (xColorItem *) &(data[1]);
-    for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--)
-        SwapColorItem(pItem++);
-    swaps(&(data->length), n);
-}
-
-void XETSwStoreNamedColor           (register xStoreNamedColorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swapl(&(data->pixel), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client)
-{
-    register char n;
-    swapl(&(data->cmap), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-} 
-
-void XETSwLookupColor(register xLookupColorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cmap), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwCreateCursor(register xCreateCursorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cid), n);
-    swapl(&(data->source), n);
-    swapl(&(data->mask), n);
-    swaps(&(data->foreRed), n);
-    swaps(&(data->foreGreen), n);
-    swaps(&(data->foreBlue), n);
-    swaps(&(data->backRed), n);
-    swaps(&(data->backGreen), n);
-    swaps(&(data->backBlue), n);
-    swaps(&(data->x), n);
-    swaps(&(data->y), n);
-}
-
-void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cid), n);
-    swapl(&(data->source), n);
-    swapl(&(data->mask), n);
-    swaps(&(data->sourceChar), n);
-    swaps(&(data->maskChar), n);
-    swaps(&(data->foreRed), n);
-    swaps(&(data->foreGreen), n);
-    swaps(&(data->foreBlue), n);
-    swaps(&(data->backRed), n);
-    swaps(&(data->backGreen), n);
-    swaps(&(data->backBlue), n);
-}
-
-
-void XETSwRecolorCursor(register xRecolorCursorReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->cursor), n);
-    swaps(&(data->foreRed), n);
-    swaps(&(data->foreGreen), n);
-    swaps(&(data->foreBlue), n);
-    swaps(&(data->backRed), n);
-    swaps(&(data->backGreen), n);
-    swaps(&(data->backBlue), n);
-}
-
-void XETSwQueryBestSize   (register xQueryBestSizeReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swapl(&(data->drawable), n);
-    swaps(&(data->width), n);
-    swaps(&(data->height), n);
-
-}
-
-void XETSwQueryExtension (register xQueryExtensionReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->nbytes), n);
-}
-
-void XETSwChangeKeyboardMapping   (register xChangeKeyboardMappingReq *data)
-{
-    register char n;
-    register long *p;
-    register int i, count;
-
-    swaps(&(data->length), n);
-    p = (long *)&(data[1]);
-    count = data->keyCodes * data->keySymsPerKeyCode;
-    for(i = 0; i < count; i++)
-    {
-        swapl(p, n);
-        p++;
-    }
-}
-
-
-void XETSwChangeKeyboardControl   (register xChangeKeyboardControlReq *data,
-    ClientPtr client)
-{
-    register char n;
-    swapl(&(data->mask), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-void XETSwChangePointerControl   (register xChangePointerControlReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->accelNum), n);
-    swaps(&(data->accelDenum), n);
-    swaps(&(data->threshold), n);
-}
-
-
-void XETSwSetScreenSaver            (register xSetScreenSaverReq *data)
-{
-    register char n;
-    swaps(&(data->length), n);
-    swaps(&(data->timeout), n);
-    swaps(&(data->interval), n);
-}
-
-void XETSwChangeHosts(register xChangeHostsReq *data)
-{
-    register char n;
-
-    swaps(&(data->length), n);
-    swaps(&(data->hostLength), n);
-
-}
-void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client)
-{
-    register char n;
-    swapl(&(data->window), n);
-    swaps(&(data->nAtoms), n);
-    swaps(&(data->nPositions), n);
-    SwapRestL(data);
-    swaps(&(data->length), n);
-}
-
-/*ARGSUSED*/
-void XETSwNoOperation(xReq *data)
-{
-    /* noop -- don't do anything */
-}
diff --git a/XTrap/xtrapditbl.c b/XTrap/xtrapditbl.c
deleted file mode 100644
index db78c26..0000000
--- a/XTrap/xtrapditbl.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/****************************************************************************
-Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*****************************************************************************/
-/*
- *  ABSTRACT:
- *
- *      This module is contains Vector tables used for swapping and general   
- *      dispatch by the XTrap server extension.
- *
- *  CONTRIBUTORS:
- *
- *      Ken Miller
- *      Marc Evans
- *
- */
-
-/*-----------------*
- *  Include Files  *
- *-----------------*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xprotostr.h>
-#include <X11/extensions/xtrapdi.h>
-#include "input.h"          /* Server DevicePtr definitions */
-#include "misc.h"
-#include "dixstruct.h"
-#ifdef PC
-# include "extnsist.h"
-#else
-# include "extnsionst.h"        /* Server ExtensionEntry definitions */
-#endif
-#include <X11/extensions/xtrapddmi.h>
-#include <X11/extensions/xtrapproto.h>
-
-globaldef void_function XETSwProcVector[256L] =
-{
-    (void_function)ProcBadRequest,
-    XETSwCreateWindow,
-    XETSwChangeWindowAttributes,
-    XETSwResourceReq,			/* GetWindowAttributes */
-    XETSwResourceReq,			/* DestroyWindow */
-    XETSwResourceReq,			/* 5 DestroySubwindows */
-    XETSwResourceReq,			/* XETSwChangeSaveSet, */
-    XETSwReparentWindow,
-    XETSwResourceReq,			/* MapWindow */
-    XETSwResourceReq,			/* MapSubwindows */
-    XETSwResourceReq,			/* 10 UnmapWindow */
-    XETSwResourceReq,			/* UnmapSubwindows */
-    XETSwConfigureWindow,
-    XETSwResourceReq,			/* XETSwCirculateWindow, */
-    XETSwResourceReq,			/* GetGeometry */
-    XETSwResourceReq,			/* 15 QueryTree */
-    XETSwInternAtom,
-    XETSwResourceReq,			/* XETSwGetAtomName, */
-    XETSwChangeProperty,
-    XETSwDeleteProperty,
-    XETSwGetProperty,			/* 20 */
-    XETSwResourceReq,			/* XETSwListProperties, */
-    XETSwSetSelectionOwner,
-    XETSwResourceReq, 			/* XETSwGetSelectionOwner, */
-    XETSwConvertSelection,
-    XETSwSendEvent,			/* 25 */
-    XETSwGrabPointer,
-    XETSwResourceReq, 			/* XETSwUngrabPointer, */
-    XETSwGrabButton,
-    XETSwUngrabButton,
-    XETSwChangeActivePointerGrab,	/* 30 */
-    XETSwGrabKeyboard,
-    XETSwResourceReq,			/* XETSwUngrabKeyboard, */
-    XETSwGrabKey,
-    XETSwUngrabKey,
-    XETSwResourceReq,			/* 35 XETSwAllowEvents, */
-    XETSwSimpleReq,			/* XETSwGrabServer, */
-    XETSwSimpleReq,			/* XETSwUngrabServer, */
-    XETSwResourceReq,			/* XETSwQueryPointer, */
-    XETSwGetMotionEvents,
-    XETSwTranslateCoords,		/*40 */
-    XETSwWarpPointer,
-    XETSwSetInputFocus,
-    XETSwSimpleReq,			/* XETSwGetInputFocus, */
-    XETSwSimpleReq,			/* QueryKeymap, */
-    XETSwOpenFont,			/* 45 */
-    XETSwResourceReq,			/* XETSwCloseFont, */
-    XETSwResourceReq, 			/* XETSwQueryFont, */
-    XETSwResourceReq,			/* XETSwQueryTextExtents,  */
-    XETSwListFonts,
-    XETSwListFontsWithInfo,		/* 50 */
-    XETSwSetFontPath,
-    XETSwSimpleReq,			/* GetFontPath, */
-    XETSwCreatePixmap,
-    XETSwResourceReq,			/* XETSwFreePixmap, */
-    XETSwCreateGC,			/* 55 */
-    XETSwChangeGC,
-    XETSwCopyGC,
-    XETSwSetDashes,
-    XETSwSetClipRectangles,
-    XETSwResourceReq,			/* 60 XETSwFreeGC, */
-    XETSwClearToBackground,
-    XETSwCopyArea,
-    XETSwCopyPlane,
-    XETSwPoly,				/* PolyPoint, */
-    XETSwPoly,				/* 65 PolyLine */
-    XETSwPoly,				/* PolySegment, */
-    XETSwPoly,				/* PolyRectangle, */
-    XETSwPoly,				/* PolyArc, */
-    XETSwFillPoly,
-    XETSwPoly,				/* 70 PolyFillRectangle */
-    XETSwPoly,				/* PolyFillArc, */
-    XETSwPutImage,
-    XETSwGetImage,
-    XETSwPolyText,
-    XETSwPolyText,			/* 75 */
-    XETSwImageText,
-    XETSwImageText,
-    XETSwCreateColormap,
-    XETSwResourceReq,			/* XETSwFreeColormap, */
-    XETSwCopyColormapAndFree,		/* 80 */
-    XETSwResourceReq,			/* XETSwInstallColormap, */
-    XETSwResourceReq,			/* XETSwUninstallColormap, */
-    XETSwResourceReq, 			/* XETSwListInstalledColormaps, */
-    XETSwAllocColor,
-    XETSwAllocNamedColor,		/* 85 */
-    XETSwAllocColorCells,
-    XETSwAllocColorPlanes,
-    XETSwFreeColors,
-    XETSwStoreColors,
-    XETSwStoreNamedColor,		/* 90 */
-    XETSwQueryColors,
-    XETSwLookupColor,
-    XETSwCreateCursor,
-    XETSwCreateGlyphCursor,
-    XETSwResourceReq,			/* 95 XETSwFreeCursor, */
-    XETSwRecolorCursor,
-    XETSwQueryBestSize,
-    XETSwQueryExtension,
-    XETSwSimpleReq,			/* ListExtensions, */
-    XETSwChangeKeyboardMapping,		/* 100 */
-    XETSwSimpleReq,			/* GetKeyboardMapping, */
-    XETSwChangeKeyboardControl,
-    XETSwSimpleReq,			/* GetKeyboardControl, */
-    XETSwSimpleReq,			/* Bell, */
-    XETSwChangePointerControl,		/* 105 */
-    XETSwSimpleReq,			/* GetPointerControl, */
-    XETSwSetScreenSaver,
-    XETSwSimpleReq,			/* GetScreenSaver, */
-    XETSwChangeHosts,
-    XETSwSimpleReq,			/* 110 ListHosts, */
-    XETSwSimpleReq,			/* XETSwChangeAccessControl, */
-    XETSwSimpleReq,			/* XETSwChangeCloseDownMode, */
-    XETSwResourceReq,			/* XETSwKillClient, */
-    XETSwRotateProperties,
-    XETSwSimpleReq,			/* 115 ForceScreenSaver */
-    XETSwSimpleReq,			/* SetPointerMapping, */
-    XETSwSimpleReq,			/* GetPointerMapping, */
-    XETSwSimpleReq,			/* SetModifierMapping, */
-    XETSwSimpleReq,			/* GetModifierMapping, */
-    NotImplemented,			/* 120 */
-    NotImplemented,
-    NotImplemented,
-    NotImplemented,
-    NotImplemented,
-    NotImplemented,			/* 125 */
-    NotImplemented,
-    XETSwNoOperation
-};
-
-/* NOTE: This array must align with the values of the constants used
- * as minor_opcode values in the request structure. Failure to do this
- * could result in random code paths.
- */
-globaldef int_function XETrapDispatchVector[10L] = 
-{
-    XETrapReset,            /* 0 XETrap_Reset */
-    XETrapGetAvailable,     /* 1 XETrap_GetAvailable */
-    XETrapConfig,           /* 2 XETrap_Config */
-    XETrapStartTrap,        /* 3 XETrap_StartTrap */
-    XETrapStopTrap,         /* 4 XETrap_StopTrap */
-    XETrapGetCurrent,       /* 5 XETrap_GetCurrent */
-    XETrapGetStatistics,    /* 6 XETrap_GetStatistics */
-#ifndef _XINPUT
-    XETrapSimulateXEvent,   /* 7 XETrap_SimulateXEvent */
-#endif
-    XETrapGetVersion,       /* 8 XETrap_GetVersion */
-    XETrapGetLastInpTime,   /* 9 XETrap_GetLastInpTime */
-};
-
-/* NOTE: This array must align with the values of the constants used
- * as minor_opcode values in the request structure. Failure to do this
- * could result in random code paths.
- */
-globaldef int_function XETSwDispatchVector[10L] = 
-{
-    sXETrapReset,           /* 0 XETrap_Reset */
-    sXETrapGetAvailable,    /* 1 XETrap_GetAvailable */
-    sXETrapConfig,          /* 2 XETrap_Config */
-    sXETrapStartTrap,       /* 3 XETrap_StartTrap */
-    sXETrapStopTrap,        /* 4 XETrap_StopTrap */
-    sXETrapGetCurrent,      /* 5 XETrap_GetCurrent */
-    sXETrapGetStatistics,   /* 6 XETrap_GetStatistics */
-#ifndef _XINPUT
-    sXETrapSimulateXEvent,  /* 7 XETrap_SimulateXEvent */
-#endif
-    sXETrapGetVersion,      /* 8 XETrap_GetVersion */
-    sXETrapGetLastInpTime,  /* 9 XETrap_GetLastInpTime */
-};
-
-/* ProcVector shadow vector */
-globaldef int_function XETrapProcVector[256L]       = {XETrapRequestVector};
-/*
- * Events are faked as if they're vectored since that's
- * the way it'll eventually be (X11 R5?).
- */
-#ifndef VECTORED_EVENTS
-globaldef int_function EventProcVector[XETrapCoreEvents]       = {NULL};
-#endif
-globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL};
-
-
diff --git a/configure.ac b/configure.ac
index ce2721d..6b2f6ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -531,7 +531,6 @@ AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
 AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
-AC_ARG_ENABLE(xtrap,          AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--enable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no])
 AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
 AC_ARG_ENABLE(xvmc,           AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
@@ -819,13 +818,6 @@ if test "x$MITSHM" = xyes; then
 	AC_DEFINE(HAS_SHM, 1, [Support SHM])
 fi
 
-AM_CONDITIONAL(XTRAP, [test "x$XTRAP" = xyes])
-if test "x$XTRAP" = xyes; then
-	AC_DEFINE(XTRAP, 1, [Support XTrap extension])
-	REQUIRED_MODULES="$REQUIRED_MODULES trapproto"
-	XTRAP_LIB='$(top_builddir)/XTrap/libxtrap.la'
-fi
-
 AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
 if test "x$RECORD" = xyes; then
 	AC_DEFINE(XRECORD, 1, [Support Record extension])
@@ -1209,7 +1201,7 @@ AC_MSG_RESULT([$XVFB])
 AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
 
 if test "x$XVFB" = xyes; then
-	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
+	XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
 	XVFB_SYS_LIBS="$XVFBMODULES_LIBS"
 	AC_SUBST([XVFB_LIBS])
 	AC_SUBST([XVFB_SYS_LIBS])
@@ -1227,7 +1219,7 @@ AC_MSG_RESULT([$XNEST])
 AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
 
 if test "x$XNEST" = xyes; then
-	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
+	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
 	XNEST_SYS_LIBS="$XNESTMODULES_LIBS"
 	AC_SUBST([XNEST_LIBS])
 	AC_SUBST([XNEST_SYS_LIBS])
@@ -1589,7 +1581,7 @@ if test "x$XQUARTZ" = xyes; then
 	AC_DEFINE(ROOTLESS,1,[Build Rootless code])
 
 	DARWIN_GLX_LIBS='$(top_builddir)/hw/xquartz/GL/libCGLCore.la $(top_builddir)/glx/libglx.la'
-	DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
+	DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
 	AC_SUBST([DARWIN_LIBS])
 
 	AC_CHECK_LIB([Xplugin],[xp_init],[:])
@@ -1631,9 +1623,9 @@ if test "x$DMX" = xyes; then
 		AC_MSG_ERROR([Xdmx build explicitly requested, but required
 		              modules not found.])
 	fi
-	DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
+	DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
 	XDMX_CFLAGS="$DMXMODULES_CFLAGS"
-	XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
+	XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
 	XDMX_SYS_LIBS="$DMXMODULES_LIBS"
 	AC_SUBST([XDMX_CFLAGS])
 	AC_SUBST([XDMX_LIBS])
@@ -1759,7 +1751,7 @@ if test "$KDRIVE" = yes; then
     
     KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
 
-    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+    KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
     KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
     case $host_os in
 	*linux*)
@@ -1901,7 +1893,6 @@ dix/Makefile
 doc/Makefile
 fb/Makefile
 record/Makefile
-XTrap/Makefile
 config/Makefile
 mi/Makefile
 miext/Makefile
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index ed15ca4..f19a852 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -6,10 +6,6 @@ if GLX
 GLXMODS = libglx.la
 endif
 
-if XTRAP
-XTRAPMOD = libxtrap.la
-endif
-
 if DBE
 DBEMOD = libdbe.la
 endif
@@ -25,8 +21,7 @@ module_LTLIBRARIES = libfb.la \
 extsmoduledir = $(moduledir)/extensions
 extsmodule_LTLIBRARIES = $(RECORDMOD) \
 			 $(DBEMOD) \
-                         $(GLXMODS) \
-                         $(XTRAPMOD)
+                         $(GLXMODS)
 
 fontsmoduledir = $(moduledir)/fonts
 fontsmodule_LTLIBRARIES = libfreetype.la
@@ -77,7 +72,3 @@ libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS)
 
 libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c
 libxorgxkb_la_LIBADD = $(top_builddir)/dix/libdix.la
-
-libxtrap_la_LDFLAGS = -avoid-version
-libxtrap_la_LIBADD = $(top_builddir)/XTrap/libxtrap.la
-libxtrap_la_SOURCES = xf86XTrapModule.c
diff --git a/hw/xfree86/dixmods/xf86XTrapModule.c b/hw/xfree86/dixmods/xf86XTrapModule.c
deleted file mode 100644
index e89d775..0000000
--- a/hw/xfree86/dixmods/xf86XTrapModule.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*  This is the xf86 module code for the DEC_XTRAP extension. */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xf86Module.h"
-
-#include <X11/extensions/xtrapdi.h>
-
-extern void DEC_XTRAPInit(INITARGS);
-
-static MODULESETUPPROTO(xtrapSetup);
-
-static ExtensionModule xtrapExt =
-{
-    DEC_XTRAPInit,
-    XTrapExtName,
-    NULL,
-    NULL,
-    NULL
-};
-
-static XF86ModuleVersionInfo xtrapVersRec =
-{
-    "xtrap",
-    MODULEVENDORSTRING,
-    MODINFOSTRING1,
-    MODINFOSTRING2,
-    XORG_VERSION_CURRENT,
-    1, 0, 0,
-    ABI_CLASS_EXTENSION,         /* needs the server extension ABI */
-    ABI_EXTENSION_VERSION,
-    MOD_CLASS_EXTENSION,
-    {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData xtrapModuleData = { &xtrapVersRec, xtrapSetup, NULL };
-
-static pointer
-xtrapSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
-    LoadExtension(&xtrapExt, FALSE);
-    /* Need a non-NULL return value to indicate success */
-    return (pointer)1;
-}
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index ad74f77..b088ef8 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -410,9 +410,6 @@
 /* Support XTest extension */
 #undef XTEST
 
-/* Support XTrap extension */
-#undef XTRAP
-
 /* Support Xv extension */
 #undef XV
 
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 5a253c7..0fee53d 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -163,9 +163,6 @@
 /* Support XTest extension */
 #undef XTEST
 
-/* Support XTrap extension */
-#undef XTRAP
-
 /* Support Xv Extension */
 #undef XV
 
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 3740daa..31f9945 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -240,9 +240,6 @@ extern void BigReqExtensionInit(INITARGS);
 #ifdef XIDLE
 extern void XIdleExtensionInit(INITARGS);
 #endif
-#ifdef XTRAP
-extern void DEC_XTRAPInit(INITARGS);
-#endif
 #ifdef SCREENSAVER
 extern void ScreenSaverExtensionInit (INITARGS);
 #endif
@@ -485,9 +482,6 @@ InitExtensions(int argc, char *argv[])
 #ifdef XIDLE
     if (!noXIdleExtension) XIdleExtensionInit();
 #endif
-#ifdef XTRAP
-    if (!noTestExtensions) DEC_XTRAPInit();
-#endif
 #if defined(SCREENSAVER)
     if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
 #endif
commit a81b5ce452766bbc4b2ac0849711284ba8591b46
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 25 13:23:09 2008 +0930

    dix: free memory associated with the EventList. #16507
    
    Un-deprecates CloseDownEvents.
    
    X.Org Bug 16507 <http://bugs.freedesktop.org/show_bug.cgi?id=16507>

diff --git a/dix/events.c b/dix/events.c
index 7bd6825..f6309f2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5520,14 +5520,15 @@ InitEvents(void)
         FatalError("[dix] Failed to allocate input event list.\n");
 }
 
-/**
- * This function is deprecated! It shouldn't be used anymore. It used to free
- * the spriteTraces, but now they are freed when the SpriteRec is freed.
- */
-_X_DEPRECATED void
+void
 CloseDownEvents(void)
 {
+    int len;
+    EventListPtr list;
 
+    len = GetEventList(&list);
+    while(len--)
+        xfree(list[len].event);
 }
 
 /**
diff --git a/dix/main.c b/dix/main.c
index e0bb180..3bc45fb 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -437,6 +437,7 @@ int main(int argc, char *argv[], char *envp[])
 
         memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr));
 	CloseDownDevices();
+	CloseDownEvents();
 
 	for (i = screenInfo.numScreens - 1; i >= 0; i--)
 	{
commit 3a2beb2f867fd47dc5a7723dcac345ea0b0ecf3d
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 25 13:12:41 2008 +0930

    dix: InitEventList does not need to be _X_EXPORT.

diff --git a/dix/getevents.c b/dix/getevents.c
index b00bc11..3713f4b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -787,7 +787,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
  *
  * @param num_events Number of elements in list.
  */
-_X_EXPORT EventListPtr
+EventListPtr
 InitEventList(int num_events)
 {
     EventListPtr events;
commit 385943e0e97463ce4681a9b6a4a40d7e3c91e51e
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Tue Jun 24 23:13:32 2008 -0300

    Set --enable-builtin-fonts as default.
    
    Some reasons to embed fonts by default:
    1. X server doesn't pick a good default font path so it's easiest just
    to built in the core fonts and let new X hackers more happy. Developers
    and distro guys are wise enough to just set --disable-builtin-fonts
    when they want.
    
    2. Seems that this is by far the most popular FAQ
    (http://www.x.org/wiki/FAQErrorMessages).
    
    3. No one gave a good argument to not do this:
        http://lists.freedesktop.org/archives/xorg/2008-May/035479.html

diff --git a/configure.ac b/configure.ac
index ab6cb10..ce2721d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -505,9 +505,9 @@ AC_ARG_ENABLE(install-libxf86config,
 				[Install libxf86config (default: disabled)]),
 				[INSTALL_LIBXF86CONFIG=$enableval],
 				[INSTALL_LIBXF86CONFIG=no])
-AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
+AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: yes)]),
                                 [BUILTIN_FONTS=$enableval],
-                                [BUILTIN_FONTS=no])
+                                [BUILTIN_FONTS=yes])
 AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
                                  [NULL_ROOT_CURSOR=$enableval],
                                  [NULL_ROOT_CURSOR=no])
commit f3b29efc4d7bb346cdd3fd79e780f1022c8f46e8
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Tue Jun 24 23:07:49 2008 -0300

    Remove NOFONTSERVERACCESS macro
    
    dix: this is semantically different but it goes through the same path in
    the code.

diff --git a/configure.ac b/configure.ac
index 201bfe4..ab6cb10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -962,7 +962,6 @@ fi
 
 if test "x$BUILTIN_FONTS" = xyes; then
        AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
-       AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
        FONTPATH="built-ins"
 fi
 
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 83b264a..89f1528 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1920,8 +1920,6 @@ InitFonts (void)
         BuiltinRegisterFpeFunctions();
 #else
 	FontFileRegisterFpeFunctions();
-#endif
-#ifndef NOFONTSERVERACCESS
 	fs_register_fpe_functions();
 #endif
     }
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 0c515c5..ad74f77 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -480,9 +480,6 @@
 /* Use only built-in fonts */
 #undef BUILTIN_FONTS
 
-/* Avoid using font servers */
-#undef NOFONTSERVERACCESS
-
 /* Use an empty root cursor */
 #undef NULL_ROOT_CURSOR
 
commit 2ff7eb4995b663cf12a01124745de600f38d0bfc
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Tue Jun 24 22:09:34 2008 -0300

    xfree86: kill INHERIT_LOCK_STATE macro.
    
    I don't know how this survived so long. Google didn't show
    anything usable related with this.

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index a7f9578..e7effc8 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -196,45 +196,6 @@ void
 ProcessInputEvents ()
 {
   int x, y;
-#ifdef INHERIT_LOCK_STATE
-  static int generation = 0;
-#endif
-
-    /*
-     * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock
-     * and ScrollLock will be set to match that of the VT the server is
-     * running on.
-     */
-#ifdef INHERIT_LOCK_STATE
-    if (generation != serverGeneration) {
-      xEvent kevent;
-      DevicePtr pKeyboard = xf86Info.pKeyboard;
-      extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll;
-
-      generation = serverGeneration;
-      kevent.u.keyButtonPointer.time = GetTimeInMillis();
-      kevent.u.keyButtonPointer.rootX = 0;
-      kevent.u.keyButtonPointer.rootY = 0;
-      kevent.u.u.type = KeyPress;
-
-
-      if (xf86InitialCaps) {
-        kevent.u.u.detail = xf86InitialCaps;
-        (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
-        xf86InitialCaps = 0;
-      }
-      if (xf86InitialNum) {
-        kevent.u.u.detail = xf86InitialNum;
-        (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
-        xf86InitialNum = 0;
-      }
-      if (xf86InitialScroll) {
-        kevent.u.u.detail = xf86InitialScroll;
-        (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
-        xf86InitialScroll = 0;
-      }
-    }
-#endif
 
   mieqProcessInputEvents();
 
commit a3ec22627355fc08730ad7e90022e374763d333f
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Jun 24 20:32:24 2008 -0400

    Fix a leak in the code that parses the protocol names.
    
    Also added some comments.
    Reported by Ben Gamari (bug #16492).

diff --git a/dix/registry.c b/dix/registry.c
index 10fa21f..a519cff 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -126,10 +126,12 @@ RegisterExtensionNames(ExtensionEntry *extEntry)
     rewind(fh);
 
     while (fgets(buf, sizeof(buf), fh)) {
+	lineobj = NULL;
 	ptr = strchr(buf, '\n');
 	if (ptr)
 	    *ptr = 0;
 
+	/* Check for comments or empty lines */
 	switch (buf[0]) {
 	case PROT_REQUEST:
 	case PROT_EVENT:
@@ -139,48 +141,54 @@ RegisterExtensionNames(ExtensionEntry *extEntry)
 	case '\0':
 	    continue;
 	default:
-	    continue;
+	    goto invalid;
 	}
 
+	/* Check for space character in the fifth position */
 	ptr = strchr(buf, ' ');
-	if (!ptr || ptr != buf + 4) {
-	    LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
-	    continue;
-	}
+	if (!ptr || ptr != buf + 4)
+	    goto invalid;
+
+	/* Duplicate the string after the space */
 	lineobj = strdup(ptr + 1);
 	if (!lineobj)
 	    continue;
 
+	/* Check for a colon somewhere on the line */
 	ptr = strchr(buf, ':');
-	if (!ptr) {
-	    LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
-	    continue;
-	}
-	*ptr = 0;
+	if (!ptr)
+	    goto invalid;
 
+	/* Compare the part before colon with the target extension name */
+	*ptr = 0;
 	if (strcmp(buf + 5, extEntry->name))
-	    continue;
+	    goto skip;
 
+	/* Get the opcode for the request, event, or error */
 	offset = strtol(buf + 1, &ptr, 10);
-	if (offset == 0 && ptr == buf + 1) {
-	    LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
-	    continue;
-	}
+	if (offset == 0 && ptr == buf + 1)
+	    goto invalid;
 
+	/* Save the strdup result in the registry */
 	switch(buf[0]) {
 	case PROT_REQUEST:
 	    if (extEntry->base)
 		RegisterRequestName(extEntry->base, offset, lineobj);
 	    else
 		RegisterRequestName(offset, 0, lineobj);
-	    break;
+	    continue;
 	case PROT_EVENT:
 	    RegisterEventName(extEntry->eventBase + offset, lineobj);
-	    break;
+	    continue;
 	case PROT_ERROR:
 	    RegisterErrorName(extEntry->errorBase + offset, lineobj);
-	    break;
+	    continue;
 	}
+
+    invalid:
+	LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
+    skip:
+	free(lineobj);
     }
 }
 
commit a4cb25f8c816adc3bdf6a28d5beb558e8be40121
Author: Ben Gamari <bgamari at gmail.com>
Date:   Tue Jun 24 12:08:35 2008 +0930

    dix: free FocusPrivates when deleting a window. #16493
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>
    
    X.Org Bug 16493 <http://bugs.freedesktop.org/show_bug.cgi?id=16493>

diff --git a/dix/window.c b/dix/window.c
index 6b95068..137afa0 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -978,6 +978,7 @@ DeleteWindow(pointer value, XID wid)
 	if (pWin->prevSib)
 	    pWin->prevSib->nextSib = pWin->nextSib;
     }
+    xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
     dixFreePrivates(pWin->devPrivates);
     xfree(pWin);
     return Success;
commit 32a7bbbba6fec0535a8faa1d6d2ecebe786bcc81
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 24 09:28:05 2008 +0930

    xfree86: fix up leftover allocation of xf86Events.
    
    Thanks to Eamon Walsh for spotting this.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 675ec9f..b98e903 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -131,7 +131,7 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
     local->history_size = GetMotionHistorySize();
     /* Preallocate xEvent store */
     if (!xf86Events)
-        xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+        GetEventList(&xf86Events);
     if (!xf86Events)
         FatalError("Couldn't allocate event store\n");
 }
commit bcc88a1d46c7ba469c4e2861875f84f8c77d4b15
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 22 22:34:30 2008 +0930

    xkb: remove unused variable is_core.

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 28107d0..d3b585a 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -309,15 +309,14 @@ AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
 DeviceIntPtr    dev = (DeviceIntPtr) arg;
 XkbSrvInfoPtr	xkbi = dev->key->xkbInfo;
 KeyCode		key;
-BOOL            is_core;
 
     if (xkbi->repeatKey == 0)
 	return 0;
 
-    is_core = (dev == inputInfo.keyboard);
     key = xkbi->repeatKey;
     AccessXKeyboardEvent(dev, DeviceKeyRelease, key, True);
     AccessXKeyboardEvent(dev, DeviceKeyPress, key, True);
+
     return xkbi->desc->ctrls->repeat_interval;
 }
 
commit 9ed9d98dec58d1f7468d02c4b951811b8e1ca7c1
Author: Julien Cristau <jcristau at debian.org>
Date:   Tue Jun 24 22:36:32 2008 +0200

    x86emu: fix build, fallout from 9719354

diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h
index ff28885..c0c09c1 100644
--- a/hw/xfree86/x86emu/x86emu/types.h
+++ b/hw/xfree86/x86emu/x86emu/types.h
@@ -75,7 +75,7 @@
     defined(__sparc64__) || \
     defined(__s390x__) || \
     (defined(__hppa__) && defined(__LP64)) || \
-    defined(__amd64__) || defined(amd64) \
+    defined(__amd64__) || defined(amd64) || \
     (defined(__sgi) && (_MIPS_SZLONG == 64))
 #define NUM32 int
 #else
commit e9b4f3cd856e2401675452c387b4155246239f91
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Jun 23 16:18:20 2008 -0400

    Fix "warning: suggest parentheses around && within ||".

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index ec9a358..3c98f6e 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -378,7 +378,7 @@ xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     /* only update coordinate state for first sprite, otherwise we get jumps
        when removing a sprite. The second sprite is never HW rendered anyway */
     if (pDev == inputInfo.pointer ||
-            !pDev->isMaster && pDev->u.master == inputInfo.pointer)
+	(!pDev->isMaster && pDev->u.master == inputInfo.pointer))
     {
 	ScreenPriv->x = x;
 	ScreenPriv->y = y;
commit 8910dde96ec4318c9c44fb9717b6b52fad56cd1d
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Jun 23 14:51:38 2008 -0400

    Fix "warning: assignment discards qualifiers from pointer target type".

diff --git a/hw/xfree86/loader/dlloader.c b/hw/xfree86/loader/dlloader.c
index 4caefd0..18dcb76 100644
--- a/hw/xfree86/loader/dlloader.c
+++ b/hw/xfree86/loader/dlloader.c
@@ -87,16 +87,15 @@ DLFindSymbolLocal(pointer module, const char *name)
 
     static const char symPrefix[] = DLSYM_PREFIX;
 
-    if (strlen(symPrefix)) {
+    if (sizeof(symPrefix) > 1) {
 	n = malloc(strlen(symPrefix) + strlen(name) + 1);
 	sprintf(n, "%s%s", symPrefix, name);
-    } else {
-	n = name;
+	name = n;
     }
 
-    p = dlsym(module, n);
+    p = dlsym(module, name);
 
-    if (strlen(symPrefix))
+    if (sizeof(symPrefix) > 1)
 	free(n);
 
     return p;
commit 95d4ede538fbb68049ba3efa0acb0e9712e5cb01
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 20 23:49:32 2008 -0400

    Fix "warning: passing argument 1 of `modeIsPresent' from incompatible pointer type".

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 126ae9f..f0ae730 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2417,14 +2417,14 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
 }
 
 static Bool
-modeIsPresent(char * modename,MonPtr monitorp)
+modeIsPresent(DisplayModePtr mode, MonPtr monitorp)
 {
     DisplayModePtr knownmodes = monitorp->Modes;
 
     /* all I can think of is a linear search... */
     while(knownmodes != NULL)
     {
-	if(!strcmp(modename,knownmodes->name) &&
+	if(!strcmp(mode->name, knownmodes->name) &&
 	   !(knownmodes->type & M_T_DEFAULT))
 	    return TRUE;
 	knownmodes = knownmodes->next;
commit fa1545eeda2a7feebc006840a44d390177634231
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 20 23:47:22 2008 -0400

    Fix "warning: passing argument 1 of `xf86addNewLoadDirective' from incompatible pointer type".

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index e52974d..126ae9f 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -305,7 +305,7 @@ xf86ModulelistFromConfig(pointer **optlist)
                 }
             }
             if (found == FALSE) {
-	            XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+		XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
 	            ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
                 xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
             }
@@ -314,7 +314,7 @@ xf86ModulelistFromConfig(pointer **optlist)
 	xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
 	for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
 	    if (ModuleDefaults[i].toLoad == TRUE) {
-		XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+		XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
 		ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
 	    }
 	}
commit 2725ba1fca45e5ba241695e24333d8efab1f862b
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 14:41:32 2008 -0400

    Also remove xorgconfig from configure.ac.

diff --git a/configure.ac b/configure.ac
index f6997e5..201bfe4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1830,13 +1830,6 @@ AC_TRY_COMPILE([
 
 AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
 
-dnl xorgconfig CLI configuration utility
-if test "x$XORG" = xyes; then
-    PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
-    AC_SUBST(XORGCONFIG_DEP_CFLAGS)
-    AC_SUBST(XORGCONFIG_DEP_LIBS)
-fi
-
 dnl xorgcfg GUI configuration utility
 AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], 
 	[Build xorgcfg GUI configuration utility (default: no)]),
@@ -1971,7 +1964,6 @@ hw/xfree86/utils/gtf/Makefile
 hw/xfree86/utils/ioport/Makefile
 hw/xfree86/utils/kbd_mode/Makefile
 hw/xfree86/utils/xorgcfg/Makefile
-hw/xfree86/utils/xorgconfig/Makefile
 hw/dmx/config/Makefile
 hw/dmx/doc/Makefile
 hw/dmx/examples/Makefile
commit 9719354ae04a41e9834ac9ba8fd9e895092ba4f1
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 14:37:06 2008 -0400

    Check for __amd64__, not __x86_64__.
    
    Spiritual revert of 1fa4de80fcfc697b5e5879cc351fb3e9dbf6acbe.  Intel's C
    compiler claims to be gcc-compatible; if they're not defining the same
    macros as gcc then that's their bug, not ours.  Even if we were to do
    this aliasing we should do it once and for all in servermd.h.

diff --git a/fb/fb.h b/fb/fb.h
index 8e76beb..2c6c4fb 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -138,7 +138,7 @@ typedef unsigned __int64    FbBits;
       defined(ia64) || defined(__ia64__) || \
       defined(__sparc64__) || defined(_LP64) || \
       defined(__s390x__) || \
-      defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
+      defined(amd64) || defined (__amd64__) \
       defined (__powerpc64__) || \
       (defined(sgi) && (_MIPS_SZLONG == 64))
 typedef unsigned long	    FbBits;
diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h
index 9e7f821..a20baa3 100644
--- a/hw/xfree86/common/compiler.h
+++ b/hw/xfree86/common/compiler.h
@@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port);
 extern unsigned int inw(unsigned long port);
 extern unsigned int inl(unsigned long port);
  
-#   elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
+#   elif defined(linux) && defined(__amd64__)
  
 #    include <inttypes.h>
 
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 7e5fab4..a786eed 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -454,7 +454,7 @@ chooseVideoDriver(void)
 	if (info != NULL)
 	    chosen_driver = videoPtrToDriverName(info);
 	if (chosen_driver == NULL) {
-#if defined  __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
+#if defined  __i386__ || defined __amd64__ || defined __hurd__
 	    chosen_driver = "vesa";
 #elif defined __sparc__
 	    chosen_driver = "sunffb";
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index a00269b..774a4c4 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -63,7 +63,7 @@
 #include <string.h>
 #if defined(linux) && \
     (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \
-    || defined(__amd64__) || defined(__x86_64__))
+    || defined(__amd64__))
 #include <malloc.h>
 #endif
 #include <stdarg.h>
diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c
index d1ee787..fe166c8 100644
--- a/hw/xfree86/os-support/bsd/bsdResource.c
+++ b/hw/xfree86/os-support/bsd/bsdResource.c
@@ -19,7 +19,7 @@
 
 #ifdef INCLUDE_XF86_NO_DOMAIN
 
-#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__)
 
 resPtr
 xf86AccResFromOS(resPtr ret)
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 557483b..a1390c0 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -202,7 +202,7 @@
 /*
  * Select architecture specific PCI init function
  */
-#if defined(__i386__) || defined(__i386) ||  defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
+#if defined(__i386__) || defined(__i386) ||  defined(__amd64__) || defined(__amd64)
 # define ARCH_PCI_INIT ix86PciInit
 #elif defined(__powerpc__) || defined(__powerpc64__)
 # define ARCH_PCI_INIT ppcPciInit
diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c
index 5cd7168..7c51fcc 100644
--- a/hw/xfree86/os-support/misc/SlowBcopy.c
+++ b/hw/xfree86/os-support/misc/SlowBcopy.c
@@ -30,7 +30,7 @@ xf86SetReallySlowBcopy(void)
 	really_slow_bcopy = 1;
 }
 
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__amd64__)
 static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len)
 {
     while(len--)
@@ -45,7 +45,7 @@ static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int l
 _X_EXPORT void
 xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len)
 {
-#if defined(__i386__) || defined(__x86_64__)
+#if defined(__i386__) || defined(__amd64__)
     if (really_slow_bcopy) {
 	xf86_really_slow_bcopy(src, dst, len);
 	return;
diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c
index 629dfe1..748bd3a 100644
--- a/hw/xfree86/utils/xorgcfg/loadmod.c
+++ b/hw/xfree86/utils/xorgcfg/loadmod.c
@@ -181,7 +181,7 @@ LOOKUP xfree86LookupTab[] = {
    SYMFUNC(xf86memcpy)
 #if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \
     defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \
-    defined (__amd64__) || defined(__x86_64__)
+    defined (__amd64__)
    /*
     * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
     * structure copies.  This causes a problem both here and in shared
diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c
index 41968e1..4a6ac5d 100644
--- a/hw/xfree86/x86emu/prim_ops.c
+++ b/hw/xfree86/x86emu/prim_ops.c
@@ -103,7 +103,7 @@
 #include "x86emu/x86emui.h"
 
 #if defined(__GNUC__)
-# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)
+# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)
 #  include "x86emu/prim_x86_gcc.h"
 # endif
 #endif
diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
index 5a443cd..5530a3a 100644
--- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
+++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h
@@ -42,7 +42,7 @@
 
 #include "x86emu/types.h"
 
-#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__))
+#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__))
 #error This file is intended to be used by gcc on i386 or x86-64 system
 #endif
 
diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h
index 2d41b0f..ff28885 100644
--- a/hw/xfree86/x86emu/x86emu/types.h
+++ b/hw/xfree86/x86emu/x86emu/types.h
@@ -75,7 +75,7 @@
     defined(__sparc64__) || \
     defined(__s390x__) || \
     (defined(__hppa__) && defined(__LP64)) || \
-    defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \
+    defined(__amd64__) || defined(amd64) \
     (defined(__sgi) && (_MIPS_SZLONG == 64))
 #define NUM32 int
 #else
diff --git a/include/servermd.h b/include/servermd.h
index 91b705b..f10e6bc 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -285,7 +285,7 @@ SOFTWARE.
 
 #endif /* ia64 */
 
-#if defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__)
+#if defined(__amd64__) || defined(amd64) || defined(__amd64)
 # define IMAGE_BYTE_ORDER	LSBFirst
 
 # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO)
diff --git a/mi/micoord.h b/mi/micoord.h
index 876e88c..16d0861 100644
--- a/mi/micoord.h
+++ b/mi/micoord.h
@@ -48,7 +48,7 @@
     defined(__alpha) || defined(__alpha__) || \
     defined(__i386__) || defined(__i386) || defined(__ia64__) || \
     defined(__s390x__) || defined(__s390__) || \
-    defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__)
+    defined(__amd64__) || defined(amd64) || defined(__amd64)
 #define GetHighWord(x) (((int) (x)) >> 16)
 #else
 #define GetHighWord(x) (((int) (x)) / 65536)
commit 249c892784ca5e8c75863dd82097ca2bedec4723
Author: Roland Bär <roland at verifysoft.de>
Date:   Tue Jun 24 14:13:02 2008 -0400

    Bug #11857: Avoid running off the end of a MAXCLIENTS-sized array.

diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c
index 52bd57a..a4ba45b 100644
--- a/XTrap/xtrapdi.c
+++ b/XTrap/xtrapdi.c
@@ -487,7 +487,7 @@ int XETrapCreateEnv(ClientPtr client)
     XETrapEnv *penv = NULL;
     int status = Success;
 
-    if (client->index > MAXCLIENTS)
+    if (client->index >= MAXCLIENTS)
     {
         status = BadImplementation;
     }
commit 9e5b3deafb97ec1f83e6bfe067bc68df7385bc6a
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 14:08:04 2008 -0400

    Bug #11842: Fix emulation of int1A PCI BIOS services.
    
    Use only %di to name the PCI register to read/write, rather than %edi.
    DOS is only expecting the base PCI config space anyway, and the BIOS
    might be using the high bits of %edi.

diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c
index 535978b..f50607c 100644
--- a/hw/xfree86/int10/xf86int10.c
+++ b/hw/xfree86/int10/xf86int10.c
@@ -730,7 +730,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb108:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_read_u8(dev, & X86_CL, X86_EDI);
+	    pci_device_cfg_read_u8(dev, & X86_CL, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
@@ -743,7 +743,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb109:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_read_u16(dev, & X86_CX, X86_EDI);
+	    pci_device_cfg_read_u16(dev, & X86_CX, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
@@ -756,7 +756,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb10a:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_read_u32(dev, & X86_ECX, X86_EDI);
+	    pci_device_cfg_read_u32(dev, & X86_ECX, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
@@ -769,7 +769,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb10b:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_write_u8(dev, X86_CL, X86_EDI);
+	    pci_device_cfg_write_u8(dev, X86_CL, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
@@ -782,7 +782,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb10c:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_write_u16(dev, X86_CX, X86_EDI);
+	    pci_device_cfg_write_u16(dev, X86_CX, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
@@ -795,7 +795,7 @@ int1A_handler(xf86Int10InfoPtr pInt)
 	return 1;
     case 0xb10d:
 	if ((dev = findPci(pInt, X86_EBX)) != NULL) {
-	    pci_device_cfg_write_u32(dev, X86_ECX, X86_EDI);
+	    pci_device_cfg_write_u32(dev, X86_ECX, X86_DI);
 	    X86_EAX = X86_AL | (SUCCESSFUL << 8);
 	    X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
 	} else {
commit d34430414ac0e77eec61ab0ac9ef427b236eb639
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 13:32:55 2008 -0400

    Remove xorgconfig.  Use X -configure instead.

diff --git a/hw/xfree86/utils/Makefile.am b/hw/xfree86/utils/Makefile.am
index e3e7a61..62705d2 100644
--- a/hw/xfree86/utils/Makefile.am
+++ b/hw/xfree86/utils/Makefile.am
@@ -3,5 +3,4 @@ SUBDIRS = \
 	cvt \
 	ioport \
 	kbd_mode \
-	xorgcfg \
-	xorgconfig
+	xorgcfg
diff --git a/hw/xfree86/utils/xorgconfig/.gitignore b/hw/xfree86/utils/xorgconfig/.gitignore
deleted file mode 100644
index 6f3cabd..0000000
--- a/hw/xfree86/utils/xorgconfig/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-xorgconfig.1
diff --git a/hw/xfree86/utils/xorgconfig/Cards b/hw/xfree86/utils/xorgconfig/Cards
deleted file mode 100644
index b95928c..0000000
--- a/hw/xfree86/utils/xorgconfig/Cards
+++ /dev/null
@@ -1,3135 +0,0 @@
-# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $
-# This is the database of card definitions used by xf86config.
-# Each definition should have a NAME entry, CHIPSET (descriptive) and
-# SERVER (one of Mono, VGA16, SVGA, S3, 8514, Mach8, Mach32, Mach64, AGX,
-# P9000, W32, I128).
-# A reference to another definition is made with SEE (already defined
-# entries are not overridden).
-# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier),
-# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED
-# (indicates card that is not yet properly supported by a dedicated
-# server). A LINE entry adds a line of text to be included in the
-# Device section (can include options or comments).
-# There's no CLOCKS option (although a Clocks line can be included
-# with LINE), as it is very undesirable to have a Clocks line that
-# is incorrect. The idea is that the Clocks are probed for to be
-# sure (a commented suggested Clocks line can be included).
-#
-# The majority of entries are just a binding of a model name to a
-# chipset/server and untested.
-#
-# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.79 2002/10/16 01:31:05 dawes Exp $
-
-# VGA
-
-NAME * Generic VGA compatible
-SERVER VGA16
-DRIVER vga
-
-NAME * Generic VESA compatible
-SERVER VGA16
-DRIVER vesa
-
-NAME * Unsupported VGA compatible
-SERVER VGA16
-DRIVER vga
-UNSUPPORTED
-
-
-#	  #
-# generic #
-#	  #
-
-NAME ** Alliance Pro Motion (generic)      [apm]
-#CHIPSET apm
-SERVER SVGA
-DRIVER apm
-LINE #Option "no_accel"
-
-NAME ** Ark Logic (generic)                [ark]
-#CHIPSET ark
-SERVER SVGA
-DRIVER ark
-
-NAME ** ASPEED Technology (generic)        [ast]
-#CHIPSET ast
-SERVER SVGA
-DRIVER ast
-
-NAME ** ATI (generic)                      [ati]
-#CHIPSET ati
-SERVER SVGA
-DRIVER ati
-
-NAME ** ATI Rage 128 based (generic)       [r128]
-#CHIPSET r128
-SERVER SVGA
-DRIVER r128
-
-NAME ** ATI Radeon (generic)               [radeon]
-#CHIPSET radeon
-SERVER SVGA
-DRIVER radeon
-
-NAME ** Chips and Technologies (generic)   [chips]
-#CHIPSET chips
-SERVER SVGA
-DRIVER chips
-LINE # Option "suspend_hack"
-LINE # Option "STN"
-LINE # Option "no_stretch"
-LINE # Option "no_center"
-LINE # Option "use_modeline"
-LINE # Option "fix_panel_size"
-LINE # videoram 512
-LINE # Option "noaccel"
-LINE # Option "no_bitblt"
-LINE # Option "xaa_no_color_exp"
-LINE # Option "xaa_benchmark"
-LINE # Option "hw_cursor"
-LINE # Option "nolinear"
-LINE # MemBase 0x03b00000
-LINE # Option "hw_clocks"
-LINE # Textclockfreq 25.175
-
-NAME ** Cirrus Logic (generic)             [cirrus]
-#CHIPSET cirrus
-SERVER SVGA
-DRIVER cirrus
-LINE # MemBase 0x00e00000		# ISA card that maps to 14Mb
-LINE # MemBase 0x04000000		# VLB card that maps to 64Mb
-LINE # MemBase 0x80000000		# VLB card that maps to 2048Mb
-LINE # MemBase 0x02000000		# VLB card that maps to 32Mb
-LINE # Option "linear"
-LINE # Option "fifo_conservative"
-
-NAME ** Cyrix MediaGX (generic)            [cyrix]
-#CHIPSET cyrix
-SERVER SVGA
-DRIVER cyrix
-
-NAME ** Linux framebuffer (generic)        [fbdev]
-#CHIPSET fbdev
-SERVER SVGA
-DRIVER fbdev
-
-NAME ** 3DLabs, TI (generic)               [glint]
-#CHIPSET glint
-SERVER SVGA
-DRIVER glint
-LINE #Option "no_accel"
-
-NAME ** Number Nine I128 (generic)         [i128]
-#CHIPSET i128
-SERVER SVGA
-DRIVER i128
-
-NAME ** Intel i740 (generic)               [i740]
-#CHIPSET i740
-SERVER SVGA
-DRIVER i740
-
-NAME ** Intel i810 (generic)               [i810]
-#CHIPSET i810
-SERVER SVGA
-DRIVER i810
-
-NAME ** Matrox Graphics (generic)          [mga]
-#CHIPSET mga
-SERVER SVGA
-DRIVER mga
-LINE # Option "mga_sdram"
-
-NAME ** NeoMagic (generic)                 [neomagic]
-#CHIPSET neomagic
-SERVER SVGA
-DRIVER neomagic
-LINE # Chipset    "NM2160"
-LINE # IOBase     0xfea00000
-LINE # MemBase    0xfd000000
-LINE # VideoRam   2048
-LINE # DacSpeed   90
-LINE # Option     "linear"
-LINE # Option     "nolinear"
-LINE # Option     "sw_cursor"
-LINE # Option     "hw_cursor"
-LINE # Option     "no_accel"
-LINE # Option     "intern_disp"
-LINE # Option     "extern_disp"
-LINE # Option     "mmio"
-LINE # Option     "no_mmio"
-LINE # Option     "lcd_center"
-LINE # Option     "no_stretch"
-
-NAME ** NVIDIA (generic)                   [nv]
-#CHIPSET nv
-SERVER SVGA
-DRIVER nv
-
-NAME ** Rendition (generic)                [rendition]
-#CHIPSET rendition
-SERVER SVGA
-DRIVER rendition
-LINE # Option "sw_cursor"
-
-NAME ** S3 (not ViRGE or Savage) (generic) [s3]
-#CHIPSET s3
-SERVER SVGA
-DRIVER s3
-
-NAME ** S3 ViRGE (generic)                 [s3virge]
-#CHIPSET s3virge
-SERVER SVGA
-DRIVER s3virge
-LINE # Option "xaa_benchmark"
-LINE # Option "fifo_moderate"
-LINE # Option "pci_burst_on"
-LINE # Option "pci_retry"
-LINE # Option "lcd_center"
-LINE # Set_LCDClk  <pixel_clock_for_LCD>
-
-NAME ** S3 Savage (generic)                [savage]
-#CHIPSET savage
-SERVER SVGA
-DRIVER savage
-
-NAME ** Silicon Motion (generic)           [siliconmotion]
-#CHIPSET siliconmotion
-SERVER SVGA
-DRIVER siliconmotion
-
-NAME ** SiS (generic)                      [sis]
-#CHIPSET sis
-SERVER SVGA
-DRIVER sis
-LINE # Option "no_accel"
-LINE # Option "fifo_moderate"
-LINE # Option "fifo_conserv"
-LINE # Option "fifo_aggressive"
-LINE # Option "no_BitBlt"
-LINE # Option "fast_vram"
-LINE # Option "pci_burst_on"
-LINE # Option "xaa_benchmark"
-LINE # Option "ext_eng_queue"
-
-NAME ** 3Dfx (generic)                     [tdfx]
-#CHIPSET tdfx
-SERVER SVGA
-DRIVER tdfx
-
-NAME ** DEC TGA (generic)                  [tga]
-#CHIPSET tga
-SERVER SVGA
-DRIVER tga
-
-NAME ** Trident (generic)                  [trident]
-#CHIPSET trident
-SERVER SVGA
-DRIVER trident
-
-NAME ** Tseng Labs (generic)               [tseng]
-#CHIPSET tseng
-SERVER SVGA
-DRIVER tseng
-LINE # Option "linear"
-LINE # Option "noaccel"
-LINE # Option "power_saver"
-LINE # Option "fast_dram"
-LINE # Option "pci_retry"
-LINE # Option "hibit_high"
-LINE # Option "hibit_low"
-LINE # MemBase 0x3C00000
-
-NAME ** VMWare guest OS (generic)          [vmware]
-#CHIPSET vmware
-SERVER SVGA
-DRIVER vmware
-
-
-#Chips & Technologies
-
-#untested
-NAME Chips & Technologies CT65520
-CHIPSET ct65520
-SERVER SVGA
-DRIVER chips
-LINE # Device section for C&T cards.
-LINE # Option "suspend_hack"
-LINE # Option "STN"
-LINE # Option "no_stretch"
-LINE # Option "no_center"
-LINE # Option "use_modeline"
-LINE # Option "fix_panel_size"
-LINE # videoram 512
-
-NAME Chips & Technologies CT65525
-CHIPSET ct65525
-LINE # Option "nolinear"
-LINE # MemBase 0x03b00000
-SEE Chips & Technologies CT65520
-
-NAME Chips & Technologies CT65530
-CHIPSET ct65530
-SEE Chips & Technologies CT65525
-
-NAME Chips & Technologies CT65535
-CHIPSET ct65535
-NOCLOCKPROBE
-LINE # Option "hw_clocks"
-LINE # Textclockfreq 25.175
-SEE Chips & Technologies CT65530
-
-NAME Chips & Technologies CT65540
-CHIPSET ct65540
-NOCLOCKPROBE
-LINE # Option "use_18bit_bus"
-SEE Chips & Technologies CT65535
-
-NAME Chips & Technologies CT65545
-CHIPSET ct65545
-NOCLOCKPROBE
-LINE # Option "noaccel"
-LINE # Option "no_bitblt"
-LINE # Option "xaa_no_color_exp"
-LINE # Option "xaa_benchmark"
-LINE # Option "hw_cursor"
-LINE # Option "mmio"
-SEE Chips & Technologies CT65540
-
-NAME Chips & Technologies CT65546
-CHIPSET ct65546
-SEE Chips & Technologies CT65545
-
-NAME Chips & Technologies CT65548
-CHIPSET ct65548
-SEE Chips & Technologies CT65545
-
-NAME Chips & Technologies CT65550
-CHIPSET ct65550
-NOCLOCKPROBE
-LINE # Option "noaccel"
-LINE # Option "no_bitblt"
-LINE # Option "xaa_no_color_exp"
-LINE # Option "xaa_benchmark"
-LINE # Option "hw_cursor"
-LINE # Option "sync_on_green"
-LINE # Option "fast_dram"
-LINE # Option "use_vclk1"
-LINE # Textclockfreq 25.175
-SEE Chips & Technologies CT65530
-
-NAME Chips & Technologies CT65554
-CHIPSET ct65554
-SEE Chips & Technologies CT65550
-
-NAME Chips & Technologies CT65555
-CHIPSET ct65555
-SEE Chips & Technologies CT65550
-
-NAME Chips & Technologies CT68554
-CHIPSET ct68554
-SEE Chips & Technologies CT65550
-
-NAME Chips & Technologies CT69000
-CHIPSET ct69000
-SEE Chips & Technologies CT65550
-
-NAME Chips & Technologies CT69030
-CHIPSET ct69030
-SEE Chips & Technologies CT65550
-
-NAME Chips & Technologies CT64200
-CHIPSET ct64200
-SERVER SVGA
-DRIVER chips
-LINE # Device section for C&T cards.
-LINE # videoram 1024
-
-NAME Chips & Technologies CT64300
-CHIPSET ct64300
-SERVER SVGA
-DRIVER chips
-LINE # Option "noaccel"
-LINE # Option "no_bitblt"
-LINE # Option "xaa_no_color_exp"
-LINE # Option "xaa_benchmark"
-LINE # Option "hw_cursor"
-LINE # Option "nolinear"
-LINE # MemBase 0x03b00000
-LINE # Option "hw_clocks"
-LINE # Textclockfreq 25.175
-SEE Chips & Technologies CT64200
-
-# Cirrus Logic
-
-#tested
-NAME Cirrus Logic GD542x
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-LINE # Device section for Cirrus Logic GD5420/2/4/6/8/9-based cards.
-LINE     #MemBase 0x00e00000
-LINE     #MemBase 0x04e00000
-LINE     #Option "linear"
-
-#tested
-NAME Cirrus Logic GD543x
-CHIPSET CL-GD5430/5434/5436
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE # Device section for Cirrus Logic GD5430/34-based cards.
-LINE     #MemBase 0x00e00000		# ISA card that maps to 14Mb
-LINE     #MemBase 0x04000000		# VLB card that maps to 64Mb
-LINE     #MemBase 0x80000000		# VLB card that maps to 2048Mb
-LINE     #MemBase 0x02000000		# VLB card that maps to 32Mb
-LINE     #Option "linear"
-
-NAME Cirrus Logic GD544x
-CHIPSET CL-GD544x
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-
-NAME Creative Labs Graphics Blaster MA201
-SEE Cirrus Logic GD544x
-
-NAME Creative Labs Graphics Blaster MA202
-SEE Cirrus Logic GD544x
-
-#tested
-NAME Cirrus Logic GD5462
-CHIPSET CL-GD5462
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE #Option "fifo_conservative"
-
-#tested
-NAME Cirrus Logic GD5464
-CHIPSET CL-GD5464
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE #Option "fifo_conservative"
-
-#tested
-NAME Cirrus Logic GD5465
-CHIPSET CL-GD5465
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE #Option "fifo_conservative"
-
-NAME Creative Labs Graphics Blaster MA302
-CHIPSET CL-GD5462
-SEE Cirrus Logic GD5462
-
-NAME Creative Labs Graphics Blaster MA334
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
-
-NAME Creative Labs Graphics Blaster 3D
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
-
-#tested
-NAME Cirrus Logic GD5480
-CHIPSET CL-GD5480
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-
-#tested
-NAME Diamond SpeedStar 64
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME Diamond SpeedStar64 Graphics 2000/2200
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME Diamond SpeedStar Pro SE (CL-GD5430/5434)
-SEE Cirrus Logic GD543x
-
-NAME Diamond SpeedStar Pro 1100
-SEE Cirrus Logic GD542x
-
-NAME Orchid Kelvin 64 VLB Rev A
-CHIPSET CL-GD5434
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE # Device section for Orchid Kelvin 64 VLB Rev A
-LINE # Linear framebuffer maps at 2048Mb. Some motherboards make linear addressing
-LINE # impossible. Some cards map at 32Mb.
-LINE     #MemBase 0x02000000		# VLB card that maps to 32Mb
-LINE     #MemBase 0x04000000		# VLB card that maps to 64Mb
-LINE     MemBase 0x80000000		# VLB card that maps to 2048Mb
-LINE     #Option "linear"
-
-NAME Orchid Kelvin 64 VLB Rev B
-CHIPSET CL-GD5434
-SERVER SVGA
-DRIVER cirrus
-NOCLOCKPROBE
-LINE # Device section for Orchid Kelvin 64 VLB Rev B
-LINE # Linear framebuffer maps at 32Mb. Some motherboards make linear addressing
-LINE # impossible. Some cards map at 2048Mb.
-LINE     MemBase 0x02000000		# VLB card that maps to 32Mb
-LINE     #MemBase 0x04000000		# VLB card that maps to 64Mb
-LINE     #MemBase 0x80000000		# VLB card that maps to 2048Mb
-LINE     #Option "linear"
-
-NAME Orchid Kelvin 64
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME Intel 5430
-CHIPSET CL-GD5430
-SEE Cirrus Logic GD543x
-
-NAME STB Nitro (64)
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME STB Nitro 64 Video
-CHIPSET CL-GD5446
-SEE Cirrus Logic GD544x
-
-NAME STB Horizon
-CHIPSET CL-GD5426/28
-SEE Cirrus Logic GD542x
-
-NAME STB Horizon Video
-CHIPSET CL-GD5440
-SEE Cirrus Logic GD544x
-
-NAME Genoa 8500VL(-28)
-CHIPSET CL-GD5426/28
-SEE Cirrus Logic GD542x
-
-NAME Diamond SpeedStar Pro (not SE)
-CHIPSET CL-GD5426/28
-SEE Cirrus Logic GD542x
-
-NAME ALG-5434(E)
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME Actix ProStar
-CHIPSET CL-GD5426/5428
-SEE Cirrus Logic GD542x
-
-NAME Actix ProStar 64
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-#tested
-NAME Acumos AVGA3
-SEE Cirrus Logic GD542x
-
-NAME DFI-WG1000
-SEE Cirrus Logic GD542x
-
-NAME Spider VLB Plus
-CHIPSET CL-GD5428
-SEE Cirrus Logic GD542x
-
-NAME VI720
-CHIPSET CL-GD5434
-SEE Cirrus Logic GD543x
-
-NAME Cirrus Logic GD62xx (laptop)
-CHIPSET CL-GD6205/15/25/35
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Cirrus Logic GD64xx (laptop)
-CHIPSET CL-GD6420/6440
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Cirrus Logic GD754x (laptop)
-CHIPSET CL-GD7541/42/43/48
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Techworks Ultimate 3D
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
-
-NAME VideoLogic GrafixStar 550
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
-
-NAME Jaton Video-70P
-CHIPSET CL-GD5464
-SEE Cirrus Logic GD5464
-
-NAME PixelView Combo TV Pro (Prolink)
-CHIPSET CL-GD5480, 4MB
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE # COMMENT on card TV Tuner
-NOCLOCKPROBE
-
-NAME PixelView Combo TV 3D AGP (Prolink)
-CHIPSET CL-GD5465, 4MB
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE # COMMENT on card TV+FM Tuner
-NOCLOCKPROBE
-
-NAME Creative Labs Graphics Blaster Eclipse (OEM Model CT6510)
-SEE Cirrus Logic GD5465
-
-NAME VideoLogic GrafixStar 560 (PCI/AGP)
-SEE Cirrus Logic GD5465
-
-NAME Cirrus Logic GD5446 (noname card)
-CHIPSET CL-GD5446, 1MB (upgradable to 2MB).
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Octek VL-VGA-26
-CHIPSET CL-GD5426
-SEE Cirrus Logic GD542x
-
-NAME Octek VL-VGA-28
-CHIPSET CL-GD5428
-SEE Cirrus Logic GD542x
-
-NAME Octek Combo-26
-CHIPSET CL-GD5426
-SEE Cirrus Logic GD542x
-
-NAME Octek Combo-28
-CHIPSET CL-GD5428
-SEE Cirrus Logic GD542x
-
-NAME Octek AVGA-20
-SEE Cirrus Logic GD542x
-
-# S3 801/805
-
-NAME S3 801/805 (generic)
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME S3 86C801 (generic)
-SEE S3 801/805 (generic)
-
-NAME S3 86C805 (generic)
-SEE S3 801/805 (generic)
-
-#tested
-NAME S3 801/805 with ATT20c490 RAMDAC
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-LINE     #Option "dac_8_bit"		# Not supported by some 20c490 clones
-
-NAME S3 801/805 with SC1148{2,3,4} RAMDAC
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc11482
-
-NAME S3 801/805 with SC1148{5,7,9} RAMDAC
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc11485
-
-NAME S3 801/805 with S3 GenDAC
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC s3gendac
-CLOCKCHIP s3gendac
-
-NAME S3 801/805 with ATT20c490 RAMDAC and ICD2061A
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-CLOCKCHIP icd2061a
-LINE     #Option "dac_8_bit"		# Not supported by some 20c490 clones
-
-NAME S3 801/805 with Chrontel 8391
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-CLOCKCHIP ch8391
-LINE     Option "dac_8_bit"
-
-#tested
-NAME Actix GE32+ 2MB
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-LINE     #Option "dac_8_bit"
-
-NAME Actix GE32i
-CHIPSET S3 805i
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME Orchid Fahrenheit VA
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-
-NAME Orchid Fahrenheit 1280
-CHIPSET S3 801
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Probable clocks:
-LINE     #Clocks 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00
-LINE     #Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50
-
-NAME Orchid Fahrenheit-1280+
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20C490
-LINE     Dacspeed   110
-LINE     Option     "dac_8_bit"
-LINE     #Option    "nolinear" # VLB card may require this
-LINE     #Probable clocks:
-LINE     #Clocks     25.20 28.32 40.0 0.0 50.10 77.0 36.10 45.0
-LINE     #Clocks     130.0 120.20 80.0 31.50 110.30 65.0 75.0 94.60
-
-NAME Diamond Stealth 24
-CHIPSET S3 801/805
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-LINE     #Option    "nolinear"
-LINE     #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
-
-NAME Miro Crystal 8S
-SEE S3 801/805 (generic)
-
-NAME Miro Crystal 10SD with GenDAC
-SEE S3 801/805 with S3 GenDAC
-
-NAME Dell S3 805
-SEE S3 801/805 (generic)
-
-NAME STB Powergraph X-24
-SEE S3 801/805 with ATT20c490 RAMDAC and ICD2061A
-
-NAME JAX 8241
-SEE S3 801/805 with Chrontel 8391
-
-NAME VL-41
-SEE S3 801/805 with Chrontel 8391
-
-NAME SPEA Mirage
-SEE S3 801/805 with Chrontel 8391
-
-# S3 864/Trio64/Trio32/868
-
-NAME S3 864 (generic)
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME S3 86C864 (generic)
-SEE S3 864 (generic)
-
-NAME S3 Vision864 (generic)
-SEE S3 864 (generic)
-
-NAME S3 864 with SDAC (86C716)
-CHIPSET S3 864
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC s3_sdac
-CLOCKCHIP s3_sdac
-NOCLOCKPROBE
-
-NAME S3 864 with ATT 20C498 or 21C498
-CHIPSET S3 864
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c498
-
-NAME S3 864 with STG1703
-CHIPSET S3 864
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC stg1703
-NOCLOCKPROBE
-
-NAME S3 868 (generic)
-CHIPSET S3 868
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME S3 86C868 (generic)
-SEE S3 868 (generic)
-
-NAME S3 Vision868 (generic)
-SEE S3 868 (generic)
-
-NAME S3 868 with SDAC (86C716)
-CHIPSET S3 868
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 868 with ATT 20C498 or 21C498
-CHIPSET S3 868
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c498
-
-NAME S3 868 with ATT 20C409
-CHIPSET S3 868
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c409
-NOCLOCKPROBE
-
-NAME Number Nine FX Motion 531
-CLOCKCHIP icd2061a
-SEE S3 868 with ATT 20C498 or 21C498
-
-NAME S3 Trio64 (generic)
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 86C764 (generic)
-SEE S3 Trio64 (generic)
-
-NAME S3 Trio64V+ (generic)
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 86C765 (generic)
-SEE S3 Trio64V+ (generic)
-
-NAME S3 Trio32 (generic)
-CHIPSET S3 Trio32
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Genoa Phantom 64i with S3 SDAC
-DACSPEED 135
-SEE S3 864 with SDAC (86C716)
-
-NAME Number Nine GXE64
-CHIPSET S3 864
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-LINE     Option "number_nine"
-
-NAME Number Nine GXE64 with S3 Trio64
-SEE S3 Trio64 (generic)
-
-NAME Diamond Stealth 64 DRAM with S3 SDAC
-DACSPEED 135
-SEE S3 864 with SDAC (86C716)
-
-NAME Diamond Stealth64 Graphics 2xx0 series (864 + SDAC)
-DACSPEED 135
-SEE S3 864 with SDAC (86C716)
-
-NAME Diamond Stealth 64 DRAM with S3 Trio64
-SEE S3 Trio64 (generic)
-
-NAME Diamond Stealth64 Graphics 2xx0 series (Trio64)
-SEE S3 Trio64 (generic)
-
-NAME Diamond Stealth 64 DRAM SE
-SEE S3 Trio32 (generic)
-
-NAME Diamond Stealth64 Video 2001 series (2121/2201)
-SEE S3 Trio64V+ (generic)
-
-NAME Actix GE64
-CLOCKCHIP icd2061a
-SEE S3 864 (generic)
-
-NAME ELSA Winner 1000PRO with S3 SDAC
-SEE S3 864 with SDAC (86C716)
-
-NAME ELSA Winner 1000PRO with STG1700 or AT&T RAMDAC
-CHIPSET S3 864
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-
-NAME ELSA Winner 1000PRO/X
-SEE S3 868 with SDAC (86C716)
-
-NAME ELSA Winner 1000ISA
-CHIPSET S3 805i
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-LINE     Option "dac_8_bit"
-LINE     # the following settings should be detected and set automatically by XF86_S3
-LINE     # if the serial number of the ELSA card is printed correctly:
-LINE     #ClockChip "icd2061a"
-
-NAME Cardex Trio64
-SEE S3 Trio64 (generic)
-
-NAME Cardex Trio64Pro
-SEE S3 Trio64 (generic)
-
-NAME Miro Crystal 12SD
-SEE S3 Trio32 (generic)
-
-NAME Miro Crystal 22SD
-SEE S3 Trio64 (generic)
-
-NAME Miro Crystal 20SD with ICS2494 (BIOS 1.xx)
-SEE S3 864 with ATT 20C498 or 21C498
-
-NAME Miro Crystal 20SD with ICD2061A (BIOS 2.xx)
-CLOCKCHIP icd2061a
-SEE S3 864 with ATT 20C498 or 21C498
-
-NAME Miro Crystal 20SD VLB with S3 SDAC (BIOS 3.xx)
-SEE S3 864 with SDAC (86C716)
-
-NAME Miro Crystal 20SD PCI with S3 SDAC
-SEE S3 868 with SDAC (86C716)
-
-NAME ELSA Winner 1000AVI (SDAC version)
-SEE S3 868 with SDAC (86C716)
-
-NAME ELSA Winner 1000AVI (AT&T 20C409 version)
-SEE S3 868 with ATT 20C409
-
-NAME Diamond Stealth Video DRAM
-SEE S3 868 with SDAC (86C716)
-
-NAME Diamond Stealth64 Video 2120/2200
-SEE S3 868 with SDAC (86C716)
-
-NAME SPEA/V7 Mirage P64
-CLOCKCHIP ics2595
-SEE S3 864 (generic)
-
-NAME SPEA/V7 Mirage P64 with S3 Trio64
-SEE S3 Trio64 (generic)
-
-NAME Number Nine FX Vision 330
-SEE S3 Trio64 (generic)
-
-NAME Number Nine FX Motion 331
-SEE S3 Trio64V+ (generic)
-
-NAME ASUS Video Magic PCI V864
-SEE S3 864 (generic)
-
-NAME ASUS Video Magic PCI VT64
-SEE S3 Trio64 (generic)
-
-NAME VidTech FastMax P20
-SEE S3 864 (generic)
-
-NAME VideoLogic GrafixStar 500
-SEE S3 868 with SDAC (86C716)
-
-NAME VideoLogic GrafixStar 400
-SEE S3 Trio64V+ (generic)
-
-NAME VideoLogic GrafixStar 300
-SEE S3 Trio64 (generic)
-
-NAME 2 the Max MAXColor S3 Trio64V+
-SEE S3 Trio64V+ (generic)
-
-NAME DataExpert DSV3365
-SEE S3 Trio64V+ (generic)
-
-NAME ExpertColor DSV3365
-SEE S3 Trio64V+ (generic)
-
-NAME DSV3326
-SEE S3 Trio64V+ (generic)
-
-# S3 Trio64V2
-
-NAME S3 Trio64V2 (generic)
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 Trio64V2/DX (generic)
-SEE S3 Trio64V2 (generic)
-
-NAME S3 Trio64V2/GX (generic)
-SEE S3 Trio64V2 (generic)
-
-NAME S3 86C775 (generic)
-SEE S3 Trio64V2/DX (generic)
-
-NAME S3 86C785 (generic)
-SEE S3 Trio64V2/GX (generic)
-
-NAME ELSA WINNER 1000/T2D
-SEE S3 Trio64V2/DX (generic)
-
-
-# S3 Aurora64V+
-
-NAME S3 Aurora64V+ (generic)
-CHIPSET S3 Aurora64V+
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-LINE     # Option "lcd_center"
-LINE     # Set_LCDClk  <pixel_clock_for_LCD>
-
-NAME S3 86CM65
-SEE S3 Aurora64V+ (generic)
-
-NAME SHARP 9080
-SEE S3 Aurora64V+ (generic)
-
-NAME SHARP 9090
-SEE S3 Aurora64V+ (generic)
-
-NAME COMPAQ Armada 7730MT
-SEE S3 Aurora64V+ (generic)
-
-NAME COMPAQ Armada 7380DMT
-SEE S3 Aurora64V+ (generic)
-
-
-# S3 964/968
-
-NAME S3 964 (generic)
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 86C964 (generic)
-SEE S3 964 (generic)
-
-NAME S3 Vision964 (generic)
-SEE S3 964 (generic)
-
-NAME S3 968 (generic)
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME S3 86C968 (generic)
-SEE S3 968 (generic)
-
-NAME S3 Vision968 (generic)
-SEE S3 968 (generic)
-
-NAME Number Nine GXE64 Pro
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC ti3025
-LINE     Option "number_nine"
-
-NAME Diamond Stealth 64 VRAM
-CLOCKCHIP icd2061a
-LINE    #Option "slow_vram"
-SEE S3 964 (generic)
-
-NAME Diamond Stealth64 Video 3200
-CHIPSET S3 968
-LINE    #Option "slow_vram"
-SEE S3 968 (generic)
-
-NAME Diamond Stealth 64 Video VRAM (TI RAMDAC)
-CHIPSET S3 968
-LINE    #Option "slow_vram"
-LINE    #DacSpeed 220
-SEE S3 968 (generic)
-
-NAME Diamond Stealth64 Video 3240/3400 (TI RAMDAC)
-CHIPSET S3 968
-LINE    #Option "slow_vram"
-LINE    #DacSpeed 220
-SEE S3 968 (generic)
-
-NAME Diamond Stealth64 Video 3240/3400 (IBM RAMDAC)
-CHIPSET S3 968
-LINE    #Option "slow_vram"
-RAMDAC ibm_rgb526
-LINE    DacSpeed 220
-SEE S3 968 (generic)
-
-NAME Genoa VideoBlitz III AV
-CHIPSET S3 968
-LINE    #s3RefClk  50
-LINE    #DACspeed 170
-SEE S3 968 (generic)
-
-NAME STB Velocity 64 Video
-CHIPSET S3 968
-LINE    #s3RefClk  24
-LINE    #DACspeed 220
-SEE S3 968 (generic)
-
-NAME STB Powergraph 64 Video
-SEE S3 Trio64V+ (generic)
-
-NAME STB Powergraph 64
-SEE S3 Trio64 (generic)
-
-NAME ELSA Winner 1000TRIO
-SEE S3 Trio64 (generic)
-
-NAME ELSA Winner 1000TRIO/V
-SEE S3 Trio64V+ (generic)
-
-NAME Hercules Graphite Terminator 64
-LINE     Option "slow_vram"
-LINE    #s3RefClk  50
-LINE    #DACspeed 170
-SEE S3 964 (generic)
-
-NAME Hercules Terminator 64/Video
-SEE S3 Trio64V+ (generic)
-
-NAME Hercules Graphite Terminator 64/DRAM
-SEE S3 Trio64 (generic)
-
-NAME Hercules Graphite Terminator Pro 64
-LINE    #s3RefClk  16
-LINE    #DACspeed 220
-SEE S3 968 (generic)
-
-NAME Number Nine FX Motion 771
-LINE    #s3RefClk  16
-SEE S3 968 (generic)
-
-NAME Spider Tarantula 64
-SEE S3 964 (generic)
-
-NAME Miro Crystal 20SV
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-
-NAME Miro Crystal 40SV
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP ti3025
-
-NAME Miro Crystal 80SV
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Miro Video 20SV
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c505
-LINE    #DacSpeed 150
-CLOCKCHIP ics9161a
-
-NAME SPEA Mercury 64
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP ics9161a
-LINE     #Option "spea_mercury"
-
-NAME ELSA Winner 2000PRO-2
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "ELSA_w2000pro"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000PRO-4
-CHIPSET S3 964
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "ELSA_w2000pro"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000PRO/X-2
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000PRO/X-4
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000PRO/X-8
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000AVI
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME ELSA Gloria-4
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME ELSA Gloria-8
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Option "sync_on_green"
-NOCLOCKPROBE
-
-NAME VideoLogic GrafixStar 700
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME LeadTek WinFast S430
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME WinFast S430
-SEE LeadTek WinFast S430
-
-NAME LeadTek WinFast S510
-CHIPSET S3 968
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME WinFast S510
-SEE LeadTek WinFast S510
-
-# S3 928
-
-NAME S3 928 (generic)
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME S3 86C928 (generic)
-SEE S3 928 (generic)
-
-NAME Actix Ultra
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-LINE     #Option "dac_8_bit"
-
-NAME Diamond Stealth Pro
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-LINE     #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp
-LINE     #Option "no_linear" # Some VLB machines may require this
-
-NAME ELSA Winner 1000VL
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     # the following settings should be detected and set automatically by XF86_S3
-LINE     # if the serial number of the ELSA card is printed correctly:
-LINE     #ClockChip "icd2061a"
-LINE     #Membase 0xf8000000
-
-NAME ELSA Winner 1000TwinBus
-SEE ELSA Winner 1000VL
-
-NAME ELSA Winner 2000
-SEE S3 928 (generic)
-
-NAME Miro Crystal 16S
-SEE S3 928 (generic)
-
-NAME SPEA/V7 Mercury
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP sc11412
-LINE     Option "spea_mercury"
-
-NAME STB Pegasus
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-RAMDAC bt485
-CLOCKCHIP icd2061a
-LINE     Option "stb_pegasus"
-LINE     #Option "sync_on_green"
-
-NAME Number Nine GXE Level 14/16
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-DACSPEED 200
-CLOCKCHIP icd2061a
-LINE     Option "number_nine"
-LINE     #Option "nolinear"
-LINE     #Option "nomemaccess"
-
-NAME Number Nine GXE Level 10/11/12
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-LINE     Option "number_nine"
-
-NAME 928Movie
-CHIPSET S3 928
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2595
-RAMDAC bt485
-LINE     # pixel multiplexing not supported
-
-# S3 911/924
-
-NAME S3 911/924 (generic)
-CHIPSET S3 911/924
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-
-NAME S3 86C911 (generic)
-SEE S3 911/924 (generic)
-
-NAME S3 86C924 (generic)
-SEE S3 911/924 (generic)
-
-NAME Diamond Stealth VRAM
-CHIPSET S3 911/924
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-CLOCKCHIP icd2061a
-
-#NAME Orchid Fahrenheit 1280
-#SEE S3 911/924 (generic)
-
-NAME S3 924 with SC1148 DAC
-CHIPSET S3 924
-SERVER S3
-DRIVER vga
-UNSUPPORTED
-LINE     #Probable clocks:
-LINE     #Clocks 25.2 28.3 39.7 1.7 49.9 76.7 35.7 44
-LINE     #Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3
-
-# S3 ViRGE,/DX,/GX and ViRGE/VX
-
-NAME S3 ViRGE (old S3V server)
-CHIPSET S3 ViRGE
-SERVER S3V
-DRIVER s3virge
-NOCLOCKPROBE
-
-NAME S3 ViRGE (generic)
-CHIPSET S3 ViRGE
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-NAME S3 ViRGE/DX (generic)
-CHIPSET S3 ViRGE/DX
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-NAME S3 ViRGE/GX (generic)
-CHIPSET S3 ViRGE/GX
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-
-NAME S3 ViRGE/GX2 (generic)
-CHIPSET S3 ViRGE/GX2
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-NAME S3 ViRGE/MX (generic)
-CHIPSET S3 ViRGE/MX
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "lcd_center"
-LINE      #Set_LCDClk  <pixel_clock_for_LCD>
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-NAME S3 ViRGE/MX+ (generic)
-SEE S3 ViRGE/MX (generic)
-
-
-
-
-NAME S3 86C325 (generic)
-SEE S3 ViRGE (generic)
-
-NAME S3 86C375 (generic)
-SEE S3 ViRGE/DX (generic)
-
-NAME S3 86C385 (generic)
-SEE S3 ViRGE/GX (generic)
-
-NAME S3 86C357 (generic)
-SEE S3 ViRGE/GX2 (generic)
-
-NAME S3 86C260 (generic)
-SEE S3 ViRGE/MX (generic)
-
-NAME S3 86C280 (generic)
-SEE S3 ViRGE/MX+ (generic)
-
-
-NAME ELSA Victory 3D
-SEE S3 ViRGE (generic)
-
-NAME ELSA Victory 3DX
-SEE S3 ViRGE/DX (generic)
-
-NAME ELSA Winner 3000-S
-SEE S3 ViRGE (generic)
-
-NAME Number Nine Visual 9FX Reality 332
-SEE S3 ViRGE (generic)
-
-NAME Number Nine FX Motion 332
-SEE S3 ViRGE (generic)
-
-NAME Diamond Stealth 3D 2000
-SEE S3 ViRGE (generic)
-
-NAME Diamond Stealth 3D 2000 PRO
-SEE S3 ViRGE/DX (generic)
-
-NAME Diamond Multimedia Stealth 3D 2000
-SEE S3 ViRGE (generic)
-
-NAME Diamond Multimedia Stealth 3D 2000 PRO
-SEE S3 ViRGE/DX (generic)
-
-NAME Canopus Co. Power Window 3DV
-SEE S3 ViRGE (generic)
-
-NAME DataExpert DSV3325
-SEE S3 ViRGE (generic)
-
-NAME ExpertColor DSV3325
-SEE S3 ViRGE (generic)
-
-NAME DSV3325
-SEE S3 ViRGE (generic)
-
-NAME Hercules Terminator 64/3D
-SEE S3 ViRGE (generic)
-
-NAME Hercules Terminator 3D/DX
-SEE S3 ViRGE/DX (generic)
-
-NAME LeadTek WinFast 3D S600
-SEE S3 ViRGE (generic)
-
-NAME WinFast 3D S600
-SEE LeadTek WinFast 3D S600
-
-NAME LeadTek WinFast 3D S680
-SEE S3 ViRGE/GX2 (generic)
-
-NAME Miro MiroMedia 3D
-SEE S3 ViRGE (generic)
-
-NAME Orchid Technology Fahrenheit Video 3D
-SEE S3 ViRGE (generic)
-
-NAME STB Systems Powergraph 3D
-SEE S3 ViRGE (generic)
-
-NAME STB Nitro 3D
-CHIPSET S3 ViRGE/GX
-SEE S3 ViRGE/GX (generic)
-
-NAME MELCO WGP-VG4S
-LINE      #DACSpeed  191 162 111 83
-LINE      #SetMClck  75
-SEE S3 ViRGE (generic)
-
-
-
-NAME S3 ViRGE/VX (generic)
-CHIPSET S3 ViRGE/VX
-SERVER SVGA
-DRIVER s3virge
-NOCLOCKPROBE
-LINE      #Option "xaa_benchmark"
-LINE      #Option "fifo_moderate"
-LINE      #Option "pci_burst_on"
-LINE      #Option "pci_retry"
-
-
-NAME S3 86C988 (generic)
-SEE S3 ViRGE/VX (generic)
-
-NAME ELSA Winner 3000
-SEE S3 ViRGE/VX (generic)
-
-NAME ELSA Winner 3000-M-22
-SEE S3 ViRGE/VX (generic)
-
-NAME ELSA Winner 3000-L-42
-SEE S3 ViRGE/VX (generic)
-
-NAME ELSA Winner 2000AVI/3D
-SEE S3 ViRGE/VX (generic)
-
-NAME Diamond Stealth 3D 3000
-SEE S3 ViRGE/VX (generic)
-
-NAME STB Systems Velocity 3D
-SEE S3 ViRGE/VX (generic)
-
-NAME MELCO WGP-VX8
-SEE S3 ViRGE/VX (generic)
-
-NAME Diamond Stealth 3D 4000
-SEE S3 ViRGE/GX2 (generic)
-
-NAME Toshiba Tecra 750CDT
-SEE S3 ViRGE/MX (generic)
-
-NAME Toshiba Tecra 750DVD
-SEE S3 ViRGE/MX (generic)
-
-NAME Toshiba Tecra 540CDT
-SEE S3 ViRGE/MX (generic)
-
-NAME Toshiba Tecra 550CDT
-SEE S3 ViRGE/MX (generic)
-
-# currently unsupported S3
-
-NAME S3 86C365 (Trio3D)
-SEE * Unsupported VGA compatible
-
-NAME S3 86C391 (Savage3D)
-SEE * Unsupported VGA compatible
-
-NAME S3 Trio3D
-SEE * Unsupported VGA compatible
-
-NAME S3 Savage3D
-SEE * Unsupported VGA compatible
-
-NAME S3 Savage4
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-# ET4000/ET6000
-
-NAME ET3000 (generic)
-CHIPSET ET3000
-SERVER SVGA
-DRIVER tseng
-
-NAME Genoa 5400
-SEE ET3000 (generic)
-
-NAME ET4000 (generic)
-CHIPSET ET4000
-SERVER SVGA
-DRIVER tseng
-
-NAME ET4000/W32 (generic)
-CHIPSET ET4000/W32
-SERVER W32
-DRIVER tseng
-
-NAME ET4000 W32i, W32p (generic)
-CHIPSET ET4000/W32(i/p)
-SERVER SVGA
-DRIVER tseng
-LINE     #Option "linear"       # for linear mode at 8bpp
-LINE     #Option "noaccel"      # when problems with accelerator
-LINE     #Option "power_saver"  # enable VESA DPMS
-LINE     #Option "fast_dram"
-LINE     #Option "pci_retry"    # faster, but problematic for ISA DMA
-LINE     #Option "hibit_high"   # see README.tseng -- most cards need this
-LINE     #Option "hibit_low"    # see README.tseng -- mostly for older ET4000 cards
-LINE     #MemBase 0x3C00000     # when automatic MemBase detection doesn't work
-LINE         # -- see README.tseng for more (important) information on MemBase
-
-NAME ET6000 (generic)
-CHIPSET ET6000
-SERVER SVGA
-DRIVER tseng
-NOCLOCKPROBE
-LINE     #videoram 2304         # 2.25 MB, when memory probe is incorrect
-LINE     #Option "linear"       # for linear mode at 8bpp
-LINE     #Option "noaccel"      # when problems with accelerator
-LINE     #Option "power_saver"  # enable VESA DPMS
-LINE     #Option "pci_retry"    # faster, but problematic for ISA DMA
-LINE     #Option "hw_cursor"    # Use hardware cursor (see docs for limitations)
-LINE     #Option "xaa_no_color_exp"  # When text (or bitmap) is not rendered correctly
-
-NAME ET6100 (generic)
-CHIPSET ET6100
-SEE ET6000 (generic)
-
-NAME Diamond Stealth 32
-CLOCKCHIP icd2061a
-NOCLOCKPROBE
-SEE ET4000 W32i, W32p (generic)
-
-NAME Cardex Cobra
-SEE ET4000 W32i, W32p (generic)
-
-NAME Cardex Challenger (Pro)
-SEE ET4000 W32i, W32p (generic)
-
-NAME Colorgraphic Dual Lightning
-SEE ET4000 W32i, W32p (generic)
-
-NAME Dell onboard ET4000
-SEE ET4000 (generic)
-
-NAME DFI-WG5000
-SEE ET4000 W32i, W32p (generic)
-
-NAME Diamond SpeedStar (Plus)
-SEE ET4000 (generic)
-
-NAME Diamond SpeedStar 24
-SEE ET4000 (generic)
-
-NAME Diamond SpeedStar HiColor
-SEE ET4000 (generic)
-
-NAME Genoa 8900 Phantom 32i
-SEE ET4000 W32i, W32p (generic)
-
-NAME Hercules Dynamite
-SEE ET4000/W32 (generic)
-
-NAME Hercules Dynamite Power
-SEE ET4000 W32i, W32p (generic)
-
-NAME Hercules Dynamite Pro
-SEE ET4000 W32i, W32p (generic)
-
-NAME Integral FlashPoint
-SEE ET4000 W32i, W32p (generic)
-
-NAME LeadTek WinFast S200
-SEE ET4000 W32i, W32p (generic)
-
-NAME Matrox Comet
-SEE ET4000 W32i, W32p (generic)
-
-NAME Matrox Marvel II
-SEE ET4000 W32i, W32p (generic)
-
-NAME Miro MiroVideo 20TD
-SEE ET4000 W32i, W32p (generic)
-
-NAME WinFast S200
-SEE LeadTek WinFast S200
-
-NAME Sigma Concorde
-SEE ET4000/W32 (generic)
-
-NAME Sigma Legend
-SEE ET4000 (generic)
-
-NAME SPEA/V7 ShowTime Plus
-SEE ET4000 W32i, W32p (generic)
-
-NAME STB LightSpeed
-SEE ET4000 W32i, W32p (generic)
-
-NAME STB MVP-2
-SEE ET4000 (generic)
-
-NAME STB MVP-2 PCI
-SEE ET4000 W32i, W32p (generic)
-
-NAME STB MVP-2X
-SEE ET4000 W32i, W32p (generic)
-
-NAME STB MVP-4 PCI
-SEE ET4000 W32i, W32p (generic)
-
-NAME STB MVP-4X
-SEE ET4000 W32i, W32p (generic)
-
-NAME TechWorks Thunderbolt
-SEE ET4000/W32 (generic)
-
-NAME ViewTop PCI
-SEE ET4000 W32i, W32p (generic)
-
-NAME SNI PC5H W32
-CLOCKCHIP stg1703
-NOCLOCKPROBE
-SEE ET4000 W32i, W32p (generic)
-
-NAME SNI Scenic W32
-CLOCKCHIP stg1703
-NOCLOCKPROBE
-SEE ET4000 W32i, W32p (generic)
-
-NAME Hercules Dynamite 128/Video
-SEE ET6000 (generic)
-
-NAME STB LightSpeed 128
-SEE ET6000 (generic)
-
-NAME VideoLogic GrafixStar 600
-SEE ET6000 (generic)
-
-NAME Jazz Multimedia G-Force 128
-SEE ET6000 (generic)
-
-NAME Mirage Z-128
-SEE ET6000 (generic)
-
-NAME California Graphics SunTracer 6000
-SEE ET6000 (generic)
-
-NAME Binar Graphics AnyView
-SEE ET6000 (generic)
-
-NAME MediaVision Proaxcel 128
-SEE ET6000 (generic)
-
-NAME ATrend ATC-2165A
-SEE ET6000 (generic)
-
-NAME Interay PMC Viper
-SEE ET6000 (generic)
-
-NAME 2-the-Max MAXColor 6000
-SEE ET6000 (generic)
-
-NAME Gainward Challenger EV
-SEE ET6000 (generic)
-
-NAME MachSpeed VGA ET6000
-SEE ET6000 (generic)
-
-NAME KouTech KeyVision 128 EV
-SEE ET6000 (generic)
-
-NAME Jaton Video-58P
-SEE ET6000 (generic)
-
-# ATI
-
-NAME ATI Rage 128
-CHIPSET ati
-SERVER SVGA
-DRIVER ati
-
-NAME ATI 8514 Ultra (no VGA)
-CHIPSET ati
-SERVER Mach8
-DRIVER vga
-UNSUPPORTED
-
-NAME ATI Graphics Ultra
-CHIPSET ati
-SERVER Mach8
-DRIVER ati
-
-NAME ATI Graphics Ultra Pro
-CHIPSET ati
-SERVER Mach32
-DRIVER ati
-
-NAME ATI Wonder SVGA
-CHIPSET ati
-SERVER SVGA
-DRIVER ati
-
-NAME ATI Ultra Plus
-CHIPSET ati
-SERVER Mach32
-DRIVER ati
-
-NAME ATI Mach32
-CHIPSET ati
-SERVER Mach32
-DRIVER ati
-
-NAME ATI Mach64
-CHIPSET ati
-SERVER Mach64
-DRIVER ati
-NOCLOCKPROBE
-
-NAME ATI Mach64 CT (264CT)
-SEE ATI Mach64
-
-NAME ATI Mach64 VT (264VT)
-SEE ATI Mach64
-
-NAME ATI Mach64 GT (264GT), aka 3D RAGE
-SEE ATI Mach64
-
-NAME ATI Mach64 3D RAGE II
-SEE ATI Mach64
-
-NAME ATI Mach64 3D RAGE II+DVD
-SEE ATI Mach64
-
-NAME ATI Mach64 3D Rage IIC
-SEE ATI Mach64
-
-NAME ATI Mach64 3D Rage Pro
-SEE ATI Mach64
-
-NAME ATI 3D Pro Turbo
-SEE ATI Mach64
-
-NAME ATI 3D Pro Turbo PC2TV
-SEE ATI Mach64
-
-NAME ATI 3D Xpression
-SEE ATI Mach64
-
-NAME ATI 3D Xpression+
-SEE ATI Mach64
-
-NAME ATI 3D Xpression+ PC2TV
-SEE ATI Mach64
-
-NAME ATI All-in-Wonder
-SEE ATI Mach64
-
-NAME ATI All-in-Wonder Pro
-SEE ATI Mach64
-
-NAME ATI Graphics Pro Turbo
-SEE ATI Mach64
-
-NAME ATI Graphics Pro Turbo 1600
-SEE ATI Mach64
-
-NAME ATI Graphics Xpression
-SEE ATI Mach64
-
-NAME ATI Video Boost
-SEE ATI Mach64
-
-NAME ATI Video Charger
-SEE ATI Mach64
-
-NAME ATI Video Xpression
-SEE ATI Mach64
-
-NAME ATI Video Xpression+
-SEE ATI Mach64
-
-NAME ATI WinBoost
-SEE ATI Mach64
-
-NAME ATI WinCharger
-SEE ATI Mach64
-
-NAME ATI WinTurbo
-SEE ATI Mach64
-
-NAME ATI Xpert 98
-SEE ATI Mach64
-
-NAME ATI Xpert XL
-SEE ATI Mach64
-
-NAME ATI Xpert at Play
-SEE ATI Mach64
-
-NAME ATI Xpert at Play 98
-SEE ATI Mach64
-
-NAME ATI Xpert at Work
-SEE ATI Mach64
-
-NAME ATI integrated on Intel Maui MU440EX motherboard
-SEE ATI Mach64
-
-NAME ASUS PCI-V264CT
-SEE ATI Mach64
-
-NAME ASUS PCI-AV264CT
-SEE ATI Mach64
-
-# AGX
-
-NAME AGX (generic)
-CHIPSET AGX-014/15/16
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-
-NAME Boca Vortex (Sierra RAMDAC)
-CHIPSET AGX-015
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc15025
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-
-NAME EIZO (VRAM)
-SEE AGX (generic)
-
-NAME Orchid Celsius (AT&T RAMDAC)
-CHIPSET AGX-015
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC att20c490
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-
-NAME Orchid Celsius (Sierra RAMDAC)
-CHIPSET AGX-015
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc15025
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-
-
-NAME Spider Black Widow
-CHIPSET AGX-015
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc15025
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-
-
-NAME Spider Black Widow Plus
-CHIPSET AGX-016
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC sc15025
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-LINE     #Option "fifo_aggressive" # 3x bus bw - may result in random pixels
-LINE	 #Probable clocks:
-LINE     #Clocks 25.2  28.3  39.9  72.2  50.0  76.9  36.1  44.8
-LINE     #Clocks 89.0  119.8 79.9  31.5 110.0  64.9  74.9  94.9
-
-NAME Hercules Graphite HG210
-CHIPSET AGX-014
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-RAMDAC bt482
-DACSPEED 85
-LINE     Chipset "AGX-014"
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Probable clocks:
-LINE     #Clocks 25.0  28.0  32.0  36.0  40.0  45.0  50.0  65.0
-LINE     #Clocks 70.0  75.0  80.0  85.0  90.0  95.0 100.0 110.0
-
-NAME Hercules Graphite Pro
-CHIPSET AGX-015
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-# Card specific DAC, doesn't appear in ramdac menu
-LINE     Ramdac "herc_dual_dac"
-LINE     Chipset "AGX-015"
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-LINE     #Probable clocks:
-LINE     #Clocks 25.0  28.0  32.0  36.0  40.0  45.0  50.0  65.0
-LINE     #Clocks 70.0  75.0  80.0  85.0  90.0  95.0 100.0 110.0
-
-NAME Hercules Graphite Power
-CHIPSET AGX-016
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-# Card specific DAC, doesn't appear in ramdac menu
-#   The glue logic state machine for RAMDAC switching doesn't work as
-#   documented, for now we're stuck with the small RAMDAC
-LINE     Ramdac "herc_small_dac"
-LINE     Chipset "AGX-016"
-LINE     Option "dac_8_bit"
-LINE     Option "no_wait_state"
-LINE     #Option "fifo_moderate"   # 2x bus bw - may result in random pixels
-LINE     #Option "fifo_aggressive" # 3x bus bw - may result in random pixels
-LINE     #Probable clocks:
-LINE     #Clocks 25.0  28.0  32.0  36.0  40.0  45.0  50.0  65.0
-LINE     #Clocks 70.0  75.0  80.0  85.0  90.0  95.0 100.0 110.0
-
-NAME XGA-2  (ISA bus)
-CHIPSET XGA-2
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-LINE     #Instance  7           # XGA instance 0-7
-LINE     #COPbase   0xC8F00     # XGA memory-mapped register address
-LINE     #POSbase   0           # Disable probing if above are specified
-
-NAME XGA-1  (ISA bus)
-CHIPSET XGA-1
-SERVER AGX
-DRIVER vga
-UNSUPPORTED
-LINE     #Instance  7           # XGA instance 0-7
-LINE     #COPbase   0xC8F00     # XGA memory-mapped register address
-LINE     #POSbase   0           # Disable probing if above are specified
-
-# WD
-
-NAME Paradise/WD 90CXX
-CHIPSET WD90CXX
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME DFI-WG6000
-CHIPSET WD90C33
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Diamond SpeedStar 24X (not fully supported)
-CHIPSET WD90C31
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME WD 90C24 (laptop)
-CHIPSET WD90C24
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE     #Chipset "wd90c24"
-LINE     #Option "noaccel" # Use this if acceleration is causing problems
-LINE     #Clocks 25.175 28.322 65     36     # These are not programmable
-LINE     #Clocks 29.979 77.408 62.195 59.957 # These are programmable
-LINE     #Clocks 31.5   35.501 75.166 50.114 # These are not programmable
-LINE     #Clocks 39.822 72.038 44.744 80.092 # These are programmable
-LINE     #Clocks 44.297                      # Must match Mclk
-
-
-NAME WD 90C24A or 90C24A2 (laptop)
-CHIPSET WD90C24A
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE     #Chipset "wd90c24"
-LINE     #Clocks 25.175 28.322 65     36     # These are not programmable
-LINE     #Clocks 29.979 77.408 62.195 59.957 # These are programmable
-LINE     #Clocks 31.5   35.501 75.166 50.114 # These are not programmable
-LINE     #Clocks 39.822 72.038 44.744 80.092 # These are programmable
-LINE     #Clocks 44.297                      # Must match Mclk
-
-# Avance Logic
-
-NAME Avance Logic 2101
-CHIPSET Avance Logic
-LINE   #chipset "al2101"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Avance Logic 2228
-CHIPSET Avance Logic
-LINE   #chipset "ali2228"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Avance Logic 2301
-CHIPSET Avance Logic
-LINE   #chipset "ali2301"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Avance Logic 2302
-CHIPSET Avance Logic
-LINE   #chipset "ali2302"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Avance Logic 2308
-CHIPSET Avance Logic
-LINE   #chipset "ali2308"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Avance Logic 2401
-CHIPSET Avance Logic
-LINE   #chipset "ali2401"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Hercules Stingray
-CHIPSET ALG-2228/2301/2302
-LINE   #chipset "ali2228"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME SPEA/V7 Mirage VEGA Plus
-CHIPSET ALG-2228
-LINE   #chipset "ali2228"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-# ARK Logic
-
-NAME Ark Logic ARK1000PV (generic)
-CHIPSET ARK1000PV
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-# For now, treat the VL as a PV.  This may be changed later
-NAME Ark Logic ARK1000VL (generic)
-CHIPSET ARK1000VL
-LINE Chipset "ark1000pv"
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Ark Logic ARK2000PV (generic)
-CHIPSET ARK1000PV
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Ark Logic ARK2000MT (generic)
-CHIPSET ARK1000MT
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Hercules Stingray Pro
-SEE Ark Logic ARK1000PV (generic)
-
-NAME Hercules Stingray Pro/V
-SEE Ark Logic ARK1000PV (generic)
-
-NAME Ocean (octek) VL-VGA-1000
-RAMDAC att20c490
-SEE Ark Logic ARK1000VL (generic)
-
-NAME Hercules Stingray 64/V with ZoomDAC
-SEE Ark Logic ARK2000PV (generic)
-
-NAME Hercules Stingray 64/V with ICS5342
-CHIPSET ARK2000MT
-RAMDAC ics5342
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Diamond Stealth64 Graphics 2001 series
-CHIPSET ARK2000PV
-RAMDAC ics5342
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-# Oak
-
-NAME Oak ISA Card (generic)
-CHIPSET Oak OTI-067/77
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Oak 87 VLB (generic)
-CHIPSET Oak OTI-087
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE Option "fifo_aggressive" # Comment this if you experience streaks.
-LINE Option "no_wait"         # Comment this if you find problems.        
-LINE #Option "enable_bitblt"  # You may enable this and see if it works (see README.Oak file)
-
-NAME Oak 87 ISA (generic)
-CHIPSET Oak OTI-087
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE Option "noaccel"        # ISA cards seem to have Color Expansion support broken
-LINE #Option "enable_bitblt" # This should work on ISA, but lets not make it default just in case.
-
-NAME Paradise Accelerator Value
-SEE Oak 87 ISA (generic)
-
-# P9000
-
-NAME Diamond Viper VLB 2Mb
-CHIPSET Weitek 9000
-SERVER P9000
-DRIVER vga
-UNSUPPORTED
-LINE     #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
-LINE     #Versions later than 3.1 do not require a clocks line
-LINE     Chipset "vipervlb" # Required for some cards which autodetect as PCI
-LINE     Videoram 2048      # Required
-LINE     Membase 0x80000000 # Optional (0x80000000 is default)
-NOCLOCKPROBE
-
-NAME Diamond Viper PCI 2Mb
-CHIPSET Weitek 9000
-SERVER P9000
-DRIVER vga
-UNSUPPORTED
-LINE     #Clocks must match the mode clocks (XFree86 3.1 P9000 server)
-LINE     #Versions later than 3.1 do not require a clocks line
-LINE     Videoram 2048      # Required
-LINE     #Membase 0x80000000 # Use scanpci to get the correct Membase
-NOCLOCKPROBE
-
-NAME Orchid P9000 VLB
-CHIPSET Weitek 9000
-SERVER P9000
-DRIVER vga
-UNSUPPORTED
-LINE     Chipset "orchid_p9000"
-LINE     Membase 0xE0000000
-NOCLOCKPROBE
-
-# P9100
-
-NAME Weitek P9100 (generic)
-CHIPSET Weitek P9100
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME Diamond Viper Pro Video
-SEE Weitek P9100 (generic)
-
-# Trident
-
-NAME Trident 8900/9000 (generic)
-CHIPSET TVGA8900/9000
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Trident 8900D (generic)
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Trident TVGA9200CXr (generic)
-CHIPSET TVGA9200CXr
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-NAME Trident TGUI9400CXi (generic)
-CHIPSET TGUI9400CXi
-SERVER SVGA
-DRIVER trident
-
-NAME Trident TGUI9420DGi (generic)
-CHIPSET TGUI9420DGi
-SERVER SVGA
-DRIVER trident
-
-NAME Trident TGUI9430DGi (generic)
-CHIPSET TGUI9430DGi
-SERVER SVGA
-DRIVER trident
-
-NAME Trident TGUI9420 (generic)
-CHIPSET TGUI9420
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TGUI9440 (generic)
-CHIPSET TGUI9440
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TGUI9660 (generic)
-CHIPSET TGUI9660
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TGUI9680 (generic)
-CHIPSET TGUI9680
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TGUI9682 (generic)
-CHIPSET TGUI9682
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TGUI9685 (generic)
-CHIPSET TGUI9685
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9320 (generic)
-CHIPSET Cyber9320
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9382 (generic)
-CHIPSET Cyber9382
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9385 (generic)
-CHIPSET Cyber9385
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9388 (generic)
-CHIPSET Cyber9388
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 939a (generic)
-CHIPSET Cyber939a
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9397 (generic)
-CHIPSET Cyber9397
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Cyber 9520 (generic)
-CHIPSET Cyber9520
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident 3DImage975 (generic)
-CHIPSET 3dimage975
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident 3DImage975 AGP (generic)
-CHIPSET 3dimage975
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident 3DImage985 (generic)
-CHIPSET 3dimage985
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Providia 9682 (generic)
-CHIPSET Providia9682
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Providia 9685 (generic)
-CHIPSET Providia9685
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident TVGA 8800BR
-SEE * Generic VGA compatible
-
-NAME Trident TVGA 8800CS
-SEE * Generic VGA compatible
-
-NAME Trident CyberBlade (generic)
-CHIPSET CyberBlade
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-NAME Trident Blade3D (generic)
-CHIPSET Blade3D
-SERVER SVGA
-DRIVER trident
-NOCLOCKPROBE
-
-# SiS
-
-NAME SiS 530
-CHIPSET SIS530
-SERVER SVGA
-DRIVER sis
-
-NAME SiS 620
-CHIPSET SIS620
-SERVER SVGA
-DRIVER sis
-
-NAME SiS SG86C201
-CHIPSET SIS86C201
-SERVER SVGA
-DRIVER sis
-
-NAME SiS SG86C205
-CHIPSET SIS86C205
-SERVER SVGA
-DRIVER sis
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-NOCLOCKPROBE
-
-NAME SiS SG86C215
-CHIPSET SIS86C215 
-SERVER SVGA
-DRIVER sis
-LINE     # This is a cheap version of 86c205. I am not sure if acceleration works
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "no_BitBlt" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-NOCLOCKPROBE
-
-NAME SiS SG86C225
-CHIPSET SIS86C225
-SERVER SVGA
-DRIVER sis
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-NOCLOCKPROBE
-
-NAME SiS 5597
-CHIPSET SiS5597
-SERVER SVGA
-DRIVER sis
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-LINE     # Option "fast_vram"
-LINE     # Option "pci_burst_on"
-LINE     # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
-LINE     # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
-LINE                              # errors, but gives some accel
-NOCLOCKPROBE
-
-NAME SiS 5598
-CHIPSET SIS5598
-SERVER SVGA
-DRIVER sis
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-LINE     # Option "fast_vram"
-LINE     # Option "pci_burst_on"
-LINE     # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
-LINE     # Option "ext_eng_queue" # Turbo-queue. This can cause drawing
-LINE                              # errors, but gives some accel
-NOCLOCKPROBE
-
-NAME SiS 6326
-CHIPSET SiS6326
-SERVER SVGA
-DRIVER sis
-LINE     # Option "no_accel" # Use this if acceleration is causing problems
-LINE     # Option "fifo_moderate" 
-LINE     # Option "fifo_conserv" 
-LINE     # Option "fifo_aggressive" 
-LINE     # Option "fast_vram"
-LINE     # Option "pci_burst_on"
-LINE     # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!!
-LINE     # Option "ext_eng_queue" # Turbo-queue. This can cause drawing 
-LINE                              # errors, but gives some accel
-NOCLOCKPROBE
-
-NAME MSI MS-4417
-SEE SiS 6326
-
-NAME SiS 3D PRO AGP
-SEE SiS 6326
-
-NAME Miro Crystal DVD
-SEE SiS 6326
-
-NAME PC-Chips M567 Mainboard
-SEE SiS 5597
-
-NAME Diamond SpeedStar A50
-SEE SiS 6326
-
-# Cyrix
-
-NAME MediaGX
-CHIPSET mediagx
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-# Alliance ProMotion
-
-NAME Alliance ProMotion 6422
-CHIPSET AP6422
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-
-# Number 9 I128
-
-NAME Number Nine Imagine I-128
-CHIPSET I128
-SERVER I128
-DRIVER i128
-NOCLOCKPROBE
-
-NAME Number Nine Imagine I-128 Series 2
-CHIPSET I128
-SERVER I128
-DRIVER i128
-NOCLOCKPROBE
-
-NAME Number Nine Revolution 3D (T2R)
-CHIPSET I128
-SERVER I128
-DRIVER i128
-NOCLOCKPROBE
-
-NAME Number Nine Imagine-128 Revolution IV (T2R4)
-CHIPSET I128
-SERVER I128
-DRIVER i128
-NOCLOCKPROBE
-
-# Matrox
-
-NAME Matrox Millennium 2MB
-CHIPSET mga2064w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 2048
-NOCLOCKPROBE
-
-NAME Matrox Millennium 4MB
-CHIPSET mga2064w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-NOCLOCKPROBE
-
-NAME Matrox Millennium 8MB
-CHIPSET mga2064w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-NOCLOCKPROBE
-
-NAME Matrox Millennium II 4MB
-CHIPSET mga2164w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-NOCLOCKPROBE
-
-NAME Matrox Millennium II 8MB
-CHIPSET mga2164w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-NOCLOCKPROBE
-
-NAME Matrox Millennium II 16MB
-CHIPSET mga2164w
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 16384
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 4MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 8MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 16MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 16384
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 SD 4MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-LINE # Option "mga_sdram"
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 SD 8MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-LINE # Option "mga_sdram"
-NOCLOCKPROBE
-
-NAME Matrox Millennium G200 SD 16MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 16384
-LINE # Option "mga_sdram"
-NOCLOCKPROBE
-
-NAME Matrox Mystique
-CHIPSET mga1064sg
-SERVER SVGA
-DRIVER mga
-NOCLOCKPROBE
-
-NAME Matrox Mystique G200 4MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-NOCLOCKPROBE
-
-NAME Matrox Mystique G200 8MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-NOCLOCKPROBE
-
-NAME Matrox Millennium G400
-CHIPSET mgag400
-SERVER SVGA
-DRIVER mga
-NOCLOCKPROBE
-
-NAME Matrox Mystique G200 16MB
-CHIPSET mgag200
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 16384
-NOCLOCKPROBE
-
-NAME Matrox Productiva G100 4MB
-CHIPSET mgag100
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 4096
-NOCLOCKPROBE
-
-NAME Matrox Productiva G100 8MB
-CHIPSET mgag100
-SERVER SVGA
-DRIVER mga
-LINE VideoRam 8192
-NOCLOCKPROBE
-
-# NVIDIA
-
-NAME Diamond Edge 3D
-CHIPSET nv1
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-NOCLOCKPROBE
-
-NAME RIVA128
-CHIPSET RIVA128
-SERVER SVGA
-DRIVER nv
-NOCLOCKPROBE
-
-NAME RIVA TNT
-CHIPSET RIVATNT
-SERVER SVGA
-DRIVER nv
-NOCLOCKPROBE
-
-NAME RIVA TNT2
-CHIPSET RIVATNT2
-SERVER SVGA
-DRIVER nv
-NOCLOCKPROBE
-
-NAME NVIDIA GeForce
-CHIPSET GeForce
-SERVER SVGA
-DRIVER nv
-NOCLOCKPROBE
-
-NAME ELSA VICTORY ERAZOR
-SEE RIVA128
-
-NAME ELSA Winner 1000 R3D
-SEE RIVA128
-
-NAME ELSA ERAZOR II
-SEE RIVA TNT
-
-NAME Diamond Viper 330
-SEE RIVA128
-
-NAME Diamond Viper 550
-SEE RIVA TNT
-
-NAME Diamond Viper 770
-SEE RIVA TNT2
-
-NAME STB Velocity 128
-SEE RIVA128
-
-NAME STB nvidia 128
-SEE RIVA128
-
-NAME STB Velocity 4400
-SEE RIVA TNT
-
-NAME ASUS 3Dexplorer
-SEE RIVA128
-
-NAME Guillemot Maxi Gamer Xentor
-SEE RIVA TNT2
-
-NAME Guillemot Maxi Gamer Xentor 32
-SEE RIVA TNT2
-
-NAME Creative Graphics Blaster TNT
-SEE RIVA TNT
-
-NAME Creative Graphics Blaster TNT2
-SEE RIVA TNT2
-
-# 3Dfx
-NAME Voodoo Banshee (generic)
-SERVER SVGA
-CHIPSET 3dfx Banshee
-DRIVER tdfx
-
-NAME Voodoo3 (generic)
-SERVER SVGA
-CHIPSET 3dfx Voodoo3
-DRIVER tdfx
-
-NAME Elsa Victory II
-SEE Voodoo Banshee (generic)
-
-NAME Diamond Monster Fusion
-SEE Voodoo Banshee (generic)
-
-NAME AOpen PA2010
-SEE Voodoo Banshee (generic)
-
-NAME Chaintech Desperado 3F10
-SEE Voodoo Banshee (generic)
-
-# 3DLabs
-
-NAME ELSA GLoria-L/MX
-CHIPSET GLINT MX
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME ELSA GLoria-L
-CHIPSET GLINT 500TX
-SERVER 3DLabs
-DRIVER glint
-NOCLOCKPROBE
-
-NAME ELSA GLoria-XL
-CHIPSET GLINT MX
-SERVER 3DLabs
-DRIVER glint
-NOCLOCKPROBE
-
-NAME Diamond Fire GL 3000
-CHIPSET GLINT 500TX
-SERVER 3DLabs
-DRIVER glint
-LINE Option "firegl_3000"
-NOCLOCKPROBE
-
-NAME ELSA GLoria-S
-CHIPSET PERMEDIA
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-LINE #VideoRam 8192
-NOCLOCKPROBE
-
-NAME Diamond Fire GL 1000
-CHIPSET PERMEDIA
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-LINE #VideoRam 8192
-NOCLOCKPROBE
-
-NAME ELSA GLoria Synergy
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME ELSA Winner 2000/Office
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME Diamond Fire GL 1000 PRO
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME Creative Blaster Exxtreme
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME AccelStar Permedia II AGP
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME Leadtek WinFast 2300
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-NOCLOCKPROBE
-
-NAME 3DLabs Oxygen GMX
-CHIPSET PERMEDIA 2
-SERVER 3DLabs
-DRIVER glint
-LINE #Option "no_accel"
-NOCLOCKPROBE
-
-NAME Appian Jeronimo 2000
-CHIPSET PERMEDIA 3
-SERVER 3DLabs
-DRIVER glint
-NOCLOCKPROBE
-
-# Alliance Semiconductor
-
-NAME Diamond Stealth Video 2500
-CHIPSET Alliance AT24 
-SERVER SVGA
-DRIVER apm
-NOCLOCKPROBE
-
-NAME AT3D
-CHIPSET Alliance AT3D
-SERVER SVGA
-DRIVER apm
-NOCLOCKPROBE
-LINE #Option "no_accel"
-
-NAME AT25
-SEE AT3D
-
-NAME Hercules Stingray 128 3D
-SEE AT3D
-
-# NeoMagic
-
-NAME NeoMagic (laptop/notebook)
-CHIPSET MagicGraph 128 series
-SERVER SVGA
-DRIVER neomagic
-LINE #    Chipset    "NM2160"
-LINE #    IOBase     0xfea00000
-LINE #    MemBase    0xfd000000
-LINE #    VideoRam   2048
-LINE #    DacSpeed   90
-LINE #    Option     "linear"
-LINE #    Option     "nolinear"
-LINE #    Option     "sw_cursor"
-LINE #    Option     "hw_cursor"
-LINE #    Option     "no_accel"
-LINE #    Option     "intern_disp"
-LINE #    Option     "extern_disp"
-LINE #    Option     "mmio"
-LINE #    Option     "no_mmio"
-LINE #    Option     "lcd_center"
-LINE #    Option     "no_stretch"
-
-# Epson SPC8110
-
-NAME EPSON SPC8110 (CardPC)
-CHIPSET SPC8110
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE #    Chipset    "spc8110"
-LINE #    MemBase    0x03e00000
-LINE #    VideoRam   1024
-LINE #    Option     "nolinear"
-LINE #    Option     "sw_cursor"
-LINE #    Option     "noaccel"
-LINE #    Option     "fifo_moderate"
-LINE #    Option     "fifo_conservative"
-
-# Silicon Motion, Inc.
-
-NAME Silicon Motion Lynx family
-CHIPSET Lynx
-SERVER SVGA
-DRIVER siliconmotion
-NOCLOCKPROBE
-
-# Rendition
-
-NAME Rendition Verite 1000
-CHIPSET Verite 1000
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE # Option "sw_cursor"
-
-NAME Rendition Verite 2x00
-CHIPSET Verite 2x00
-SERVER SVGA
-DRIVER vga
-UNSUPPORTED
-LINE # Option "sw_cursor"
-
-NAME Creative Labs 3D Blaster PCI (Verite 1000)
-SEE Rendition Verite 1000
-
-NAME Canopus Total-3D
-SEE Rendition Verite 1000
-
-NAME Sierra Screaming 3D
-SEE Rendition Verite 1000
-
-NAME Miro CRYSTAL VRX
-SEE Rendition Verite 1000
-
-NAME Diamond Stealth II S220
-CHIPSET Verite 2100
-SEE Rendition Verite 2x00
-
-NAME Hercules Thriller3D
-CHIPSET Verite 2200
-SEE Rendition Verite 2x00
-
-# Digital
-
-NAME Digital 8-plane TGA (UDB/Multia)
-CHIPSET TGA
-SERVER TGA
-DRIVER tga
-RAMDAC Bt485
-
-NAME Digital 8-plane TGA (ZLXp-E1)
-CHIPSET TGA
-SERVER TGA
-DRIVER tga
-RAMDAC Bt485
-
-NAME Digital 24-plane TGA (ZLXp-E2)
-CHIPSET TGA
-SERVER TGA
-DRIVER tga
-RAMDAC Bt463
-
-NAME Digital 24-plane+3D TGA (ZLXp-E3)
-CHIPSET TGA
-SERVER TGA
-DRIVER tga
-RAMDAC Bt463
-
-# i810
-
-NAME Intel 810
-SERVER SVGA
-DRIVER i810
-
-# i740
-
-NAME Intel 740 (generic)
-SERVER SVGA
-DRIVER i740
-
-# Misc
-
-END
diff --git a/hw/xfree86/utils/xorgconfig/Cards98 b/hw/xfree86/utils/xorgconfig/Cards98
deleted file mode 100644
index ef14a03..0000000
--- a/hw/xfree86/utils/xorgconfig/Cards98
+++ /dev/null
@@ -1,647 +0,0 @@
-# $XFree86: xc/programs/Xserver/hw/xfree98/xf86config/Cards98,v 1.7 1998/06/04 16:43:45 hohndel Exp $
-#
-#
-#
-# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $
-# This is the database of card definitions used by xf86config.
-# Each definition should have a NAME entry, CHIPSET (descriptive) and
-# SERVER (one of EGC, GANBWAP, PEGC, NKVNEC, WABS, WABEP, WSNA, TGUI,
-# MGA, SVGA, NECS3, PWSKB, PWLB, GA968).
-# A reference to another definition is made with SEE (already defined
-# entries are not overridden).
-# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier),
-# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED
-# (indicates card that is not yet properly supported by a dedicated
-# server). A LINE entry adds a line of text to be included in the
-# Device section (can include options or comments).
-# There's no CLOCKS option (although a Clocks line can be included
-# with LINE), as it is very undesirable to have a Clocks line that
-# is incorrect. The idea is that the Clocks are probed for to be
-# sure (a commented suggested Clocks line can be included).
-#
-# The majority of entries are just a binding of a model name to a
-# chipset/server and untested.
-#
-
-# EGC
-
-NAME EGC16
-CHIPSET EGC
-SERVER EGC
-LINE    Chipset "vga"
-
-# PEGC
-
-NAME PEGC
-CHIPSET PEGC
-SERVER PEGC
-LINE    VideoRam	512
-LINE    Clocks	31.5
-LINE    # Virtual resolution for 640x400
-LINE    # Clocks	28.322
-
-# GANBWAP
-
-NAME GA-98NBI
-CHIPSET CL-GD5434
-SERVER GANBWAP
-LINE    ClockChip	"cirrus"
-LINE    Option	"ga98nb1"
-LINE    Option	"no_mmio"
-LINE    # Option	"sw_cursor"
-
-NAME GA-98NBII
-CHIPSET CL-GD5434
-SERVER GANBWAP
-LINE    ClockChip	"cirrus"
-LINE    Option	"ga98nb2"
-LINE    Option	"no_mmio"
-LINE    # Option	"sw_cursor"
-
-NAME GA-98NBIV
-CHIPSET CL-GD5434
-SERVER GANBWAP
-LINE    ClockChip	"cirrus"
-LINE    Option	"ga98nb4"
-LINE    Option	"no_mmio"
-LINE    # Option	"sw_cursor"
-
-NAME WAP-2000/4000
-CHIPSET CL-GD5434
-SERVER GANBWAP
-LINE    Option	"wap"
-LINE    Option	"no_mmio"
-LINE    # Option	"epsonmemwin"
-
-# NKVNEC
-
-NAME PCNKV/PCNKV2/NEC_CIRRUS
-CHIPSET CL-GD5428/5429/5430
-SERVER NKVNEC
-LINE    # Option	"fast_dram"
-LINE    VideoRam    1024
-
-NAME PC9821Bf/U8W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Bp/U8W/U7W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Bs/U7W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Be/U7W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821BA3/U2/W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821BX3/U2/W
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821BX4/U2
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cb
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Ce
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cf
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Ce2
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cs
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cs2
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cx
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Cx2
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Es
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Nd
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Ne2
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Nf
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Np
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Ns
-LINE    Option	"nec_cirrus"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V7/C
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V10/C,S
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V12/S
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V13/S
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V16/S
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V16/S5V,P
-LINE    Chipset "clgd5446"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821V20/S7
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xb10
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xc13/S5
-LINE    Chipset "clgd5446"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xc16/M,S
-LINE    Chipset "clgd5446"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xc200/M,S
-LINE    Chipset "clgd5446"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xa7e
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xe
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC9821Xe10
-LINE    Chipset "clgd5430"
-LINE    Option	"nec_cirrus"
-LINE    Option	"no_mmio"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC486MR
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC486MS
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC486MU
-LINE    Chipset "clgd5429"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC486MV
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC586MV
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-NAME PC586RV
-LINE    Chipset "clgd5429"
-SEE PCNKV/PCNKV2/NEC_CIRRUS
-
-# WABS
-
-NAME WAB-S
-CHIPSET CL-GD5426/5428
-SERVER WABS
-LINE    VideoRam	1024
-LINE    # VideoRam	2048
-
-NAME WAB-1000/2000
-CHIPSET CL-GD5428
-SERVER WABS
-LINE    VideoRam	1024
-LINE    # VideoRam	2048
-
-NAME WSR-E/G
-SEE WAB-1000/2000
-
-# WABEP
-
-NAME WAB-EP
-CHIPSET CL-GD5428
-SERVER WABEP
-LINE    Option	"med_dram"
-
-# WSNA
-
-NAME WSN-A2F
-CHIPSET CL-GD5434
-SERVER WSNA
-LINE    Option	"no_mmio"
-LINE    Option	"med_dram"
-
-# TGUI
-
-NAME NEC Trident
-CHIPSET TGUI9680/9682
-SERVER TGUI
-LINE    Option	"xaa_no_color_exp"
-LINE    # Option	"noaccel"
-LINE    # Option	"Linear"
-LINE    # Option	"med_dram"
-LINE    # Option	"hw_cursor"
-
-NAME PC9821Ra20/N
-SEE NEC Trident
-
-NAME PC9821RaII23/N,W
-SEE NEC Trident
-
-NAME PC9821Ra266/N,W
-SEE NEC Trident
-
-NAME PC9821Rs20/B20
-SEE NEC Trident
-
-NAME PC9821RsII26/B40
-SEE NEC Trident
-
-NAME PC9821V13/M7
-SEE NEC Trident
-
-NAME PC9821V16/M7
-SEE NEC Trident
-
-NAME PC9821V20/M7
-SEE NEC Trident
-
-NAME PC9821Xa7/C,K
-SEE NEC Trident
-
-NAME PC9821Xa9/C,K
-SEE NEC Trident
-
-NAME PC9821Xa10/C,K
-SEE NEC Trident
-
-NAME PC9821Xa12/C,K
-SEE NEC Trident
-
-NAME PC9821Xa13/C,K,W
-SEE NEC Trident
-
-NAME PC9821Xa16/R,W
-SEE NEC Trident
-
-NAME PC9821Xa20/W
-SEE NEC Trident
-
-NAME PC9821Xc13/M,S
-SEE NEC Trident
-
-NAME PC9821Xv13/R
-SEE NEC Trident
-
-NAME GA-DRV/98
-CHIPSET TGUI9680
-SERVER TGUI
-LINE    Option	"noaccel"
-LINE    # Option	"med_dram"
-LINE    # Option	"hw_cursor"
-
-# MGA
-
-NAME MGA Millennium
-CHIPSET MGA2064W
-SERVER MGA
-
-NAME PC9821Xt13
-SEE MGA Millennium
-
-NAME PC9821Xt16
-SEE MGA Millennium
-
-NAME PC9821Xv13/W
-SEE MGA Millennium
-
-NAME PC9821Xv20/W
-SEE MGA Millennium
-
-NAME PC9821St15
-SEE MGA Millennium
-
-NAME PC9821St20
-SEE MGA Millennium
-
-NAME PC9821RvII26/N20
-SEE MGA Millennium
-
-NAME NEC FC-WAB-X2
-SEE MGA Millennium
-
-NAME MGA Mystique
-CHIPSET MGA1064SG
-SERVER MGA
-
-NAME PC9821V166/S
-LINE    VideoRam	2048
-SEE MGA Mystique
-
-NAME PC9821V200/S
-LINE    VideoRam	2048
-SEE MGA Mystique
-
-NAME PC9821V200/M
-LINE    VideoRam	4096
-SEE MGA Mystique
-
-NAME PC9821V233/M7
-LINE    VideoRam	2048
-SEE MGA Mystique
-
-NAME PC9821V233/M7V
-LINE    VideoRam	4096
-SEE MGA Mystique
-
-# SVGA
-
-NAME NEC Cirrus 755x
-CHIPSET CL-GD7555
-LINE    Chipset "clgd7555"
-LINE    # VideoRam	2048
-LINE    # Option	"no_bitblt"
-LINE    # Option	"fast_dram"
-LINE    Option	"linear"
-LINE    Option	"noaccel"
-SERVER SVGA
-
-NAME PC9821Nr12
-SEE NEC Cirrus 755x
-
-NAME PC9821Nr13
-SEE NEC Cirrus 755x
-
-NAME PC9821La13
-SEE NEC Cirrus 755x
-
-NAME PC9821Ls12
-SEE NEC Cirrus 755x
-
-NAME PC9821Ls13
-SEE NEC Cirrus 755x
-
-NAME PC9821Ls150
-SEE NEC Cirrus 755x
-
-# NECS3
-
-NAME NEC WAB-A/B
-CHIPSET S3 928
-SERVER NECS3
-LINE    Chipset	"s3_generic"
-LINE    Dacspeed	110
-LINE    Ramdac	"sc15025"
-LINE    Option	"dac_8_bit"
-LINE    # Option	"necwab"
-LINE    # Option	"nomemaccess"
-LINE    Clocks	25.0  28.0  40.0   0.0  50.0  77.0  36.0  45.0
-LINE    Clocks	130.0 120.0  80.0  31.0 110.0  65.0  75.0  94.0
-
-NAME NEC FC-WAB-A/B
-CHIPSET S3 928
-SERVER NECS3
-LINE    Chipset	"s3_generic"
-LINE    Dacspeed	110
-LINE    Ramdac	"bt485"
-LINE    Option	"necwab"
-LINE    Option	"nomemaccess"
-LINE    Option	"noinit"
-LINE    Option	"nolinear"
-LINE    Clocks	25.0  28.0  40.0   0.0  50.0  77.0  36.0  45.0
-LINE    Clocks	130.0 120.0  80.0  31.0 110.0  65.0  75.0  94.0
-
-NAME PC9821Af/U9W E09?
-SEE NEC WAB-A/B
-
-NAME PC9821An/U8W
-SEE NEC WAB-A/B
-
-NAME PC9821Ap2/U8W/C9W
-SEE NEC WAB-A/B
-
-NAME PC9821As2/U7W/U8W
-SEE NEC WAB-A/B
-
-NAME NEC 864
-CHIPSET S3 864
-SERVER NECS3
-LINE    Chipset	"s3_generic"
-LINE    Option	"necwab"
-LINE    Ramdac	"s3_sdac"
-LINE    ClockChip	"s3_sdac"
-
-NAME PC9821Ap3
-SEE NEC 864
-
-NAME PC9821As3
-SEE NEC 864
-
-NAME PC9821Xp
-SEE NEC 864
-
-NAME PC9821Xs
-SEE NEC 864
-
-# PWSKB
-
-NAME PowerWindow 928/801
-CHIPSET S3 928
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    Ramdac	"sc15025"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"epsonmemwin"
-LINE    # Option	"nomemaccess"
-LINE    ClockChip	"icd2061a"
-
-NAME PowerWindow 928II
-CHIPSET S3 928
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    Ramdac	"att20c505"
-LINE    # Ramdac	"bt485"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"pw_mux"
-LINE    Option	"bt485_curs"
-LINE    # Option	"epsonmemwin"
-LINE    # Option	"nomemaccess"
-LINE    ClockChip	"icd2061a"
-
-NAME PowerWindow 805i
-CHIPSET S3 805
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    Ramdac	"s3gendac"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"pw805i"
-LINE    # Option	"epsonmemwin"
-LINE    # Option	"nomemaccess"
-LINE    ClockChip	"s3_sdac"
-
-NAME PowerWindow 928G
-CHIPSET S3 928
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    Ramdac	"sc15025"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"nomemaccess"
-LINE    # Option	"nolinear"
-LINE    ClockChip	"icd2061a"
-
-NAME PCSKB/PCSKB2
-CHIPSET S3 911/924
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    Ramdac	"sc15025"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"nomemaccess"
-LINE    Option	"pcskb"
-LINE    Clocks	25.0  28.0  40.0   0.0  50.0  77.0  36.0  45.0
-LINE    Clocks	130.0 120.0  80.0  31.0 110.0  65.0  75.0  94.0
-
-NAME PCSKB3/PCSKB4/PCPKB4
-CHIPSET S3 928
-SERVER PWSKB
-LINE    Chipset	"s3_generic"
-LINE    Ramdac	"sc15025"
-LINE    # Ramdac	"att20c498"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    Option	"nomemaccess"
-LINE    Option	"pcskb4"
-LINE    Clocks	 25.0  28.0  40.0   0.0  50.0  77.0  36.0  45.0
-LINE    Clocks	130.0 120.0  80.0  31.0 110.0  65.0  75.0  94.0
-
-# PWLB
-
-NAME PowerWindow 928GLB
-CHIPSET S3 928
-SERVER PWLB
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    Ramdac	"sc15025"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    # Option	"pw_localbus"
-LINE    # Option	"nomemaccess"
-LINE    # Option	"nolinear"
-LINE    ClockChip	"icd2061a"
-
-NAME PowerWindow 928IILB
-CHIPSET S3 928
-SERVER PWLB
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    Ramdac	"att20c505"
-LINE    # Ramdac	"bt485"
-LINE    Dacspeed	110
-LINE    Option	"dac_8_bit"
-LINE    Option	"bt485_curs"
-LINE    Option	"pw_localbus"
-LINE    # Option	"pw_mux"
-LINE    # Option	"nomemaccess"
-LINE    # Option	"nolinear"
-LINE    ClockChip	"icd2061a"
-
-NAME PowerWindow 964LB
-CHIPSET S3 964
-SERVER PWLB
-LINE    Chipset	"s3_generic"
-LINE    Option	"pw_localbus"
-LINE    Option	"number_nine"
-LINE    Ramdac	"ti3025"
-LINE    ClockChip	"ti3025"
-LINE    VideoRam	4096
-
-# GA968
-
-NAME GA-968V4/PCI
-CHIPSET S3 968
-SERVER GA968
-LINE    Chipset	"s3_generic"
-LINE    # Chipset	"mmio_928"
-LINE    VideoRam	4096
diff --git a/hw/xfree86/utils/xorgconfig/Makefile.am b/hw/xfree86/utils/xorgconfig/Makefile.am
deleted file mode 100644
index dabfc32..0000000
--- a/hw/xfree86/utils/xorgconfig/Makefile.am
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright 2005 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons
-# to whom the Software is furnished to do so, provided that the above
-# copyright notice(s) and this permission notice appear in all copies of
-# the Software and that both the above copyright notice(s) and this
-# permission notice appear in supporting documentation.
-# 
-# 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
-# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# 
-# Except as contained in this notice, the name of a copyright holder
-# shall not be used in advertising or otherwise to promote the sale, use
-# or other dealings in this Software without prior written authorization
-# of the copyright holder.
-# 
-
-bin_PROGRAMS = xorgconfig
-
-X11dir = $(libdir)/X11
-dist_X11_DATA = Cards
-
-xorgconfig_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ \
-	-DCARD_DATABASE_FILE='"$(X11dir)/Cards"' \
-	-DPROJECTROOT='"$(PROJECTROOT)"' \
-        -DFILEMANSUFFIX='"$(FILE_MAN_SUFFIX)"' \
-        -DXVERSIONSTRING='"$(PACKAGE_STRING)"'
-
-xorgconfig_LDADD = @XORGCONFIG_DEP_LIBS@
-
-xorgconfig_SOURCES =	\
-	cards.c		\
-	cards.h		\
-	xorgconfig.c
-
-# Man page
-include $(top_srcdir)/cpprules.in
-
-appmandir = $(APP_MAN_DIR)
-
-appman_PRE = xorgconfig.man
-appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
-
-EXTRAMANDEFS = \
-	-D__XCONFIGFILE__=$(__XCONFIGFILE__) \
-	-D__XSERVERNAME__=$(XSERVERNAME)
-
-BUILT_SOURCES = $(appman_PRE)
-CLEANFILES = $(appman_PRE) $(appman_DATA)
-
-SUFFIXES += .$(APP_MAN_SUFFIX) .man
-
-.man.$(APP_MAN_SUFFIX):
-	-rm -f $@
-	$(LN_S) $< $@
-
-EXTRA_DIST = \
-	Cards98 \
-	xorgconfig.man.pre
diff --git a/hw/xfree86/utils/xorgconfig/cards.c b/hw/xfree86/utils/xorgconfig/cards.c
deleted file mode 100644
index 8116f0a..0000000
--- a/hw/xfree86/utils/xorgconfig/cards.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- *  Functions to manipulate card database.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "cards.h"
-
-/* Some vars to make path names in texts more flexible. */
-#ifndef PROJECTROOT
-# define PROJECTROOT		"/usr"
-#endif
-#define TREEROOT		PROJECTROOT
-#define TREEROOTLX		TREEROOT "/lib/X11"
-#define TREEROOTCFG		TREEROOT "/etc/X11"
-#ifdef XDOCDIR
-# define TREEROOTDOC		XDOCDIR
-#else
-# define TREEROOTDOC		TREEROOTLX "/doc"
-#endif
-
-/*
- * Database format:
- *
- * NAME <name of card>
- * CHIPSET <chipset description>
- * SERVER <server name>	
- * DRIVER <driver name>
- *
- * Optional keywords:
- * RAMDAC <ramdac identifier>
- * CLOCKCHIP <clockchip identifier>
- * DACSPEED <dacspeed>
- * NOCLOCKPROBE
- * UNSUPPORTED
- *
- * SEE <name of card> refers to another card definition; parameters that
- * are already defined are not overridden.
- *
- * <server name> is one of Mono, VGA16, SVGA, S3, Mach32, Mach8, 8514,
- * P9000, AGX, W32.
- *
- * A useful additional keywords may be CLOCKS.
- */
-
-
-
-/* Database vars. */
-
-int lastcard;
-
-Card card[MAX_CARDS];
-
-
-static int
-getnextline(FILE *f, char *l)
-{
-	if (fgets(l, 128, f) == NULL)
-		return -1;
-	return 0;
-}
-
-static void
-appendstring(char **destp, char *src)
-{
-	char *newstr;
-	newstr = malloc(strlen(*destp) + strlen(src) + 1);
-	strcpy(newstr, *destp);
-	strcat(newstr, src);
-	if (strlen(*destp) > 0)
-		free(*destp);
-	*destp = newstr;
-}
-
-int
-lookupcard(char *name) {
-	int i;
-	for (i = 0; i <= lastcard; i++)
-		if (strcmp(name, card[i].name) == 0)
-			return i;
-	return -1;
-}
-
-static char *s3_comment =
-"# Use Option \"nolinear\" if the server doesn't start up correctly\n"
-"# (this avoids the linear framebuffer probe). If that fails try\n"
-"# option \"nomemaccess\".\n"
-"#\n"
-"# Refer to " TREEROOTDOC "/README.S3, and the XF86_S3 man page.\n";
-
-static char *cirrus_comment =
-"# Use Option \"no_bitblt\" if you have graphics problems. If that fails\n"
-"# try Option \"noaccel\".\n"
-"# Refer to " TREEROOTDOC "/README.cirrus.\n"
-"# To allow linear addressing, uncomment the Option line and the\n"
-"# address that the card maps the framebuffer to.\n";
-
-int parse_database() {
-	FILE *f;
-	char buf[128];
-	int i, lineno;
-	char filename[128];
-
-	strcpy(filename, CARD_DATABASE_FILE);
-	f = fopen(filename, "r");
-	if (f == NULL)
-		return -1;
-
-	lastcard = -1;
-	lineno = 0;
-
-	for (;;) {
-		if (getnextline(f, buf))
-			break;
-		lineno++;
-		if (buf[0] == '#')
-			/* Comment. */
-			continue;
-		if (strncmp(buf, "END", 3) == 0)
-			/* End of database. */
-			break;
-		if (strncmp(buf, "LINE", 4) == 0 && lastcard>=0) {
-			/* Line of Device comment. */
-			/* Append to existing lines. */
-			appendstring(&card[lastcard].lines, buf + 5);
-			continue;
-		}
-		/*
-		 * The following keywords require the trailing newline
-		 * to be deleted.
-		 */
-		i = strlen(buf);
-		buf[--i] = '\0';
-
-		/* remove trailing spaces or tabs */
-		for(--i; i>=0 && (buf[i] == ' ' || buf[i] == '\011'); i--) ;
-		if (i>=0)
-		   buf[i+1] = '\0';
-		else 
-		   continue; /* skip empty lines */
-
-		if (strncmp(buf, "NAME", 4) == 0) {
-			/* New entry. */
-			lastcard++;
-			card[lastcard].name = malloc(strlen(buf + 5) + 1);
-			strcpy(card[lastcard].name, buf + 5);
-			card[lastcard].chipset = NULL;
-		        card[lastcard].server = NULL;
-			card[lastcard].driver = NULL;
-		        card[lastcard].ramdac = NULL;
-			card[lastcard].clockchip = NULL;
-			card[lastcard].dacspeed = NULL;
-			card[lastcard].flags = 0;
-			card[lastcard].lines = "";
-			continue;
-		}
-		if (lastcard < 0)  /* no NAME line found yet */
-		   continue; 
-		if (strncmp(buf, "SEE", 3) == 0) {
-			/* Reference to another entry. */
-			int i;
-			i = lookupcard(buf + 4);
-			if (i == -1) {
-				printf("Error in database, invalid reference: %s.\n",
-					buf + 4);
-				free(card[lastcard].name);
-				lastcard--;
-				continue;
-			}
-			if (card[lastcard].chipset == NULL)
-				card[lastcard].chipset = card[i].chipset;
-			if (card[lastcard].server == NULL)
-				card[lastcard].server = card[i].server;
-			if (card[lastcard].driver == NULL)
-				card[lastcard].driver = card[i].driver;
-			if (card[lastcard].ramdac == NULL)
-				card[lastcard].ramdac = card[i].ramdac;
-			if (card[lastcard].clockchip == NULL)
-				card[lastcard].clockchip = card[i].clockchip;
-			if (card[lastcard].dacspeed == NULL)
-				card[lastcard].dacspeed = card[i].dacspeed;
-			card[lastcard].flags |= card[i].flags;
-			appendstring(&card[lastcard].lines, card[i].lines);
-			continue;
-		}
-		if (strncmp(buf, "CHIPSET", 7) == 0) {
-			/* Chipset description. */
-			card[lastcard].chipset = malloc(strlen(buf + 8) + 1);
-			strcpy(card[lastcard].chipset, buf + 8);
-			continue;
-		}
-		if (strncmp(buf, "SERVER", 6) == 0) {
-			/* Server identifier. */
-			card[lastcard].server = malloc(strlen(buf + 7) + 1);
-			strcpy(card[lastcard].server, buf + 7);
-			continue;
-		}
-		if (strncmp(buf, "DRIVER", 6) == 0) {
-			/* Driver identifier. */
-			card[lastcard].driver = malloc(strlen(buf + 7) + 1);
-			strcpy(card[lastcard].driver, buf + 7);
-			continue;
-		}
-		if (strncmp(buf, "RAMDAC", 6) == 0) {
-			/* Ramdac indentifier. */
-			card[lastcard].ramdac = malloc(strlen(buf + 7) + 1);
-			strcpy(card[lastcard].ramdac, buf + 7);
-			continue;
-		}
-		if (strncmp(buf, "CLOCKCHIP", 9) == 0) {
-			/* Clockchip indentifier. */
-			card[lastcard].clockchip = malloc(strlen(buf + 10) + 1);
-			strcpy(card[lastcard].clockchip, buf + 10);
-			card[lastcard].flags |= NOCLOCKPROBE;
-			continue;
-		}
-		if (strncmp(buf, "DACSPEED", 8) == 0) {
-			/* Clockchip indentifier. */
-			card[lastcard].dacspeed = malloc(strlen(buf + 9) + 1);
-			strcpy(card[lastcard].dacspeed, buf + 9);
-			continue;
-		}
-		if (strncmp(buf, "NOCLOCKPROBE", 12) == 0) {
-			card[lastcard].flags |= NOCLOCKPROBE;
-			continue;
-		}
-		if (strncmp(buf, "UNSUPPORTED", 12) == 0) {
-			card[lastcard].flags |= UNSUPPORTED;
-			continue;
-		}
-		/* test for missing required fields */
-		if (card[lastcard].driver == NULL) {
-		    fprintf(stderr, "Warning DRIVER specification missing "
-			    "in Card database entry %s (line %d).\n", 
-			    card[lastcard].name, lineno);
-		    keypress();
-		       card[lastcard].driver = "unknown";
-		}
-		if (card[lastcard].chipset == NULL) {
-		    fprintf(stderr, "Warning CHIPSET specification missing "
-			    "in Card database entry %s (line %d).\n", 
-			    card[lastcard].name, lineno);
-		    keypress();
-		    card[lastcard].chipset = "unknown";
-		}
-	    }
-
-	fclose(f);
-
-	/*
-	 * Add general comments.
-	 */
-	for (i = 0; i <= lastcard; i++) {
-		if (card[i].server && strcmp(card[i].server, "S3") == 0)
-			appendstring(&card[i].lines, s3_comment);
-		if (card[i].chipset && 
-		    strncmp(card[i].chipset, "CL-GD", 5) == 0)
-			appendstring(&card[i].lines, cirrus_comment);
-	}
-
-	sort_database();
-
-	return 0;
-}
-
-static int
-compare_card(const void *e1, const void *e2)
-{
-	return strcmp(((Card *)e1)->name, ((Card *)e2)->name);
-}
-
-void
-sort_database() {
-	/* Each element is a bunch of words, but nothing too bad. */
-	qsort(card, lastcard + 1, sizeof(Card), compare_card);
-}
diff --git a/hw/xfree86/utils/xorgconfig/cards.h b/hw/xfree86/utils/xorgconfig/cards.h
deleted file mode 100644
index 7e1438d..0000000
--- a/hw/xfree86/utils/xorgconfig/cards.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef CARD_DATABASE_FILE
-#define CARD_DATABASE_FILE "Cards"
-#endif
-
-#define MAX_CARDS 1000
-
-typedef struct {
-	char *name;		/* Name of the card. */
-	char *chipset;		/* Chipset (decriptive). */
-	char *server;		/* Server identifier. */
-        char *driver;		/* Driver identifier. */
-        char *ramdac;		/* Ramdac identifier. */
-	char *clockchip;	/* Clockchip identifier. */
-	char *dacspeed;		/* DAC speed rating. */
-	int flags;
-	char *lines;		/* Additional Device section lines. */
-} Card;
-
-/* Flags: */
-#define NOCLOCKPROBE	0x1	/* Never probe clocks of the card. */
-#define UNSUPPORTED	0x2	/* Card is not supported (only VGA). */
-
-extern int lastcard;
-
-extern Card card[MAX_CARDS];
-
-extern int lookupcard ( char *name );
-extern int parse_database ( void );
-extern void sort_database ( void );
-extern void keypress ( void );
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c
deleted file mode 100644
index 30eb831..0000000
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.c
+++ /dev/null
@@ -1,2890 +0,0 @@
-/*
- * This is a configuration program that will create a base XF86Config
- * file based on menu choices. Its main feature is that clueless users
- * may be less inclined to select crazy sync rates way over monitor spec,
- * by presenting a menu with standard monitor types. Also some people
- * don't read docs unless an executable that they can run tells them to.
- *
- * It assumes a 24-line or bigger text console.
- *
- * Revision history:
- * 25Sep94 Initial version.
- * 27Sep94 Fix hsync range of monitor types to match with best possible mode.
- *         Remove 'const'.
- *         Tweak descriptions.
- * 28Sep94 Fixes from J"org Wunsch:
- *           Don't use gets().
- *           Add mouse device prompt.
- *           Fix lines overrun for 24-line console.
- *         Increase buffer size for probeonly output.
- * 29Sep94 Fix bad bug with old XF86Config preserving during probeonly run.
- *         Add note about vertical refresh in interlaced modes.
- *         Name gets() replacement getstring().
- *         Add warning about binary paths.
- *         Fixes from David Dawes:
- *           Don't use 'ln -sf'.
- *           Omit man path reference in comment.
- *           Generate only a generic 320x200 SVGA section for accel cards.
- *	     Only allow writing to /usr/X11R6/lib/X11 if root, and use
- *	       -xf86config for the -probeonly phase (root only).
- *         Fix bug that forces screen type to accel in some cases.
- * 30Sep94 Continue after clocks probe fails.
- *         Note about programmable clocks.
- *         Rename to 'xf86config'. Not to be confused with XF86Config
- *           or the -xf86config option.
- * 07Oct94 Correct hsync in standard mode timings comments, and include
- *           the proper +/-h/vsync flags.
- * 11Oct94 Skip 'numclocks:' and 'pixel clocks:' lines when probing for
- * 	     clocks.
- * 18Oct94 Add check for existence of /usr/X11R6.
- *	   Add note about ctrl-alt-backspace.
- * 06Nov94 Add comment above standard mode timings in XF86Config.
- * 24Dec94 Add low-resolution modes using doublescan.
- * 29Dec94 Add note in horizontal sync range selection.
- *	   Ask about ClearDTR/RTS option for Mouse Systems mice.
- *	   Ask about writing to /etc/XF86Config.
- *	   Allow link to be set in /var/X11R6/bin.
- *	   Note about X -probeonly crashing.
- *	   Add keyboard Alt binding option for non-ASCII characters.
- *	   Add card database selection.
- *	   Write temporary XF86Config for clock probing in /tmp instead
- *	     of /usr/X11R6/lib/X11.
- *	   Add RAMDAC and Clockchip menu.
- * 27Mar99 Modified for XFree86 4.0 config file format
- * 06Sep02 Write comment block about 'DontVTSwitch'.
- *
- * Possible enhancements:
- * - Add more standard mode timings (also applies to README.Config). Missing
- *   are 1024x768 @ 72 Hz, 1152x900 modes, and 1280x1024 @ ~70 Hz.
- *   I suspect there is a VESA standard for 1024x768 @ 72 Hz with 77 MHz dot
- *   clock, and 1024x768 @ 75 Hz with 78.7 MHz dot clock. New types of
- *   monitors probably work better with VESA 75 Hz timings.
- * - Add option for creation of clear, minimal XF86Config.
- * - The card database doesn't include most of the entries in previous
- *   databases.
- *
- * Send comments to H.Hanemaayer at inter.nl.net.
- *
- * Things to keep up-to-date:
- * - Accelerated server names.
- * - Ramdac and Clockchip settings.
- * - The card database.
- *
- */
-/*  Oct2000
- *  New 'Configuration of XKB' section.
- *  Author: Ivan Pascal      The XFree86 Project.
- */
-/*
- *  Nov2002
- *  Some enhancements:
- *  - Add new PS/2 mouse protocol.
- *    "IMPS/2","ExplorerPS/2","ThinkingMousePS/2","MouseManPlusPS/2",
- *    "GlidePointPS/2","NetMousePS/2" and "NetScrollPS/2".
- *  - Add mouse-speed setting for PS/2 mouse.
- *  - Fix seg.fault problem on Solaris.
- *  - Add modestring "1400x1050"(for ATI Mobile-Rage).
- *  - Add videomemory 8192, 16384, 32768, 65536, 131072 and 262144.
- *  - Ready to DRI.
- *  - Load xtt module instead of freetype module.
- *  - Add font path "/TrueType/" and "/freefont/".
- *  Chisato Yamauchi(cyamauch at phyas.aichi-edu.ac.jp)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "xorg-server.h"
-# include "xkb-config.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <X11/Xlib.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBrules.h>
-#define MAX_XKBOPTIONS	5
-
-#include "cards.h"
-
-
-/*
- * Define the following to 310 to remove references to XFree86 features that
- * have been added since XFree86 3.1 (e.g. DoubleScan modes).
- * or to 311 to remove certain new modelines
- */
-#define XFREE86_VERSION 400
-
-/*
- * Define this to have /etc/X11/XF86Config prompted for as the default
- * location to write the XF86Config file to.
- */
-#define PREFER_XF86CONFIG_IN_ETC
-
-/*
- * Define this to force the user to go through XKB configuration section.
- *
- */
-#define FORCE_XKB_DIALOG
-
-/*
- * Configuration variables.
- */
-
-#define MAX_CLOCKS_LINES 16
-
-#define DUMBCONFIG2 "dumbconfig.2"
-#define DUMBCONFIG3 "dumbconfig.3"
-
-/* some more vars to make path names in texts more flexible. OS/2 users
- * may be more irritated than Unix users
- */
-#ifndef PROJECTROOT
-#define PROJECTROOT		"/usr"
-#endif
-#define TREEROOT		PROJECTROOT
-#define TREEROOTLX		TREEROOT "/lib/X11"
-#define TREEROOTCFG		TREEROOT "/etc/X11"
-#define TREEROOTSHARE		TREEROOT "/share/X11"
-#ifdef XDOCDIR
-# define TREEROOTDOC		XDOCDIR
-#else
-# define TREEROOTDOC		TREEROOTLX "/doc"
-#endif
-#ifdef XFONTDIR
-# define TREEROOTFONT		XFONTDIR
-#else
-# define TREEROOTFONT		TREEROOTLX "/fonts"
-#endif
-#define MODULEPATH		TREEROOT "/lib/modules"
-
-#define XSERVERNAME_FOR_PROBE "X"
-
-#ifndef XCONFIGFILE
-#define XCONFIGFILE		"xorg.conf"
-#endif
-#define CONFIGNAME		XCONFIGFILE
-
-/*
- * This is the filename of the temporary XF86Config file that is written
- * when the program is told to probe clocks (which can only happen for
- * root).
- */
-#define TEMPORARY_XF86CONFIG_DIR_PREFIX "/tmp/."XCONFIGFILE
-#define TEMPORARY_XF86CONFIG_FILENAME XCONFIGFILE".tmp"
-
-#ifndef XF86_VERSION_MAJOR
-#ifdef XVERSION
-#if XVERSION > 40000000
-#define XF86_VERSION_MAJOR	(XVERSION / 10000000)
-#else
-#define XF86_VERSION_MAJOR	(XVERSION / 1000)
-#endif
-#else
-#define XF86_VERSION_MAJOR	4
-#endif
-#endif
-
-
-int config_mousetype;		/* Mouse. */
-int config_emulate3buttons;
-int config_chordmiddle;
-int config_cleardtrrts;
-char *config_pointerdevice;
-int config_altmeta;		/* Keyboard. */
-int config_monitortype;		/* Monitor. */
-char *config_hsyncrange;
-char *config_vsyncrange;
-char *config_monitoridentifier;
-int config_videomemory;		/* Video card. */
-int config_screentype;		/* mono, vga16, svga, accel */
-char *config_deviceidentifier;
-int config_numberofclockslines;
-char *config_clocksline[MAX_CLOCKS_LINES];
-char *config_modesline8bpp;
-char *config_modesline16bpp;
-char *config_modesline24bpp;
-int config_virtual;		/* 1 (yes) or 0 (no) */
-int config_virtualx8bpp, config_virtualy8bpp;
-int config_virtualx16bpp, config_virtualy16bpp;
-int config_virtualx24bpp, config_virtualy24bpp;
-char *config_ramdac;
-char *config_dacspeed;
-char *config_clockchip;
-#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
-char *config_keyboard_dev = "/dev/wskbd0";
-#endif
-int config_xkbdisable = 0;
-char *config_xkbrules;
-char *config_xkbmodel = "pc105";
-char *config_xkblayout = "us";
-char *config_xkbvariant = (char *) 0;
-char *config_xkboptions = (char *) 0;
-char *config_depth;
-
-char *temp_dir = "";
-
-/*
- * These are from the selected card definition. Parameters from the
- * definition are offered during the questioning about the video card.
- */
-
-int card_selected;	/* Card selected from database. */
-
-
-static int write_XF86Config(char *filename);
-
-
-/*
- * This is the initial intro text that appears when the program is started.
- */
-
-static char *intro_text =
-"\n"
-"This program will create a basic " CONFIGNAME " file, based on menu selections\n"
-"you make.  It will ask for a pathname when it is ready to write the file.\n"
-"\n"
-"The " CONFIGNAME " file usually resides in /etc/X11 or " TREEROOTCFG ".  If\n"
-"no " CONFIGNAME " file is present there, " __XSERVERNAME__" will probe the system to\n"
-"autoconfigure itself.  You can run " __XSERVERNAME__ " -configure to generate a " CONFIGNAME "\n"
-"file based on the results of autoconfiguration, or let this program\n"
-"produce a base " CONFIGNAME " file for your configuration, and fine-tune it.\n"
-"A sample " CONFIGNAME " file is also supplied with "__XSERVERNAME__"; it is configured \n"
-"for a standard VGA card and monitor with 640x480 resolution.\n"
-"\n"
-"There are also many chipset and card-specific options and settings available,\n"
-"but this program does not know about these. On some configurations some of\n"
-"these settings must be specified. Refer to the X driver man pages and the\n"
-"chipset-specific READMEs in " TREEROOTDOC " for further details.\n"
-#if 0
-" Refer to " TREEROOTDOC "/README.Config\n"
-"for a detailed overview of the configuration process.\n"
-"\n"
-"(what should we change this section to?)\n"
-"For accelerated servers (including accelerated drivers in the SVGA server),\n"
-"there are many chipset and card-specific options and settings. This program\n"
-"does not know about these. On some configurations some of these settings must\n"
-"be specified. Refer to the server man pages and chipset-specific READMEs.\n"
-#endif
-"\n"
-"Before continuing with this program, make sure you know what video card\n"
-"you have, and preferably also the chipset it uses and the amount of video\n"
-"memory on your video card, as well as the specifications of your monitor.\n"
-"\n"
-;
-
-static char *finalcomment_text =
-"File has been written. Take a look at it before starting an X server. Note that\n"
-"the " CONFIGNAME " file must be in one of the directories searched by the server\n"
-"(e.g. /etc/X11) in order to be used. Within the server press\n"
-"ctrl, alt and '+' simultaneously to cycle video resolutions. Pressing ctrl,\n"
-"alt and backspace simultaneously immediately exits the server (use if\n"
-"the monitor doesn't sync for a particular mode).\n"
-"\n"
-"For further configuration, refer to the " XCONFIGFILE "(" FILEMANSUFFIX ") manual page.\n"
-"\n";
-
-static void *
-Malloc(int i) {
-       void *p;
-
-       p = malloc(i);
-       if (p == NULL) {
-               printf("Fatal malloc error\n");
-               exit(-1);
-       }
-       return p;
-}
-
-static char *
-Strdup(const char *s){
-	char *d;
-
-	d = Malloc(strlen(s) + 1);
-	strcpy(d, s);
-	return d;
-}
-
-static void 
-createtmpdir(void) {
-       /* length of prefix + 20 (digits in 2**64) + 1 (slash) + 1 */
-       temp_dir = Malloc(strlen(TEMPORARY_XF86CONFIG_DIR_PREFIX) + 22);
-       sprintf(temp_dir, "%s%ld", TEMPORARY_XF86CONFIG_DIR_PREFIX,
-	       (long)getpid());
-       if (mkdir(temp_dir, 0700) != 0) {
-               printf("Cannot create directory %s\n", temp_dir);
-               exit(-1);
-       }
-       /* append a slash */
-       strcat(temp_dir, "/");
-}
-
-
-void 
-keypress(void) {
-	printf("Press enter to continue, or ctrl-c to abort.");
-	getchar();
-	printf("\n");
-}
-
-static void 
-emptylines(void) {
-	int i;
-	for (i = 0; i < 50; i++)
-		printf("\n");
-}
-
-static int 
-answerisyes(char *s)
-{
-	if (s[0] == '\'')	/* For fools that type the ' literally. */
-		return tolower(s[1]) == 'y';
-	return tolower(s[0]) == 'y';
-}
-
-/*
- * This is a replacement for gets(). Limit is 80 chars.
- * The 386BSD descendants scream about using gets(), for good reason.
- */
-
-static void 
-getstring(char *s)
-{
-	char *cp;
-	if (fgets(s, 80, stdin) == NULL)
-		exit(1);
-	cp = strchr(s, '\n');
-	if (cp)
-		*cp=0;
-}
-
-/*
- * Mouse configuration.
- */
-
-int	M_OSMOUSE,	M_WSMOUSE,		M_AUTO,
-	M_SYSMOUSE,	M_MOUSESYSTEMS, 	M_PS2,
-	M_MICROSOFT,	M_BUSMOUSE,		M_IMPS2,
-	M_EXPLORER_PS2, M_GLIDEPOINT_PS2,	M_MOUSEMANPLUS_PS2,
-	M_NETMOUSE_PS2, M_NETSCROLL_PS2,	M_THINKINGMOUSE_PS2,
-	M_ACECAD,	M_GLIDEPOINT,		M_INTELLIMOUSE,
-	M_LOGITECH,	M_MMHITTAB,		M_MMSERIES,
-	M_MOUSEMAN,	M_THINKINGMOUSE,	M_VUID;
-
-struct {
-	char *name;
-	int *ident;
-	char *desc;
-} mouse_info[] = {
-#if defined(QNX4)
-#define DEF_PROTO_STRING	"OSMOUSE"
-	{"OSMOUSE",		&M_OSMOUSE,
-	 "OSMOUSE"
-	},
-#endif
-#ifdef WSCONS_SUPPORT
-#define WS_MOUSE_STRING		"wsmouse"
-#define DEF_PROTO_STRING	WS_MOUSE_STRING
-	{WS_MOUSE_STRING,	&M_WSMOUSE,
-	 "wsmouse protocol"
-	},
-#endif
-#ifndef DEF_PROTO_STRING
-#define DEF_PROTO_STRING	"Auto"
-#endif
-	{"Auto",		&M_AUTO,
-	 "Auto detect"
-	},
-#ifdef sun
-	{"VUID",		&M_VUID,
-	 "Solaris VUID protocol (SPARC, USB, or virtual mouse)"
-	},
-#endif
-	{"SysMouse",		&M_SYSMOUSE,
-	 "SysMouse"
-	},
-#define M_MOUSESYSTEMS_STRING	"MouseSystems"
-	{M_MOUSESYSTEMS_STRING,	&M_MOUSESYSTEMS,
-	 "Mouse Systems (3-button protocol)"
-	},
-	{"PS/2",		&M_PS2,
-	 "PS/2 Mouse"
-	},
-#define M_MICROSOFT_STRING	"Microsoft"
-	{M_MICROSOFT_STRING,	&M_MICROSOFT,
-	 "Microsoft compatible (2-button protocol)"
-	},
-	{"Busmouse",		&M_BUSMOUSE,
-	 "Bus Mouse"
-	},
-#ifndef __FreeBSD__
-	{"IMPS/2",		&M_IMPS2,
-	 "IntelliMouse PS/2"
-	},
-	{"ExplorerPS/2",	&M_EXPLORER_PS2,
-	 "Explorer PS/2"
-	},
-	{"GlidePointPS/2",	&M_GLIDEPOINT_PS2,
-	 "GlidePoint PS/2"
-	},
-	{"MouseManPlusPS/2",	&M_MOUSEMANPLUS_PS2,
-	 "MouseManPlus PS/2"
-	},
-	{"NetMousePS/2",	&M_NETMOUSE_PS2,
-	 "NetMouse PS/2"
-	},
-	{"NetScrollPS/2",	&M_NETSCROLL_PS2,
-	 "NetScroll PS/2"
-	},
-	{"ThinkingMousePS/2",	&M_THINKINGMOUSE_PS2,
-	 "ThinkingMouse PS/2"
-	},
-#endif
-	{"AceCad",		&M_ACECAD,
-	 "AceCad"
-	},
-	{"GlidePoint",		&M_GLIDEPOINT,
-	 "GlidePoint"
-	},
-	{"IntelliMouse",	&M_INTELLIMOUSE,
-	 "Microsoft IntelliMouse"
-	},
-	{"Logitech",		&M_LOGITECH,
-	 "Logitech Mouse (serial, old type, Logitech protocol)"
-	},
-	{"MMHitTab",		&M_MMHITTAB,
-	 "MM HitTablet"
-	},
-	{"MMSeries",		&M_MMSERIES,
-	 "MM Series"	/* XXXX These descriptions should be improved. */
-	},
-	{"MouseMan",		&M_MOUSEMAN,
-	 "Logitech MouseMan (Microsoft compatible)"
-	},
-	{"ThinkingMouse",	&M_THINKINGMOUSE,
-	 "ThinkingMouse"
-	},
-};
-
-#ifdef WSCONS_SUPPORT
-# define DEF_MOUSEDEV "/dev/wsmouse";
-#elif defined(__FreeBSD__) || defined(__DragonFly__)
-# define DEF_MOUSEDEV "/dev/sysmouse";
-#elif defined(__linux__)
-# define DEF_MOUSEDEV "/dev/input/mice";
-#else
-# define DEF_MOUSEDEV "/dev/mouse";
-#endif
-
-static char *mouseintro_text =
-"First specify a mouse protocol type. Choose one from the following list:\n"
-"\n";
-
-static char *mousedev_text =
-"Now give the full device name that the mouse is connected to, for example\n"
-"/dev/tty00. Just pressing enter will use the default, %s.\n"
-"\n";
-
-static char *mousecomment_text =
-"The recommended protocol is " DEF_PROTO_STRING ". If you have a very old mouse\n"
-"or don't want OS support or auto detection, and you have a two-button\n"
-"or three-button serial mouse, it is most likely of type " M_MICROSOFT_STRING ".\n"
-#ifdef WSCONS_SUPPORT
-"\n"
-"If your system uses the wscons console driver, with a PS/2 type mouse,\n"
-"select " WS_MOUSE_STRING ".\n"
-#endif
-"\n";
-
-static char *twobuttonmousecomment_text =
-"You have selected a two-button mouse protocol. It is recommended that you\n"
-"enable Emulate3Buttons.\n";
-
-static char *threebuttonmousecomment_text =
-"You have selected a three-button mouse protocol. It is recommended that you\n"
-"do not enable Emulate3Buttons, unless the third button doesn't work.\n";
-
-static char *unknownbuttonsmousecomment_text =
-"If your mouse has only two buttons, it is recommended that you enable\n"
-"Emulate3Buttons.\n";
-
-static char *microsoftmousecomment_text =
-"You have selected a Microsoft protocol mouse. If your mouse was made by\n"
-"Logitech, you might want to enable ChordMiddle which could cause the\n"
-"third button to work.\n";
-
-static char *mousesystemscomment_text =
-"You have selected a Mouse Systems protocol mouse. If your mouse is normally\n"
-"in Microsoft-compatible mode, enabling the ClearDTR and ClearRTS options\n"
-"may cause it to switch to Mouse Systems mode when the server starts.\n";
-
-static char *logitechmousecomment_text =
-"You have selected a Logitech protocol mouse. This is only valid for old\n"
-"Logitech mice.\n";
-
-static char *mousemancomment_text =
-"You have selected a Logitech MouseMan type mouse. You might want to enable\n"
-"ChordMiddle which could cause the third button to work.\n";
-
-static void 
-mouse_configuration(void) {
-
-#if !defined(QNX4)
-	int i, j;
-	char s[80];
-	char *def_mousedev = DEF_MOUSEDEV;
-
-#define MOUSETYPE_COUNT sizeof(mouse_info)/sizeof(mouse_info[0])
-	for (i = 0; i < MOUSETYPE_COUNT; i++)
-		*(mouse_info[i].ident) = i;
-
-	for (i=0;;) {
-		emptylines();
-		printf("%s", mouseintro_text);
-		for (j = i; j < i + 14 && j < MOUSETYPE_COUNT; j++)
-			printf("%2d.  %s [%s]\n", j + 1,
-			       mouse_info[j].name, mouse_info[j].desc);
-		printf("\n");
-		printf("%s", mousecomment_text);
-		printf("Enter a protocol number: ");
-		getstring(s);
-		if (strlen(s) == 0) {
-			i += 14;
-			if (i >= MOUSETYPE_COUNT)
-				i = 0;
-			continue;
-		}
-		config_mousetype = atoi(s) - 1;
-		if (config_mousetype >= 0 && config_mousetype < MOUSETYPE_COUNT)
-			break;
-	}
-	printf("\n");
-
-	if (config_mousetype == M_LOGITECH) {
-		/* Logitech. */
-		printf("%s", logitechmousecomment_text);
-		printf("\n");
-		printf("Please answer the following question with either 'y' or 'n'.\n");
-		printf("Are you sure it's really not a Microsoft compatible one? ");
-		getstring(s);
-		if (!answerisyes(s))
-			config_mousetype = M_MICROSOFT;
-		printf("\n");
-	}
-
-	config_chordmiddle = 0;
-	if (config_mousetype == M_MICROSOFT || config_mousetype == M_MOUSEMAN) {
-		/* Microsoft or MouseMan. */
-		if (config_mousetype == M_MICROSOFT)
-			printf("%s", microsoftmousecomment_text);
-		else
-			printf("%s", mousemancomment_text);
-		printf("\n");
-		printf("Please answer the following question with either 'y' or 'n'.\n");
-		printf("Do you want to enable ChordMiddle? ");
-		getstring(s);
-		if (answerisyes(s))
-			config_chordmiddle = 1;
-		printf("\n");
-	}
-
-	config_cleardtrrts = 0;
-	if (config_mousetype == M_MOUSESYSTEMS) {
-		/* Mouse Systems. */
-		printf("%s", mousesystemscomment_text);
-		printf("\n");
-		printf("Please answer the following question with either 'y' or 'n'.\n");
-		printf("Do you want to enable ClearDTR and ClearRTS? ");
-		getstring(s);
-		if (answerisyes(s))
-			config_cleardtrrts = 1;
-		printf("\n");
-	}
-
-	if (config_mousetype == M_MICROSOFT) {
-		if (config_chordmiddle)
-			printf("%s", threebuttonmousecomment_text);
-		else
-			printf("%s", twobuttonmousecomment_text);
-	}
-	else if (config_mousetype == M_MOUSESYSTEMS ||
-		 config_mousetype == M_INTELLIMOUSE) {
-		printf("%s", threebuttonmousecomment_text);
-	}
-	else {
-		printf("%s", unknownbuttonsmousecomment_text);
-	}
-
-	printf("\n");
-
-	printf("Please answer the following question with either 'y' or 'n'.\n");
-	printf("Do you want to enable Emulate3Buttons? ");
-	getstring(s);
-	if (answerisyes(s))
-		config_emulate3buttons = 1;
-	else
-		config_emulate3buttons = 0;
-	printf("\n");
-
-#if (defined(sun) && (defined(__i386) || defined(__x86)))
-	/* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse, 
-	   but PS/2 mice default to /dev/kdmouse */
-	if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) {
-	    def_mousedev = "/dev/kdmouse";
-	}
-#endif
-
-	printf(mousedev_text, def_mousedev);
-	printf("Mouse device: ");
-	getstring(s);
-	if (strlen(s) == 0) {
-		config_pointerdevice = def_mousedev;
-	} else {
-		config_pointerdevice = Malloc(strlen(s) + 1);
-		strcpy(config_pointerdevice, s);
-	}
-	printf("\n");
-
-#else
-       	/* set some reasonable defaults for OS/2 */
-       	config_mousetype = M_OSMOUSE;
-	config_chordmiddle = 0;       
-	config_cleardtrrts = 0;
-	config_emulate3buttons = 0;
-	config_pointerdevice = "QNXMOUSE";
-#endif
-}
-
-
-/*
- * Keyboard configuration.
- */
-
-/*
- * Configuration of XKB 
- */
-static char *xkbmodeltext = 
-"Please select one of the following keyboard types that is the better\n"
-"description of your keyboard. If nothing really matches,\n"
-"choose \"Generic 104-key PC\"\n\n";
-
-static char *xkblayouttext = 
-"Please select the layout corresponding to your keyboard\n";
-
-static char *xkbvarianttext =
-"Please enter a variant name for '%s' layout. Or just press enter\n"
-"for default variant\n\n";
-
-static char *xkboptionstext = 
-"Please answer the following question with either 'y' or 'n'.\n"
-"Do you want to select additional XKB options (group switcher,\n"
-"group indicator, etc.)? ";
-
-#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
-static char *kbdevtext =
-"Please enter the device name for your keyboard or just press enter\n"
-"for the default of wskbd0\n\n";
-#endif
-
-static void 
-keyboard_configuration(void)
-{
-	int i, j;
-	char s[80];
-        char *rulesfile;
-	int number, options[MAX_XKBOPTIONS], num_options;
-        XkbRF_RulesPtr rules;
-
-#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
-	printf(kbdevtext);
-	getstring(s);
-	if (strlen(s) != 0) {
-	    config_keyboard_dev = Malloc(strlen(s) + 1);
-	    strcpy(config_keyboard_dev, s);
-	}
-#endif
-
-#ifndef XKB_RULES_DIR
-# define XKB_RULES_DIR XKB_BASE_DIRECTORY "/rules"
-#endif
-	
-#ifdef XFREE98_XKB
-	config_xkbrules = "xfree98";	/* static */
-        rulesfile = XKB_RULES_DIR "/xfree98";
-#else
-	config_xkbrules = __XKBDEFRULES__;	/* static */
-        rulesfile = XKB_RULES_DIR "/" __XKBDEFRULES__;
-#endif
-
-        rules = XkbRF_Load(rulesfile, "", True, False);
-	emptylines();
-
-        if (!rules) {
-            printf("XKB rules file '%s' not found\n", rulesfile);
-            printf("Keyboard XKB options will be set to default values.\n");
-            keypress();
-            return;
-        }
-
-	number = -1;
-	for (i=0;;) {
-		emptylines();
-		printf(xkbmodeltext);
-		for (j = i; j < i + 16 && j < rules->models.num_desc; j++)
-		    printf("%3d  %-50s\n", j+1, rules->models.desc[j].desc);
-		printf("\nEnter a number to choose the keyboard.\n\n");
-		if (rules->models.num_desc >= 16)
-			printf("Press enter for the next page\n");
-		getstring(s);
-		if (strlen(s) == 0) {
-			i += 16;
-			if (i > rules->models.num_desc)
-				i = 0;
-			continue;
-		}
-		number = atoi(s) - 1;
-		if (number >= 0 && number < rules->models.num_desc)
-			break;
-	}
-
-	i = strlen(rules->models.desc[number].name) + 1;
-	config_xkbmodel = Malloc(i);
-	sprintf(config_xkbmodel,"%s", rules->models.desc[number].name);
-
-	emptylines();
-	printf(xkblayouttext);
-
-	number = -1;
-	for (i=0;;) {
-	    	emptylines();
-		for (j = i; j < i + 18 && j < rules->layouts.num_desc; j++)
-			printf("%3d  %-50s\n", j+1,
-				rules->layouts.desc[j].desc);
-		printf("\n");
-		printf("Enter a number to choose the country.\n");
-		if (rules->layouts.num_desc >= 18)
-			printf("Press enter for the next page\n");
-		printf("\n");
-		getstring(s);
-		if (strlen(s) == 0) {
-			i += 18;
-			if (i > rules->layouts.num_desc)
-				i = 0;
-			continue;
-		}
-		number = atoi(s) - 1;
-		if (number >= 0 && number < rules->layouts.num_desc)
-			break;
-	}
-	config_xkblayout = Malloc(strlen(rules->layouts.desc[number].name)+1);
-	sprintf(config_xkblayout,"%s", rules->layouts.desc[number].name);
-
-	emptylines();
-	printf(xkbvarianttext, config_xkblayout);
-	getstring(s);
-	if (strlen(s) != 0) {
-	    config_xkbvariant = Malloc(strlen(s) + 1);
-	    strcpy(config_xkbvariant, s);
-        }
-
-	emptylines();
-	printf(xkboptionstext);
-	getstring(s);
-	if (!answerisyes(s))
-            return;
-
-        num_options = 0;
-        for (j=0,i=0;;) {
-            if (!strchr(rules->options.desc[i].name, ':')) {
-	        emptylines();
-                printf("   %s\n\n", rules->options.desc[i].desc);
-                j = i;
-            } else {
-                printf("%3d  %-50s\n", i - j, rules->options.desc[i].desc);
-            }
-            i++;
-            if ( i == rules->options.num_desc ||
-                 !strchr(rules->options.desc[i].name, ':')) {
-                printf("\nPlease select the option or just press enter if none\n");
-	        getstring(s);
-	        if (strlen(s) != 0) {
-	            number = atoi(s);
-                    if (number && (num_options < MAX_XKBOPTIONS)) {
-                        options[num_options++] = number + j;
-                    }
-                }    
-            }
-            if (i == rules->options.num_desc)
-                break;
-        }
-
-        if (!num_options)
-            return;
-
-        for (j=0,i=0; i<num_options; i++) {
-            j += strlen(rules->options.desc[options[i]].name);
-        }
-	config_xkboptions = Malloc(j + num_options);
-        for (j=0,i=0; i<num_options; i++) {
-	    j += sprintf(config_xkboptions+j,"%s%s",
-                    i == 0 ? "": "," ,rules->options.desc[options[i]].name);
-        }
-	return;
-}
-
-
-
-/*
- * Monitor configuration.
- */
-
-static char *monitorintro_text =
-"Now we want to set the specifications of the monitor. The two critical\n"
-"parameters are the vertical refresh rate, which is the rate at which the\n"
-"the whole screen is refreshed, and most importantly the horizontal sync rate,\n"
-"which is the rate at which scanlines are displayed.\n"
-"\n"
-"The valid range for horizontal sync and vertical sync should be documented\n"
-"in the manual of your monitor.\n"
-"\n";
-
-static char *hsyncintro_text =
-"You must indicate the horizontal sync range of your monitor. You can either\n"
-"select one of the predefined ranges below that correspond to industry-\n"
-"standard monitor types, or give a specific range.\n"
-"\n"
-"It is VERY IMPORTANT that you do not specify a monitor type with a horizontal\n"
-"sync range that is beyond the capabilities of your monitor. If in doubt,\n"
-"choose a conservative setting.\n"
-"\n";
-
-static char *customhsync_text =
-"Please enter the horizontal sync range of your monitor, in the format used\n"
-"in the table of monitor types above. You can either specify one or more\n"
-"continuous ranges (e.g. 15-25, 30-50), or one or more fixed sync frequencies.\n"
-"\n";
-
-static char *vsyncintro_text =
-"You must indicate the vertical sync range of your monitor. You can either\n"
-"select one of the predefined ranges below that correspond to industry-\n"
-"standard monitor types, or give a specific range. For interlaced modes,\n"
-"the number that counts is the high one (e.g. 87 Hz rather than 43 Hz).\n"
-"\n"
-" 1  50-70\n"
-" 2  50-90\n"
-" 3  50-100\n"
-" 4  40-150\n"
-" 5  Enter your own vertical sync range\n";
-
-static char *monitordescintro_text =
-"You must now enter a few identification/description strings, namely an\n"
-"identifier, a vendor name, and a model name. Just pressing enter will fill\n"
-"in default names.\n"
-"\n";
-
-#define NU_MONITORTYPES 10
-
-static char *monitortype_range[NU_MONITORTYPES] = {
-	"31.5",
-	"31.5 - 35.1",
-	"31.5, 35.5",
-	"31.5, 35.15, 35.5",
-	"31.5 - 37.9",
-	"31.5 - 48.5",
-	"31.5 - 57.0",
-	"31.5 - 64.3",
-	"31.5 - 79.0",
-	"31.5 - 82.0"
-};
-
-static char *monitortype_name[NU_MONITORTYPES] = {
-	"Standard VGA, 640x480 @ 60 Hz",
-	"Super VGA, 800x600 @ 56 Hz",
-	"8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600)",
-	"Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz",
-	"Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz",
-	"Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz",
-	"High Frequency SVGA, 1024x768 @ 70 Hz",
-	"Monitor that can do 1280x1024 @ 60 Hz",
-	"Monitor that can do 1280x1024 @ 74 Hz",
-	"Monitor that can do 1280x1024 @ 76 Hz"
-};
-
-static void 
-monitor_configuration(void) {
-	int i;
-	char s[80];
-	printf("%s", monitorintro_text);
-
-	keypress();
-	emptylines();
-
-	printf("%s", hsyncintro_text);
-
-	printf("    hsync in kHz; monitor type with characteristic modes\n");
-	for (i = 0; i < NU_MONITORTYPES; i++)
-		printf("%2d  %s; %s\n", i + 1, monitortype_range[i],
-			monitortype_name[i]);
-
-	printf("%2d  Enter your own horizontal sync range\n",
-		NU_MONITORTYPES + 1);
-	printf("\n");
-
-	printf("Enter your choice (1-%d): ", NU_MONITORTYPES + 1);
-	getstring(s);
-	config_monitortype = atoi(s) - 1;
-	if (config_monitortype < 0)
-		config_monitortype = 0;
-
-	printf("\n");
-
-	if (config_monitortype < NU_MONITORTYPES)
-		config_hsyncrange = monitortype_range[config_monitortype];
-	else {
-		/* Custom hsync range option selected. */
-		printf("%s", customhsync_text);
-		printf("Horizontal sync range: ");
-		getstring(s);
-		config_hsyncrange = Malloc(strlen(s) + 1);
-		strcpy(config_hsyncrange, s);
-		printf("\n");
-	}
-
-	printf("%s", vsyncintro_text);
-	printf("\n");
-
-	printf("Enter your choice: ");
-	getstring(s);
-	printf("\n");
-	switch (atoi(s)) {
-	case 0 :
-	case 1 :
-		config_vsyncrange = "50-70";
-		break;
-	case 2 :
-		config_vsyncrange = "50-90";
-		break;
-	case 3 :
-		config_vsyncrange = "50-100";
-		break;
-	case 4 :
-		config_vsyncrange = "40-150";
-		break;
-	case 5 :
-		/* Custom vsync range option selected. */
-		printf("Vertical sync range: ");
-		getstring(s);
-		config_vsyncrange = Malloc(strlen(s) + 1);
-		strcpy(config_vsyncrange, s);
-		printf("\n");
-		break;
-	}
-	printf("%s", monitordescintro_text);
-	printf("The strings are free-form, spaces are allowed.\n");
-	printf("Enter an identifier for your monitor definition: ");
-	getstring(s);
-	if (strlen(s) == 0)
-		config_monitoridentifier = "My Monitor";
-	else {
-		config_monitoridentifier = Malloc(strlen(s) + 1);
-		strcpy(config_monitoridentifier, s);
-	}
-}
-
-
-/*
- * Card database.
- */
-
-static char *cardintro_text =
-"Now we must configure video card specific settings. At this point you can\n"
-"choose to make a selection out of a database of video card definitions.\n"
-"Because there can be variation in Ramdacs and clock generators even\n"
-"between cards of the same model, it is not sensible to blindly copy\n"
-"the settings (e.g. a Device section). For this reason, after you make a\n"
-"selection, you will still be asked about the components of the card, with\n"
-"the settings from the chosen database entry presented as a strong hint.\n"
-"\n"
-"The database entries include information about the chipset, what driver to\n"
-"run, the Ramdac and ClockChip, and comments that will be included in the\n"
-"Device section. However, a lot of definitions only hint about what driver\n"
-"to run (based on the chipset the card uses) and are untested.\n"
-"\n"
-"If you can't find your card in the database, there's nothing to worry about.\n"
-"You should only choose a database entry that is exactly the same model as\n"
-"your card; choosing one that looks similar is just a bad idea (e.g. a\n"
-"GemStone Snail 64 may be as different from a GemStone Snail 64+ in terms of\n"
-"hardware as can be).\n"
-"\n";
-
-static char *cardunsupported_text =
-"This card is basically UNSUPPORTED. It may only work as a generic\n"
-"VGA-compatible card. If you have an "__XSERVERNAME__" version more recent than what\n"
-"this card definition was based on, there's a chance that it is now\n"
-"supported.\n";
-
-static void 
-carddb_configuration(void) {
-	int i;
-	char s[80];
-	card_selected = -1;
-	printf("%s", cardintro_text);
-	printf("Do you want to look at the card database? ");
-	getstring(s);
-	printf("\n");
-	if (!answerisyes(s))
-		return;
-
-	/*
-	 * Choose a database entry.
-	 */
-	if (parse_database()) {
-		printf("Couldn't read card database file %s.\n",
-			CARD_DATABASE_FILE);
-		keypress();
-		return;
-	}
-
-	i = 0;
-	for (;;) {
-		int j;
-		emptylines();
-		for (j = i; j < i + 18 && j <= lastcard; j++) {
-			char *name = card[j].name,
-			     *chipset = card[j].chipset;
-
-			printf("%3d  %-50s%s\n", j,
-				name ? name : "-",
-				chipset ? chipset : "-");
-		}
-		printf("\n");
-		printf("Enter a number to choose the corresponding card definition.\n");
-		printf("Press enter for the next page, q to continue configuration.\n");
-		printf("\n");
-		getstring(s);
-		if (s[0] == 'q')
-			break;
-		if (strlen(s) == 0) {
-			i += 18;
-			if (i > lastcard)
-				i = 0;
-			continue;
-		}
-		card_selected = atoi(s);
-		if (card_selected >= 0 && card_selected <= lastcard)
-			break;
-	}
-
-	/*
-	 * Look at the selected card.
-	 */
-	if (card_selected != -1) {
-		char *name = card[card_selected].name,
-		     *chipset = card[card_selected].chipset;
-
-		printf("\nYour selected card definition:\n\n");
-		printf("Identifier: %s\n", name ? name : "-");
-		printf("Chipset:    %s\n", chipset ? chipset : "-");
-		if (!card[card_selected].driver)
-			card[card_selected].driver = "unknown";
-		printf("Driver:     %s\n", card[card_selected].driver);
-
-		if (card[card_selected].ramdac != NULL)
-			printf("Ramdac:     %s\n", card[card_selected].ramdac);
-		if (card[card_selected].dacspeed != NULL)
-			printf("DacSpeed:     %s\n", card[card_selected].dacspeed);
-		if (card[card_selected].clockchip != NULL)
-			printf("Clockchip:  %s\n", card[card_selected].clockchip);
-		if (card[card_selected].flags & NOCLOCKPROBE)
-			printf("Do NOT probe clocks or use any Clocks line.\n");
-		if (card[card_selected].flags & UNSUPPORTED)
-			printf("%s", cardunsupported_text);
-#if 0	/* Might be confusing. */
-		if (strlen(card[card_selected].lines) > 0)
-			printf("Device section text:\n%s",
-				card[card_selected].lines);
-#endif
-		printf("\n");
-		keypress();
-	}
-}
-
-
-/*
- * Screen/video card configuration.
- */
-
-static char *deviceintro_text =
-"Now you must give information about your video card. This will be used for\n"
-"the \"Device\" section of your video card in " CONFIGNAME ".\n"
-"\n";
-
-static char *videomemoryintro_text =
-"It is probably a good idea to use the same approximate amount as that detected\n"
-"by the server you intend to use. If you encounter problems that are due to the\n"
-"used server not supporting the amount memory you have, specify the maximum\n"
-"amount supported by the server.\n"
-"\n"
-"How much video memory do you have on your video card:\n"
-"\n";
-
-static char *carddescintro_text =
-"You must now enter a few identification/description strings, namely an\n"
-"identifier, a vendor name, and a model name. Just pressing enter will fill\n"
-"in default names (possibly from a card definition).\n"
-"\n";
-
-#if 0
-static char *devicesettingscomment_text =
-"Especially for accelerated drivers, Ramdac, Dacspeed and ClockChip settings\n"
-"or special options may be required in the Device section.\n"
-"\n";
-
-static char *ramdaccomment_text =
-"The RAMDAC setting only applies to some drivers. Some RAMDAC's are\n"
-"auto-detected by the server. The detection of a RAMDAC is forced by using a\n"
-"Ramdac \"identifier\" line in the Device section. The identifiers are shown\n"
-"at the right of the following table of RAMDAC types:\n"
-"\n";
-
-#define NU_RAMDACS 24
-
-static char *ramdac_name[NU_RAMDACS] = {
-	"AT&T 20C490 (S3 and AGX servers, ARK driver)",
-	"AT&T 20C498/21C498/22C498 (S3, autodetected)",
-	"AT&T 20C409/20C499 (S3, autodetected)",
-	"AT&T 20C505 (S3)",
-	"BrookTree BT481 (AGX)",
-	"BrookTree BT482 (AGX)",
-	"BrookTree BT485/9485 (S3)",
-	"Sierra SC15025 (S3, AGX)",
-#if XFREE86_VERSION >= 311	
-	"S3 GenDAC (86C708) (autodetected)",
-	"S3 SDAC (86C716) (autodetected)",
-#else
-	"S3 GenDAC (86C708)",
-	"S3 SDAC (86C716)",
-#endif
-	"STG-1700 (S3, autodetected)",
-	"STG-1703 (S3, autodetected)",
-	"TI 3020 (S3, autodetected)",
-	"TI 3025 (S3, autodetected)",
-	"TI 3026 (S3, autodetected)",
-	"IBM RGB 514 (S3, autodetected)",
-	"IBM RGB 524 (S3, autodetected)",
-	"IBM RGB 525 (S3, autodetected)",
-	"IBM RGB 526 (S3)",
-	"IBM RGB 528 (S3, autodetected)",
-	"ICS5342 (S3, ARK)",
-	"ICS5341 (W32)",
-	"IC Works w30C516 ZoomDac (ARK)",
-	"Normal DAC"
-};
-
-static char *ramdac_id[NU_RAMDACS] = {
-	"att20c490", "att20c498", "att20c409", "att20c505", "bt481", "bt482",
-	"bt485", "sc15025", "s3gendac", "s3_sdac", "stg1700","stg1703",
-	"ti3020", "ti3025", "ti3026", "ibm_rgb514", "ibm_rgb524",
-	"ibm_rgb525", "ibm_rgb526", "ibm_rgb528", "ics5342", "ics5341",
-	"zoomdac", "normal"
-};
-
-static char *clockchipcomment_text =
-"A Clockchip line in the Device section forces the detection of a\n"
-"programmable clock device. With a clockchip enabled, any required\n"
-"clock can be programmed without requiring probing of clocks or a\n"
-"Clocks line. Most cards don't have a programmable clock chip.\n"
-"Choose from the following list:\n"
-"\n";
-
-#define NU_CLOCKCHIPS 12
-
-static char *clockchip_name[] = {
-	"Chrontel 8391",
-	"ICD2061A and compatibles (ICS9161A, DCS2824)",
-	"ICS2595",
-	"ICS5342 (similar to SDAC, but not completely compatible)",
-	"ICS5341",
-	"S3 GenDAC (86C708) and ICS5300 (autodetected)",
-	"S3 SDAC (86C716)",
-	"STG 1703 (autodetected)",
-	"Sierra SC11412",
-	"TI 3025 (autodetected)",
-	"TI 3026 (autodetected)",
-	"IBM RGB 51x/52x (autodetected)",
-};
-
-static char *clockchip_id[] = {
-	"ch8391", "icd2061a", "ics2595", "ics5342", "ics5341",
-	"s3gendac", "s3_sdac",
-	"stg1703", "sc11412", "ti3025", "ti3026", "ibm_rgb5xx",
-};
-
-static char *deviceclockscomment_text =
-"For most modern configurations, a Clocks line is neither required or\n"
-"desirable.  However for some older hardware it can be useful since it\n"
-"prevents the slow and nasty sounding clock probing at server start-up.\n"
-"Probed clocks are displayed at server startup, along with other server\n"
-"and hardware configuration info. You can save this information in a file\n"
-"by running 'X -probeonly 2>output_file'. Be warned that clock probing is\n"
-"inherently imprecise; some clocks may be slightly too high (varies per run).\n"
-"\n";
-
-static char *deviceclocksquestion_text =
-"At this point I can run X -probeonly, and try to extract the clock information\n"
-"from the output. It is recommended that you do this yourself and if a set of\n"
-"clocks is shown then you add a clocks line (note that the list of clocks may\n"
-"be split over multiple Clocks lines) to your Device section afterwards. Be\n"
-"aware that a clocks line is not appropriate for most modern hardware that\n"
-"has programmable clocks.\n"
-"\n"
-"You must be root to be able to run X -probeonly now.\n"
-"\n";
-
-static char *probeonlywarning_text =
-"It is possible that the hardware detection routines in the server will somehow\n"
-"cause the system to crash and the screen to remain blank. If this is the\n"
-"case, do not choose this option the next time. The server may need a\n"
-"Ramdac, ClockChip or special option (e.g. \"nolinear\" for S3) to probe\n"
-"and start-up correctly.\n"
-"\n";
-#endif
-
-static char *modesorderintro_text =
-"For each depth, a list of modes (resolutions) is defined. The default\n"
-"resolution that the server will start-up with will be the first listed\n"
-"mode that can be supported by the monitor and card.\n"
-"Currently it is set to:\n"
-"\n";
-
-static char *modesorder_text2 =
-"Modes that cannot be supported due to monitor or clock constraints will\n"
-"be automatically skipped by the server.\n"
-"\n"
-" 1  Change the modes for 8-bit (256 colors)\n"
-" 2  Change the modes for 16-bit (32K/64K colors)\n"
-" 3  Change the modes for 24-bit (24-bit color)\n"
-" 4  The modes are OK, continue.\n"
-"\n";
-
-static char *modeslist_text =
-"Please type the digits corresponding to the modes that you want to select.\n"
-"For example, 432 selects \"1024x768\" \"800x600\" \"640x480\", with a\n"
-"default mode of 1024x768.\n"
-"\n";
-
-static char *virtual_text =
-"You can have a virtual screen (desktop), which is screen area that is larger\n"
-"than the physical screen and which is panned by moving the mouse to the edge\n"
-"of the screen. If you don't want virtual desktop at a certain resolution,\n"
-"you cannot have modes listed that are larger. Each color depth can have a\n"
-"differently-sized virtual screen\n"
-"\n";
-
-static int videomemory[] = {
-	256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144
-};
-
-/* Is this required? */
-#if XFREE86_VERSION >= 400
-#define NU_MODESTRINGS 13
-#else
-#if XFREE86_VERSION >= 330
-#define NU_MODESTRINGS 12
-#else
-#if XFREE86_VERSION >= 311
-#define NU_MODESTRINGS 8
-#else
-#define NU_MODESTRINGS 5
-#endif
-#endif
-#endif
-
-static char *modestring[NU_MODESTRINGS] = {
-	"\"640x400\"",
-	"\"640x480\"",
-	"\"800x600\"",
-	"\"1024x768\"",
-	"\"1280x1024\"",
-#if XFREE86_VERSION >= 311
-	"\"320x200\"",
-	"\"320x240\"",
-	"\"400x300\""
-#endif
-#if XFREE86_VERSION >= 330
-	,"\"1152x864\"",
-	"\"1600x1200\"",
-	"\"1800x1400\"",
-	"\"512x384\""
-#endif
-#if XFREE86_VERSION >= 400
-	,"\"1400x1050\""
-#endif
-};
-
-static int exists_dir(char *name) {
-	struct stat sbuf;
-
-	/* is it there ? */
-	if (stat(name,&sbuf) == -1)
-		return 0;
-
-	/* is there, but is it a dir? */
-	return S_ISDIR(sbuf.st_mode) ? 1 : 0;
-}
-
-static int 
-screen_configuration(void) {
-	int i, c/*, np*/;
-	char s[80];
-
-	/*
-	 * Configure the "Device" section for the video card.
-	 */
-
-	printf("%s", deviceintro_text);
-
-	printf("%s", videomemoryintro_text);
-
-	for (i = 0; i < sizeof(videomemory) / sizeof(videomemory[0]); i++)
-		printf("%2d  %dK\n", i + 1, videomemory[i]);
-	printf("%2d  Other\n\n", i + 1);
-
-	printf("Enter your choice: ");
-	getstring(s);
-	printf("\n");
-
-	c = atoi(s) - 1;
-	if (c >= 0 && c < sizeof(videomemory) / sizeof(videomemory[0]))
-		config_videomemory = videomemory[c];
-	else {
-		printf("Amount of video memory in Kbytes: ");
-		getstring(s);
-		config_videomemory = atoi(s);
-		printf("\n");
-	}
-
-	printf("%s", carddescintro_text);
-	if (card_selected != -1)
-		printf("Your card definition is %s.\n\n",
-			card[card_selected].name);
-	printf("The strings are free-form, spaces are allowed.\n");
-	printf("Enter an identifier for your video card definition: ");
-	getstring(s);
-	if (strlen(s) == 0)
-		if (card_selected != -1)
-			config_deviceidentifier = card[card_selected].name;
-		else
-			config_deviceidentifier = "My Video Card";
-	else {
-		config_deviceidentifier = Malloc(strlen(s) + 1);
-		strcpy(config_deviceidentifier, s);
-	}
-	printf("\n");
-
-	emptylines();
-
-	/*
-	 * Initialize screen mode variables for svga and accel
-	 * to default values.
-	 * XXXX Doesn't leave room for off-screen caching in 16/32bpp modes
-	 *      for the accelerated servers in some situations.
-	 */
-	config_modesline8bpp =
-	config_modesline16bpp =
-	config_modesline24bpp = "\"640x480\"";
-	config_virtualx8bpp = config_virtualx16bpp = config_virtualx24bpp =
-	config_virtualy8bpp = config_virtualy16bpp = config_virtualy24bpp = 0;
-	if (config_videomemory >= 4096) {
-		config_virtualx8bpp = 1600;
-		config_virtualy8bpp = 1280;
-		if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
-			/*
-			 * Allow room for font/pixmap cache for accel
-			 * servers.
-			 */
-			config_virtualx16bpp = 1280;
-			config_virtualy16bpp = 1024;
-		}
-		else {
-			config_virtualx16bpp = 1600;
-			config_virtualy16bpp = 1280;
-		}
-		if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
-			config_virtualx24bpp = 1152;
-			config_virtualy24bpp = 900;
-		}
-		else {
-			config_virtualx24bpp = 1280;
-			config_virtualy24bpp = 1024;
-		}
-		/* Add 1600x1280 */
-		config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
-		config_modesline16bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
-		config_modesline24bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
-
-	}
-	else
-	if (config_videomemory >= 2048) {
-		if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
-			/*
-			 * Allow room for font/pixmap cache for accel
-			 * servers.
-			 * Also the mach32 is has a limited width.
-			 */
-			config_virtualx8bpp = 1280;
-			config_virtualy8bpp = 1024;
-		}
-		else {
-			config_virtualx8bpp = 1600;
-			config_virtualy8bpp = 1200;
-		}
-		if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
-			config_virtualx16bpp = 1024;
-			config_virtualy16bpp = 768;
-		}
-		else {
-			config_virtualx16bpp = 1152;
-			config_virtualy16bpp = 900;
-		}
-		config_virtualx24bpp = 800;
-		config_virtualy24bpp = 600;
-		if (config_videomemory >= 2048 + 256) {
-			config_virtualx24bpp = 1024;
-			config_virtualy24bpp = 768;
-		}
-		config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\"";
-		config_modesline16bpp = "\"1024x768\" \"800x600\" \"640x480\"";
-		if (config_videomemory >= 2048 + 256)
-			config_modesline24bpp = "\"1024x768\" \"800x600\" \"640x480\"";
-		else
-			config_modesline24bpp = "\"800x600\" \"640x480\"";
-	}
-	else
-	if (config_videomemory >= 1024) {
-		if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) {
-			/*
-			 * Allow room for font/pixmap cache for accel
-			 * servers.
-			 */
-			config_virtualx8bpp = 1024;
-			config_virtualy8bpp = 768;
-		}
-		else {
-			config_virtualx8bpp = 1152;
-			config_virtualy8bpp = 900;
-		}
-		config_virtualx16bpp = 800; /* Forget about cache space;  */
-		config_virtualy16bpp = 600; /* it's small enough as it is. */
-		config_virtualx24bpp = 640;
-		config_virtualy24bpp = 480;
-		config_modesline8bpp = "\"1024x768\" \"800x600\" \"640x480\"";
-		config_modesline16bpp = "\"800x600\" \"640x480\"";
-		config_modesline24bpp = "\"640x480\"";
-	}
-	else
-	if (config_videomemory >= 512) {
-		config_virtualx8bpp = 800;
-		config_virtualy8bpp = 600;
-		config_modesline8bpp = "\"800x600\" \"640x480\"";
-		config_modesline16bpp = "\"640x400\"";
-	}
-	else
-	if (config_videomemory >= 256) {
-		config_modesline8bpp = "\"640x400\"";
-		config_virtualx8bpp = 640;
-		config_virtualy8bpp = 400;
-	}
-	else {
-		printf("Invalid amount of video memory. Please try again\n");
-		return(1);
-	}
-
-#if 0
-	/*
-	 * Handle the Ramdac/Clockchip setting.
-	 */
-
-	printf("%s", devicesettingscomment_text);
-
-	if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED))
-		goto skipramdacselection;
-
-	printf("%s", ramdaccomment_text);
-
-	/* meanwhile there are so many RAMDACs that they do no longer fit on
-	 * on page
-	 */
-	for (np=12, i=0 ;;) {
-		int j;
-		for (j = i; j < i + np && j < NU_RAMDACS; j++)
-			printf("%3d  %-60s%s\n", j+1,
-				ramdac_name[j],
-				ramdac_id[j]);
-
-		printf("\n");
-		if (card_selected != -1)
-			if (card[card_selected].ramdac != NULL)
-				printf("The card definition has Ramdac \"%s\".\n\n",
-					card[card_selected].ramdac);
-		printf("\n");
-		printf("Enter a number to choose the corresponding RAMDAC.\n");
-		printf("Press enter for the next page, q to quit without selection of a RAMDAC.\n");
-		printf("\n");
-		getstring(s);
-
-		config_ramdac = NULL;
-		if (s[0] == 'q')
-			break;
-
-		if (strlen(s) > 0) {
-			c = atoi(s)-1;
-			if (c >= 0 && c < NU_RAMDACS) {
-				config_ramdac = ramdac_id[atoi(s)-1];
-				break;
-			}
-		}
-		
-		i += np;
-		if (np==12) np = 18; /* account intro lines only displayed 1st time */
-		if (i >= NU_RAMDACS)
-			i = 0;
-		emptylines();
-	}
-
-skipramdacselection:
-	emptylines();
-	printf("%s", clockchipcomment_text);
-
-	for (i = 0; i < NU_CLOCKCHIPS; i++)
-		printf("%2d  %-60s%s\n",
-			i + 1, clockchip_name[i], clockchip_id[i]);
-
-	printf("\n");
-
-	if (card_selected != -1)
-		if (card[card_selected].clockchip != NULL)
-			printf("The card definition has Clockchip \"%s\"\n\n",
-				card[card_selected].clockchip);
-
-	printf("Just press enter if you don't want a Clockchip setting.\n");
-	printf("What Clockchip setting do you want (1-%d)? ", NU_CLOCKCHIPS);
-
-	getstring(s);
-	config_clockchip = NULL;
-	if (strlen(s) > 0)
-		config_clockchip = clockchip_id[atoi(s) - 1];
-
-	emptylines();
-
-	/*
-	 * Optionally run X -probeonly to figure out the clocks.
-	 */
-
-	config_numberofclockslines = 0;
-
-	printf("%s", deviceclockscomment_text);
-
-	printf("%s", deviceclocksquestion_text);
-#endif
-
-#if 0
-	/*
-	 * XXX Change this to check for a CLOCKPROBE flag rather than an
-	 * NOCLOCKPROBE.
-	 */
-	if (card_selected != -1)
-		if (card[card_selected].flags & NOCLOCKPROBE)
-			printf("The card definition says to NOT probe clocks.\n");
-
-	if (config_clockchip != NULL) {
-		printf("Because you have enabled a Clockchip line, there's no need for clock\n"
-			"probing.\n");
-		keypress();
-		goto skipclockprobing;
-	}
-
-	printf("Do you want me to run 'X -probeonly' now? ");
-	getstring(s);
-	printf("\n");
-	if (answerisyes(s)) {
-		/*
-		 * Write temporary XF86Config and run X -probeonly.
-		 * Only allow when root.
-		 */
-		FILE *f;
-		char *buf;
-		char syscmdline[2*256+100]; /* enough */
-                char *fname = NULL;
-                char *d2name = NULL;
-                char *d3name = NULL;
-
-		if (getuid() != 0) {
-			printf("Sorry, you must be root to do this.\n\n");
-			goto endofprobeonly;
-		}
-		printf("%s", probeonlywarning_text);
-		keypress();
-		fname = Malloc(strlen(temp_dir) +
-                               strlen(TEMPORARY_XF86CONFIG_FILENAME) + 1);
-		sprintf(fname, "%s%s", temp_dir,
-                       TEMPORARY_XF86CONFIG_FILENAME);
-		d2name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG2) + 1);
-		sprintf(d2name, "%s%s", temp_dir, DUMBCONFIG2);
-		d3name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG3) + 1);
-		sprintf(d3name, "%s%s", temp_dir, DUMBCONFIG3);
-		printf("Running X -probeonly -pn -xf86config %s.\n", fname);
-		write_XF86Config(fname);
-		sync();
-		/* compose a line with the real path */
-                sprintf(syscmdline, "X -probeonly -pn -xf86config %s 2> %s",
-                        fname, d2name);
-
-		if (system(syscmdline)) {
-			printf("X -probeonly call failed.\n");
-			printf("No Clocks line inserted.\n");
-			goto clocksprobefailed;
-		}
-		/* Look for 'clocks:' (case sensitive). */		
-                sprintf(syscmdline, "grep clocks\\: %s > %s", d2name, d3name);
-                if (system(syscmdline)) {
-			printf("grep failed.\n");
-			printf("Cannot find clocks in server output.\n");
-			goto clocksprobefailed;
-		}
-                f = fopen(d3name, "r");
-		buf = Malloc(8192);
-		/* Parse lines. */
-		while (fgets(buf, 8192, f) != NULL) {
-			char *clks;
-			clks = strstr(buf, "clocks: ") + 8;
-			if (clks >= buf + 3 && strcmp(clks - 11, "num") == 0)
-				/* Reject lines with 'numclocks:'. */
-				continue;
-			if (clks >= buf + 8 && strcpy(clks - 14, "pixel ") == 0)
-				/* Reject lines with 'pixel clocks:'. */
-				continue;
-			clks[strlen(clks) - 1] = '\0';	/* Remove '\n'. */
-			config_clocksline[config_numberofclockslines] =
-				Malloc(strlen(clks) + 1);
-			strcpy(config_clocksline[config_numberofclockslines],
-				clks);
-			printf("Clocks %s\n", clks);
-			config_numberofclockslines++;
-		}
-		fclose(f);
-clocksprobefailed:
-                unlink(d3name);
-                unlink(d2name);
-                unlink(fname);
-		printf("\n");
-
-endofprobeonly:
-		keypress();
-	}
-skipclockprobing:
-#endif
-
-	/*
-	 * For vga driver, no further configuration is required.
-	 */
-	if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED))
-		return (0);
-	
-	/*
-	 * Configure the modes order.
-	 */
-	config_virtual = 0;
-	for (;;) {
-	 	char modes[128];
-
-		emptylines();
-
-		printf("%s", modesorderintro_text);
-		printf("%s for 8-bit\n", config_modesline8bpp);
-		printf("%s for 16-bit\n", config_modesline16bpp);
-		printf("%s for 24-bit\n", config_modesline24bpp);
-		printf("\n");
-		printf("%s", modesorder_text2);
-
-		printf("Enter your choice: ");
-		getstring(s);
-		printf("\n");
-
-		c = atoi(s) - 1;
-		if (c < 0 || c >= 3)
-			break;
-
-		printf("Select modes from the following list:\n\n");
-
-		for (i = 0; i < NU_MODESTRINGS; i++)
-                        printf(" %c  %s\n", i < 9 ? '1' + i :
-                                                    'a' + i - 9, 
-                                            modestring[i]);
-		printf("\n");
-
-		printf("%s", modeslist_text);
-
-		printf("Which modes? ");
-		getstring(s);
-		printf("\n");
-
-		modes[0] = '\0';
-		for (i = 0; i < strlen(s); i++) {
-                        if ( NU_MODESTRINGS > 9 ) {
-                          if ((s[i] < '1' || s[i] > '9') &&
-                              (s[i] < 'a' || s[i] > 'a' + NU_MODESTRINGS - 10)) {
-                                printf("Invalid mode skipped.\n");
-                                continue;
-                            }
-                        }
-                        else {
-                          if (s[i] < '1' || s[i] > '0' + NU_MODESTRINGS) {
-				printf("Invalid mode skipped.\n");
-				continue;
-			  }
-			}
-			if (i > 0)
-				strcat(modes, " ");
-                        strcat(modes, modestring[s[i] <= '9' ? s[i] - '1' :
-                                                               s[i] - 'a' + 9]);
-		}
-		switch (c) {
-		case 0 :
-			config_modesline8bpp = Malloc(strlen(modes) + 1);
-			strcpy(config_modesline8bpp, modes);
-			break;
-		case 1 :
-			config_modesline16bpp = Malloc(strlen(modes) + 1);
-			strcpy(config_modesline16bpp, modes);
-			break;
-		case 2 :
-			config_modesline24bpp = Malloc(strlen(modes) + 1);
-			strcpy(config_modesline24bpp, modes);
-			break;
-		}
-
-		printf("%s", virtual_text);
-
-		printf("Please answer the following question with either 'y' or 'n'.\n");
-		printf("Do you want a virtual screen that is larger than the physical screen?");
-		getstring(s);
-		if (answerisyes(s))
-			config_virtual = 1;
-	}
-	return(0);
-}
-
-static char *defaultdepthtext = 
-"Please specify which color depth you want to use by default:\n"
-"\n";
-
-static struct depth_str {
-    char *name;
-    char *desc;
-} depth_list[] = {
-    { "1", "1 bit (monochrome)" },
-    { "4", "4 bits (16 colors)" },
-    { "8", "8 bits (256 colors)" },
-    { "16", "16 bits (65536 colors)" },
-    { "24", "24 bits (16 million colors)" }
-};
-
-static int ndepths = sizeof(depth_list)/sizeof(struct depth_str);
-
-static void
-depth_configuration(void)
-{
-	int i;
-	char s[80];
-	int depth;
-
-	printf(defaultdepthtext);
-	for (i=0; i<ndepths; i++) {
-	    printf("%3d  %-50s\n",i+1,depth_list[i].desc);
-	}
-	
-	printf("\nEnter a number to choose the default depth.\n\n");
-	getstring(s);
-	if (strlen(s) == 0)
-	    depth = 0;
-	else {
-	    i = atoi(s)-1;
-	    depth = (i < 0 || i > ndepths) ? 0 : i;
-	}
-	config_depth = depth_list[depth].name;
-}
-
-/*
- * Create the XF86Config file.
- */
-
-static char *XF86Config_firstchunk_text =
-"# File generated by xorgconfig.\n"
-"\n"
-"#\n"
-"# Copyright 2004 "XVENDORNAME"\n"
-"#\n"
-"# Permission is hereby granted, free of charge, to any person obtaining a\n"
-"# copy of this software and associated documentation files (the \"Software\"),\n"
-"# to deal in the Software without restriction, including without limitation\n"
-"# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n"
-"# and/or sell copies of the Software, and to permit persons to whom the\n"
-"# Software is furnished to do so, subject to the following conditions:\n"
-"# \n"
-"# The above copyright notice and this permission notice shall be included in\n"
-"# all copies or substantial portions of the Software.\n"
-"# \n"
-"# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n"
-"# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n"
-"# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n"
-"# "XVENDORNAME" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n"
-"# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\n"
-"# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n"
-"# SOFTWARE.\n"
-"# \n"
-"# Except as contained in this notice, the name of "XVENDORNAME" shall\n"
-"# not be used in advertising or otherwise to promote the sale, use or other\n"
-"# dealings in this Software without prior written authorization from\n"
-"# "XVENDORNAME".\n"
-"#\n"
-"\n"
-"# **********************************************************************\n"
-"# Refer to the " CONFIGNAME "(" FILEMANSUFFIX ") man page for details about the format of \n"
-"# this file.\n"
-"# **********************************************************************\n"
-"\n"
-"# **********************************************************************\n"
-"# Module section -- this  section  is used to specify\n"
-"# which dynamically loadable modules to load.\n"
-"# **********************************************************************\n"
-"#\n"
-"Section \"Module\"\n"
-"\n"
-"# This loads the DBE extension module.\n"
-"\n"
-"    Load        \"dbe\"  	# Double buffer extension\n"
-"\n"
-"# This loads the miscellaneous extensions module, and disables\n"
-"# initialisation of the XFree86-DGA extension within that module.\n"
-"    SubSection  \"extmod\"\n"
-"      Option    \"omit xfree86-dga\"   # don't initialise the DGA extension\n"
-"    EndSubSection\n"
-"\n"
-"# This loads the font modules\n"
-#ifdef HAS_TYPE1
-"    Load        \"type1\"\n"
-#else
-"#    Load        \"type1\"\n"
-#endif
-"    Load        \"freetype\"\n"
-"#    Load        \"xtt\"\n"
-"\n"
-"# This loads the GLX module\n"
-"#    Load       \"glx\"\n"
-"# This loads the DRI module\n"
-"#    Load       \"dri\"\n"
-"\n"
-"EndSection\n"
-"\n"
-"# **********************************************************************\n"
-"# Files section.  This allows default font and rgb paths to be set\n"
-"# **********************************************************************\n"
-"\n"
-"Section \"Files\"\n"
-"\n"
-"# Multiple FontPath entries are allowed (which are concatenated together),\n"
-"# as well as specifying multiple comma-separated entries in one FontPath\n"
-"# command (or a combination of both methods)\n"
-"# \n"
-"\n";
-
-static char *XF86Config_fontpaths[] = 
-{
-/*	"    FontPath	\"" TREEROOTFONT "/75dpi/\"\n"*/
-    "/local/",
-	"/misc/",
-	"/75dpi/:unscaled",
-	"/100dpi/:unscaled",
-	"/Type1/",
-	"/TrueType/",
-	"/freefont/",
-	"/75dpi/",
-	"/100dpi/",
-	0 /* end of fontpaths */
-};
-
-static char *XF86Config_fontpathchunk_text =
-
-"\n"
-"# The module search path.  The default path is shown here.\n"
-"\n"
-"#    ModulePath \"" MODULEPATH "\"\n"
-"\n"
-"EndSection\n"
-"\n"
-"# **********************************************************************\n"
-"# Server flags section.\n"
-"# **********************************************************************\n"
-"\n"
-"Section \"ServerFlags\"\n"
-"\n"
-"# Uncomment this to cause a core dump at the spot where a signal is \n"
-"# received.  This may leave the console in an unusable state, but may\n"
-"# provide a better stack trace in the core dump to aid in debugging\n"
-"\n"
-"#    Option \"NoTrapSignals\"\n"
-"\n"
-"# Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence\n"
-"# (where n is 1 through 12).  This allows clients to receive these key\n"
-"# events.\n"
-"\n"
-"#    Option \"DontVTSwitch\"\n"
-"\n"
-"# Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence\n"
-"# This allows clients to receive this key event.\n"
-"\n"
-"#    Option \"DontZap\"\n"
-"\n"
-"# Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching\n"
-"# sequences.  This allows clients to receive these key events.\n"
-"\n"
-"#    Option \"Dont Zoom\"\n"
-"\n"
-"# Uncomment this to disable tuning with the xvidtune client. With\n"
-"# it the client can still run and fetch card and monitor attributes,\n"
-"# but it will not be allowed to change them. If it tries it will\n"
-"# receive a protocol error.\n"
-"\n"
-"#    Option \"DisableVidModeExtension\"\n"
-"\n"
-"# Uncomment this to enable the use of a non-local xvidtune client. \n"
-"\n"
-"#    Option \"AllowNonLocalXvidtune\"\n"
-"\n"
-"# Uncomment this to disable dynamically modifying the input device\n"
-"# (mouse and keyboard) settings. \n"
-"\n"
-"#    Option \"DisableModInDev\"\n"
-"\n"
-"# Uncomment this to enable the use of a non-local client to\n"
-"# change the keyboard or mouse settings (currently only xset).\n"
-"\n"
-"#    Option \"AllowNonLocalModInDev\"\n"
-"\n"
-"EndSection\n"
-"\n"
-"# **********************************************************************\n"
-"# Input devices\n"
-"# **********************************************************************\n"
-"\n"
-"# **********************************************************************\n"
-"# Core keyboard's InputDevice section\n"
-"# **********************************************************************\n"
-"\n"
-"Section \"InputDevice\"\n"
-"\n"
-"    Identifier	\"Keyboard1\"\n"
-"    Driver	\"kbd\"\n"
-"\n"
-"    Option \"AutoRepeat\" \"500 30\"\n"
-"\n"
-"# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))\n"
-"#    Option	\"Xleds\"      \"1 2 3\"\n"
-"\n";
-
-static char *keyboardchunk2_text =
-"\n";
-
-static char *keyboardchunk3_text =
-"# To customise the XKB settings to suit your keyboard, modify the\n"
-"# lines below (which are the defaults).  For example, for a non-U.S.\n"
-"# keyboard, you will probably want to use:\n"
-"#    Option \"XkbModel\"    \"pc105\"\n"
-"# If you have a US Microsoft Natural keyboard, you can use:\n"
-"#    Option \"XkbModel\"    \"microsoft\"\n"
-"#\n"
-"# Then to change the language, change the Layout setting.\n"
-"# For example, a german layout can be obtained with:\n"
-"#    Option \"XkbLayout\"   \"de\"\n"
-"# or:\n"
-"#    Option \"XkbLayout\"   \"de\"\n"
-"#    Option \"XkbVariant\"  \"nodeadkeys\"\n"
-"#\n"
-"# If you'd like to switch the positions of your capslock and\n"
-"# control keys, use:\n"
-"#    Option \"XkbOptions\"  \"ctrl:swapcaps\"\n"
-"\n"
-"# These are the default XKB settings for "__XSERVERNAME__"\n"
-"#    Option \"XkbRules\"    \""__XKBDEFRULES__"\"\n"
-"#    Option \"XkbModel\"    \"pc105\"\n"
-"#    Option \"XkbLayout\"   \"us\"\n"
-"#    Option \"XkbVariant\"  \"\"\n"
-"#    Option \"XkbOptions\"  \"\"\n"
-"\n";
-
-static char *keyboardlastchunk_text =
-"\n"
-"EndSection\n"
-"\n"
-"\n";
-
-static char *pointersection_text1 = 
-"# **********************************************************************\n"
-"# Core Pointer's InputDevice section\n"
-"# **********************************************************************\n"
-"\n"
-"Section \"InputDevice\"\n"
-"\n"
-"# Identifier and driver\n"
-"\n"
-#if defined(__UNIXWARE__)
-"#    Identifier	\"Mouse1\"\n"
-"#    Driver	\"mouse\"\n"
-#else
-"    Identifier	\"Mouse1\"\n"
-"    Driver	\"mouse\"\n"
-#endif
-;
-
-static char *pointersection_text2 =
-"\n"
-"# Mouse-speed setting for PS/2 mouse.\n"
-"\n"
-"#    Option \"Resolution\"	\"256\"\n"
-"\n"
-"# Baudrate and SampleRate are only for some Logitech mice. In\n"
-"# almost every case these lines should be omitted.\n"
-"\n"
-"#    Option \"BaudRate\"	\"9600\"\n"
-"#    Option \"SampleRate\"	\"150\"\n"
-"\n"
-"# Mouse wheel mapping.  Default is to map vertical wheel to buttons 4 & 5,\n"
-"# horizontal wheel to buttons 6 & 7.   Change if your mouse has more than\n"
-"# 3 buttons and you need to map the wheel to different button ids to avoid\n"
-"# conflicts.\n"
-"\n"
-"    Option \"ZAxisMapping\"   \"4 5 6 7\"\n"
-"\n"
-"# Emulate3Buttons is an option for 2-button mice\n"
-"# Emulate3Timeout is the timeout in milliseconds (default is 50ms)\n"
-"\n";
-
-
-static char *xinputsection_text =
-"# **********************************************************************\n"
-"# Other input device sections \n"
-"# this is optional and is required only if you\n"
-"# are using extended input devices.  This is for example only.  Refer\n"
-"# to the " CONFIGNAME " man page for a description of the options.\n"
-"# **********************************************************************\n"
-"#\n"
-"# Section \"InputDevice\" \n"
-"#    Identifier  \"Mouse2\"\n"
-"#    Driver      \"mouse\"\n"
-"#    Option      \"Protocol\"      \"MouseMan\"\n"
-"#    Option      \"Device\"        \"/dev/mouse2\"\n"
-"# EndSection\n"
-"#\n"
-"# Section \"InputDevice\"\n"
-"#    Identifier \"spaceball\"\n"
-"#    Driver     \"magellan\"\n"
-"#    Option     \"Device\"        \"/dev/cua0\"\n"
-"# EndSection\n"
-"#\n"
-"# Section \"InputDevice\"\n"
-"#    Identifier \"spaceball2\"\n"
-"#    Driver     \"spaceorb\"\n"
-"#    Option     \"Device\"        \"/dev/cua0\"\n"
-"# EndSection\n"
-"#\n"
-"# Section \"InputDevice\"\n"
-"#    Identifier \"touchscreen0\"\n"
-"#    Driver     \"microtouch\"\n"
-"#    Option     \"Device\"        \"/dev/ttyS0\"\n"
-"#    Option     \"MinX\"          \"1412\"\n"
-"#    Option     \"MaxX\"          \"15184\"\n"
-"#    Option     \"MinY\"          \"15372\"\n"
-"#    Option     \"MaxY\"          \"1230\"\n"
-"#    Option     \"ScreenNumber\"  \"0\"\n"
-"#    Option     \"ReportingMode\" \"Scaled\"\n"
-"#    Option     \"ButtonNumber\"  \"1\"\n"
-"#    Option     \"SendCoreEvents\"\n"
-"# EndSection\n"
-"#\n"
-"# Section \"InputDevice\"\n"
-"#    Identifier \"touchscreen1\"\n"
-"#    Driver     \"elo2300\"\n"
-"#    Option     \"Device\"        \"/dev/ttyS0\"\n"
-"#    Option     \"MinX\"          \"231\"\n"
-"#    Option     \"MaxX\"          \"3868\"\n"
-"#    Option     \"MinY\"          \"3858\"\n"
-"#    Option     \"MaxY\"          \"272\"\n"
-"#    Option     \"ScreenNumber\"  \"0\"\n"
-"#    Option     \"ReportingMode\" \"Scaled\"\n"
-"#    Option     \"ButtonThreshold\"       \"17\"\n"
-"#    Option     \"ButtonNumber\"  \"1\"\n"
-"#    Option     \"SendCoreEvents\"\n"
-"# EndSection\n"
-"\n";
-
-static char *monitorsection_text1 =
-"# **********************************************************************\n"
-"# Monitor section\n"
-"# **********************************************************************\n"
-"\n"
-"# Any number of monitor sections may be present\n"
-"\n"
-"Section \"Monitor\"\n"
-"\n";
-
-static char *monitorsection_text2 =
-"# HorizSync is in kHz unless units are specified.\n"
-"# HorizSync may be a comma separated list of discrete values, or a\n"
-"# comma separated list of ranges of values.\n"
-"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR\'S\n"
-"# USER MANUAL FOR THE CORRECT NUMBERS.\n"
-"\n";
-
-static char *monitorsection_text3 =
-"#    HorizSync	30-64         # multisync\n"
-"#    HorizSync	31.5, 35.2    # multiple fixed sync frequencies\n"
-"#    HorizSync	15-25, 30-50  # multiple ranges of sync frequencies\n"
-"\n"
-"# VertRefresh is in Hz unless units are specified.\n"
-"# VertRefresh may be a comma separated list of discrete values, or a\n"
-"# comma separated list of ranges of values.\n"
-"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY.  REFER TO YOUR MONITOR\'S\n"
-"# USER MANUAL FOR THE CORRECT NUMBERS.\n"
-"\n";
-
-#if 0
-static char *monitorsection_text4 =
-"# Modes can be specified in two formats.  A compact one-line format, or\n"
-"# a multi-line format.\n"
-"\n"
-"# These two are equivalent\n"
-"\n"
-"#    ModeLine \"1024x768i\" 45 1024 1048 1208 1264 768 776 784 817 Interlace\n"
-"\n"
-"#    Mode \"1024x768i\"\n"
-"#        DotClock	45\n"
-"#        HTimings	1024 1048 1208 1264\n"
-"#        VTimings	768 776 784 817\n"
-"#        Flags		\"Interlace\"\n"
-"#    EndMode\n"
-"\n";
-
-static char *modelines_text =
-"# This is a set of standard mode timings. Modes that are out of monitor spec\n"
-"# are automatically deleted by the server (provided the HorizSync and\n"
-"# VertRefresh lines are correct), so there's no immediate need to\n"
-"# delete mode timings (unless particular mode timings don't work on your\n"
-"# monitor). With these modes, the best standard mode that your monitor\n"
-"# and video card can support for a given resolution is automatically\n"
-"# used.\n"
-"\n"
-"# 640x400 @ 70 Hz, 31.5 kHz hsync\n"
-"Modeline \"640x400\"     25.175 640  664  760  800   400  409  411  450\n"
-"# 640x480 @ 60 Hz, 31.5 kHz hsync\n"
-"Modeline \"640x480\"     25.175 640  664  760  800   480  491  493  525\n"
-"# 800x600 @ 56 Hz, 35.15 kHz hsync\n"
-"ModeLine \"800x600\"     36     800  824  896 1024   600  601  603  625\n"
-"# 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync\n"
-"Modeline \"1024x768\"    44.9  1024 1048 1208 1264   768  776  784  817 Interlace\n"
-"\n"
-"# 640x400 @ 85 Hz, 37.86 kHz hsync\n"
-"Modeline \"640x400\"     31.5   640  672 736   832   400  401  404  445 -HSync +VSync\n"
-"# 640x480 @ 72 Hz, 36.5 kHz hsync\n"
-"Modeline \"640x480\"     31.5   640  680  720  864   480  488  491  521\n"
-"# 640x480 @ 75 Hz, 37.50 kHz hsync\n"
-"ModeLine  \"640x480\"    31.5   640  656  720  840   480  481  484  500 -HSync -VSync\n"
-"# 800x600 @ 60 Hz, 37.8 kHz hsync\n"
-"Modeline \"800x600\"     40     800  840  968 1056   600  601  605  628 +hsync +vsync\n"
-"\n"
-"# 640x480 @ 85 Hz, 43.27 kHz hsync\n"
-"Modeline \"640x480\"     36     640  696  752  832   480  481  484  509 -HSync -VSync\n"
-"# 1152x864 @ 89 Hz interlaced, 44 kHz hsync\n"
-"ModeLine \"1152x864\"    65    1152 1168 1384 1480   864  865  875  985 Interlace\n"
-"\n"
-"# 800x600 @ 72 Hz, 48.0 kHz hsync\n"
-"Modeline \"800x600\"     50     800  856  976 1040   600  637  643  666 +hsync +vsync\n"
-"# 1024x768 @ 60 Hz, 48.4 kHz hsync\n"
-"Modeline \"1024x768\"    65    1024 1032 1176 1344   768  771  777  806 -hsync -vsync\n"
-"\n"
-"# 640x480 @ 100 Hz, 53.01 kHz hsync\n"
-"Modeline \"640x480\"     45.8   640  672  768  864   480  488  494  530 -HSync -VSync\n"
-"# 1152x864 @ 60 Hz, 53.5 kHz hsync\n"
-"Modeline  \"1152x864\"   89.9  1152 1216 1472 1680   864  868  876  892 -HSync -VSync\n"
-"# 800x600 @ 85 Hz, 55.84 kHz hsync\n"
-"Modeline  \"800x600\"    60.75  800  864  928 1088   600  616  621  657 -HSync -VSync\n"
-"\n"
-"# 1024x768 @ 70 Hz, 56.5 kHz hsync\n"
-"Modeline \"1024x768\"    75    1024 1048 1184 1328   768  771  777  806 -hsync -vsync\n"
-"# 1280x1024 @ 87 Hz interlaced, 51 kHz hsync\n"
-"Modeline \"1280x1024\"   80    1280 1296 1512 1568  1024 1025 1037 1165 Interlace\n"
-"\n"
-"# 800x600 @ 100 Hz, 64.02 kHz hsync\n"
-"Modeline  \"800x600\"    69.65  800  864  928 1088   600  604  610  640 -HSync -VSync\n"
-"# 1024x768 @ 76 Hz, 62.5 kHz hsync\n"
-"Modeline \"1024x768\"    85    1024 1032 1152 1360   768  784  787  823\n"
-"# 1152x864 @ 70 Hz, 62.4 kHz hsync\n"
-"Modeline  \"1152x864\"   92    1152 1208 1368 1474   864  865  875  895\n"
-"# 1280x1024 @ 61 Hz, 64.2 kHz hsync\n"
-"Modeline \"1280x1024\"  110    1280 1328 1512 1712  1024 1025 1028 1054\n"
-"\n"
-"# 1024x768 @ 85 Hz, 70.24 kHz hsync\n"
-"Modeline \"1024x768\"   98.9  1024 1056 1216 1408   768 782 788 822 -HSync -VSync\n"
-"# 1152x864 @ 78 Hz, 70.8 kHz hsync\n"
-"Modeline \"1152x864\"   110   1152 1240 1324 1552   864  864  876  908\n"
-"\n"
-"# 1280x1024 @ 70 Hz, 74.59 kHz hsync\n"
-"Modeline \"1280x1024\"  126.5 1280 1312 1472 1696  1024 1032 1040 1068 -HSync -VSync\n"
-"# 1600x1200 @ 60Hz, 75.00 kHz hsync\n"
-"Modeline \"1600x1200\"  162   1600 1664 1856 2160  1200 1201 1204 1250 +HSync +VSync\n"
-"# 1152x864 @ 84 Hz, 76.0 kHz hsync\n"
-"Modeline \"1152x864\"   135    1152 1464 1592 1776   864  864  876  908\n"
-"\n"
-"# 1280x1024 @ 74 Hz, 78.85 kHz hsync\n"
-"Modeline \"1280x1024\"  135    1280 1312 1456 1712  1024 1027 1030 1064\n"
-"\n"
-"# 1024x768 @ 100Hz, 80.21 kHz hsync\n"
-"Modeline \"1024x768\"   115.5  1024 1056 1248 1440  768  771  781  802 -HSync -VSync\n"
-"# 1280x1024 @ 76 Hz, 81.13 kHz hsync\n"
-"Modeline \"1280x1024\"  135    1280 1312 1416 1664  1024 1027 1030 1064\n"
-"\n"
-"# 1600x1200 @ 70 Hz, 87.50 kHz hsync\n"
-"Modeline \"1600x1200\"  189    1600 1664 1856 2160  1200 1201 1204 1250 -HSync -VSync\n"
-"# 1152x864 @ 100 Hz, 89.62 kHz hsync\n"
-"Modeline \"1152x864\"   137.65 1152 1184 1312 1536   864  866  885  902 -HSync -VSync\n"
-"# 1280x1024 @ 85 Hz, 91.15 kHz hsync\n"
-"Modeline \"1280x1024\"  157.5  1280 1344 1504 1728  1024 1025 1028 1072 +HSync +VSync\n"
-"# 1600x1200 @ 75 Hz, 93.75 kHz hsync\n"
-"Modeline \"1600x1200\"  202.5  1600 1664 1856 2160  1200 1201 1204 1250 +HSync +VSync\n"
-"# 1600x1200 @ 85 Hz, 105.77 kHz hsync\n"
-"Modeline \"1600x1200\"  220    1600 1616 1808 2080  1200 1204 1207 1244 +HSync +VSync\n"
-"# 1280x1024 @ 100 Hz, 107.16 kHz hsync\n"
-"Modeline \"1280x1024\"  181.75 1280 1312 1440 1696  1024 1031 1046 1072 -HSync -VSync\n"
-"\n"
-"# 1800x1440 @ 64Hz, 96.15 kHz hsync \n"
-"ModeLine \"1800X1440\"  230    1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n"
-"# 1800x1440 @ 70Hz, 104.52 kHz hsync \n"
-"ModeLine \"1800X1440\"  250    1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n"
-"\n"
-"# 512x384 @ 78 Hz, 31.50 kHz hsync\n"
-"Modeline \"512x384\"    20.160 512  528  592  640   384  385  388  404 -HSync -VSync\n"
-"# 512x384 @ 85 Hz, 34.38 kHz hsync\n"
-"Modeline \"512x384\"    22     512  528  592  640   384  385  388  404 -HSync -VSync\n"
-"\n"
-#if XFREE86_VERSION >= 311
-"# Low-res Doublescan modes\n"
-"# If your chipset does not support doublescan, you get a 'squashed'\n"
-"# resolution like 320x400.\n"
-"\n"
-"# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio\n"
-"Modeline \"320x200\"     12.588 320  336  384  400   200  204  205  225 Doublescan\n"
-"# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio\n"
-"Modeline \"320x240\"     12.588 320  336  384  400   240  245  246  262 Doublescan\n"
-"# 320x240 @ 72 Hz, 36.5 kHz hsync\n"
-"Modeline \"320x240\"     15.750 320  336  384  400   240  244  246  262 Doublescan\n"
-"# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio\n"
-"ModeLine \"400x300\"     18     400  416  448  512   300  301  302  312 Doublescan\n"
-"# 400x300 @ 60 Hz, 37.8 kHz hsync\n"
-"Modeline \"400x300\"     20     400  416  480  528   300  301  303  314 Doublescan\n"
-"# 400x300 @ 72 Hz, 48.0 kHz hsync\n"
-"Modeline \"400x300\"     25     400  424  488  520   300  319  322  333 Doublescan\n"
-"# 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio\n"
-"ModeLine \"480x300\"     21.656 480  496  536  616   300  301  302  312 Doublescan\n"
-"# 480x300 @ 60 Hz, 37.8 kHz hsync\n"
-"Modeline \"480x300\"     23.890 480  496  576  632   300  301  303  314 Doublescan\n"
-"# 480x300 @ 63 Hz, 39.6 kHz hsync\n"
-"Modeline \"480x300\"     25     480  496  576  632   300  301  303  314 Doublescan\n"
-"# 480x300 @ 72 Hz, 48.0 kHz hsync\n"
-"Modeline \"480x300\"     29.952 480  504  584  624   300  319  322  333 Doublescan\n"
-"\n"
-#endif
-;
-#endif
-
-static char *devicesection_text =
-"# **********************************************************************\n"
-"# Graphics device section\n"
-"# **********************************************************************\n"
-"\n"
-"# Any number of graphics device sections may be present\n"
-"\n"
-"# Standard VGA Device:\n"
-"\n"
-"Section \"Device\"\n"
-"    Identifier	\"Standard VGA\"\n"
-"    VendorName	\"Unknown\"\n"
-"    BoardName	\"Unknown\"\n"
-"\n"
-"# The chipset line is optional in most cases.  It can be used to override\n"
-"# the driver's chipset detection, and should not normally be specified.\n"
-"\n"
-"#    Chipset	\"generic\"\n"
-"\n"
-"# The Driver line must be present.  When using run-time loadable driver\n"
-"# modules, this line instructs the server to load the specified driver\n"
-"# module.  Even when not using loadable driver modules, this line\n"
-"# indicates which driver should interpret the information in this section.\n"
-"\n"
-"    Driver     \"vga\"\n"
-"# The BusID line is used to specify which of possibly multiple devices\n"
-"# this section is intended for.  When this line isn't present, a device\n"
-"# section can only match up with the primary video device.  For PCI\n"
-"# devices a line like the following could be used.  This line should not\n"
-"# normally be included unless there is more than one video device\n"
-"# intalled.\n"
-"\n"
-"#    BusID      \"PCI:0:10:0\"\n"
-"\n"
-"#    VideoRam	256\n"
-"\n"
-"#    Clocks	25.2 28.3\n"
-"\n"
-"EndSection\n"
-"\n"
-"# Device configured by xorgconfig:\n"
-"\n";
-
-static char *screensection_text1 =
-"# **********************************************************************\n"
-"# Screen sections\n"
-"# **********************************************************************\n"
-"\n"
-"# Any number of screen sections may be present.  Each describes\n"
-"# the configuration of a single screen.  A single specific screen section\n"
-"# may be specified from the X server command line with the \"-screen\"\n"
-"# option.\n";
-
-static char *serverlayout_section_text1 = 
-"# **********************************************************************\n"
-"# ServerLayout sections.\n"
-"# **********************************************************************\n"
-"\n"
-"# Any number of ServerLayout sections may be present.  Each describes\n"
-"# the way multiple screens are organised.  A specific ServerLayout\n"
-"# section may be specified from the X server command line with the\n"
-"# \"-layout\" option.  In the absence of this, the first section is used.\n"
-"# When now ServerLayout section is present, the first Screen section\n"
-"# is used alone.\n"
-"\n"
-"Section \"ServerLayout\"\n"
-"\n"
-"# The Identifier line must be present\n"
-"    Identifier  \"Simple Layout\"\n"
-"\n"
-"# Each Screen line specifies a Screen section name, and optionally\n"
-"# the relative position of other screens.  The four names after\n"
-"# primary screen name are the screens to the top, bottom, left and right\n"
-"# of the primary screen.  In this example, screen 2 is located to the\n"
-"# right of screen 1.\n"
-"\n";
-
-static char *serverlayout_section_text2 =
-"\n"
-"# Each InputDevice line specifies an InputDevice section name and\n"
-"# optionally some options to specify the way the device is to be\n"
-"# used.  Those options include \"CorePointer\", \"CoreKeyboard\" and\n"
-"# \"SendCoreEvents\".\n"
-"\n"
-"    InputDevice \"Mouse1\" \"CorePointer\"\n"
-"    InputDevice \"Keyboard1\" \"CoreKeyboard\"\n"
-"\n"
-"EndSection\n"
-"\n"
-"# Section \"DRI\"\n"
-"#    Mode 0666\n"
-"# EndSection\n"
-"\n";
-
-static void 
-write_fontpath_section(FILE *f)
-{
-	/* this will create the Fontpath lines, but only after checking,
-	 * that the corresponding dir exists (was THE absolute problem
-	 * users had with XFree86/OS2 3.1.2D !)
-	 */
-	int i;
-	char cur[256+20],*colon, *hash;
-
-#ifdef COMPILEDDEFAULTFONTPATH
-	static const char dfp[] = COMPILEDDEFAULTFONTPATH;
-	const char *thisdir;
-	const char *nextdir;
-	int len;
-
-	for (thisdir = dfp; thisdir != NULL; thisdir = nextdir) {
-	    nextdir = strchr(thisdir, ',');
-	    if (nextdir == NULL) {
-		len = strlen(thisdir);
-	    } else {
-		len = nextdir - thisdir;
-		nextdir++;
-	    }
-	    if (len >= sizeof(cur))
-		continue;
-	    strncpy(cur, thisdir, len);
-	    cur[len] = '\0';
-	    colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */
-	    if (colon) *colon = 0;
-	    hash = exists_dir(cur) ? "" : "#";
-	    if (colon) *colon = ':';
-	    fprintf(f,"%s    FontPath   \"%s\"\n", hash, cur);
-	}
-#endif
-
-	for (i=0; XF86Config_fontpaths[i]; i++) {
-		strcpy(cur,TREEROOTFONT);
-		strcat(cur,XF86Config_fontpaths[i]);
-		/* remove a ':' */
-		colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */
-		if (colon) *colon = 0;
-#ifdef COMPILEDDEFAULTFONTPATH
-		/* skip if we already added it as part of the default font path */
-		if (strstr(dfp, cur) != NULL)
-		    continue;
-#endif
-		hash = exists_dir(cur) ? "" : "#";
-		fprintf(f,"%s    FontPath   \"%s%s\"\n",
-			hash,
-			TREEROOTFONT,
-			XF86Config_fontpaths[i]);
-	}
-}
-
-static int 
-write_XF86Config(char *filename)
-{
-	FILE *f;
-
-	/*
-	 * Write the file.
-	 */
-
-	f = fopen(filename, "w");
-	if (f == NULL) {
-		printf("Failed to open filename for writing.\n");
-		if (getuid() != 0)
-			printf("Maybe you need to be root to write to the specified directory?\n");
-		return(1);
-	}
-
-	fprintf(f, "%s", XF86Config_firstchunk_text);
-	write_fontpath_section(f);
-	fprintf(f, "%s", XF86Config_fontpathchunk_text);
-
-	/*
-	 * Write keyboard section.
-	 */
-	if (config_altmeta) {
-		fprintf(f, "    Option \"LeftAlt\"     \"Meta\"\n");
-		fprintf(f, "    Option \"RightAlt\"    \"ModeShift\"\n");
-	}
-	else {
-		fprintf(f, "#    Option \"LeftAlt\"     \"Meta\"\n");
-		fprintf(f, "#    Option \"RightAlt\"    \"ModeShift\"\n");
-	}
-#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT)
-	/* wscons keyoards need a protocol line */
-	fprintf(f, "    Option \"Protocol\" \"wskbd\"\n");
-	fprintf(f, "    Option \"Device\" \"%s\"\n", config_keyboard_dev);
-	fprintf(f, "    Option \"XkbKeycodes\" \"wscons(ppc)\"\n");
-#endif
-	fprintf(f, "%s", keyboardchunk2_text);
-
-	fprintf(f, "%s", keyboardchunk3_text);
-	if (config_xkbdisable) {
-		fprintf(f, "    Option \"XkbDisable\"\n\n");
-	} else {
-		fprintf(f, "#    Option \"XkbDisable\"\n\n");
-	}
-	fprintf(f, "    Option \"XkbRules\"	\"%s\"\n",
-		config_xkbrules);
-	fprintf(f, "    Option \"XkbModel\"	\"%s\"\n",
-		config_xkbmodel);
-	fprintf(f, "    Option \"XkbLayout\"	\"%s\"\n",
-		config_xkblayout);
-        if (config_xkbvariant)
-	    fprintf(f, "    Option \"XkbVariant\"	\"%s\"\n",
-		    config_xkbvariant);
-        if (config_xkboptions)
-	    fprintf(f, "    Option \"XkbOptions\"	\"%s\"\n",
-		    config_xkboptions);
-
-	fprintf(f, "%s",keyboardlastchunk_text);
-
-	/*
-	 * Write pointer section.
-	 */
-	fprintf(f, "%s", pointersection_text1);
-	fprintf(f, "    Option \"Protocol\"    \"%s\"\t# %s\n",
-		mouse_info[config_mousetype].name,
-		mouse_info[config_mousetype].desc);
-#if !defined(QNX4)
-	fprintf(f, "    Option \"Device\"      \"%s\"\n", config_pointerdevice);
-#endif
-	fprintf(f, "%s", pointersection_text2);
-	if (!config_emulate3buttons)
-		fprintf(f, "#");
-	fprintf(f, "    Option \"Emulate3Buttons\"\n");
-	fprintf(f, "#    Option \"Emulate3Timeout\"    \"50\"\n\n");
-	fprintf(f, "# ChordMiddle is an option for some 3-button Logitech mice\n\n");
-	if (!config_chordmiddle)
-		fprintf(f, "#");
-	fprintf(f, "    Option \"ChordMiddle\"\n\n");
-	if (config_cleardtrrts) {
-		fprintf(f, "    Option \"ClearDTR\"\n");
-		fprintf(f, "    Option \"ClearRTS\"\n\n");
-	}
-	fprintf(f, "EndSection\n\n\n");
-
-	/*
-	 * Write XInput sample section
-	 */
-	fprintf(f, "%s", xinputsection_text);
-
-	/*
-	 * Write monitor section.
-	 */
-	fprintf(f, "%s", monitorsection_text1);
-	fprintf(f, "    Identifier  \"%s\"\n", config_monitoridentifier);
-	fprintf(f, "\n");
-	fprintf(f, "%s", monitorsection_text2);
-	fprintf(f, "    HorizSync   %s\n", config_hsyncrange);
-	fprintf(f, "\n");
-	fprintf(f, "%s", monitorsection_text3);
-	fprintf(f, "    VertRefresh %s\n", config_vsyncrange);
-	fprintf(f, "\n");
-#if 0
-	fprintf(f, "%s", monitorsection_text4);
-	fprintf(f, "%s", modelines_text);
-#endif
-	fprintf(f, "EndSection\n\n\n");
-
-	/*
-	 * Write Device section.
-	 */
-
-	fprintf(f, "%s", devicesection_text);
-	fprintf(f, "Section \"Device\"\n");
-	fprintf(f, "    Identifier  \"%s\"\n", config_deviceidentifier);
-   	if (card_selected != -1) {
-	        fprintf(f, "    Driver      \"%s\"\n", card[card_selected].driver);
-	        if (card[card_selected].flags & UNSUPPORTED) {
-			fprintf(f, "	# unsupported card\n");
-		}
-	} else {
-	        fprintf(f, "    Driver      \"vga\"\n"
-			"	# unsupported card\n");
-	}
-	/* Rely on server to detect video memory. */
-	fprintf(f, "    #VideoRam    %d\n", config_videomemory);
-	if (card_selected != -1)
-		/* Add comment lines from card definition. */
-		fprintf(f, card[card_selected].lines);
-	if (config_ramdac != NULL)
-		fprintf(f, "    Ramdac      \"%s\"\n", config_ramdac);
-	if (card_selected != -1)
-		if (card[card_selected].dacspeed != NULL)
-			fprintf(f, "    Dacspeed    %s\n",
-				card[card_selected].dacspeed);
-	if (config_clockchip != NULL)
-		fprintf(f, "    Clockchip   \"%s\"\n", config_clockchip);
-	else
-	if (config_numberofclockslines == 0)
-		fprintf(f, "    # Insert Clocks lines here if appropriate\n");
-	else {
-		int i;
-		for (i = 0; i < config_numberofclockslines; i++)
-			fprintf(f, "    Clocks %s\n", config_clocksline[i]);
-	}
-	fprintf(f, "EndSection\n\n\n");	
-
-	/*
-	 * Write Screen sections.
-	 */
-
-	fprintf(f, "%s", screensection_text1);
-
-	fprintf(f, 
-		"Section \"Screen\"\n"
-		"    Identifier  \"Screen 1\"\n"
-		"    Device      \"%s\"\n"
-		"    Monitor     \"%s\"\n"
-		"    DefaultDepth %s\n"
-		"\n"
-		"    Subsection \"Display\"\n"
-		"        Depth       8\n"
-		"        Modes       %s\n"
-		"        ViewPort    0 0\n",
-		config_deviceidentifier,
-		config_monitoridentifier,
-		config_depth,
-		config_modesline8bpp);
-	if (config_virtual)
-		fprintf(f, "        Virtual     %d %d\n",
-			config_virtualx8bpp, config_virtualy8bpp);
-	fprintf(f, 
-		"    EndSubsection\n"
-		"    Subsection \"Display\"\n"
-		"        Depth       16\n"
-		"        Modes       %s\n"
-		"        ViewPort    0 0\n",
-		config_modesline16bpp);
-	if (config_virtual)
-		fprintf(f, "        Virtual     %d %d\n",
-			config_virtualx16bpp, config_virtualy16bpp);
-	fprintf(f, 
-		"    EndSubsection\n"
-		"    Subsection \"Display\"\n"
-		"        Depth       24\n"
-		"        Modes       %s\n"
-		"        ViewPort    0 0\n",
-		config_modesline24bpp);
-	if (config_virtual)
-		fprintf(f, "        Virtual     %d %d\n",
-			config_virtualx24bpp, config_virtualy24bpp);
-	fprintf(f, 
-		"    EndSubsection\n"
-		"EndSection\n"
-		"\n");
-
-        /*
-	 * ServerLayout section
-	 */
-   
-        fprintf(f, serverlayout_section_text1);
-	/* replace with  screen config */
-	fprintf(f, "    Screen \"Screen 1\"\n");
-
-	fprintf(f, serverlayout_section_text2);
-
-        fclose(f);
-	return(0);
-}
-
-static char *
-append_version(char *name)
-{
-#ifdef APPEND_VERSION_TO_CONFIG_NAME
-	char *ret = NULL;
-
-	if (XF86_VERSION_MAJOR > 9 || XF86_VERSION_MAJOR < 0)
-		return name;
-
-	ret = Malloc(strlen(name) + 2 + 1);
-	sprintf(ret, "%s-%d", name, XF86_VERSION_MAJOR);
-	free(name);
-	return ret;
-#else
-	return name;
-#endif
-}
-
-/*
- * Ask where to write XF86Config to. Returns filename.
- */
-
-static char *
-ask_XF86Config_location(void) {
-	char s[80];
-	char *filename = NULL;
-
-	printf(
-"I am going to write the " CONFIGNAME " file now. Make sure you don't accidently\n"
-"overwrite a previously configured one.\n\n");
-
-	if (getuid() == 0) {
-#ifdef PREFER_XF86CONFIG_IN_ETC
-		filename = Strdup("/etc/X11/" XCONFIGFILE);
-		filename = append_version(filename);
-		printf("Shall I write it to %s? ", filename);
-		getstring(s);
-		printf("\n");
-		if (answerisyes(s))
-			return filename;
-#endif
-
-		if (filename)
-			free(filename);
-		filename = Strdup(TREEROOTCFG "/" XCONFIGFILE);
-		filename = append_version(filename);
-		printf("Please answer the following question with either 'y' or 'n'.\n");
-		printf("Shall I write it to the default location, %s? ", filename);
-		getstring(s);
-		printf("\n");
-		if (answerisyes(s))
-			return filename;
-
-#ifndef PREFER_XF86CONFIG_IN_ETC
-		if (filename)
-			free(filename);
-		filename = Strdup("/etc/X11/" XCONFIGFILE);
-		filename = append_version(filename);
-		printf("Shall I write it to %s? ", filename);
-		getstring(s);
-		printf("\n");
-		if (answerisyes(s))
-			return filename;
-#endif
-	}
-
-	if (filename)
-		free(filename);
-	filename = Strdup(XCONFIGFILE);
-	filename = append_version(filename);
-	printf("Do you want it written to the current directory as '%s'? ", filename);
-	getstring(s);
-	printf("\n");
-	if (answerisyes(s)) {
-		return filename;
-	}
-
-	printf("Please give a filename to write to: ");
-	getstring(s);
-	printf("\n");
-	if (filename)
-		free(filename);
-	filename = Strdup(s);
-	return filename;
-}
-
-
-/*
- * Check if an earlier version of XFree86 is installed; warn about proper
- * search path order in that case.
- */
-
-static char *notinstalled_text =
-"The directory " TREEROOT " does not exist. This probably means that you have\n"
-"not yet installed the version of "__XSERVERNAME__" that this program was built\n"
-"to configure. Please install "__XSERVERNAME__" "XVERSIONSTRING" before running this program,\n"
-"following the instructions in the INSTALL or README that comes with the\n"
-__XSERVERNAME__" distribution for your OS.\n"
-"For a minimal installation it is sufficient to only install base binaries,\n"
-"libraries, configuration files and a server that you want to use.\n"
-"\n";
-
-static char *oldxfree86_text =
-"The directory '/usr/X386/bin' exists. You probably have a very old version of\n"
-"XFree86 installed, but this program was built to configure "__XSERVERNAME__" "XVERSIONSTRING"\n"
-"installed in '" TREEROOT "' instead of '/usr/X386'.\n"
-"\n"
-"It is important that the directory '" TREEROOT "' is present in your\n"
-"search path, *before* any occurrence of '/usr/X386/bin'. If you have installed\n"
-"X program binaries that are not in the base "__XSERVERNAME__" distribution in\n"
-"'/usr/X386/bin', you can keep the directory in your path as long as it is\n"
-"after '" TREEROOT "'.\n"
-"\n";
-
-static char *pathnote_text =	
-"Note that the X binary directory in your path may be a symbolic link.\n"
-"In that case you could modify the symbolic link to point to the new binaries.\n"
-"Example: 'rm -f /usr/bin/X11; ln -s /usr/X11R6/bin /usr/bin/X11', if the\n"
-"link is '/usr/bin/X11'.\n"
-"\n"
-"Make sure the path is OK before continuing.\n";
-
-static void 
-path_check(void) {
-	char s[80];
-	int ok;
-
-	ok = exists_dir(TREEROOT);
-	if (!ok) {
-		printf("%s", notinstalled_text);
-		printf("Do you want to continue? ");
-		getstring(s);
-		if (!answerisyes(s))
-			exit(-1);
-		printf("\n");
-	}
-
-	ok = exists_dir("/usr/X386/bin");
-	if (!ok)
-		return;
-
-	printf("%s", oldxfree86_text);
-	printf("Your PATH is currently set as follows:\n%s\n\n",
-		getenv("PATH"));
-	printf("%s", pathnote_text);
-	keypress();
-}
-
-
-static void
-configdir_check(void)
-{
-	/* /etc/X11 may not exist on some systems */
-	if (getuid() == 0) {
-		struct stat buf;
-		if (stat("/etc/X11", &buf) == -1 && errno == ENOENT)
-			mkdir("/etc/X11", 0777);
-		if (stat(TREEROOTCFG, &buf) == -1 && errno == ENOENT)
-			mkdir(TREEROOTCFG, 0777);
-	}
-}
-
-
-/*
- * Program entry point.
- */
-
-int 
-main(int argc, char *argv[]) {
-    
-	createtmpdir();
-
-	emptylines();
-
-	printf("%s", intro_text);
-
-	keypress();
-	emptylines();
-
-	path_check();
-
-	emptylines();
-
-	configdir_check();
-
-	emptylines();
-
-	mouse_configuration();
-
-	emptylines();
-
-	keyboard_configuration();
-
-	emptylines();
-
-	monitor_configuration();
-
-	emptylines();
-
-	carddb_configuration();
-
-	emptylines();
-
- 	while(screen_configuration()){};
-
-	emptylines();
-
-	depth_configuration();
-
-	emptylines();
-
-	while(write_XF86Config(ask_XF86Config_location())){};
-
-	printf("%s", finalcomment_text);
-
-	exit(0);
-}
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre b/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre
deleted file mode 100644
index b3d656c..0000000
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre
+++ /dev/null
@@ -1,22 +0,0 @@
-.\" $XdotOrg: $
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xorgconfig.man,v 1.5 2001/11/01 23:35:34 dawes Exp $
-.TH xorgconfig 1 __vendorversion__
-.SH NAME
-xorgconfig \- generate an __XCONFIGFILE__ file
-.SH SYNOPSIS
-.B xorgconfig
-.SH DESCRIPTION
-\fIxorgconfig\fP is an interactive program for generating an __XCONFIGFILE__ file
-for use with __XSERVERNAME__ X servers.
-.PP
-Note that the default name used by \fIxorgconfig\fP for the __XCONFIGFILE__ file
-is system-dependent.  For instance, on OS/2, XConfig is used.
-.SH FILES
-.TP
-.I __projectroot__/lib/X11/Cards
-Video cards database
-.SH "SEE ALSO"
-__XSERVERNAME__(1), __XCONFIGFILE__(__filemansuffix__), xorgcfg(1), reconfig(1)
-.SH AUTHOR
-Harm Hanemaayer.
-.\" $TOG: xf86conf.man /main/9 1997/07/19 10:53:08 kaleb $
commit 574c62e305e5380bb1b0f4bfec4f7cc3e3f03ada
Author: Owen Taylor <otaylor at fishsoup.net>
Date:   Tue Jun 24 12:40:47 2008 -0400

    Bug #15369: Don't reduce Over to Src for transform + RepeatNone.
    
    Only do no-src-alpha optimizations for a RepeatNone source if we can
    easily probe that we won't sample outside the edges of the source.

diff --git a/render/picture.c b/render/picture.c
index 2fbd09e..b7874bb 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1548,12 +1548,24 @@ FreePictFormat (pointer	pPictFormat,
  * being careful to avoid these cases.
  */
 static CARD8
-ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst)
+ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+		   INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height)
 {
     Bool no_src_alpha, no_dst_alpha;
 
+    /* Sampling off the edge of a RepeatNone picture introduces alpha
+     * even if the picture itself doesn't have alpha. We don't try to
+     * detect every case where we don't sample off the edge, just the
+     * simplest case where there is no transform on the source
+     * picture.
+     */
     no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) &&
                    PICT_FORMAT_A(pSrc->format) == 0 &&
+                   (pSrc->repeatType != RepeatNone ||
+		    (!pSrc->transform &&
+		     xSrc >= 0 && ySrc >= 0 &&
+		     xSrc + width <= pSrc->pDrawable->width &&
+		     ySrc + height <= pSrc->pDrawable->height)) &&
                    pSrc->alphaMap == NULL &&
                    pMask == NULL;
     no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) &&
@@ -1655,7 +1667,7 @@ CompositePicture (CARD8		op,
 	ValidatePicture (pMask);
     ValidatePicture (pDst);
 
-    op = ReduceCompositeOp (op, pSrc, pMask, pDst);
+    op = ReduceCompositeOp (op, pSrc, pMask, pDst, xSrc, ySrc, width, height);
     if (op == PictOpDst)
 	return;
 
commit 100afae578e59e31b65a6264c281ba7deea5ac39
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 10:52:31 2008 -0400

    Bug #15586: (Correctly) refuse to redirect the root window.

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 0372b9b..19c7db0 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -82,6 +82,9 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
 	return Success;
     }
 
+    if (!pWin->parent)
+	return BadMatch;
+
     /*
      * Only one Manual update is allowed
      */
commit 4c4e06af7950df509fa02099788be66cf37a4d01
Author: Paul Bender <pebender at gmail.com>
Date:   Tue Jun 24 10:44:47 2008 -0400

    Bug #15665: Fix building without Composite.

diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am
index 58c8e88..bd8267a 100644
--- a/hw/xfree86/xaa/Makefile.am
+++ b/hw/xfree86/xaa/Makefile.am
@@ -9,7 +9,9 @@ MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c
 POLYSEG = s-xaaLine.c s-xaaDashLine.c
 
 libxaa_la_LDFLAGS = -avoid-version
+if COMPOSITE
 libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la
+endif
 
 module_LTLIBRARIES = libxaa.la
 libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
commit 59510a76436c739fd9421f01cc4210607d9e7f57
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 24 10:40:36 2008 -0400

    Remove some default modes that really shouldn't be in the default set.

diff --git a/hw/xfree86/common/extramodes b/hw/xfree86/common/extramodes
index 1d72861..4505026 100644
--- a/hw/xfree86/common/extramodes
+++ b/hw/xfree86/common/extramodes
@@ -7,18 +7,12 @@
 # 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
 ModeLine "832x624" 57.284 832  864  928 1152  624  625  628  667 -Hsync -Vsync
 
-# 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz
-ModeLine "1152x768"   64.995 1152 1178 1314 1472  768  771  777  806 +hsync +vsync
-
 # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
 ModeLine "1400x1050" 122.0 1400 1488 1640 1880   1050 1052 1064 1082 +hsync +vsync
 
 # 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
 ModeLine "1400x1050" 155.8 1400 1464 1784 1912   1050 1052 1064 1090 +hsync +vsync
 
-# 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz
-Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync
-
 # 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
 Modeline "1920x1440" 341.35  1920 2072 2288 2656  1440 1441 1444 1512 -hsync +vsync
 
commit b622f6dc5d8d70d17be0374a85a9b16b43a62a01
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Jun 23 23:45:57 2008 +0200

    kdrive: fix building with --disable-xv (bug#16488)

diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index 07ab8c8..29098c3 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -12,6 +12,12 @@ KDRIVE_HW_SOURCES =	\
 	vga.h
 endif
 
+if XV
+KDRIVE_XV_SOURCES =	\
+	kxv.c		\
+	kxv.h
+endif
+
 libkdrive_a_SOURCES =	\
 	fourcc.h	\
 	kaa.c		\
@@ -31,8 +37,7 @@ libkdrive_a_SOURCES =	\
 	koffscreen.c	\
 	kshadow.c	\
 	ktest.c		\
-	kxv.c		\
-	kxv.h		\
+	$(KDRIVE_XV_SOURCES) \
 	$(KDRIVE_HW_SOURCES) \
         $(top_srcdir)/mi/miinitext.c
 
commit 3b587826924c60f6736dc5faf584b964fde1b4da
Author: Jesse Ruffin <jesse at eloquentpeasant.net>
Date:   Mon Jun 23 14:35:20 2008 -0400

    Bug #16302: Fix GLX drawable refcounting in DMX.

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index ab7ee96..2365f82 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -1004,8 +1004,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	    prevglxc->pGlxPixmap = 0;
 	}
 
-	if (prevglxc->pGlxReadPixmap && 
-	    prevglxc->pGlxReadPixmap != prevglxc->pGlxPixmap ) {
+	if (prevglxc->pGlxReadPixmap) {
 	    /*
 	    ** The previous drawable was a glx pixmap, release it.
 	    */
@@ -1023,8 +1022,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	    prevglxc->pGlxWindow = 0;   
 	}
 
-	if (prevglxc->pGlxReadWindow &&
-	    prevglxc->pGlxReadWindow != prevglxc->pGlxWindow) {
+	if (prevglxc->pGlxReadWindow) {
 	    /*
 	    ** The previous drawable was a glx window, release it.
 	    */
@@ -1042,8 +1040,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	    prevglxc->pGlxPbuffer = 0;   
 	}
 
-	if (prevglxc->pGlxReadPbuffer &&
-	    prevglxc->pGlxReadPbuffer != prevglxc->pGlxPbuffer ) {
+	if (prevglxc->pGlxReadPbuffer) {
 	    /*
 	    ** The previous drawable was a glx Pbuffer, release it.
 	    */
@@ -1071,7 +1068,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	    pGlxPixmap->refcnt++;
 	}
 
-	if (pReadGlxPixmap && pReadGlxPixmap != pGlxPixmap) {
+	if (pReadGlxPixmap) {
 	    pReadGlxPixmap->refcnt++;
 	}
 
@@ -1079,7 +1076,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	   pGlxWindow->refcnt++;
 	}
 
-	if (pGlxReadWindow && pGlxReadWindow != pGlxWindow) {
+	if (pGlxReadWindow) {
 	   pGlxReadWindow->refcnt++;
 	}
 
@@ -1087,7 +1084,7 @@ static int MakeCurrent(__GLXclientState *cl,
 	   pGlxPbuffer->refcnt++;
 	}
 
-	if (pGlxReadPbuffer && pGlxReadPbuffer != pGlxPbuffer) {
+	if (pGlxReadPbuffer) {
 	   pGlxReadPbuffer->refcnt++;
 	}
 
commit c8d066a15142678041c1d82ccf530dcdb2ea74ca
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 23 13:59:48 2008 -0400

    Implement bswap in x86emu.
    
    Yes, this is a 486+ instruction and thus not strictly legal in vm86
    mode, but enough BIOSes use it (looking at you VIA) that we might as
    well implement it.

diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c
index 324de8a..a1eda76 100644
--- a/hw/xfree86/x86emu/ops2.c
+++ b/hw/xfree86/x86emu/ops2.c
@@ -40,6 +40,12 @@
 
 #include "x86emu/x86emui.h"
 
+#undef bswap_32
+#define bswap_32(x) (((x & 0xff000000) >> 24) | \
+		     ((x & 0x00ff0000) >> 8) | \
+		     ((x & 0x0000ff00) << 8) | \
+		     ((x & 0x000000ff) << 24))
+
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
@@ -2571,6 +2577,47 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
     END_OF_INSTR();
 }
 
+/* Handles opcodes 0xc8-0xcf */
+static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2))
+{
+    START_OF_INSTR();
+    DECODE_PRINTF("BSWAP\n");
+    TRACE_AND_STEP();
+
+    switch (op2) {
+	case 0xc8:
+	    M.x86.R_EAX = bswap_32(M.x86.R_EAX);
+	    break;
+	case 0xc9:
+	    M.x86.R_ECX = bswap_32(M.x86.R_ECX);
+	    break;
+	case 0xca:
+	    M.x86.R_EDX = bswap_32(M.x86.R_EDX);
+	    break;
+	case 0xcb:
+	    M.x86.R_EBX = bswap_32(M.x86.R_EBX);
+	    break;
+	case 0xcc:
+	    M.x86.R_ESP = bswap_32(M.x86.R_ESP);
+	    break;
+	case 0xcd:
+	    M.x86.R_EBP = bswap_32(M.x86.R_EBP);
+	    break;
+	case 0xce:
+	    M.x86.R_ESI = bswap_32(M.x86.R_ESI);
+	    break;
+	case 0xcf:
+	    M.x86.R_EDI = bswap_32(M.x86.R_EDI);
+	    break;
+	default:
+	    /* can't happen */
+	    break;
+    }
+
+    DECODE_CLEAR_SEGOVR();
+    END_OF_INSTR();
+}
+
 /***************************************************************************
  * Double byte operation code table:
  **************************************************************************/
@@ -2788,14 +2835,14 @@ void (*x86emu_optab2[256])(u8) =
 /*  0xc5 */ x86emuOp2_illegal_op,
 /*  0xc6 */ x86emuOp2_illegal_op,
 /*  0xc7 */ x86emuOp2_illegal_op,
-/*  0xc8 */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xc9 */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xca */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xcb */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xcc */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xcd */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xce */ x86emuOp2_illegal_op,  /* TODO: bswap */
-/*  0xcf */ x86emuOp2_illegal_op,  /* TODO: bswap */
+/*  0xc8 */ x86emuOp2_bswap,
+/*  0xc9 */ x86emuOp2_bswap,
+/*  0xca */ x86emuOp2_bswap,
+/*  0xcb */ x86emuOp2_bswap,
+/*  0xcc */ x86emuOp2_bswap,
+/*  0xcd */ x86emuOp2_bswap,
+/*  0xce */ x86emuOp2_bswap,
+/*  0xcf */ x86emuOp2_bswap,
 
 /*  0xd0 */ x86emuOp2_illegal_op,
 /*  0xd1 */ x86emuOp2_illegal_op,
commit b55fbca4f0705aeff1c69d3ef851c5ff5af6ed94
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 20 13:27:32 2008 -0400

    Bug #12414: Create full-fledged pixmaps in fb24_32ReformatTile().
    
    ... instead of creating pixmaps that only fb knows about, which will
    have no devPrivates for any other subsystem and thus cause havoc if
    (when) they leak out.

diff --git a/fb/fb24_32.c b/fb/fb24_32.c
index a03726b..1ebd598 100644
--- a/fb/fb24_32.c
+++ b/fb/fb24_32.c
@@ -1,5 +1,4 @@
 /*
- *
  * Copyright © 2000 SuSE, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
@@ -544,11 +543,10 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
     int		oldXoff, oldYoff;
     int		newXoff, newYoff;
 
-    pNewTile = fbCreatePixmapBpp (pScreen,
-				  pOldTile->drawable.width,
-				  pOldTile->drawable.height,
-				  pOldTile->drawable.depth,
-				  bitsPerPixel, 0);
+    pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
+				     pOldTile->drawable.height,
+				     pOldTile->drawable.depth,
+				     pOldTile->usage_hint);
     if (!pNewTile)
 	return 0;
     fbGetDrawable (&pOldTile->drawable, 
commit 155fcecb320dbcfb899d6bcd78048ce0993bf28b
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon May 19 08:09:33 2008 +0200

    Various messages clean-ups.

diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 83583d5..cbb9e48 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -310,8 +310,7 @@ acquire_vt:
 #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
 #ifdef WSCONS_SUPPORT
 	case WSCONS:
-	    fprintf(stderr, "xf86OpenConsole\n");
-	    /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */
+	    /* Nothing to do */
    	    break; 
 #endif
         }
@@ -575,8 +574,14 @@ xf86OpenPcvt()
             sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
 	    if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0)
 	    {
-		FatalError("xf86OpenPcvt: Cannot open %s (%s)",
+		ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
 			   vtname, strerror(errno));
+		xf86Info.vtno = initialVT;
+	        sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1);
+		if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
+			FatalError("xf86OpenPcvt: Cannot open %s (%s)",
+			   	vtname, strerror(errno));
+		}
 	    }
 	    if (ioctl(fd, VT_GETMODE, &vtmode) < 0)
 	    {
@@ -585,8 +590,8 @@ xf86OpenPcvt()
 	    xf86Info.consType = PCVT;
 #ifdef WSCONS_SUPPORT
 	    xf86Msg(X_PROBED,
-		    "Using wscons driver in pcvt compatibility mode "
-		    "(version %d.%d)\n",
+		    "Using wscons driver on %s in pcvt compatibility mode "
+		    "(version %d.%d)\n", vtname,
 		    pcvt_version.rmajor, pcvt_version.rminor);
 #else
 	    xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n",
@@ -620,7 +625,7 @@ xf86OpenWScons()
 #if defined(__NetBSD__)
 	sprintf(ttyname, "/dev/ttyE%d", i);
 #elif defined(__OpenBSD__)
-	sprintf(ttyname, "/dev/ttyC%d", i);
+	sprintf(ttyname, "/dev/ttyC%x", i);
 #endif
 	if ((fd = open(ttyname, 2)) != -1)
 	    break;
@@ -662,7 +667,7 @@ xf86CloseConsole()
 	    VT.mode = VT_AUTO;
 	    ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */
         }
-#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
+#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL)
         if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0)
         {
             xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)",
commit 41a65e110409a290288180e8e1517f053f877586
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon May 19 06:12:04 2008 +0200

    Fix ipc check on OpenBSD

diff --git a/configure.ac b/configure.ac
index fec18ca..f6997e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,6 +262,8 @@ AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
 AC_CACHE_CHECK([for SYSV IPC],
 		ac_cv_sysv_ipc,
 		[AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/ipc.h>
 #include <sys/shm.h>
 ],[
 { 
commit ce4d4b3c1b0e25f64d6f781b09528b2f3ae33207
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon May 19 05:19:01 2008 +0200

    build fix

diff --git a/hw/xfree86/os-support/bsd/bsd_axp.c b/hw/xfree86/os-support/bsd/bsd_axp.c
index 51ffef1..cb10a9d 100644
--- a/hw/xfree86/os-support/bsd/bsd_axp.c
+++ b/hw/xfree86/os-support/bsd/bsd_axp.c
@@ -7,7 +7,7 @@
 #include "os.h"
 #include "xf86.h"
 #include "xf86Priv.h"
-#include "xf86Axp.h"
+#include "shared/xf86Axp.h"
 #include <sys/param.h>
 #include "xf86_OSlib.h"
 #include <stdio.h>
commit 19c7e9da55646f1f6e05c28cd71865cd8d84e1ff
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon May 19 02:24:17 2008 +0200

    preserve errno around the SIGIO handler

diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
index c97f503..f51131c 100644
--- a/hw/xfree86/os-support/shared/sigio.c
+++ b/hw/xfree86/os-support/shared/sigio.c
@@ -101,6 +101,7 @@ xf86SIGIO (int sig)
     int	    i;
     fd_set  ready;
     struct timeval  to;
+    int save_errno = errno;	/* do not clobber the global errno */
     int	    r;
 
     ready = xf86SigIOMask;
@@ -117,6 +118,8 @@ xf86SIGIO (int sig)
     if (r > 0) {
       xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
     }
+    /* restore global errno */
+    errno = save_errno;
 }
 
 static int
commit 0a81d476388c51f8aa723400dffc375e112ea97a
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Mon May 19 02:20:44 2008 +0200

    Remove RCS Id.

diff --git a/hw/xfree86/utils/kbd_mode/Makefile.am b/hw/xfree86/utils/kbd_mode/Makefile.am
index 1b28411..087caa2 100644
--- a/hw/xfree86/utils/kbd_mode/Makefile.am
+++ b/hw/xfree86/utils/kbd_mode/Makefile.am
@@ -1,4 +1,3 @@
-# $Id$
 #
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # 
commit c0d7ad9c88172d753b932069743ae65f75de3aa9
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Thu Jun 19 16:51:18 2008 +0200

    Let code build with gcc 2.95

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index eb084a5..e52974d 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -599,8 +599,9 @@ configFiles(XF86ConfFilesPtr fileconf)
       pathFrom = X_CONFIG;
       if (*f) {
         if (xf86Info.useDefaultFontPath) {
+          char *g;
           xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
-          char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
+	  g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
           strcpy(g, f);
           strcat(g, ",");
           defaultFontPath = strcat(g, defaultFontPath);
@@ -1233,8 +1234,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
      * remove the core attribute from the later ones.
      */
     for (devs = servlayoutp->inputs; devs && *devs; devs++) {
-        indp = *devs;
 	pointer opt1 = NULL, opt2 = NULL;
+        indp = *devs;
 	if (indp->commonOptions &&
 	    xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
 	    opt1 = indp->commonOptions;
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 8f34032..6c93066 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -597,6 +597,10 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
     }
     else
     {
+	int width, height, old_width, old_height;
+	void *shadowData;
+	PixmapPtr shadow;
+
 	PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, F(crtc->x), F(crtc->y));
 	PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc);
 
@@ -605,12 +609,12 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
 	 * matches the mode, not the pre-rotated copy in the
 	 * frame buffer
 	 */
-	int	    width = mode->HDisplay;
-	int	    height = mode->VDisplay;
-	void	    *shadowData = crtc->rotatedData;
-	PixmapPtr   shadow = crtc->rotatedPixmap;
-	int	    old_width = shadow ? shadow->drawable.width : 0;
-	int	    old_height = shadow ? shadow->drawable.height : 0;
+	width = mode->HDisplay;
+	height = mode->VDisplay;
+	shadowData = crtc->rotatedData;
+	shadow = crtc->rotatedPixmap;
+	old_width = shadow ? shadow->drawable.width : 0;
+	old_height = shadow ? shadow->drawable.height : 0;
 	
 	/* Allocate memory for rotation */
 	if (old_width != width || old_height != height)
commit 219dd2d44a9da40427ad48b0f09b981fe0551f4b
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Sun May 18 13:53:32 2008 +0200

    sprintf() -> snprintf()

diff --git a/os/access.c b/os/access.c
index db14380..6b55afd 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1190,7 +1190,8 @@ ResetHosts (char *display)
 		strlen(display) + 1;
     if (fnamelen > sizeof(fname))
 	FatalError("Display name `%s' is too long\n", display);
-    sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display);
+    snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, 
+	     display);
 
     if ((fd = fopen (fname, "r")) != 0)
     {
commit cfcb3da75e807dec225cc7ea469e04d2db10bf73
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jun 18 11:37:00 2008 -0700

    Make button down state a bitmask. Master buttons track union of slave buttons
    
    Mixing usage where some parts of the code treated this field as a bitmask
    and other parts as an array of card8 was wrong, and as the wire protocol
    wanted bitmasks, it was less invasive to switch the newer counting code use
    booleans.
    
    Master devices track slave buttons by waiting for all slave buttons to be
    released before delivering the release event to the client.
    
    This also removes the state merging code in DeepCopyDeviceClasses -- that
    code was changing master device state without delivering any events,
    violating protocol invariants. The result will be that existing slave
    button state which does not match the master will not be visible through the
    master device. Fixing this would require that we synthesize events in this
    function, which seems like a bad idea. Note that keyboards have the same
    issue.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4736a12..d59a87d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -587,8 +587,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
 
     if (from->button)
     {
-        int i;
-        DeviceIntPtr sd;
         if (!to->button)
         {
             classes = dixLookupPrivate(&to->devPrivates,
@@ -603,20 +601,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
                 classes->button = NULL;
         }
 
-        to->button->buttonsDown = 0;
-        memset(to->button->down, 0, MAP_LENGTH);
-        /* merge button states from all attached devices */
-        for (sd = inputInfo.devices; sd; sd = sd->next)
-        {
-            if (sd->isMaster || sd->u.master != to)
-                continue;
-
-            for (i = 0; i < MAP_LENGTH; i++)
-            {
-                to->button->down[i] += sd->button->down[i];
-                to->button->buttonsDown++;
-            }
-        }
 #ifdef XKB
         if (from->button->xkb_acts)
         {
@@ -923,8 +907,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         if (!b)
             return DONT_PROCESS;
 
-        if (b->down[key]++ > 0)
+        kptr = &b->down[key >> 3];
+        if ((*kptr & bit) != 0)
             return DONT_PROCESS;
+        *kptr |= bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
         b->buttonsDown++;
@@ -938,10 +924,25 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         if (!b)
             return DONT_PROCESS;
 
-        if (b->down[key] == 0)
-            return DONT_PROCESS;
-        if (--b->down[key] > 0)
+        kptr = &b->down[key>>3];
+        if (!(*kptr & bit))
             return DONT_PROCESS;
+        if (device->isMaster) {
+            DeviceIntPtr sd;
+
+            /*
+             * Leave the button down if any slave has the
+             * button still down. Note that this depends on the
+             * event being delivered through the slave first
+             */
+            for (sd = inputInfo.devices; sd; sd = sd->next) {
+                if (sd->isMaster || sd->u.master != device)
+                    continue;
+                if ((sd->button->down[key>>3] & bit) != 0)
+                    return DONT_PROCESS;
+            }
+        }
+        *kptr &= ~bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
         if (b->buttonsDown >= 1 && !--b->buttonsDown)
diff --git a/dix/devices.c b/dix/devices.c
index 3581cde..91a43f3 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1153,7 +1153,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
     butc->buttonsDown = 0;
     butc->state = 0;
     butc->motionMask = 0;
-    bzero((char *)butc->down, MAP_LENGTH);
+    bzero((char *)butc->down, sizeof(butc->down));
 #ifdef XKB
     butc->xkb_acts=	NULL;
 #endif
diff --git a/include/inputstr.h b/include/inputstr.h
index 11fe031..4c7ec2e 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -186,7 +186,7 @@ typedef struct _ButtonClassRec {
     CARD8		buttonsDown;	/* number of buttons currently down */
     unsigned short	state;
     Mask		motionMask;
-    CARD8		down[MAP_LENGTH];
+    CARD8		down[DOWN_LENGTH];
     CARD8		map[MAP_LENGTH];
 #ifdef XKB
     union _XkbAction    *xkb_acts;
commit 3cc5ae6a4f725483612c00fc8bcc2c61607f66a8
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 18 16:14:42 2008 +0930

    dix: don't attempt to send Enter/Leave events if we have a keyboard.
    
    Dereferencing into dev->valuator could crash the server, although it looks
    like I could only reproduce this by having a keyboard send an event after it
    was created and the WM was still replaying. Or so.

diff --git a/dix/events.c b/dix/events.c
index 4e11bda..7bd6825 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4583,6 +4583,9 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
         WindowPtr toWin,
         int mode)
 {
+    if (!IsPointerDevice(pDev))
+        return;
+
     if (fromWin == toWin)
 	return;
     if (IsParent(fromWin, toWin))
commit 528b4e36ade482df99747081688ae52cfaeb28eb
Author: Alan Hourihane <alanh at tungstengraphics.com>
Date:   Wed Jun 18 22:34:02 2008 +0100

    Set driverPriv immediately on CreatePixmap.
    
    If it's NULL anyway, we bail, if not, it lets
    ModifyPixmapHeader know about the private.

diff --git a/exa/exa.c b/exa/exa.c
index fc04748..48352bd 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -314,7 +314,6 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
 
     if (driver_alloc) {
         size_t paddedWidth, datasize;
-        void *driver_priv;
 
 	paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
         if (paddedWidth / 4 > 32767 || h > 32767)
@@ -327,22 +326,21 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
 
         datasize = h * paddedWidth;
 
-        driver_priv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
-        if (!driver_priv) {
+        pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
+        if (!pExaPixmap->driverPriv) {
              fbDestroyPixmap(pPixmap);
              return NULL;
         }
 
         (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
                                        paddedWidth, NULL);
-        pExaPixmap->driverPriv = driver_priv;
         pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
         pExaPixmap->fb_ptr = NULL;
     } else {
-         pExaPixmap->driverPriv = NULL;
-         /* Scratch pixmaps may have w/h equal to zero, and may not be
-	  * migrated.
-	  */
+        pExaPixmap->driverPriv = NULL;
+        /* Scratch pixmaps may have w/h equal to zero, and may not be
+	 * migrated.
+	 */
         if (!w || !h)
 	    pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
         else
commit dfb622f991ae95f7d56931d898dbc012cf91ad78
Author: Keith Packard <keithp at keithp.com>
Date:   Sat Jun 14 13:40:53 2008 -0700

    Make button down state a bitmask. Master buttons track union of slave buttons
    
    Mixing usage where some parts of the code treated this field as a bitmask
    and other parts as an array of card8 was wrong, and as the wire protocol
    wanted bitmasks, it was less invasive to switch the newer counting code use
    booleans.
    
    Master devices track slave buttons by waiting for all slave buttons to be
    released before delivering the release event to the client.
    
    This also removes the state merging code in DeepCopyDeviceClasses -- that
    code was changing master device state without delivering any events,
    violating protocol invariants. The result will be that existing slave
    button state which does not match the master will not be visible through the
    master device. Fixing this would require that we synthesize events in this
    function, which seems like a bad idea. Note that keyboards have the same
    issue.

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 57fb65b..3235964 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -587,8 +587,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
 
     if (from->button)
     {
-        int i;
-        DeviceIntPtr sd;
         if (!to->button)
         {
             classes = dixLookupPrivate(&to->devPrivates,
@@ -603,20 +601,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
                 classes->button = NULL;
         }
 
-        to->button->buttonsDown = 0;
-        memset(to->button->down, 0, MAP_LENGTH);
-        /* merge button states from all attached devices */
-        for (sd = inputInfo.devices; sd; sd = sd->next)
-        {
-            if (sd->isMaster || sd->u.master != to)
-                continue;
-
-            for (i = 0; i < MAP_LENGTH; i++)
-            {
-                to->button->down[i] += sd->button->down[i];
-                to->button->buttonsDown++;
-            }
-        }
 #ifdef XKB
         if (from->button->xkb_acts)
         {
@@ -923,8 +907,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         if (!b)
             return DONT_PROCESS;
 
-        if (b->down[key]++ > 0)
+	kptr = &b->down[key >> 3];
+        if ((*kptr & bit) != 0)
             return DONT_PROCESS;
+	*kptr |= bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
         b->buttonsDown++;
@@ -938,10 +924,25 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         if (!b)
             return DONT_PROCESS;
 
-        if (b->down[key] == 0)
-            return DONT_PROCESS;
-        if (--b->down[key] > 0)
+	kptr = &b->down[key>>3];
+        if (!(*kptr & bit))
             return DONT_PROCESS;
+	if (device->isMaster) {
+	    DeviceIntPtr sd;
+
+	    /*
+	     * Leave the button down if any slave has the
+	     * button still down. Note that this depends on the
+	     * event being delivered through the slave first
+	     */
+	    for (sd = inputInfo.devices; sd; sd = sd->next) {
+		if (sd->isMaster || sd->u.master != device)
+		    continue;
+		if ((sd->button->down[key>>3] & bit) != 0)
+		    return DONT_PROCESS;
+	    }
+	}
+	*kptr &= ~bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
         if (b->buttonsDown >= 1 && !--b->buttonsDown)
diff --git a/dix/devices.c b/dix/devices.c
index b88d856..8eb6c25 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1153,7 +1153,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
     butc->buttonsDown = 0;
     butc->state = 0;
     butc->motionMask = 0;
-    bzero((char *)butc->down, MAP_LENGTH);
+    bzero((char *)butc->down, sizeof(butc->down));
 #ifdef XKB
     butc->xkb_acts=	NULL;
 #endif
diff --git a/include/inputstr.h b/include/inputstr.h
index 7209b2c..de66167 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -183,7 +183,7 @@ typedef struct _ButtonClassRec {
     CARD8		buttonsDown;	/* number of buttons currently down */
     unsigned short	state;
     Mask		motionMask;
-    CARD8		down[MAP_LENGTH];
+    CARD8		down[DOWN_LENGTH];
     CARD8		map[MAP_LENGTH];
 #ifdef XKB
     union _XkbAction    *xkb_acts;
commit 068fa63496c7c363706f0d356b5132bc591c04c6
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Wed Jun 18 09:23:09 2008 +0930

    dix: fix a crash when the client has a different byteorder.
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>

diff --git a/dix/events.c b/dix/events.c
index a35e9e4..4e11bda 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -6168,6 +6168,10 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
     if (events->u.u.type == GenericEvent)
     {
         eventlength += ((xGenericEvent*)events)->length * 4;
+    }
+
+    if(pClient->swapped)
+    {
         if (eventlength > swapEventLen)
         {
             swapEventLen = eventlength;
@@ -6178,10 +6182,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
                 return;
             }
         }
-    }
 
-    if(pClient->swapped)
-    {
 	for(i = 0; i < count; i++)
 	{
 	    eventFrom = &events[i];
@@ -6192,7 +6193,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
 	    (*EventSwapVector[eventFrom->u.u.type & 0177])
 		(eventFrom, eventTo);
 
-	    (void)WriteToClient(pClient, eventlength, (char *)&eventTo);
+	    (void)WriteToClient(pClient, eventlength, (char *)eventTo);
 	}
     }
     else
commit d21155a3e9b51df946766926bc6155c8972c4439
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 15 20:00:41 2008 +0930

    input: fix up usage of button->down, used to be a bitmask, is now an array.
    
    device->button->down used to be a 32-byte bitmask with one bit for each
    button. This has changed into a 256-byte array, with one byte assigned for
    each button. Some of the callers were still using this array as a bitmask
    however, this is fixed with this patch.
    
    Thanks to Keith Packard for pointing this out. See also:
    http://lists.freedesktop.org/archives/xorg/2008-June/036202.html

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6f88b57..4736a12 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1153,9 +1153,11 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
     ev->num_valuators = 0;
 
     if (b) {
+	int i;
 	ev->classes_reported |= (1 << ButtonClass);
 	ev->num_buttons = b->numButtons;
-	memmove((char *)&ev->buttons[0], (char *)b->down, 4);
+	for (i = 0; i < 32; i++)
+	    SetBitIf(ev->buttons, b->down, i);
     } else if (k) {
 	ev->classes_reported |= (1 << KeyClass);
 	ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
@@ -1270,11 +1272,13 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
 	    first += 3;
 	    nval -= 3;
 	    if (nbuttons > 32) {
+		int i;
 		(ev - 1)->deviceid |= MORE_EVENTS;
 		bev = (deviceButtonStateNotify *) ev++;
 		bev->type = DeviceButtonStateNotify;
 		bev->deviceid = dev->id;
-		memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28);
+		for (i = 32; i < MAP_LENGTH; i++)
+		    SetBitIf(bev->buttons, b->down, i);
 	    }
 	    if (nval > 0) {
 		(ev - 1)->deviceid |= MORE_EVENTS;
@@ -1692,7 +1696,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
     if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
 	return BadValue;
     for (i = 0; i < nElts; i++)
-	if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
+	if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
 	    return MappingBusy;
     for (i = 0; i < nElts; i++)
 	b->map[i + 1] = map[i];
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 71ab79b..268bdd7 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -119,7 +119,7 @@ ProcXQueryDeviceState(ClientPtr client)
 	total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
 	num_classes++;
     }
-    buf = (char *)xalloc(total_length);
+    buf = (char *)xcalloc(total_length, 1);
     if (!buf)
 	return BadAlloc;
     savbuf = buf;
@@ -139,8 +139,8 @@ ProcXQueryDeviceState(ClientPtr client)
 	tb->class = ButtonClass;
 	tb->length = sizeof(xButtonState);
 	tb->num_buttons = b->numButtons;
-	for (i = 0; i < 32; i++)
-	    tb->buttons[i] = b->down[i];
+	for (i = 0; i < MAP_LENGTH; i++)
+            SetBitIf(tb->buttons, b->down, i);
 	buf += sizeof(xButtonState);
     }
 
diff --git a/dix/devices.c b/dix/devices.c
index b88d856..3581cde 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1734,7 +1734,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
         if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
             for (i = 0; i < n; i++) {
                 if ((device->button->map[i + 1] != map[i]) &&
-                    BitIsOn(device->button->down, i + 1)) {
+                        device->button->down[i + 1]) {
                     return MappingBusy;
                 }
             }
diff --git a/dix/events.c b/dix/events.c
index 8191973..a35e9e4 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4077,15 +4077,11 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
     if (xE->u.u.type != MotionNotify)
     {
 	int  key;
-	BYTE *kptr;
-	int           bit;
 
 	XE_KBPTR.rootX = pSprite->hot.x;
 	XE_KBPTR.rootY = pSprite->hot.y;
 
 	key = xE->u.u.detail;
-	kptr = &butc->down[key >> 3];
-	bit = 1 << (key & 7);
 	switch (xE->u.u.type)
 	{
 	case ButtonPress:
diff --git a/include/inputstr.h b/include/inputstr.h
index 7209b2c..11fe031 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -57,6 +57,9 @@ SOFTWARE.
 #include "privates.h"
 
 #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
+/* If byte[i] in src is non-zero, set bit i in dst, otherwise set bit to 0 */
+#define SetBitIf(dst, src, i) \
+    (src[i]) ? (dst[i/8] |= (1 << (i % 8))) : (dst[i/8] &= ~(1 << (i % 8)));
 
 #define SameClient(obj,client) \
 	(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 41b4e4c..8a26825 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1045,7 +1045,7 @@ int		button;
 	switch (pAction->type) {
 	    case XkbSA_LockDeviceBtn:
 		if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
-		    (dev->button->down[button/8]&(1L<<(button%8))))
+		    (dev->button->down[button]))
 		    return 0;
 		XkbDDXFakeDeviceButton(dev,True,button);
 		filter->upAction.type= XkbSA_NoAction;
@@ -1077,7 +1077,7 @@ int		button;
 	switch (filter->upAction.type) {
 	    case XkbSA_LockDeviceBtn:
 		if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
-		    ((dev->button->down[button/8]&(1L<<(button%8)))==0))
+		    ((dev->button->down[button])==0))
 		    return 0;
 		XkbDDXFakeDeviceButton(dev,False,button);
 		break;
commit 2b9c829bdebd16910bdf48b9d64862e3d34f5b7f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 18 09:55:53 2008 +0930

    Xi: don't drop the grab status in XExtendedGrabDevice().

diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c
index 1a2584f..c982fca 100644
--- a/Xi/extgrbdev.c
+++ b/Xi/extgrbdev.c
@@ -184,16 +184,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
             gemasks->eventMask[xgeMask->extension & 0x7F]= xgeMask->evmask;
     }
 
-    ExtGrabDevice(client, dev, stuff->device_mode,
-                  grab_window, confineTo, time, stuff->owner_events,
-                  cursor, tmp[stuff->deviceid].mask,
-                  gemasks);
-
-    if (rc != Success) {
-        errval = 0;
-        goto cleanup;
-    }
-
+    rep.status = ExtGrabDevice(client, dev, stuff->device_mode,
+                               grab_window, confineTo, time,
+                               stuff->owner_events, cursor,
+                               tmp[stuff->deviceid].mask,
+                               gemasks);
 cleanup:
 
     if (gemasks)
commit 4f3ed54dc9ea7780ff03378b13de0fddfdec2e15
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 17 10:43:36 2008 +0930

    mi: remove trailing whitespaces from misprite.c

diff --git a/mi/misprite.c b/mi/misprite.c
index c1f64ce..6f0cbe7 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -50,7 +50,7 @@ in this Software without prior written authorization from The Open Group.
 # include   "mispritest.h"
 # include   "dixfontstr.h"
 # include   <X11/fonts/fontstruct.h>
-# include   "inputstr.h" 
+# include   "inputstr.h"
 
 #ifdef RENDER
 # include   "mipict.h"
@@ -99,12 +99,12 @@ static void	    miSpriteInstallColormap(ColormapPtr pMap);
 static void	    miSpriteStoreColors(ColormapPtr pMap, int ndef,
 					xColorItem *pdef);
 
-static void	    miSpriteComputeSaved(DeviceIntPtr pDev, 
+static void	    miSpriteComputeSaved(DeviceIntPtr pDev,
                                          ScreenPtr pScreen);
 
-static Bool         miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, 
+static Bool         miSpriteDeviceCursorInitialize(DeviceIntPtr pDev,
                                                    ScreenPtr pScreen);
-static void         miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, 
+static void         miSpriteDeviceCursorCleanup(DeviceIntPtr pDev,
                                                 ScreenPtr pScreen);
 
 #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
@@ -118,12 +118,12 @@ static void         miSpriteDeviceCursorCleanup(DeviceIntPtr pDev,
  */
 
 static Bool miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
-                                  CursorPtr pCursor); 
-static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, 
+                                  CursorPtr pCursor);
+static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
                                     CursorPtr pCursor);
-static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, 
+static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
                               CursorPtr pCursor, int x, int y);
-static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, 
+static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
                                int x, int y);
 
 _X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = {
@@ -139,8 +139,8 @@ _X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = {
  * other misc functions
  */
 
-static void miSpriteRemoveCursor(DeviceIntPtr pDev, 
-                                 ScreenPtr pScreen); 
+static void miSpriteRemoveCursor(DeviceIntPtr pDev,
+                                 ScreenPtr pScreen);
 static void miSpriteSaveUnderCursor(DeviceIntPtr pDev,
                                  ScreenPtr pScreen);
 static void miSpriteRestoreCursor(DeviceIntPtr pDev,
@@ -153,7 +153,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
     miSpriteScreenPtr	    pScreenPriv;
     miCursorInfoPtr         pCursorInfo;
     DeviceIntPtr            pDev;
-    
+
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						      miSpriteScreenKey);
 
@@ -164,9 +164,9 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
             pCursorInfo = MISPRITE(pDev);
 
             if (pCursorInfo->isUp &&
-                pCursorInfo->pScreen == pScreen && 
-                RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved) 
-                         != rgnOUT) 
+                pCursorInfo->pScreen == pScreen &&
+                RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved)
+                         != rgnOUT)
             {
                 SPRITE_DEBUG(("Damage remove\n"));
                 miSpriteRemoveCursor (pDev, pScreen);
@@ -188,14 +188,14 @@ miSpriteInitialize (ScreenPtr               pScreen,
 {
     miSpriteScreenPtr	pScreenPriv;
     VisualPtr		pVisual;
-    
+
     if (!DamageSetup (pScreen))
 	return FALSE;
 
     pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec));
     if (!pScreenPriv)
 	return FALSE;
-    
+
     pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage,
 					 (DamageDestroyFunc) 0,
 					 DamageReportRawRegion,
@@ -219,10 +219,10 @@ miSpriteInitialize (ScreenPtr               pScreen,
     pScreenPriv->SourceValidate = pScreen->SourceValidate;
 
     pScreenPriv->CopyWindow = pScreen->CopyWindow;
-    
+
     pScreenPriv->InstallColormap = pScreen->InstallColormap;
     pScreenPriv->StoreColors = pScreen->StoreColors;
-    
+
     pScreenPriv->BlockHandler = pScreen->BlockHandler;
 
     pScreenPriv->DeviceCursorInitialize = pScreen->DeviceCursorInitialize;
@@ -238,7 +238,7 @@ miSpriteInitialize (ScreenPtr               pScreen,
     pScreenPriv->colors[MASK_COLOR].green = 0;
     pScreenPriv->colors[MASK_COLOR].blue = 0;
     dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
-    
+
     pScreen->CloseScreen = miSpriteCloseScreen;
     pScreen->GetImage = miSpriteGetImage;
     pScreen->GetSpans = miSpriteGetSpans;
@@ -268,6 +268,7 @@ static Bool
 miSpriteCloseScreen (int i, ScreenPtr pScreen)
 {
     miSpriteScreenPtr   pScreenPriv;
+    DeviceIntPtr        pDev;
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						      miSpriteScreenKey);
@@ -295,7 +296,7 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
     miSpriteScreenPtr    pScreenPriv;
     DeviceIntPtr    pDev = inputInfo.pointer;
     miCursorInfoPtr pCursorInfo;
-    
+
     SCREEN_PROLOGUE (pScreen, GetImage);
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@@ -308,8 +309,8 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
              if (pDrawable->type == DRAWABLE_WINDOW &&
                      pCursorInfo->isUp &&
                      pCursorInfo->pScreen == pScreen &&
-                     ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y, 
-                         sx, sy, w, h)) 
+                     ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y,
+                         sx, sy, w, h))
              {
                  SPRITE_DEBUG (("GetImage remove\n"));
                  miSpriteRemoveCursor (pDev, pScreen);
@@ -331,7 +332,7 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
     miSpriteScreenPtr	    pScreenPriv;
     DeviceIntPtr            pDev = inputInfo.pointer;
     miCursorInfoPtr         pCursorInfo;
-    
+
     SCREEN_PROLOGUE (pScreen, GetSpans);
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@@ -343,8 +344,8 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
         {
             pCursorInfo = MISPRITE(pDev);
 
-            if (pDrawable->type == DRAWABLE_WINDOW && 
-                    pCursorInfo->isUp && 
+            if (pDrawable->type == DRAWABLE_WINDOW &&
+                    pCursorInfo->isUp &&
                     pCursorInfo->pScreen == pScreen)
             {
                 DDXPointPtr    pts;
@@ -385,7 +386,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
     miSpriteScreenPtr	    pScreenPriv;
     DeviceIntPtr            pDev = inputInfo.pointer;
     miCursorInfoPtr         pCursorInfo;
-    
+
     SCREEN_PROLOGUE (pScreen, SourceValidate);
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@@ -397,7 +398,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
         {
             pCursorInfo = MISPRITE(pDev);
             if (pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp &&
-                    pCursorInfo->pScreen == pScreen && 
+                    pCursorInfo->pScreen == pScreen &&
                     ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
                         x, y, width, height))
             {
@@ -420,7 +421,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     miSpriteScreenPtr	    pScreenPriv;
     DeviceIntPtr            pDev = inputInfo.pointer;
     miCursorInfoPtr         pCursorInfo;
-    
+
     SCREEN_PROLOGUE (pScreen, CopyWindow);
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@@ -503,7 +504,7 @@ miSpriteInstallColormap (ColormapPtr pMap)
     pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, InstallColormap);
-    
+
     (*pScreen->InstallColormap) (pMap);
 
     SCREEN_EPILOGUE(pScreen, InstallColormap);
@@ -542,7 +543,7 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
     pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, StoreColors);
-    
+
     (*pScreen->StoreColors) (pMap, ndef, pdef);
 
     SCREEN_EPILOGUE(pScreen, StoreColors);
@@ -581,14 +582,14 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
             for (i = 0; i < ndef; i++)
             {
                 if (pdef[i].pixel ==
-                        pPriv->colors[SOURCE_COLOR].pixel) 
+                        pPriv->colors[SOURCE_COLOR].pixel)
                 {
                     pPriv->colors[SOURCE_COLOR] = pdef[i];
                     if (++updated == 2)
                         break;
                 }
                 if (pdef[i].pixel ==
-                        pPriv->colors[MASK_COLOR].pixel) 
+                        pPriv->colors[MASK_COLOR].pixel)
                 {
                     pPriv->colors[MASK_COLOR] = pdef[i];
                     if (++updated == 2)
@@ -695,7 +696,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						      miSpriteScreenKey);
     miCursorInfoPtr pPointer;
-    
+
     if (!pDev->isMaster && !pDev->u.master)
     {
         ErrorF("[mi] miSpriteSetCursor called for floating device.\n");
@@ -754,7 +755,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
                   sx + (int)pCursor->bits->width < pointer->saved.x2
                   && sy >= pointer->saved.y1 &&
                   sy + (int)pCursor->bits->height <
-                                pointer->saved.y2)) 
+                                pointer->saved.y2))
             {
 		int oldx1, oldy1, dx, dy;
 
@@ -967,7 +968,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
     int			x, y;
     CursorPtr		pCursor;
     miCursorInfoPtr     pCursorInfo;
-    
+
     if (!pDev->isMaster && !pDev->u.master)
     {
         ErrorF("[mi] miSpriteRestoreCursor called for floating device.\n");
@@ -988,7 +989,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
     SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id));
     if (pCursorInfo->checkPixels)
         miSpriteFindColors (pCursorInfo, pScreen);
-    if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen, 
+    if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen,
                 pCursor, x, y,
                 pScreenPriv->colors[SOURCE_COLOR].pixel,
                 pScreenPriv->colors[MASK_COLOR].pixel))
commit 79dd600942bbac3c6b531f284b42c7b2c822da90
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Jun 17 19:09:44 2008 -0400

    SELinux: Add an extension alias under the OS-agnostic "Flask" name.

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 1e3b4d6..a47df03 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -2031,6 +2031,8 @@ SELinuxExtensionInit(INITARGS)
 			    ProcSELinuxDispatch, SProcSELinuxDispatch,
 			    SELinuxResetProc, StandardMinorOpcode);
 
+    AddExtensionAlias("Flask", extEntry);
+
     /* Label objects that were created before we could register ourself */
     SELinuxLabelInitial();
 }
commit 656d3d7623c6b83024e9cdc60d1257f4d87aa268
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Jun 17 17:55:11 2008 -0400

    SELinux: Bring server-side name registry up to date.

diff --git a/dix/protocol.txt b/dix/protocol.txt
index f4cdf7b..0a85ca8 100644
--- a/dix/protocol.txt
+++ b/dix/protocol.txt
@@ -359,16 +359,28 @@ V000 SECURITY:AuthorizationRevoked
 E000 SECURITY:BadAuthorization
 E001 SECURITY:BadAuthorizationProtocol
 R000 SELinux:SELinuxQueryVersion
-R001 SELinux:SELinuxSetSelectionManager
-R002 SELinux:SELinuxGetSelectionManager
+R001 SELinux:SELinuxSetDeviceCreateContext
+R002 SELinux:SELinuxGetDeviceCreateContext
 R003 SELinux:SELinuxSetDeviceContext
 R004 SELinux:SELinuxGetDeviceContext
-R005 SELinux:SELinuxSetPropertyCreateContext
-R006 SELinux:SELinuxGetPropertyCreateContext
-R007 SELinux:SELinuxGetPropertyContext
-R008 SELinux:SELinuxSetWindowCreateContext
-R009 SELinux:SELinuxGetWindowCreateContext
-R010 SELinux:SELinuxGetWindowContext
+R005 SELinux:SELinuxSetWindowCreateContext
+R006 SELinux:SELinuxGetWindowCreateContext
+R007 SELinux:SELinuxGetWindowContext
+R008 SELinux:SELinuxSetPropertyCreateContext
+R009 SELinux:SELinuxGetPropertyCreateContext
+R010 SELinux:SELinuxSetPropertyUseContext
+R011 SELinux:SELinuxGetPropertyUseContext
+R012 SELinux:SELinuxGetPropertyContext
+R013 SELinux:SELinuxGetPropertyDataContext
+R014 SELinux:SELinuxListProperties
+R015 SELinux:SELinuxSetSelectionCreateContext
+R016 SELinux:SELinuxGetSelectionCreateContext
+R017 SELinux:SELinuxSetSelectionUseContext
+R018 SELinux:SELinuxGetSelectionUseContext
+R019 SELinux:SELinuxGetSelectionContext
+R020 SELinux:SELinuxGetSelectionDataContext
+R021 SELinux:SELinuxListSelections
+R022 SELinux:SELinuxGetClientContext
 R000 SHAPE:QueryVersion
 R001 SHAPE:Rectangles
 R002 SHAPE:Mask
commit f3490d3eba94c7d9e760d6d21991ab6677196c2b
Author: Ian Romanick <idr at us.ibm.com>
Date:   Tue Jun 17 10:35:24 2008 -0400

    Bug #15169: Make the server build again on Alpha.
    
    Still won't work until the kernel makes the resource files actually exist.

diff --git a/configure.ac b/configure.ac
index e3fc9e5..fec18ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1287,8 +1287,6 @@ if test "x$XORG" = xyes; then
 			;;
 		  alpha*)
 		  	linux_alpha=yes
-			XORG_OS_PCI="axp"
-			xorg_bus_linuxpci="no"
 			;;
 		  i*86|amd64*|x86_64*)
 			linux_acpi="yes"
diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am
index 5a15430..d48fcb6 100644
--- a/hw/xfree86/os-support/bus/Makefile.am
+++ b/hw/xfree86/os-support/bus/Makefile.am
@@ -23,10 +23,6 @@ if XORG_BUS_SPARCPCI
 PCI_SOURCES += sparcPci.c
 endif
 
-if LINUX_ALPHA
-PCI_SOURCES += axpPci.c
-endif
-
 if XORG_BUS_SPARC
 PLATFORM_SOURCES = Sbus.c
 sdk_HEADERS += xf86Sbus.h
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 1385eee..557483b 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -189,75 +189,26 @@
 #define ARCH_PCI_INIT bsdPciInit
 #endif
 
+#if defined(linux)
+# define ARCH_PCI_INIT linuxPciInit
+# if defined(__m32r__)
+#  define INCLUDE_XF86_MAP_PCI_MEM
+#  define INCLUDE_XF86_NO_DOMAIN
+# endif
+#endif /* defined(linux) */
+
+
 #if !defined(ARCH_PCI_INIT)
 /*
  * Select architecture specific PCI init function
  */
-#if defined(__alpha__)
-# if defined(linux)
-#  define ARCH_PCI_INIT axpPciInit
-# endif
-#elif defined(__arm__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__hppa__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__ia64__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__i386__) || defined(__i386)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# else
-#  define ARCH_PCI_INIT ix86PciInit
-# endif
-#elif defined(__mc68000__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__mips__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
+#if defined(__i386__) || defined(__i386) ||  defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
+# define ARCH_PCI_INIT ix86PciInit
 #elif defined(__powerpc__) || defined(__powerpc64__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# else
-#  define ARCH_PCI_INIT ppcPciInit
-# endif
-#elif defined(__s390__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__sh__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# endif
-#elif defined(__m32r__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-#  define INCLUDE_XF86_MAP_PCI_MEM
-#  define INCLUDE_XF86_NO_DOMAIN
-# endif
+# define ARCH_PCI_INIT ppcPciInit
 #elif defined(__sparc__) || defined(sparc)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# elif defined(sun)
-#  define ARCH_PCI_INIT sparcPciInit
-# endif
-# if !defined(__FreeBSD__) && !defined(linux)
-#  define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
-# endif
-#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
-# if defined(linux)
-#  define ARCH_PCI_INIT linuxPciInit
-# else
-#  define ARCH_PCI_INIT ix86PciInit
-# endif
+# define ARCH_PCI_INIT sparcPciInit
+# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
 #endif
 #endif /* !defined(ARCH_PCI_INIT) */
 
diff --git a/hw/xfree86/os-support/bus/axpPci.c b/hw/xfree86/os-support/bus/axpPci.c
deleted file mode 100644
index c59c068..0000000
--- a/hw/xfree86/os-support/bus/axpPci.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright 1998 by Concurrent Computer Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Concurrent Computer
- * Corporation not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.  Concurrent Computer Corporation makes no representations
- * about the suitability of this software for any purpose.  It is
- * provided "as is" without express or implied warranty.
- *
- * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Copyright 1998 by Metro Link Incorporated
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Metro Link
- * Incorporated not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission.  Metro Link Incorporated makes no representations
- * about the suitability of this software for any purpose.  It is
- * provided "as is" without express or implied warranty.
- *
- * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdio.h>
-#include "compiler.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "Pci.h"
-
-#include <asm/unistd.h>
-#include "../linux/lnx.h"	/* for _iobase */
-
-/*
- * Alpha/Linux platform specific PCI access functions
- */
-static CARD32 axpPciCfgRead(PCITAG tag, int off);
-static void axpPciCfgWrite(PCITAG, int off, CARD32 val);
-static void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits);
-
-static pciBusFuncs_t axpFuncs0 = {
-/* pciReadLong      */	axpPciCfgRead,
-/* pciWriteLong     */	axpPciCfgWrite,
-/* pciSetBitsLong   */	axpPciCfgSetBits,
-/* pciAddrHostToBus */	pciAddrNOOP,
-/* pciAddrBusToHost */	pciAddrNOOP
-};
-
-typedef struct _axpDomainRec {
-    int domain, hose;
-    int root_bus;
-    unsigned long dense_io,  sparse_io;
-    unsigned long dense_mem, sparse_mem;
-    IOADDRESS mapped_io;
-} axpDomainRec, *axpDomainPtr;
-
-#define MAX_DOMAINS (MAX_PCI_BUSES / 256)
-static axpDomainPtr xf86DomainInfo[MAX_DOMAINS] = { NULL, };
-static int	    pciNumDomains = 0;
-
-/*
- * For debug, domain assignment can start downward from a fixed base 
- * (instead of up from 0) by defining FORCE_HIGH_DOMAINS. This allows
- * debug of large domain numbers and sparse domain numbering on systems
- * which don't have as many hoses.
- */
-#if 0
-# define FORCE_HIGH_DOMAINS MAX_DOMAINS /* assign domains downward from here */
-#endif
-
-/*
- * If FORCE_HIGH_DOMAINS is set, make sure it's not larger than the
- * max domain
- */
-#if defined(FORCE_HIGH_DOMAINS) && (FORCE_HIGH_DOMAINS > MAX_DOMAINS)
-# undef FORCE_HIGH_DOMAINS
-# define FORCE_HIGH_DOMAINS MAX_DOMAINS
-#endif
-
-static int
-axpSetupDomains(void)
-{
-    axpDomainRec axpDomain;
-    int numDomains = 0;
-    int hose;
-
-#ifndef INCLUDE_XF86_NO_DOMAIN
-
-#ifdef FORCE_HIGH_DOMAINS
-    xf86Msg(X_WARNING, 
-	    "DEBUG OPTION FORCE_HIGH_DOMAINS in use - DRI will *NOT* work\n");
-    numDomains = FORCE_HIGH_DOMAINS;
-#endif
-
-    /*
-     * Since each hose has a different address space, hoses are a perfect
-     * overlay for domains, so set up one domain for each hose present
-     * in the system. We have to loop through all possible hoses because
-     * some systems allow sparse I/O controllers.
-     */
-    for(hose = 0; hose < MAX_DOMAINS; hose++) {
-	axpDomain.root_bus = _iobase(IOBASE_ROOT_BUS, hose, -1, -1);
-	if (axpDomain.root_bus < 0) continue;
-
-	axpDomain.hose = hose;
-
-#ifndef FORCE_HIGH_DOMAINS
-
-	axpDomain.domain = axpDomain.hose = hose;
-	numDomains = axpDomain.domain + 1;
-
-#else /* FORCE_HIGH_DOMAINS */
-
-	axpDomain.domain = numDomains - hose - 1;
-
-	xf86Msg(X_WARNING, 
-		"FORCE_HIGH_DOMAINS - assigned hose %d to domain %d\n",
-		axpDomain.hose, axpDomain.domain);
-
-#endif /* FORCE_HIGH_DOMAINS */
-
-	axpDomain.dense_io   = _iobase(IOBASE_DENSE_IO,   hose, -1, -1);
-	axpDomain.sparse_io  = _iobase(IOBASE_SPARSE_IO,  hose, -1, -1);
-        axpDomain.mapped_io  = 0;
-	axpDomain.dense_mem  = _iobase(IOBASE_DENSE_MEM,  hose, -1, -1);
-	axpDomain.sparse_mem = _iobase(IOBASE_SPARSE_MEM, hose, -1, -1);
-
-	xf86DomainInfo[axpDomain.domain] = xnfalloc(sizeof(axpDomainRec));
-	*(xf86DomainInfo[axpDomain.domain]) = axpDomain;
-
-	/*
-	 * For now, only allow a single domain (hose) on sparse i/o systems.
-	 *
-	 * Allowing multiple domains on sparse systems would require:
-	 *	1) either
-	 *		a) revamping the sparse video mapping code to allow 
-	 *		   for multiple unrelated address regions
-	 *		  	-- OR -- 
-	 *		b) implementing sparse mapping directly in 
-	 *		   xf86MapDomainMemory
-	 *	2) revaming read/write sparse routines to correctly handle
-	 *	   the solution to 1)
-	 *	3) implementing a sparse I/O system (mapping, inX/outX)
-	 *	   independent of glibc, since the glibc version only
-	 *	   supports hose 0
-	 */
-	if (axpDomain.sparse_io) {
-	    if (_iobase(IOBASE_ROOT_BUS, hose + 1, -1, -1) >= 0) {
-		/*
-		 * It's a sparse i/o system with (at least) one more hose,
-		 * show a message indicating that video is constrained to 
-		 * hose 0
-		 */
-		xf86Msg(X_INFO, 
-			"Sparse I/O system - constraining video to hose 0\n");
-	    }
-	    break;
-	}
-    }
-
-#else /* INCLUDE_XF86_NO_DOMAIN */
-
-    /*
-     * domain support is not included, so just set up a single domain (0)
-     * to represent the first hose so that axpPciInit will still have
-     * be able to set up the root bus
-     */
-    xf86DomainInfo[0] = xnfalloc(sizeof(axpDomainRec));
-    *(xf86DomainInfo[0]) = axpDomain;
-    numDomains = 1;
-
-#endif /* INCLUDE_XF86_NO_DOMAIN */
-
-    return numDomains;
-}
-
-void  
-axpPciInit()
-{
-    axpDomainPtr pDomain;
-    int domain, bus;
-
-    pciNumDomains = axpSetupDomains();
-
-    for(domain = 0; domain < pciNumDomains; domain++) {
-	if (!(pDomain = xf86DomainInfo[domain])) continue;
-
-	/*
-	 * Since any bridged buses will be behind a probed pci-pci bridge, 
-	 * only set up the root bus for each domain (hose) and the bridged 
-	 * buses will be set up as they are found.
-	 */
-	/* make a bus with both the domain and the root bus in it */
-	bus = PCI_MAKE_BUS(domain, pDomain->root_bus);
-	pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t));
-	(void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t));
-
-	pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER;
-	pciBusInfo[bus]->numDevices = 32;
-	pciBusInfo[bus]->funcs = &axpFuncs0;
-	pciBusInfo[bus]->pciBusPriv = pDomain;
-
-	pciNumBuses = bus + 1;
-    }
-}
-
-/*
- * Alpha/Linux PCI configuration space access routines
- */
-static int 
-axpPciBusFromTag(PCITAG tag)
-{
-    pciBusInfo_t *pBusInfo;
-    axpDomainPtr pDomain;
-    int bus, dfn;
-
-    bus = PCI_BUS_FROM_TAG(tag);
-    if ((bus >= pciNumBuses) 
-	|| !(pBusInfo = pciBusInfo[bus])
-	|| !(pDomain = pBusInfo->pciBusPriv)
-	|| (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1;
-
-    bus = PCI_BUS_NO_DOMAIN(bus); /* should just be root_bus */
-    dfn = PCI_DFN_FROM_TAG(tag);
-    if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1;
-
-    return bus;
-}
-
-static CARD32
-axpPciCfgRead(PCITAG tag, int off)
-{
-    int bus, dfn;
-    CARD32 val = 0xffffffff;
-
-    if ((bus = axpPciBusFromTag(tag)) >= 0) {
-	dfn = PCI_DFN_FROM_TAG(tag);
-
-	syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val);
-    }
-    return(val);	
-}
-
-static void
-axpPciCfgWrite(PCITAG tag, int off, CARD32 val)
-{
-    int bus, dfn;
-
-    if ((bus = axpPciBusFromTag(tag)) >= 0) {
-	dfn = PCI_DFN_FROM_TAG(tag);
-	syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val);
-    }
-}
-
-static void
-axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits)
-{
-    int bus, dfn;
-    CARD32 val = 0xffffffff;
-
-    if ((bus = axpPciBusFromTag(tag)) >= 0) {
-	dfn = PCI_DFN_FROM_TAG(tag);
-
-	syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val);
-	val = (val & ~mask) | (bits & mask);
-	syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val);
-    }
-}
-
-#ifndef INCLUDE_XF86_NO_DOMAIN
-
-/*
- * Alpha/Linux addressing domain support
- */
-
-_X_EXPORT int
-xf86GetPciDomain(PCITAG Tag)
-{
-    return PCI_DOM_FROM_TAG(Tag);
-}
-
-_X_EXPORT pointer
-xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
-		    ADDRESS Base, unsigned long Size)
-{
-    axpDomainPtr pDomain;
-    int domain = PCI_DOM_FROM_TAG(Tag);
-
-    if ((domain < 0) || (domain >= pciNumDomains) ||
-	!(pDomain = xf86DomainInfo[domain])) 
-	FatalError("%s called with invalid parameters\n", __FUNCTION__);
-
-    /*
-     * xf86MapVidMem already does what we need, but remember to subtract
-     * _bus_base() (the physical dense memory root of hose 0) since 
-     * xf86MapVidMem is expecting an offset relative to _bus_base() rather
-     * than an actual physical address.
-     */
-    return xf86MapVidMem(ScreenNum, Flags, 
-			 pDomain->dense_mem + Base - _bus_base(), Size);
-}
-
-IOADDRESS
-xf86MapLegacyIO(struct pci_device *dev)
-{
-    axpDomainPtr pDomain;
-    const int domain = dev->domain;
-
-    if ((domain < 0) || (domain >= pciNumDomains) ||
-	!(pDomain = xf86DomainInfo[domain])) 
-	FatalError("%s called with invalid parameters\n", __FUNCTION__);
-
-    /*
-     * Use glibc inx/outx routines for sparse I/O, so just return the
-     * base [this is ok since we also constrain sparse I/O systems to
-     * a single domain in axpSetupDomains()]
-     */
-    if (pDomain->sparse_io) return 0;
-
-    /*
-     * I/O addresses on Alpha are really just different physical memory
-     * addresses that the system corelogic turns into I/O commands on the
-     * bus, so just use xf86MapVidMem to map I/O as well, but remember
-     * to subtract _bus_base() (the physical dense memory root of hose 0)
-     * since xf86MapVidMem is expecting an offset relative to _bus_base()
-     * rather than an actual physical address.
-     *
-     * Map the entire I/O space (64kB) at once and only once.
-     */
-    if (!pDomain->mapped_io)
-        pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(-1, VIDMEM_MMIO,
-		   	            pDomain->dense_io - _bus_base(), 
-                                    0x10000);
-
-    return pDomain->mapped_io;
-}
-
-resPtr
-xf86AccResFromOS(resPtr pRes)
-{
-    resRange range;
-    int domain;
-
-    for(domain = 0; domain < pciNumDomains; domain++) {
-	if (!xf86DomainInfo[domain]) continue;
-
-	/*
-	 * Fallback is to claim the following areas:
-	 *
-	 * 0x000c0000 - 0x000effff  location of VGA and other extensions ROMS
-	 */
-
-	RANGE(range, 0x000c0000, 0x000effff, 
-	      RANGE_TYPE(ResExcMemBlock, domain));
-	pRes = xf86AddResToList(pRes, &range, -1);
-
-	/*
-	 * Fallback would be to claim well known ports in the 0x0 - 0x3ff 
-	 * range along with their sparse I/O aliases, but that's too 
-	 * imprecise.  Instead claim a bare minimum here.
-	 */
-	RANGE(range, 0x00000000, 0x000000ff, 
-	      RANGE_TYPE(ResExcIoBlock, domain)); /* For mainboard */
-	pRes = xf86AddResToList(pRes, &range, -1);
-
-	/*
-	 * At minimum, the top and bottom resources must be claimed, so that
-	 * resources that are (or appear to be) unallocated can be relocated.
-	 */
-	RANGE(range, 0x00000000, 0x00000000, 
-	      RANGE_TYPE(ResExcMemBlock, domain));
-	pRes = xf86AddResToList(pRes, &range, -1);
-	RANGE(range, 0xffffffff, 0xffffffff, 
-	      RANGE_TYPE(ResExcMemBlock, domain));
-	pRes = xf86AddResToList(pRes, &range, -1);
-/*  	RANGE(range, 0x00000000, 0x00000000, 
-	      RANGE_TYPE(ResExcIoBlock, domain));
-        pRes = xf86AddResToList(pRes, &range, -1); */
-	RANGE(range, 0xffffffff, 0xffffffff, 
-	      RANGE_TYPE(ResExcIoBlock, domain));
-	pRes = xf86AddResToList(pRes, &range, -1);
-    }
-
-    return pRes;
-}
-
-#endif /* !INCLUDE_XF86_NO_DOMAIN */
-
commit 8c9234a163eceda2abc0a2523e0f5587ea399935
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jun 15 10:01:28 2008 +0930

    Xi: avoid double button mapping.
    
    Button events were mapped once in GetPointerEvents and then again in
    UpdateDeviceState. While it might make sense to just fix up UpdateDeviceState,
    it turns out to be better to leave the raw button number in the event because
    DGA reports raw device events without button translation, and so when it calls
    UpdateDeviceState, the button down counts get scrambled and buttons get stuck
    down.
    
    See also:
    http://lists.freedesktop.org/archives/xorg/2008-June/036201.html
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 725c578..6f88b57 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1066,9 +1066,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
             (key == device->deviceGrab.activatingKey))
 	    deactivateDeviceGrab = TRUE;
     } else if (xE->u.u.type == DeviceButtonPress) {
-	xE->u.u.detail = key;
-	if (xE->u.u.detail == 0)
+	xE->u.u.detail = b->map[key];
+	if (xE->u.u.detail == 0) {
+	    xE->u.u.detail = key;
 	    return;
+	}
         if (!grab && CheckDeviceGrabs(device, xE, 0, count))
         {
             /* if a passive grab was activated, the event has been sent
@@ -1077,9 +1079,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
         }
 
     } else if (xE->u.u.type == DeviceButtonRelease) {
-	xE->u.u.detail = key;
-	if (xE->u.u.detail == 0)
+	xE->u.u.detail = b->map[key];
+	if (xE->u.u.detail == 0) {
+	    xE->u.u.detail = key;
 	    return;
+	}
         if (!b->state && device->deviceGrab.fromPassiveGrab)
             deactivateDeviceGrab = TRUE;
     }
@@ -1094,6 +1098,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
 
     if (deactivateDeviceGrab == TRUE)
 	(*device->deviceGrab.DeactivateGrab) (device);
+    xE->u.u.detail = key;
 }
 
 _X_EXPORT int
diff --git a/dix/getevents.c b/dix/getevents.c
index 5227c54..b00bc11 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1030,7 +1030,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
             kbp->type = DeviceButtonPress;
         else if (type == ButtonRelease)
             kbp->type = DeviceButtonRelease;
-        kbp->detail = pDev->button->map[buttons];
+        kbp->detail = buttons;
     }
 
     kbp->root_x = cx; /* root_x/y always in screen coords */
commit d894e86aa5bea81147c4a7ad8630bcfb04156792
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 15 10:55:08 2008 +0930

    randr: remove superfluous check against uninitialised variable.
    
    Thanks to Eamon Walsh for pointing this out.

diff --git a/randr/rrpointer.c b/randr/rrpointer.c
index e3b8b03..6b934c0 100644
--- a/randr/rrpointer.c
+++ b/randr/rrpointer.c
@@ -136,14 +136,11 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
 void
 RRPointerScreenConfigured (ScreenPtr pScreen)
 {
-    WindowPtr	pRoot; 
+    WindowPtr	pRoot;
     ScreenPtr	pCurrentScreen;
     int		x, y;
     DeviceIntPtr pDev;
 
-    if (pScreen != pCurrentScreen)
-	return;
-
     for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
     {
         if (IsPointerDevice(pDev))
commit 62a02e88f282a8e8067671909c6f27096f39d030
Author: Keith Packard <keithp at keithp.com>
Date:   Sat Jun 14 13:28:27 2008 -0700

    Leave unmapped button number in event until delivery.
    
    Button numbers were getting double-mapped when updating state, and DGA state
    update conflicted with X state update. Leave button numbers untranslated in
    the event structure until the event is delivered to fix both of these
    problems.

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 725c578..57fb65b 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1009,6 +1009,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
     if (device->isMaster)
         CheckMotion(xE, device);
 
+    key = xE->u.u.detail;
     if (xE->u.u.type != DeviceValuator && xE->u.u.type != GenericEvent) {
 	GetSpritePosition(device, &rootX, &rootY);
 	xE->u.keyButtonPointer.rootX = rootX;
@@ -1017,7 +1018,6 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
 
         xE->u.keyButtonPointer.state = state;
 
-        key = xE->u.u.detail;
     }
     if (DeviceEventCallback) {
 	DeviceEventInfoRec eventinfo;
@@ -1066,9 +1066,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
             (key == device->deviceGrab.activatingKey))
 	    deactivateDeviceGrab = TRUE;
     } else if (xE->u.u.type == DeviceButtonPress) {
-	xE->u.u.detail = key;
-	if (xE->u.u.detail == 0)
+	xE->u.u.detail = b->map[key];
+	if (xE->u.u.detail == 0) {
+	    xE->u.u.detail = key;
 	    return;
+	}
         if (!grab && CheckDeviceGrabs(device, xE, 0, count))
         {
             /* if a passive grab was activated, the event has been sent
@@ -1077,9 +1079,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
         }
 
     } else if (xE->u.u.type == DeviceButtonRelease) {
-	xE->u.u.detail = key;
-	if (xE->u.u.detail == 0)
+	xE->u.u.detail = b->map[key];
+	if (xE->u.u.detail == 0) {
+	    xE->u.u.detail = key;
 	    return;
+	}
         if (!b->state && device->deviceGrab.fromPassiveGrab)
             deactivateDeviceGrab = TRUE;
     }
@@ -1094,6 +1098,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
 
     if (deactivateDeviceGrab == TRUE)
 	(*device->deviceGrab.DeactivateGrab) (device);
+    xE->u.u.detail = key;
 }
 
 _X_EXPORT int
diff --git a/dix/getevents.c b/dix/getevents.c
index 5227c54..b00bc11 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1030,7 +1030,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
             kbp->type = DeviceButtonPress;
         else if (type == ButtonRelease)
             kbp->type = DeviceButtonRelease;
-        kbp->detail = pDev->button->map[buttons];
+        kbp->detail = buttons;
     }
 
     kbp->root_x = cx; /* root_x/y always in screen coords */
commit 222c7d67c67bdecd1791dfaff08f1590ca6a9251
Merge: 93b9a6d... 5544c51...
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jun 13 23:21:25 2008 -0700

    Merge commit 'origin/master' into transform-proposal

commit 5544c51447f551dfc6df64438873a7ce64743976
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:49:47 2008 -0400

    Fix "warning: the address of ‘newTypes’ will always evaluate as ‘true’".

diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 85415a4..eb5c381 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -473,7 +473,7 @@ register int	i;
 int		width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups];
 
     if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) ||
-	(!xkb->map->types)||(!newTypes)||((groups&XkbAllGroupsMask)==0)||
+	(!xkb->map->types)||((groups&XkbAllGroupsMask)==0)||
 	(nGroups>XkbNumKbdGroups)) {
 	return BadMatch;
     }
commit 2391c409a2840d61fed93832650c0d6c82ebebdf
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:48:17 2008 -0400

    Fix "warning: unused variable `s'".

diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 6389b90..047efcd 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -882,14 +882,13 @@ XkbSrvInfoPtr	xkbi;
 		((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
                  (xE[i].u.u.type==DeviceKeyPress)||
                  (xE[i].u.u.type == DeviceKeyRelease))) {
-		XkbStatePtr s= &xkbi->state;
 		DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
 		DebugF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
-		DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
-							s->grab_mods);
+		DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",xkbi->state.lookup_mods,
+							xkbi->state.grab_mods);
 		DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
-							s->compat_lookup_mods,
-							s->compat_grab_mods);
+							xkbi->state.compat_lookup_mods,
+							xkbi->state.compat_grab_mods);
 	    }
 	    if ( (type>=KeyPress)&&(type<=MotionNotify) ) {
 		CARD16	old,new;
commit 61dafe384a88fc397d7cd55cb23f4fdc3fb0645c
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:47:10 2008 -0400

    Fix "warning: unused variable `tsize'".

diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index ce1312e..8fa0cca 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -95,7 +95,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
     INT32 *coords = NULL, *bufptr;
     xGetDeviceMotionEventsReply rep;
     unsigned long i;
-    int rc, num_events, axes, size = 0, tsize;
+    int rc, num_events, axes, size = 0;
     unsigned long nEvents;
     DeviceIntPtr dev;
     TimeStamp start, stop;
commit 37a64b02df02d42a19d4b777930dc5e457d97d63
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:41:58 2008 -0400

    Fix "warning: ‘rc’ may be used uninitialized in this function".

diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c
index 99957fe..07bd729 100644
--- a/Xi/chdevhier.c
+++ b/Xi/chdevhier.c
@@ -80,7 +80,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
     xAnyHierarchyChangeInfo *any;
     int required_len = sizeof(xChangeDeviceHierarchyReq);
     char n;
-    int rc;
+    int rc = Success;
     int nchanges = 0;
     deviceHierarchyChangedEvent ev;
 
commit e90fcd8294fe763c97610d39cab50f2836f87dca
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:26:43 2008 -0400

    Fix "warning: no previous prototype for ‘miRROutputGetProperty’".

diff --git a/randr/randrstr.h b/randr/randrstr.h
index 62d4bbf..bd7c7c5 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -419,6 +419,11 @@ miRROutputSetProperty (ScreenPtr	    pScreen,
 		       RRPropertyValuePtr   value);
 
 Bool
+miRROutputGetProperty (ScreenPtr	    pScreen,
+		       RROutputPtr	    output,
+		       Atom		    property);
+
+Bool
 miRROutputValidateMode (ScreenPtr	    pScreen,
 			RROutputPtr	    output,
 			RRModePtr	    mode);
commit 0b00bbca5df140edbfaffab627bd82165f1b1420
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 22:22:22 2008 -0400

    Fix "Warning: no previous prototype for `SecureRPCInit'".

diff --git a/os/rpcauth.c b/os/rpcauth.c
index 3451ac1..1e134ad 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -42,6 +42,7 @@ from The Open Group.
 #include <X11/Xauth.h>
 #include "misc.h"
 #include "os.h"
+#include "osdep.h"
 #include "dixstruct.h"
 
 #include <rpc/rpc.h>
commit 1c2f038d69605b0ed1067e47dc75ca6f216991f5
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:59:09 2008 -0400

    Fix multiple warnings in os/xdmauth.c.

diff --git a/os/xdmauth.c b/os/xdmauth.c
index d143dde..8cbcd58 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -69,7 +69,7 @@ XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
 {
     XdmAuthKeyPtr	incoming;
 
-    XdmcpUnwrap (incomingData->data, &privateKey,
+    XdmcpUnwrap (incomingData->data, (unsigned char *)&privateKey,
 			      incomingData->data,incomingData->length);
     if (packet_type == ACCEPT) {
     	if (incomingData->length != 8)
@@ -89,7 +89,8 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
     outgoingData->data = 0;
     if (packet_type == REQUEST) {
 	if (XdmcpAllocARRAY8 (outgoingData, 8))
-	    XdmcpWrap (&rho, &privateKey, outgoingData->data, 8);
+	    XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey,
+		       outgoingData->data, 8);
     }
     return TRUE;
 }
@@ -99,7 +100,8 @@ XdmAuthenticationAddAuth (int name_len, char *name,
     int data_len, char *data)
 {
     Bool    ret;
-    XdmcpUnwrap (data, (unsigned char *)&privateKey, data, data_len);
+    XdmcpUnwrap ((unsigned char *)data, (unsigned char *)&privateKey,
+		 (unsigned char *)data, data_len);
     authFromXDMCP = TRUE;
     ret = AddAuthorization (name_len, name, data_len, data);
     authFromXDMCP = FALSE;
@@ -152,7 +154,7 @@ XdmAuthenticationInit (char *cookie, int cookie_len)
     }
     XdmcpGenerateKey (&rho);
     XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen,
-				 (unsigned char *)&rho,
+				 (char *)&rho,
 				 sizeof (rho),
 				 (ValidatorFunc)XdmAuthenticationValidator,
 				 (GeneratorFunc)XdmAuthenticationGenerator,
@@ -387,7 +389,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie,
     if (!plain)
 	return (XID) -1;
     for (auth = xdmAuth; auth; auth=auth->next) {
-	XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length);
+	XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
 	if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL)
 	{
 	    client->next = xdmClients;
@@ -432,7 +434,7 @@ XdmToID (unsigned short cookie_length, char *cookie)
     if (!plain)
 	return (XID) -1;
     for (auth = xdmAuth; auth; auth=auth->next) {
-	XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length);
+	XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
 	if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL)
 	{
 	    xfree (client);
commit 384ebe02b354bf1ad0a2ac25e4b5290f2e795ea1
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:49:01 2008 -0400

    Fix "warning: label ‘done’ defined but not used".

diff --git a/os/connection.c b/os/connection.c
index 38521e6..ba16044 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -757,7 +757,9 @@ ClientAuthorized(ClientPtr client,
 	}
     }
     priv->auth_id = auth_id;
+#ifdef HAVE_LAUNCHD
  done:
+#endif
     priv->conn_time = 0;
 
 #ifdef XDMCP
commit 720e44f9730b9e275579483c2a34b16bba77e146
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:42:37 2008 -0400

    Fix "warning: no previous prototype for ‘XevieExtensionInit’".

diff --git a/Xext/xevie.c b/Xext/xevie.c
index 277b93b..a5b1837 100644
--- a/Xext/xevie.c
+++ b/Xext/xevie.c
@@ -55,6 +55,7 @@ of the copyright holder.
 #include <xkbsrv.h>
 
 #include "../os/osdep.h"
+#include "modinit.h"
 
 #define NoSuchEvent 0x80000000
 
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 7282e6e..32f7ed4 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -112,6 +112,10 @@ extern void SELinuxExtensionInit(INITARGS);
 #include "xselinux.h"
 #endif
 
+#ifdef XEVIE
+extern void XevieExtensionInit(INITARGS);
+#endif
+
 #if 1
 extern void SecurityExtensionInit(INITARGS);
 #endif
commit 9d871e19c9dee5d3ee7f123249e8890417d83093
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:35:29 2008 -0400

    Fix "warning: unused variable ‘pDev’, `pPointer'".

diff --git a/mi/mipointer.c b/mi/mipointer.c
index 8b673f4..4763e12 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -126,8 +126,10 @@ miPointerInitialize (ScreenPtr                  pScreen,
 static Bool
 miPointerCloseScreen (int index, ScreenPtr pScreen)
 {
+#if 0
     miPointerPtr pPointer;
     DeviceIntPtr pDev;
+#endif
 
     SetupScreen(pScreen);
 
commit 60f64af075e8ac3e63586452f2f3d338a05785f0
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:23:31 2008 -0400

    Fix "warning: passing argument 1 of 'pixman_fill' from incompatible pointer type".

diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index f6fe8aa..9bde927 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -227,7 +227,7 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
     while (n--)
     {
 #ifndef FB_ACCESS_WRAPPER
-	if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp,
+	if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
 				      pbox->x1 + dstXoff, pbox->y1 + dstYoff,
 				      (pbox->x2 - pbox->x1),
 				      (pbox->y2 - pbox->y1),
commit c448460fdc23262f2b711a32599090c85c70447a
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:05:26 2008 -0400

    Fix "warning: pointer targets in assignment differ in signedness".

diff --git a/dix/getevents.c b/dix/getevents.c
index b9e0220..5227c54 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -277,7 +277,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
     int size;
     int dflt;
     AxisInfo from, *to; /* for scaling */
-    CARD32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
+    INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
     INT16 *corebuf;
     AxisInfo core_axis = {0};
 
commit 17ed6242e73c5f733601b15732ab30c23acf14d2
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:03:17 2008 -0400

    Fix "warning: assignment from incompatible pointer type".

diff --git a/dix/getevents.c b/dix/getevents.c
index fc07496..b9e0220 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -295,7 +295,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
     *buff = xalloc(size * pDev->valuator->numMotionEvents);
     if (!(*buff))
         return 0;
-    obuff = *buff;
+    obuff = (char *)*buff;
 
     for (i = pDev->valuator->first_motion;
          i != pDev->valuator->last_motion;
commit 02a8b118cd07d98f12aab8325d8443125703ba7d
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 21:01:50 2008 -0400

    Fix "warning: implicit declaration of function ‘miPointerGetScreen’".

diff --git a/dix/devices.c b/dix/devices.c
index c83f2fc..b88d856 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -76,6 +76,7 @@ SOFTWARE.
 #include "dispatch.h"
 #include "swaprep.h"
 #include "dixevents.h"
+#include "mipointer.h"
 
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XIproto.h>
commit 2d7ba09dc4b5eff5dba8d7867f285111574b1737
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Jun 13 16:39:40 2008 -0400

    Make devPrivates lookup functions ABI instead of static inlines.
    
    This is required to preserve compatibility across changes to the
    internal representation of the privates list.

diff --git a/dix/privates.c b/dix/privates.c
index 47a0e1a..efb3204 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -39,6 +39,12 @@ from The Open Group.
 #include "colormapst.h"
 #include "inputstr.h"
 
+struct _Private {
+    DevPrivateKey      key;
+    pointer            value;
+    struct _Private    *next;
+};
+
 typedef struct _PrivateDesc {
     DevPrivateKey key;
     unsigned size;
@@ -117,6 +123,65 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
 }
 
 /*
+ * Look up a private pointer.
+ */
+_X_EXPORT pointer
+dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
+{
+    PrivateRec *rec = *privates;
+    pointer *ptr;
+
+    while (rec) {
+	if (rec->key == key)
+	    return rec->value;
+	rec = rec->next;
+    }
+
+    ptr = dixAllocatePrivate(privates, key);
+    return ptr ? *ptr : NULL;
+}
+
+/*
+ * Look up the address of a private pointer.
+ */
+_X_EXPORT pointer *
+dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key)
+{
+    PrivateRec *rec = *privates;
+
+    while (rec) {
+	if (rec->key == key)
+	    return &rec->value;
+	rec = rec->next;
+    }
+
+    return dixAllocatePrivate(privates, key);
+}
+
+/*
+ * Set a private pointer.
+ */
+_X_EXPORT int
+dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val)
+{
+    PrivateRec *rec;
+
+ top:
+    rec = *privates;
+    while (rec) {
+	if (rec->key == key) {
+	    rec->value = val;
+	    return TRUE;
+	}
+	rec = rec->next;
+    }
+
+    if (!dixAllocatePrivate(privates, key))
+	return FALSE;
+    goto top;
+}
+
+/*
  * Called to free privates at object deletion time.
  */
 _X_EXPORT void
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index a2a2390..5713ca1 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -265,6 +265,9 @@ _X_HIDDEN void *dixLookupTab[] = {
     SYMFUNC(dixRegisterPrivateInitFunc)
     SYMFUNC(dixRegisterPrivateDeleteFunc)
     SYMFUNC(dixAllocatePrivate)
+    SYMFUNC(dixLookupPrivate)
+    SYMFUNC(dixLookupPrivateAddr)
+    SYMFUNC(dixSetPrivate)
     SYMFUNC(dixFreePrivates)
     SYMFUNC(dixRegisterPrivateOffset)
     SYMFUNC(dixLookupPrivateOffset)
diff --git a/include/privates.h b/include/privates.h
index 8d59b72..98d893c 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -20,12 +20,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *****************************************************************/
 
 typedef void *DevPrivateKey;
-
-typedef struct _Private {
-    DevPrivateKey	key;
-    pointer		value;
-    struct _Private	*next;
-} PrivateRec;
+struct _Private;
+typedef struct _Private PrivateRec;
 
 /*
  * Request pre-allocated private space for your driver/module.
@@ -43,61 +39,20 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
 /*
  * Look up a private pointer.
  */
-static _X_INLINE pointer
-dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
-{
-    PrivateRec *rec = *privates;
-    pointer *ptr;
-
-    while (rec) {
-	if (rec->key == key)
-	    return rec->value;
-	rec = rec->next;
-    }
-
-    ptr = dixAllocatePrivate(privates, key);
-    return ptr ? *ptr : NULL;
-}
+pointer
+dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key);
 
 /*
  * Look up the address of a private pointer.
  */
-static _X_INLINE pointer *
-dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key)
-{
-    PrivateRec *rec = *privates;
-
-    while (rec) {
-	if (rec->key == key)
-	    return &rec->value;
-	rec = rec->next;
-    }
-
-    return dixAllocatePrivate(privates, key);
-}
+pointer *
+dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key);
 
 /*
  * Set a private pointer.
  */
-static _X_INLINE int
-dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val)
-{
-    PrivateRec *rec;
-
- top:
-    rec = *privates;
-    while (rec) {
-	if (rec->key == key) {
-	    rec->value = val;
-	    return TRUE;
-	}
-	rec = rec->next;
-    }
-
-    if (!dixAllocatePrivate(privates, key))
-	return FALSE;
-    goto top;
-}
+int
+dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val);
 
 /*
  * Register callbacks to be called on private allocation/freeing.
commit 93b9a6d0671019f2c341559332dd74a5f10c8b91
Merge: e2da91c... 9e0e558...
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jun 13 10:13:53 2008 -0700

    Merge commit 'origin/master' into transform-proposal

commit 9e0e558f263a132babf8c91d31230831653f19c1
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 13 11:17:49 2008 -0400

    Fix unterminated endif.

diff --git a/include/servermd.h b/include/servermd.h
index 0bfa7a0..91b705b 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -179,6 +179,8 @@ SOFTWARE.
 #define BITMAP_BIT_ORDER        MSBFirst
 #define GLYPHPADBYTES           4
 
+#endif /* AIXV3 */
+
 #if defined(ibm032) || defined (ibm)
 
 #ifdef __i386__
commit 6bbfadb9094bb6437a6825b8293d13a32e041aff
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 13 11:00:50 2008 -0400

    ... and stay dead.

diff --git a/configure.ac b/configure.ac
index 55b7c9d..e3fc9e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -565,8 +565,6 @@ AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
 AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
 AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
-dnl legacy fb support
-AC_ARG_ENABLE(mfb,            AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
 dnl kdrive and its subsystems
 AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
 AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@@ -1517,15 +1515,6 @@ AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
 AM_CONDITIONAL([XF86MISC], [test "x$XF86MISC" = xyes])
 AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
 
-dnl legacy fb support
-test "x$MFB" = xauto && MFB="$XORG"
-AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
-if test "x$MFB" = xyes; then
-	if test "x$XORG" != xyes; then
-		AC_MSG_ERROR([legacy fb support requires the Xorg server])
-	fi
-fi
-
 dnl XWin DDX
 
 AC_MSG_CHECKING([whether to build XWin DDX])
@@ -1921,7 +1910,6 @@ doc/Makefile
 fb/Makefile
 record/Makefile
 XTrap/Makefile
-mfb/Makefile
 config/Makefile
 mi/Makefile
 miext/Makefile
commit f31bd087e8a7f65cd588bd1d022bb18e72b2a60c
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 13 10:35:07 2008 -0400

    Death to mfb.
    
    Anyone still interested in 1 or 4 bpp framebuffers, talk to fb.

diff --git a/Makefile.am b/Makefile.am
index 4ed30dc..116e4fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,10 +9,6 @@ if XTRAP
 XTRAP_DIR=XTrap
 endif
 
-if MFB
-MFB_DIR=mfb
-endif
-
 if GLX
 GLX_DIR=glx
 endif
@@ -39,7 +35,6 @@ SUBDIRS = \
 	Xi \
 	xkb \
 	$(DBE_DIR) \
-	$(MFB_DIR) \
 	$(RECORD_DIR) \
 	xfixes \
 	damageext \
@@ -82,7 +77,6 @@ DIST_SUBDIRS = \
 	Xi \
 	xkb \
 	dbe \
-	mfb \
 	record \
 	xfixes \
 	damageext \
diff --git a/configure.ac b/configure.ac
index 4d654da..55b7c9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1976,8 +1976,6 @@ hw/xfree86/vbe/Makefile
 hw/xfree86/vgahw/Makefile
 hw/xfree86/x86emu/Makefile
 hw/xfree86/xaa/Makefile
-hw/xfree86/xf1bpp/Makefile
-hw/xfree86/xf4bpp/Makefile
 hw/xfree86/xf8_16bpp/Makefile
 hw/xfree86/utils/Makefile
 hw/xfree86/utils/cvt/Makefile
diff --git a/fb/fb.h b/fb/fb.h
index 1cd9473..8e76beb 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -101,9 +101,6 @@
 #if GLYPHPADBYTES != 4
 #error "GLYPHPADBYTES must be 4"
 #endif
-#if GETLEFTBITS_ALIGNMENT != 1
-#error "GETLEFTBITS_ALIGNMENT must be 1"
-#endif
 /* whether to bother to include 24bpp support */
 #ifndef FBNO24BIT
 #define FB_24BIT
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index e6cc38a..b013906 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -12,19 +12,15 @@ if XF86UTILS
 XF86UTILS_SUBDIR = utils
 endif
 
-if MFB
-MFB_SUBDIR = xf1bpp xf4bpp
-endif
-
 DOC_SUBDIR = doc
 
 SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
-	  ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
+	  ramdac shadowfb vbe vgahw xaa \
 	  xf8_16bpp loader dixmods exa modes \
 	  $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
 
 DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
-               parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
+               parser rac ramdac shadowfb vbe vgahw xaa \
                xf8_16bpp loader dixmods dri dri2 exa modes \
 	       utils doc
 
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index bb79c9c..ed15ca4 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -14,17 +14,12 @@ if DBE
 DBEMOD = libdbe.la
 endif
 
-if MFB
-MFBMOD = libmfb.la
-endif
-
 if RECORD
 RECORDMOD = librecord.la
 endif
 
 module_LTLIBRARIES = libfb.la \
                      libwfb.la \
-                     $(MFBMOD) \
                      libshadow.la
 
 extsmoduledir = $(moduledir)/extensions
@@ -66,10 +61,6 @@ libglx_la_LIBADD = \
 	$(GLXDRI_LIBRARY)
 libglx_la_SOURCES = glxmodule.c
 
-libmfb_la_LDFLAGS = -avoid-version
-libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la
-libmfb_la_SOURCES = mfbmodule.c
-
 librecord_la_LDFLAGS = -avoid-version
 librecord_la_LIBADD = $(top_builddir)/record/librecord.la
 librecord_la_SOURCES = recordmod.c
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index fb08497..47407f1 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -21,7 +21,6 @@ endif
 
 AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@ \
-           -I$(top_srcdir)/mfb \
            -I$(top_srcdir)/dbe \
            -I$(top_srcdir)/hw/xfree86/loader \
            -I$(top_srcdir)/miext/shadow
diff --git a/hw/xfree86/dixmods/mfbmodule.c b/hw/xfree86/dixmods/mfbmodule.c
deleted file mode 100644
index 91539d7..0000000
--- a/hw/xfree86/dixmods/mfbmodule.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 1998 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo VersRec =
-{
-	"mfb",
-	MODULEVENDORSTRING,
-	MODINFOSTRING1,
-	MODINFOSTRING2,
-	XORG_VERSION_CURRENT,
-	1, 0, 0,
-	ABI_CLASS_ANSIC,		/* Only need the ansic layer */
-	ABI_ANSIC_VERSION,
-	MOD_CLASS_NONE,
-	{0,0,0,0}       /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData mfbModuleData = { &VersRec, NULL, NULL };
diff --git a/hw/xfree86/xf1bpp/Makefile.am b/hw/xfree86/xf1bpp/Makefile.am
deleted file mode 100644
index c724f76..0000000
--- a/hw/xfree86/xf1bpp/Makefile.am
+++ /dev/null
@@ -1,178 +0,0 @@
-module_LTLIBRARIES = libxf1bpp.la
-
-sdk_HEADERS = xf1bpp.h mfbmap.h mfbunmap.h
-
-libxf1bpp_la_LDFLAGS = -avoid-version
-
-libxf1bppgen_a_SOURCES = \
-        mfbseg.c \
-        mfbpgbwht.c \
-        mfbpgbblak.c \
-        mfbpgbinv.c \
-        mfbigbwht.c \
-        mfbigbblak.c \
-        mfbpawhite.c \
-        mfbpablack.c \
-        mfbpainv.c \
-        mfbtewhite.c \
-        mfbteblack.c \
-        mfbplywhite.c \
-        mfbplyblack.c \
-        mfbplyinv.c \
-        mfbbltC.c \
-        mfbbltX.c \
-        mfbbltCI.c \
-        mfbbltO.c \
-        mfbbltG.c \
-        mfbtileC.c \
-        mfbtileG.c
-
-libxf1bppmfb_a_SOURCES = \
-        maskbits.c \
-        mfbbitblt.c \
-        mfbbres.c \
-        mfbbresd.c \
-        mfbclip.c \
-        mfbcmap.c \
-        mfbfillarc.c \
-        mfbfillrct.c \
-        mfbfillsp.c \
-        mfbfont.c \
-        mfbgc.c \
-        mfbgetsp.c \
-        mfbhrzvert.c \
-        mfbimage.c \
-        mfbline.c \
-        mfbmisc.c \
-        mfbpixmap.c \
-        mfbpolypnt.c \
-        mfbpushpxl.c \
-        mfbscrclse.c \
-        mfbscrinit.c \
-        mfbsetsp.c \
-        mfbwindow.c \
-        mfbzerarc.c
-
-BUILT_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES)
-
-libxf1bpp_la_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES) \
-        mfbmodule.c
-
-AM_CFLAGS = -DXF86MONO $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb
-
-mfbseg.c:
-	echo "#define POLYSEGMENT" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbline.c\"" >> $@
-mfbpgbwht.c:
-	echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite" > $@
-	echo "#define OPEQ |=" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
-mfbpgbblak.c:
-	echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack" > $@
-	echo "#define OPEQ &=~" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
-mfbpgbinv.c:
-	echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert" > $@
-	echo "#define OPEQ ^=" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
-mfbigbwht.c:
-	echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite" > $@
-	echo "#define OPEQ |=" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
-mfbigbblak.c:
-	echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack" > $@
-	echo "#define OPEQ &=~" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
-mfbpawhite.c:
-	echo "#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea" > $@
-	echo "#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea" >> $@
-	echo "#define OPEQ |=" >> $@
-	echo "#define EQWHOLEWORD =~0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
-mfbpablack.c:
-	echo "#define MFBSOLIDFILLAREA xf1bppSolidBlackArea" > $@
-	echo "#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea" >> $@
-	echo "#define OPEQ &=~" >> $@
-	echo "#define EQWHOLEWORD =0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
-mfbpainv.c:
-	echo "#define MFBSOLIDFILLAREA xf1bppSolidInvertArea" > $@
-	echo "#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea" >> $@
-	echo "#define OPEQ ^=" >> $@
-	echo "#define EQWHOLEWORD ^=~0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
-mfbtewhite.c:
-	echo "#define OP" > $@
-	echo "#define CLIPTETEXT xf1bppImageGlyphBltWhite" >> $@
-	echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
-mfbteblack.c:
-	echo "#define OP ~" > $@
-	echo "#define CLIPTETEXT xf1bppImageGlyphBltBlack" >> $@
-	echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
-mfbplywhite.c:
-	echo "#define MFBFILLPOLY1RECT xf1bppFillPolyWhite" > $@
-	echo "#define OPEQ |=" >> $@
-	echo "#define EQWHOLEWORD =~0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
-mfbplyblack.c:
-	echo "#define MFBFILLPOLY1RECT xf1bppFillPolyBlack" > $@
-	echo "#define OPEQ &=~" >> $@
-	echo "#define EQWHOLEWORD =0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
-mfbplyinv.c:
-	echo "#define MFBFILLPOLY1RECT xf1bppFillPolyInvert" > $@
-	echo "#define OPEQ ^=" >> $@
-	echo "#define EQWHOLEWORD ^=~0" >> $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
-mfbbltC.c:
-	echo "#define MROP Mcopy" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
-mfbbltX.c:
-	echo "#define MROP Mxor" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
-mfbbltCI.c:
-	echo "#define MROP McopyInverted" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
-mfbbltO.c:
-	echo "#define MROP Mor" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
-mfbbltG.c:
-	echo "#define MROP M0" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
-mfbtileC.c:
-	echo "#define MROP Mcopy" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
-mfbtileG.c:
-	echo "#define MRop M0" > $@
-	echo "#include \"mfbmap.h\"" >> $@
-	echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
-
-$(libxf1bppmfb_a_SOURCES):
-	echo "#include \"mfbmap.h\"" > $@
-	echo "#include \"$(top_srcdir)/mfb/$@\"" >> $@
-
-EXTRA_DIST = mfbmap.sh mfbunmap.sh 
-DISTCLEANFILES = $(BUILT_SOURCES)
diff --git a/hw/xfree86/xf1bpp/mfbmap.h b/hw/xfree86/xf1bpp/mfbmap.h
deleted file mode 100644
index e330ebd..0000000
--- a/hw/xfree86/xf1bpp/mfbmap.h
+++ /dev/null
@@ -1,122 +0,0 @@
-
-#ifndef _MFBMAP_H
-#define _MFBMAP_H
-
-#define InverseAlu  xf1bppInverseAlu
-#define endtab  xf1bppendtab
-#define mask  xf1bppmask
-#define mergeRopBits  xf1bppmergeRopBits
-#define mergeGetRopBits  xf1bppmergeGetRopBits
-#define mfbAllocatePrivates  xf1bppAllocatePrivates
-#define mfbBSFuncRec  xf1bppBSFuncRec
-#define mfbBlackSolidFS  xf1bppBlackSolidFS
-#define mfbBlackStippleFS  xf1bppBlackStippleFS
-#define mfbBresD  xf1bppBresD
-#define mfbBresS  xf1bppBresS
-#define mfbChangeWindowAttributes  xf1bppChangeWindowAttributes
-#define mfbCloseScreen  xf1bppCloseScreen
-#define mfbCopyArea  xf1bppCopyArea
-#define mfbCopyPixmap  xf1bppCopyPixmap
-#define mfbCopyPlane  xf1bppCopyPlane
-#define mfbCopyRotatePixmap  xf1bppCopyRotatePixmap
-#define mfbCopyWindow  xf1bppCopyWindow
-#define mfbCreateColormap  xf1bppCreateColormap
-#define mfbCreateDefColormap  xf1bppCreateDefColormap
-#define mfbCreateGC  xf1bppCreateGC
-#define mfbCreatePixmap  xf1bppCreatePixmap
-#define mfbCreateWindow  xf1bppCreateWindow
-#define mfbDestroyColormap  xf1bppDestroyColormap
-#define mfbDestroyPixmap  xf1bppDestroyPixmap
-#define mfbDestroyWindow  xf1bppDestroyWindow
-#define mfbDoBitblt  xf1bppDoBitblt
-#define mfbDoBitbltCopy  xf1bppDoBitbltCopy
-#define mfbDoBitbltCopyInverted  xf1bppDoBitbltCopyInverted
-#define mfbDoBitbltGeneral  xf1bppDoBitbltGeneral
-#define mfbDoBitbltOr  xf1bppDoBitbltOr
-#define mfbDoBitbltXor  xf1bppDoBitbltXor
-#define mfbFillInScreen  xf1bppFillInScreen
-#define mfbFillPolyBlack  xf1bppFillPolyBlack
-#define mfbFillPolyInvert  xf1bppFillPolyInvert
-#define mfbFillPolyWhite  xf1bppFillPolyWhite
-#define mfbGCPrivateIndex  xf1bppGCPrivateIndex
-#define mfbGetGCPrivateIndex  xf1bppGetGCPrivateIndex
-#define mfbGetImage  xf1bppGetImage
-#define mfbGetInverseAlu xf1bppGetInverseAlu
-#define mfbGetSpans  xf1bppGetSpans
-#define mfbGetWindowPixmap  xf1bppGetWindowPixmap
-#define mfbGetWindowPrivateIndex  xf1bppGetWindowPrivateIndex
-#define mfbGetmask  xf1bppGetmask
-#define mfbGetpartmasks xf1bppGetpartmasks
-#define mfbGetrmask  xf1bppGetrmask
-#define mfbGetstarttab  xf1bppGetstarttab
-#define mfbGetendtab  xf1bppGetendtab
-#define mfbHorzS  xf1bppHorzS
-#define mfbImageGlyphBltBlack  xf1bppImageGlyphBltBlack
-#define mfbImageGlyphBltWhite  xf1bppImageGlyphBltWhite
-#define mfbInstallColormap  xf1bppInstallColormap
-#define mfbInvertSolidFS  xf1bppInvertSolidFS
-#define mfbInvertStippleFS  xf1bppInvertStippleFS
-#define mfbLineSD  xf1bppLineSD
-#define mfbLineSS  xf1bppLineSS
-#define mfbListInstalledColormaps  xf1bppListInstalledColormaps
-#define mfbMapWindow  xf1bppMapWindow
-#define mfbPadPixmap  xf1bppPadPixmap
-#define mfbPixmapToRegion  xf1bppPixmapToRegion
-#define mfbPixmapToRegionWeak xf1bppPixmapToRegionWeak
-#define mfbPolyFillArcSolid  xf1bppPolyFillArcSolid
-#define mfbPolyFillRect  xf1bppPolyFillRect
-#define mfbPolyGlyphBltBlack  xf1bppPolyGlyphBltBlack
-#define mfbPolyGlyphBltInvert  xf1bppPolyGlyphBltInvert
-#define mfbPolyGlyphBltWhite  xf1bppPolyGlyphBltWhite
-#define mfbPolyPoint  xf1bppPolyPoint
-#define mfbPositionWindow  xf1bppPositionWindow
-#define mfbPushPixels  xf1bppPushPixels
-#define mfbPushPixelsWeak  xf1bppPushPixelsWeak
-#define mfbPutImage  xf1bppPutImage
-#define mfbQueryBestSize  xf1bppQueryBestSize
-#define mfbQueryBestSizeWeak  xf1bppQueryBestSizeWeak
-#define mfbRealizeFont  xf1bppRealizeFont
-#define mfbRealizeFontWeak  xf1bppRealizeFontWeak
-#define mfbReduceRop  xf1bppReduceRop
-#define mfbRegisterCopyPlaneProc  xf1bppRegisterCopyPlaneProc
-#define mfbResolveColor  xf1bppResolveColor
-#define mfbRestoreAreas  xf1bppRestoreAreas
-#define mfbSaveAreas  xf1bppSaveAreas
-#define mfbScreenInit  xf1bppScreenInit
-#define mfbSegmentSD  xf1bppSegmentSD
-#define mfbSegmentSS  xf1bppSegmentSS
-#define mfbSetScanline  xf1bppSetScanline
-#define mfbSetSpans  xf1bppSetSpans
-#define mfbSetWindowPixmap  xf1bppSetWindowPixmap
-#define mfbSolidBlackArea  xf1bppSolidBlackArea
-#define mfbSolidInvertArea  xf1bppSolidInvertArea
-#define mfbSolidPP  xf1bppSolidPP
-#define mfbSolidWhiteArea  xf1bppSolidWhiteArea
-#define mfbStippleBlackArea  xf1bppStippleBlackArea
-#define mfbStippleInvertArea  xf1bppStippleInvertArea
-#define mfbStippleWhiteArea  xf1bppStippleWhiteArea
-#define mfbTEGlyphBltBlack  xf1bppTEGlyphBltBlack
-#define mfbTEGlyphBltWhite  xf1bppTEGlyphBltWhite
-#define mfbTileAreaPPW  xf1bppTileAreaPPW
-#define mfbTileAreaPPWCopy  xf1bppTileAreaPPWCopy
-#define mfbTileAreaPPWGeneral  xf1bppTileAreaPPWGeneral
-#define mfbTileFS  xf1bppTileFS
-#define mfbUninstallColormap  xf1bppUninstallColormap
-#define mfbUnmapWindow  xf1bppUnmapWindow
-#define mfbUnnaturalStippleFS  xf1bppUnnaturalStippleFS
-#define mfbUnnaturalTileFS  xf1bppUnnaturalTileFS
-#define mfbUnrealizeFont  xf1bppUnrealizeFont
-#define mfbUnrealizeFontWeak  xf1bppUnrealizeFontWeak
-#define mfbValidateGC  xf1bppValidateGC
-#define mfbVertS  xf1bppVertS
-#define mfbWhiteSolidFS  xf1bppWhiteSolidFS
-#define mfbWhiteStippleFS  xf1bppWhiteStippleFS
-#define mfbWindowPrivateIndex  xf1bppWindowPrivateIndex
-#define mfbXRotatePixmap  xf1bppXRotatePixmap
-#define mfbYRotatePixmap  xf1bppYRotatePixmap
-#define mfbZeroPolyArcSS  xf1bppZeroPolyArcSS
-#define partmasks  xf1bpppartmasks
-#define rmask  xf1bpprmask
-#define starttab  xf1bppstarttab
-
-#endif
diff --git a/hw/xfree86/xf1bpp/mfbmap.sh b/hw/xfree86/xf1bpp/mfbmap.sh
deleted file mode 100644
index 5140407..0000000
--- a/hw/xfree86/xf1bpp/mfbmap.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbmap.sh,v 1.1.2.3 1998/06/27 14:48:23 dawes Exp $
-#
-# This script recreates the mapping list that maps the mfb external
-#  symbols * to xf1bpp* (without "mfb")
-# This should only be rerun if there have been changes in the mfb code
-#  that affect the external symbols.
-#  It assumes that Xserver/mfb has been compiled.
-# The output goes to stdout.
-echo ""
-echo "#ifndef _MFBMAP_H"
-echo "#define _MFBMAP_H"
-echo ""
-
-nm ../../../mfb/*.o | \
-awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
-sed s/^_// | \
-grep -v "ModuleInit$" | \
-sort | \
-awk "{ print \"#define \" \$1 \" xf1bpp\"\$1 }" | \
-sed s/xf1bppmfb/xf1bpp/
-
-echo ""
-echo "#endif"
diff --git a/hw/xfree86/xf1bpp/mfbmodule.c b/hw/xfree86/xf1bpp/mfbmodule.c
deleted file mode 100644
index ccd3572..0000000
--- a/hw/xfree86/xf1bpp/mfbmodule.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 1997 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo VersRec =
-{
-        "xf1bpp",
-        MODULEVENDORSTRING,
-        MODINFOSTRING1,
-        MODINFOSTRING2,
-        XORG_VERSION_CURRENT,
-        1, 0, 0,
-        ABI_CLASS_ANSIC,        /* Only need ansic layer */
-        ABI_ANSIC_VERSION,
-        MOD_CLASS_NONE,
-        {0,0,0,0}       /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData xf1bppModuleData = { &VersRec, NULL, NULL };
diff --git a/hw/xfree86/xf1bpp/mfbunmap.h b/hw/xfree86/xf1bpp/mfbunmap.h
deleted file mode 100644
index 56b734b..0000000
--- a/hw/xfree86/xf1bpp/mfbunmap.h
+++ /dev/null
@@ -1,114 +0,0 @@
-
-#ifdef _MFBMAP_H
-#undef _MFBMAP_H
-
-#undef InverseAlu
-#undef endtab
-#undef mask
-#undef mergeRopBits
-#undef mergeGetRopBits
-#undef mfbAllocatePrivates
-#undef mfbBSFuncRec
-#undef mfbBlackSolidFS
-#undef mfbBlackStippleFS
-#undef mfbBresD
-#undef mfbBresS
-#undef mfbChangeWindowAttributes
-#undef mfbCloseScreen
-#undef mfbCopyArea
-#undef mfbCopyPixmap
-#undef mfbCopyPlane
-#undef mfbCopyRotatePixmap
-#undef mfbCopyWindow
-#undef mfbCreateColormap
-#undef mfbCreateDefColormap
-#undef mfbCreateGC
-#undef mfbCreatePixmap
-#undef mfbCreateWindow
-#undef mfbDestroyColormap
-#undef mfbDestroyPixmap
-#undef mfbDestroyWindow
-#undef mfbDoBitblt
-#undef mfbDoBitbltCopy
-#undef mfbDoBitbltCopyInverted
-#undef mfbDoBitbltGeneral
-#undef mfbDoBitbltOr
-#undef mfbDoBitbltXor
-#undef mfbFillPolyBlack
-#undef mfbFillPolyInvert
-#undef mfbFillPolyWhite
-#undef mfbGCPrivateIndex
-#undef mfbGetImage
-#undef mfbGetInverseAlu
-#undef mfbGetSpans
-#undef mfbGetWindowPixmap
-#undef mfbHorzS
-#undef mfbImageGlyphBltBlack
-#undef mfbImageGlyphBltWhite
-#undef mfbInstallColormap
-#undef mfbInvertSolidFS
-#undef mfbInvertStippleFS
-#undef mfbLineSD
-#undef mfbLineSS
-#undef mfbListInstalledColormaps
-#undef mfbMapWindow
-#undef mfbPadPixmap
-#undef mfbPixmapToRegion
-#undef mfbPixmapToRegionWeak
-#undef mfbPolyFillArcSolid
-#undef mfbPolyFillRect
-#undef mfbPolyGlyphBltBlack
-#undef mfbPolyGlyphBltInvert
-#undef mfbPolyGlyphBltWhite
-#undef mfbPolyPoint
-#undef mfbPositionWindow
-#undef mfbPushPixels
-#undef mfbPushPixelsWeak
-#undef mfbPutImage
-#undef mfbQueryBestSize
-#undef mfbQueryBestSizeWeak
-#undef mfbRealizeFont
-#undef mfbRealizeFontWeak
-#undef mfbReduceRop
-#undef mfbRegisterCopyPlaneProc
-#undef mfbResolveColor
-#undef mfbRestoreAreas
-#undef mfbSaveAreas
-#undef mfbScreenInit
-#undef mfbSegmentSD
-#undef mfbSegmentSS
-#undef mfbSetScanline
-#undef mfbSetSpans
-#undef mfbSetWindowPixmap
-#undef mfbSolidBlackArea
-#undef mfbSolidInvertArea
-#undef mfbSolidPP
-#undef mfbSolidWhiteArea
-#undef mfbStippleBlackArea
-#undef mfbStippleInvertArea
-#undef mfbStippleWhiteArea
-#undef mfbTEGlyphBltBlack
-#undef mfbTEGlyphBltWhite
-#undef mfbTileAreaPPW
-#undef mfbTileAreaPPWCopy
-#undef mfbTileAreaPPWGeneral
-#undef mfbTileFS
-#undef mfbUninstallColormap
-#undef mfbUnmapWindow
-#undef mfbUnnaturalStippleFS
-#undef mfbUnnaturalTileFS
-#undef mfbUnrealizeFont
-#undef mfbUnrealizeFontWeak
-#undef mfbValidateGC
-#undef mfbVertS
-#undef mfbWhiteSolidFS
-#undef mfbWhiteStippleFS
-#undef mfbWindowPrivateIndex
-#undef mfbXRotatePixmap
-#undef mfbYRotatePixmap
-#undef mfbZeroPolyArcSS
-#undef partmasks
-#undef rmask
-#undef starttab
-
-#endif
diff --git a/hw/xfree86/xf1bpp/mfbunmap.sh b/hw/xfree86/xf1bpp/mfbunmap.sh
deleted file mode 100644
index 44dc781..0000000
--- a/hw/xfree86/xf1bpp/mfbunmap.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbunmap.sh,v 1.1.2.1 1998/06/27 14:48:24 dawes Exp $
-#
-# This script recreates a header that undoes the effect of mfbmap.h
-# This should only be rerun if there have been changes in the mfb code
-#  that affect the external symbols.
-#  It assumes that Xserver/mfb has been compiled.
-# The output goes to stdout.
-echo ""
-echo "#ifdef _MFBMAP_H"
-echo "#undef _MFBMAP_H"
-echo ""
-
-nm ../../../mfb/*.o | \
-awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
-sed s/^_// | \
-grep -v "ModuleInit$" | \
-sort | \
-awk "{ print \"#undef \" \$1 }"
-
-echo ""
-echo "#endif"
diff --git a/hw/xfree86/xf1bpp/xf1bpp.h b/hw/xfree86/xf1bpp/xf1bpp.h
deleted file mode 100644
index 33e5818..0000000
--- a/hw/xfree86/xf1bpp/xf1bpp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 1994-1998 The XFree86 Project, Inc.  All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
- * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project shall
- * not be used in advertising or otherwise to promote the sale, use or other
- * dealings in this Software without prior written authorization from the
- * XFree86 Project.
- */
-
-#ifndef __XF1BPP_H__
-#define __XF1BPP_H__
-
-#define MFB_PROTOTYPES_ONLY
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mfbunmap.h"
-#undef MFB_PROTOTYPES_ONLY
-
-#endif
diff --git a/hw/xfree86/xf4bpp/Makefile.am b/hw/xfree86/xf4bpp/Makefile.am
deleted file mode 100644
index 1414a0d..0000000
--- a/hw/xfree86/xf4bpp/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-module_LTLIBRARIES = libxf4bpp.la
-
-sdk_HEADERS = xf4bpp.h
-
-libxf4bpp_la_LDFLAGS = -avoid-version
-
-libxf4bpp_la_SOURCES = \
-        ppcArea.c \
-        ppcClip.c \
-        ppcCpArea.c \
-        ppcCReduce.c \
-        ppcDepth.c \
-        ppcFillRct.c \
-        ppcWinFS.c \
-        ppcPixFS.c \
-        ppcGC.c \
-        ppcGetSp.c \
-        ppcImg.c \
-        ppcPixmap.c \
-        ppcPolyPnt.c \
-        ppcQuery.c \
-        ppcRslvC.c \
-        ppcSetSp.c \
-        ppcWindow.c \
-        ppcIO.c \
-        emulOpStip.c \
-        emulRepAre.c \
-        emulTile.c \
-        vgaGC.c \
-        vgaBitBlt.c \
-        vgaImages.c \
-        vgaStipple.c \
-        vgaSolid.c \
-        offscreen.c \
-        wm3.c \
-        mfbimggblt.c \
-        mfbline.c \
-        mfbseg.c \
-        mfbhrzvert.c \
-        mfbbres.c \
-        mfbbresd.c \
-        mfbfillarc.c \
-        mfbzerarc.c \
-        vgamodule.c
-
-EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \
-             vgaVideo.h wm3.h NOTES
-
-DISTCLEANFILES = mfbseg.c
-
-mfbseg.c:
-	echo "#define POLYSEGMENT" > $@
-	echo "#include \"$(srcdir)/mfbline.c\"" >> $@
-
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/xf4bpp/NOTES b/hw/xfree86/xf4bpp/NOTES
deleted file mode 100644
index e3b77dc..0000000
--- a/hw/xfree86/xf4bpp/NOTES
+++ /dev/null
@@ -1,194 +0,0 @@
-This code originally hails from IBM.  It was ported to an early XFree86 by
-Gertjan Akkerman, whose BUGS file I append here.
-
-In turn, this is a port of Gertjan's work to the new server design.  Among the
-changes are:
-
-- The removal of almost all unreferenced code.
-- The removal of this code's own copy of mfb (xf1bpp is used instead).
-- The removal of banking support (mibank is used instead).
-- External symbols were made static where this was sufficient.
-- The remaining external names were renamed to xf4bpp*.
-- Several minor cleanups too many to mention here.
-
-To understate the matter, this code is >UGLY<.  This seems inherent in IBM's
-corporate culture.  Be that as it may, it *does* survive X11R4's xtest
-(whatever that means these days...).  For now, this is sufficient for 4bpp
-support in the new design, but at some point, I'll have to sit down and
-rewrite this from scratch.  A more technical justification for a rewrite is
-that the pixmap format is 8bpp, instead of 4bpp, which is causing me to
-pepper the rest of the server with unclean accomodations.
-
-Marc.
-
-===============================================================================
-Section 1: From IBM's X11R4 contribution towards XFree86.
-
-This section describes what I did to obtain a 16 colour vga server.
-
-I started with the SYSV, ppc, vga and common directories from IBM's X11R4
-contribution. Those directories have the following function:
-1. SYSV implements the mouse and keyboard.
-2. ppc is a generic layer implementing ddx in terms of drawing operations
-   through rectangles. (With spans as a boundary case: height = 1.)
-3. vga implements a layer of operations drawing through rectangles.
-4. common implements ddx initialization and quitting, and screen saving.
-
-I eliminated SYSV and common since the functionality provided therein is
-already provided in XFree86. Since XFree86 is actively being ported to
-new operating systems, while X11R4 is out of date, I preferred the XFree86
-code here above the SYSV and common code.
-Whatever functionality was still needed from common (default colormap
-initialization -- not much code) was moved into ppc.
-
-Since XFree86 uses the mi-provided software cursor code, IBM's software
-cursor code was deleted from ppc and vga. This is a pity, since it is
-expected that it is more efficient than mi's code, but the XFree86 mouse and
-keyboard code directly call mi, and I do not want to maintain the XFree86
-mouse and keyboard code.
-
-Since we cannot support a monolithic multi-screen server using all of the
-x11r4 contributed code yet, all multi screen code was deleted. This includes
-one header file containing a nasty copyright statement.
-
-Since glyph handling has changed between X11R4 and X11R5, the code handling
-glyphs was replaced by appropriate calls to mi.
-I hope it can be modified and put back one day.
-
-Provisionally, some code was added (viz. file vga/offscreen.c) to intercept
-calls to the rectangle drawing code when we are switched out of the VT.
-I hope this can be replaced by some window tree invalidation and GC validation
-scheme.
-
-
-Section 2: BUGS
-
-This section describes fixed and still unfixed bugs in this code.
-All bugs not labeled otherwise also occur in IBM's X11R4 code, and may be of
-interest to anybody using that code.
-
-1. (Fixed.)
-I found (and provisionally fixed) a bug in the IBM bitblit code:
-In file ddx/ibm/vga/vgaImages.c a function vgaReadColorImage is defined.
-When this function is used to read less than 8 pixels starting on a byte
-boundary it will always read precisely 8 pixels.
-Thus, when space is allocated for 4 or less pixels, it will write beyond
-the allocated space.
-Since the code is rather convoluted, this may not be apparent at first sight,
-but going through the code with an example shows the error.
-
-2. (Fixed.)
-In ppcPixmapFS.c, function ppcStipplePixmapFS there was a bug
-regarding the stipple origin: The horizontal origin is added while
-the vertical one is subtracted. The horizontal origin should be subtracted
-instead of added here.
-This bug gets visible when backing-store is enabled and one uses twm:
-the submenu icons get truncated on their left hand side.
-(In case you wonder why this bug appears: under those circumstances
-twm prepares its menus by drawing into an unmapped window. 
-The miCopyPlane function uses the ppcStipplePixmap (and many others)
-to get the plane copied.)
-I also fixed this bug in the other routines (ppcOpStipplePixmapFS,
-ppcTilePixmapFS) in this file, although I had no visible clues for this.
-I hope this is appropriate.
-
-3. (Fixed.)
-I find it suspect that ppcSetSpans gives different output when one
-claims that an actually sorted list of spans is unsorted.
-The unsorted code is wrong, and should be made to look more like the sorted
-code. I.e., use ( xStart - ppt->x ) instead of ( xStart - pbox->x1 )
-
-4. (Fixed.)
-There used to be another bug that became visible when using twm and backing
-store: popping up a submenu, and moving the cursor upwards til it leaves the
-submenu, the submenu would disappears, as it should.
-But the submenu icon would not get restored, while it should be.
-10b. By replacing the clip-computing code in ppcValidateGC by that in
-cfbValidateGC, I *finally* fixed the disappearing twm menu icon problem.
-
-5. Added mfbRegisterCopyplaneProc call. [Its omission was an error on my
-   part.]
-   Fixing a server core dump in XTest.
-
-6. Fixed not-very-high tile bug in function ppcTileRect, file emulTile.c
-   (I.e., if the tile was higher than the area to be tiled, far too much
-   was drawn, causing server core dumps in XTest.)
-   Actually, "savey" ought to be used to determine the height of the tiles in
-   the top line to be tiled, instead of "pTile->drawable.height".
-7. A use of height where width was intended was fixed in ppcTileRect:
-   "savehcount = w / pTile->drawable.height;" should use "... .width" and
-   "savehcount = ( x + w - htarget ) / pTile->drawable.height;" too.
-
-8. Deleted overly clever code in ppcCReduce.c
-   (All code that tried to pre-compute how alu's could be replaced by
-    other alu's with inverted colors, etc. was deleted. I think it is
-   at least wrong for FillSolid.)
-
-9. Looked at suspicious code in ppcSetSp.c
-   "tmpx = *pdst;" was never updated during the loop. We took it out of the
-   initialization position of the for and moved it into the loop.
-
-10. Add xSrc := GC->patOrg.x + pDrawable.x and ySrc := ... in ppcPixmapFS.c,
-   functions ppcStipplePixmapFS, ppcOpStipplePixmapFS, and ppcTilePixmapFS.
-   This because stipple and tile origins are taken relative to the drawable.
-   Also use a "modulo" function that gets the cases of a negative stipple
-   or tile offset right. (When the stipple origin is to the right of or
-   below the origin of the drawable.)
-
-11. File vgaSolid.c, function vgaFillSolid:
-   Inverting is XORing with all ones. Not with the color we want to AND/OR
-   later. So we'll have to set the color to VGA_ALLPLANES
-   whenever we want to invert existing data, and reset it before the
-   AND/OR is done.
-   Also we replaced an outb( 0x3CF, tmp2 ) by the SetVideoGraphicsData( tmp2 )
-   it is representing. (Just a cosmetic replacement.)
-
-12. File vgaImages, function vgaDrawColorImage.
-   Moved a line "invert_existing_data = TRUE;" two lines down, past a case
-   label. Now it is also part of the code executed for GXorReverse, as it
-   should be.
-
-13. The pixmap FillSpans routines (file ppcPixmapFS.c) got somewhat better
-   after importing some code from ddx/ibm/vga. (A getbits function that does
-   wrapping.)
-   They were wrong for the FillStippled and FillOpaqueStippled modes.
-   I don't understand the old code. How could it handle stipples of a size not
-   an exact multiple of 32? (or 8, for that matter.)
-
-14. In function vgaBitBlt file vgaBitBlt.c, in the shortcuts for
-    GXSet, GXClear and GXInvert, the source (x0,y0) is accidentally operated
-    upon by vgaFillSolid, instead of the destination (x1,y1).
-
-15. Notice that in DoMonoSingle and DoMonoMany in file vgaStipple.c, the left
-   edge of the square to be stippled is treated wrong.
-   Correct would be to get the bits with getbits using offset xshift, and
-   to shift them right (x & 07) places. 
-   [One might wish to use the variable tmp1 at this place, since it had been
-    set to (x & 07) at this place; but that is already re-used at this point.]
-   Also note that NeedValX is set wrong: The implicit assumption was that
-   stipples are more than 8 wide.
-   This only fixes the problem when miPushPixel is used instead of ppcPushPixel.
-   I think I should look some more into this.
-   
-16. I took out some code of the CopyArea function, in which a no-op function
-   was called while a real one was needed. My fix does not completely work,
-   although it improved the behaviour of GetImage somewhat.
-
-17.  After finding three kinds of errors in this single function,
-   -- the new kinds being the right side not being always written due to
-   an incorrect if scope, and the lower end not always being written due
-   to variables being updated at the wrong place --
-   (requiring modifications to be made at at least 10 places,
-   I decided to REWRITE the body of the ppcTileRect function from scratch.
-   This version simply computes all relevant margins in advance, and does
-   not try to reuse temporary variables. I leave that to the compiler.
-   (This was a maintenance and robustness nightmare anyway.)
-
-MORE NOTES:
-   It is funny that there are two files in mi that require compilation
-   with the proper #defines ( -DXF86VGA16  in my case ):
-   Besides the obvious mibitblt.c, there is also mipushpxl.c.
-
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/NOTES,v 1.1.2.2 1998/06/27 15:15:45 dawes Exp $
diff --git a/hw/xfree86/xf4bpp/OScompiler.h b/hw/xfree86/xf4bpp/OScompiler.h
deleted file mode 100644
index 8a8bbb5..0000000
--- a/hw/xfree86/xf4bpp/OScompiler.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef __COMPILER_DEPENDANCIES__
-#define __COMPILER_DEPENDANCIES__
-
-#define MOVE( src, dst, length ) memcpy( dst, src, length)
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define ABS(x) (((x)>0)?(x):-(x))
-
-#include "misc.h"
-#include "compiler.h"
-
-#ifdef lint
-/* So that lint doesn't complain about constructs it doesn't understand */
-#ifdef volatile
-#undef volatile
-#endif
-#define volatile
-#ifdef const
-#undef const
-#endif
-#define const
-#ifdef signed
-#undef signed
-#endif
-#define signed
-#ifdef _ANSI_DECLS_
-#undef _ANSI_DECLS_
-#endif
-#endif
-
-#endif /* !__COMPILER_DEPENDANCIES__ */
diff --git a/hw/xfree86/xf4bpp/emulOpStip.c b/hw/xfree86/xf4bpp/emulOpStip.c
deleted file mode 100644
index 542e9d3..0000000
--- a/hw/xfree86/xf4bpp/emulOpStip.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* ppc OpaqueStipple
- *
- * Based on the private stipple; does a foreground, and then an inverted
- * on the background 
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-
-void 
-xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc )
-WindowPtr pWin; /* GJA */
-register PixmapPtr pStipple ;
-unsigned long int fg ;
-unsigned long int bg ;
-int alu ;
-unsigned long int planes ;
-register int x, y, w, h ;
-int xSrc, ySrc ;
-{
-    /* DO BACKGROUND */
-    switch ( alu ) {
-	/* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */
-	case GXclear:		/* 0x0 Zero 0 */
-	case GXset:		/* 0xf 1 */
- 	    /* Foreground And Background Are Both The Same !! */
-	    xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ;
-	case GXnoop:		/* 0x5 dst */
-	    break ;
-	case GXcopy:		/* 0x3 src */
-	case GXcopyInverted:	/* 0xc NOT src */
-	    { /* Special Case Code */
- 		register int vtarget, htarget ;
-
- 		/* We Can Draw Just One Copy Then Blit The Rest !! */
-		/* Draw The One Copy */
-		htarget = MIN( w, pStipple->drawable.width ) ;
-		vtarget = MIN( h, pStipple->drawable.height ) ;
-
-		/* First The Background */
-		xf4bppFillSolid( pWin, bg, alu, planes, x, y,
-					htarget, vtarget ) ;
-		/* Then The Foreground */
-		xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
-				       x, y, htarget, vtarget,
-				       xSrc, ySrc ) ;
-
-		/* Here We Double The Size Of The BLIT Each Iteration */
-		xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
-	    }
-	    break ;
-	default:
-	/* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
-	    { /* Do The Background */
-		register int i, j;
-		register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
-		register unsigned char *data = pInvPixmap->devPrivate.ptr ;
-
-		/* INVERT PIXMAP  OK, jeff, this is for you */
-		for ( i = pInvPixmap->drawable.height ; i-- ; )
-			for ( j = pInvPixmap->devKind ; j-- ; data++ )
-				*data = ~ ( *data ) ;
-
-	        xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
-	        mfbDestroyPixmap( pInvPixmap ) ;
-	        /* DO FOREGROUND */
-	        xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );
-	    }
-	break ;
-    }
-    return;
-}
diff --git a/hw/xfree86/xf4bpp/emulRepAre.c b/hw/xfree86/xf4bpp/emulRepAre.c
deleted file mode 100644
index 20fff1e..0000000
--- a/hw/xfree86/xf4bpp/emulRepAre.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* ppc Replicate Area -- A Divide & Conquer Algorithm
- * a "ppc" Helper Function For Stipples And Tiling
- * P. Shupak 1/88
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-
-void xf4bppReplicateArea( pWin, x, y, planeMask, goalWidth, goalHeight,
-			currentHoriz, currentVert)
-WindowPtr pWin; /* GJA */
-register int x, y, planeMask ;
-int goalWidth, goalHeight ;
-int currentHoriz, currentVert ;
-{
-	for ( ;
-	      currentHoriz <= ( goalWidth >> 1 ) ;
-	      currentHoriz <<= 1 ) {
-		xf4bppBitBlt( pWin, GXcopy, planeMask,
-			x, y,
-			x + currentHoriz, y,
-			currentHoriz, currentVert ) ;
-	}
-	if ( goalWidth - currentHoriz )
-		xf4bppBitBlt( pWin, GXcopy, planeMask,
-			x, y,
-			x + currentHoriz, y,
-			goalWidth - currentHoriz, currentVert ) ;
-	for ( ;
-	      currentVert <= ( goalHeight >> 1 ) ;
-	      currentVert <<= 1 ) {
-		xf4bppBitBlt( pWin, GXcopy, planeMask,
-			x, y,
-			x, y + currentVert,
-			goalWidth, currentVert ) ;
-	}
-	if ( goalHeight - currentVert )
-		xf4bppBitBlt( pWin, GXcopy, planeMask,
-			x, y,
-			x, y + currentVert,
-			goalWidth, goalHeight - currentVert ) ;
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/emulTile.c b/hw/xfree86/xf4bpp/emulTile.c
deleted file mode 100644
index 2f2a758..0000000
--- a/hw/xfree86/xf4bpp/emulTile.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* ppc Tile
- * P. Shupak 11/87
- * Modified From original ppc Tile
- * T. Paquin 9/87
- * Uses private imageFill a bunch of times
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "ibmTrace.h"
-
-static void
-DrawFirstTile
-(
-	WindowPtr pWin, /* GJA */
-	register PixmapPtr pTile,
-	register int x,
-	register int y,
-	int w,
-	int h,
-	int alu,
-	unsigned long int planes,
-	int xOffset,
-	int yOffset
-)
-{
-register int htarget ;
-register int vtarget ;
-
-	if ( xOffset ) { /* Not X-Aligned */
-		if ( yOffset ) { /* Nor Y-Aligned */
-			htarget = MIN( pTile->drawable.width - xOffset, w ),
-			vtarget = MIN( pTile->drawable.height - yOffset, h ),
-			yOffset *= pTile->devKind ;
-			xf4bppDrawColorImage( pWin,x, y,
-				 htarget,
-				 vtarget,
-				 (unsigned char *)pTile->devPrivate.ptr + yOffset + xOffset,
-				 pTile->devKind,
-				 alu, planes ) ;
-			if ( w > htarget ) {
-				w = MIN( w, pTile->drawable.width ) ;
-				if ( h > vtarget ) {
-					h = MIN( h, pTile->drawable.height ) ;
-					xf4bppDrawColorImage( pWin, x, y + vtarget,
-						 htarget,
-						 h - vtarget,
-						 (unsigned char *)pTile->devPrivate.ptr + xOffset,
-						 pTile->devKind,
-						 alu, planes ) ;
-					xf4bppDrawColorImage( pWin, x + htarget, y,
-						 w - htarget,
-						 vtarget,
-						 (unsigned char *)pTile->devPrivate.ptr + yOffset,
-						 pTile->devKind,
-						 alu, planes ) ;
-					xf4bppDrawColorImage( pWin, x + htarget,
-						 y + vtarget,
-						 w - htarget,
-						 h - vtarget,
-						 pTile->devPrivate.ptr,
-						 pTile->devKind,
-						 alu, planes ) ;
-				}
-				else { /* h <= vtarget */
-					xf4bppDrawColorImage( pWin, x + htarget, y,
-						 w - htarget,
-						 vtarget,
-						 (unsigned char *)pTile->devPrivate.ptr + yOffset,
-						 pTile->devKind,
-						 alu, planes ) ;
-				}
-			}
-			else if ( h > vtarget ) {
-				xf4bppDrawColorImage( pWin, x, y + vtarget,
-					 htarget,
-					 MIN( h, pTile->drawable.height ) - vtarget,
-					 (unsigned char *)pTile->devPrivate.ptr + xOffset,
-					 pTile->devKind,
-					 alu, planes ) ;
-				vtarget = pTile->drawable.height ;
-			}
-		}
-		else { /* No Y Offset */
-			xf4bppDrawColorImage( pWin, x, y,
-				 htarget = MIN( pTile->drawable.width - xOffset, w ),
-				 vtarget = MIN( pTile->drawable.height, h ),
-				 (unsigned char *)pTile->devPrivate.ptr + xOffset,
-				 pTile->devKind,
-				 alu, planes ) ;
-			if ( w > htarget ) {
-				xf4bppDrawColorImage( pWin, x + htarget, y,
-					 MIN( pTile->drawable.width, w ) - htarget,
-					 vtarget,
-					 pTile->devPrivate.ptr,
-					 pTile->devKind,
-					 alu, planes ) ;
-			}
-		}
-	}
-	else if ( yOffset ) {
-		xf4bppDrawColorImage( pWin, x, y,
-			 htarget = MIN( pTile->drawable.width, w ),
-			 vtarget = MIN( pTile->drawable.height - yOffset, h ),
-			 (unsigned char *)pTile->devPrivate.ptr + ( yOffset * pTile->devKind ),
-			 pTile->devKind,
-			 alu, planes ) ;
-		if ( h > vtarget ) {
-			xf4bppDrawColorImage( pWin, x, y + vtarget,
-				 htarget,
-				 MIN( pTile->drawable.height, h ) - vtarget,
-				 pTile->devPrivate.ptr,
-				 pTile->devKind,
-				 alu, planes ) ;
-		}
-	}
-	else { /* NO Offset */
-		xf4bppDrawColorImage( pWin, x, y,
-			 htarget = MIN( pTile->drawable.width, w ),
-			 vtarget = MIN( pTile->drawable.height, h ),
-			 pTile->devPrivate.ptr,
-			 pTile->devKind,
-			 alu, planes ) ;
-	}
-
-	return ;
-}
-
-/* GJA --
- * After finding three kinds of errors in this single function,
- * (requiring modifications to be made at at least 10 places,
- * I decided to REWRITE the body of the xf4bppTileRect function from scratch.
- * This version simply computes all relevant margins in advance, and does
- * not try to reuse temporary variables. I leave that to the compiler.
- * (This was a maintenance and robustness nightmare anyway.)
- * The code is pretty obvious: all margins, coordinates, and numbers of tiles
- * are computed before drawing starts.
- * Notice that the margins consist of incompletely drawn tiles. Therefore
- * we need offsets in the data for the left and upper margins.
- * The right and lower margins are also incomplete, but start at offset 0
- * in the data. They just end at awkward offsets. 
- * The center block, by definition, consists of fully drawn tiles.
- * Perhaps we could leave out some if's. But why bother? It would decrease
- * robustness.
- */
-void
-xf4bppTileRect( pWin, pTile, alu, planes, x0, y0, w, h, xSrc, ySrc )
-WindowPtr pWin; /* GJA */
-register PixmapPtr pTile ;
-const int alu ;
-const unsigned long int planes ;
-register int x0, y0, w, h ;
-int xSrc ;
-int ySrc ;
-{
-int xOffset ;
-int yOffset ;
-int width, height;
-
-TRACE( ( "xf4bppTileRect(pTile=x%x,alu=x%x,planes=x%02x,x0=%d,y0=%d,w=%d,h=%d,xSrc=%d,ySrc=%d\n",
-		pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) ) ;
-
-     switch ( alu ) {
-	case GXclear:		/* 0x0 Zero 0 */
-	case GXinvert:		/* 0xa NOT dst */
-	case GXset:		/* 0xf 1 */
-		xf4bppFillSolid
-			( pWin, 0xFF, alu, planes, x0, y0, w, h ) ;
-	case GXnoop:		/* 0x5 dst */
-		return ;
-	default:
-		break ;
-}
-
-    width = pTile->drawable.width;
-    if ( ( xOffset = ( x0 - xSrc ) ) > 0 )
-	xOffset %= width ;
-    else
-	xOffset = width - (( - xOffset ) % width ) ;
-    if ( xOffset == width ) xOffset = 0; /* For else case */
-
-    height = pTile->drawable.height;
-    if ( ( yOffset = ( y0 - ySrc ) ) > 0 )
-	yOffset %= height ;
-    else
-	yOffset = height - (( - yOffset ) % height ) ;
-    if ( yOffset == height ) yOffset = 0; /* For else case */
-
-     switch ( alu ) {
-	case GXcopyInverted:	/* 0xc NOT src */
-	case GXcopy:		/* 0x3 src */
-		/* Special Case Code */
-		DrawFirstTile( pWin, pTile, x0, y0, w, h,
-			       alu, planes, xOffset, yOffset ) ;
-		/* Here We Double The Size Of The BLIT Each Iteration */
-		xf4bppReplicateArea( pWin, x0, y0, planes, w, h,
-			    MIN( w, pTile->drawable.width ),
-			    MIN( h, pTile->drawable.height ) ) ;
-		break ;
-	case GXnor:		/* 0x8 NOT src AND NOT dst */
-	case GXandReverse:	/* 0x2 src AND NOT dst */
-	case GXorReverse:	/* 0xb src OR NOT dst */
-	case GXnand:		/* 0xe NOT src OR NOT dst */
-	case GXandInverted:	/* 0x4 NOT src AND dst */
-	case GXand:		/* 0x1 src AND dst */
-	case GXequiv:		/* 0x9 NOT src XOR dst */
-	case GXxor:		/* 0x6 src XOR dst */
-	case GXorInverted:	/* 0xd NOT src OR dst */
-	case GXor:		/* 0x7 src OR dst */
-	default:
-		{
-		register unsigned char *data ;
-		register int hcount, vcount ; /* Number of tiles in center */
-		int xcount, ycount;	/* Temporaries */
-		int x1, y1;	/* Left upper corner of center */
-		int x2, y2;	/* Left upper corner of lower right margin */
-		int leftmgn, rightmgn, topmgn, botmgn; /* Margins */
-
-		int htarget, vtarget ;
-
-		data = pTile->devPrivate.ptr;
-	
-		/* Compute the various sizes and coordinates. */
-		leftmgn = MIN( w, width - xOffset ) ;
-		x1 = x0 + leftmgn;
-		topmgn = MIN( h, height - yOffset ) ;
-		y1 = y0 + topmgn;
-
-		rightmgn = (w - leftmgn) % width;
-		hcount = (w - leftmgn) / width;
-		x2 = x0 + w - rightmgn;
-		botmgn = (h - topmgn) % height;
-		vcount = (h - topmgn) / height;
-		y2 = y0 + h - botmgn;
-		
-		/* We'll use yOffset as offset in data.
-		 * This requires yOffset != height (ditto xOffset).
-                 */
-		yOffset *= pTile->devKind;
-
-		/* Draw top margin, including corners */
-		if ( topmgn ) {
-			if ( leftmgn ) {
-				xf4bppDrawColorImage( pWin, x0, y0, leftmgn, topmgn,
-					 data + yOffset + xOffset,
-					 pTile->devKind, alu, planes ) ;
-			}
-			for (	xcount = hcount, htarget = x1;
-				xcount ;
-				xcount--, htarget += width )
-			{
-				xf4bppDrawColorImage( pWin, htarget, y0, width, topmgn,
-					 data + yOffset,
-					 pTile->devKind, alu, planes ) ;
-			}
-			if ( rightmgn ) {
-				xf4bppDrawColorImage( pWin, x2, y0, rightmgn, topmgn,
-					 data + yOffset,
-					 pTile->devKind, alu, planes ) ;
-			}
-		}
-	
-		/* Draw bottom margin, including corners */
-		if ( botmgn ) {
-			if ( leftmgn ) {
-				xf4bppDrawColorImage( pWin, x0, y2, leftmgn, botmgn,
-					 data + xOffset,
-					 pTile->devKind, alu, planes ) ;
-			}
-			for (	xcount = hcount, htarget = x1;
-				xcount ;
-				xcount--, htarget += width )
-			{
-				xf4bppDrawColorImage( pWin, htarget, y2, width, botmgn,
-					 data,
-					 pTile->devKind, alu, planes ) ;
-			}
-			if ( rightmgn ) {
-				xf4bppDrawColorImage( pWin, x2, y2, rightmgn, botmgn,
-					 data,
-					 pTile->devKind, alu, planes ) ;
-			}
-		}
-	
-		/* Draw left margin, excluding corners */
-		if ( leftmgn ) {
-			for (	ycount = vcount, vtarget = y1 ;
-				ycount ;
-				ycount--, vtarget += height )
-			{
-				xf4bppDrawColorImage( pWin, x0, vtarget, leftmgn, height,
-					 data + xOffset,
-					 pTile->devKind, alu, planes ) ;
-			}
-		}
-
-		/* Draw right margin, excluding corners */
-		if ( rightmgn ) {
-			for (	ycount = vcount, vtarget = y1 ;
-				ycount ;
-				ycount--, vtarget += height )
-			{
-				xf4bppDrawColorImage( pWin, x2, vtarget, rightmgn, height,
-					 data,
-					 pTile->devKind, alu, planes ) ;
-			}
-		}
-
-		/* Draw center consisting of full tiles */
-		for (		ycount = vcount, vtarget = y1 ;
-				ycount ;
-				ycount--, vtarget += height )
-		{
-			for (	xcount = hcount, htarget = x1 ;
-				xcount ;
-				xcount--, htarget += width )
-			{
-				xf4bppDrawColorImage( pWin, htarget, vtarget, width, height,
-					 data,
-					 pTile->devKind, alu, planes ) ;
-				
-			}
-		}
-	} } /* Block + switch */
-}
diff --git a/hw/xfree86/xf4bpp/ibmTrace.h b/hw/xfree86/xf4bpp/ibmTrace.h
deleted file mode 100644
index f1d8840..0000000
--- a/hw/xfree86/xf4bpp/ibmTrace.h
+++ /dev/null
@@ -1 +0,0 @@
-#define TRACE(x) /* empty */
diff --git a/hw/xfree86/xf4bpp/mfbbres.c b/hw/xfree86/xf4bpp/mfbbres.c
deleted file mode 100644
index 09d7ee2..0000000
--- a/hw/xfree86/xf4bpp/mfbbres.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* GJA -- modified this file for vga16 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "miline.h"
-#include "wm3.h"
-
-/* Solid bresenham line */
-/* NOTES
-   e2 is used less often than e1, so it's not in a register
-*/
-
-void
-xf4bppBresS(addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
-PixelType *addrlbase;        /* pointer to base of bitmap */
-int nlwidth;                /* width in longwords of bitmap */
-int signdx, signdy;        /* signs of directions */
-int axis;                /* major axis (Y_AXIS or X_AXIS) */
-int x1, y1;                /* initial point */
-register int e;                /* error accumulator */
-register int e1;        /* bresenham increments */
-int e2;
-int len;                /* length of line */
-{
-    register int yinc;        /* increment to next scanline, in bytes */
-    register PixelType *addrl;                        /* bitmask long pointer 
-                                        *dont*         * cast to char pointer */
-    register PixelType bit;        /* current bit being set/cleared/etc.  */
-    PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
-    PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
-
-    register int e3 = e2-e1;
-
-    /* point to longword containing first point */
-    addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
-    yinc = signdy * nlwidth;
-    e = e-e1;                        /* to make looping easier */
-    bit = mfbGetmask(x1 & PIM);
-
-    if (!len)
-        return;
-    
-    if (axis == X_AXIS)
-    {
-        if (signdx > 0)
-        {
-            while(len--)
-            {
-                UPDRW(addrl,bit);
-                e += e1;
-                if (e >= 0)
-                {
-                    addrl += yinc;
-                    e += e3;
-                }
-                bit = SCRRIGHT(bit,1);
-                if (!bit) { bit = leftbit; addrl++; }
-            }
-        }
-        else
-        {
-            while(len--)
-            {
-                UPDRW(addrl,bit);
-                e += e1;
-                if (e >= 0)
-                {
-                    addrl += yinc;
-                    e += e3;
-                }
-                bit = SCRLEFT(bit,1);
-                if (!bit) { bit = rightbit; addrl--; }
-            }
-        }
-    } /* if X_AXIS */
-    else
-    {
-        if (signdx > 0)
-        {
-            while(len--)
-            {
-                UPDRW(addrl,bit);
-                e += e1;
-                if (e >= 0)
-                {
-                    bit = SCRRIGHT(bit,1);
-                    if (!bit) { bit = leftbit; addrl++; }
-                    e += e3;
-                }
-                addrl += yinc;
-            }
-        }
-        else
-        {
-            while(len--)
-            {
-                UPDRW(addrl,bit);
-                e += e1;
-                if (e >= 0)
-                {
-                    bit = SCRLEFT(bit,1);
-                    if (!bit) { bit = rightbit; addrl--; }
-                    e += e3;
-                }
-                addrl += yinc;
-            }
-        }
-    } /* else Y_AXIS */
-}
diff --git a/hw/xfree86/xf4bpp/mfbbresd.c b/hw/xfree86/xf4bpp/mfbbresd.c
deleted file mode 100644
index 318d4f5..0000000
--- a/hw/xfree86/xf4bpp/mfbbresd.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* GJA -- modified this file for vga16 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "miline.h"
-#include "wm3.h"
-#include "xf86.h"
-
-/* Dashed bresenham line */
-
-#define NO_INK (-1) /* GJA -- means: dash is off */
-
-#define StepDash\
-    if (!--dashRemaining) { \
-	if (++ dashIndex == numInDashList) \
-	    dashIndex = 0; \
-	dashRemaining = pDash[dashIndex]; \
-	ink = fgink; \
-	if (dashIndex & 1) \
-	    ink = bgink; \
-	if (isDoubleDash) \
-	    WM3_SET_INK(ink); \
-    }
-
-void
-xf4bppBresD(pDrawable, fgink, bgink,
-	 pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
-	 addrlbase, nlwidth,
-	 signdx, signdy, axis, x1, y1, e, e1, e2, len)
-DrawablePtr pDrawable;
-int fgink, bgink;
-int *pdashIndex;	/* current dash */
-unsigned char *pDash;	/* dash list */
-int numInDashList;	/* total length of dash list */
-int *pdashOffset;	/* offset into current dash */
-int isDoubleDash;
-PixelType *addrlbase;	/* pointer to base of bitmap */
-int nlwidth;		/* width in longwords of bitmap */
-int signdx, signdy;	/* signs of directions */
-int axis;		/* major axis (Y_AXIS or X_AXIS) */
-int x1, y1;		/* initial point */
-register int e;		/* error accumulator */
-register int e1;	/* bresenham increments */
-int e2;
-int len;		/* length of line */
-{
-    IOADDRESS REGBASE =
-	xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
-    register int yinc;	/* increment to next scanline, in bytes */
-    register PixelType *addrl;
-    register int e3 = e2-e1;
-    register unsigned long bit;
-    PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
-    PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
-    int dashIndex;
-    int dashOffset;
-    int dashRemaining;
-    int	ink;
-
-    fgink &= 0x0F; bgink &= 0x0F; /* GJA -- so they're != NO_INK */
-
-    dashOffset = *pdashOffset;
-    dashIndex = *pdashIndex;
-    dashRemaining = pDash[dashIndex] - dashOffset;
-    ink = fgink;
-    if (!isDoubleDash)
-	bgink = NO_INK;
-    if (dashIndex & 1)
-	ink = bgink;
-    if ( ink != NO_INK ) WM3_SET_INK(ink);
-
-    /* point to longword containing first point */
-    addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
-    yinc = signdy * nlwidth;
-    e = e-e1;			/* to make looping easier */
-    bit = mfbGetmask(x1 & PIM);
-    if (axis == X_AXIS)
-    {
-	if (signdx > 0)
-	{
-	    while(len--)
-	    { 
-		if ( ink != NO_INK ) UPDRW(addrl,bit);
-		e += e1;
-		if (e >= 0)
-		{
-		    addrl += yinc;
-		    e += e3;
-		}
-		bit = SCRRIGHT(bit,1);
-		if (!bit) { bit = leftbit; addrl++; }
-		StepDash
-	    }
-	}
-	else
-	{
-	    while(len--)
-	    { 
-		
-		if ( ink != NO_INK ) UPDRW(addrl,bit);
-		e += e1;
-		if (e >= 0)
-		{
-		    addrl += yinc;
-		    e += e3;
-		}
-		bit = SCRLEFT(bit,1);
-		if (!bit) { bit = rightbit; addrl--; }
-		StepDash
-	    }
-	}
-    } /* if X_AXIS */
-    else
-    {
-	if (signdx > 0)
-	{
-	    while(len--)
-	    {
-		if ( ink != NO_INK ) UPDRW(addrl,bit);
-		e += e1;
-		if (e >= 0)
-		{
-		    bit = SCRRIGHT(bit,1);
-		    if (!bit) { bit = leftbit; addrl++; }
-		    e += e3;
-		}
-		addrl += yinc;
-		StepDash
-	    }
-	}
-	else
-	{
-	    while(len--)
-	    {
-		
-		if ( ink != NO_INK ) UPDRW(addrl,bit);
-		e += e1;
-		if (e >= 0)
-		{
-		    bit = SCRLEFT(bit,1);
-		    if (!bit) { bit = rightbit; addrl--; }
-		    e += e3;
-		}
-		addrl += yinc;
-		StepDash
-	    }
-	}
-    } /* else Y_AXIS */
-    *pdashIndex = dashIndex;
-    *pdashOffset = pDash[dashIndex] - dashRemaining;
-} 
diff --git a/hw/xfree86/xf4bpp/mfbfillarc.c b/hw/xfree86/xf4bpp/mfbfillarc.c
deleted file mode 100644
index 89aeadd..0000000
--- a/hw/xfree86/xf4bpp/mfbfillarc.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/************************************************************
-
-Copyright (c) 1989  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-********************************************************/
-
-/* GJA -- Took mfb code and modified it. */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "mifillarc.h"
-#include "wm3.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-static void
-v16FillEllipseSolid
-(
-    DrawablePtr pDraw,
-    xArc *arc
-)
-{
-    int x, y, e;
-    int yk, xk, ym, xm, dx, dy, xorg, yorg;
-    register int slw;
-    miFillArcRec info;
-    int *addrlt, *addrlb;
-    register int *addrl;
-    register int n;
-    int nlwidth;
-    register int xpos;
-    int startmask, endmask, nlmiddle;
-
-    if (pDraw->type == DRAWABLE_WINDOW)
-    {
-	addrlt = (int *)
-	       (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
-	nlwidth = (int)
-	       (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
-    }
-    else
-    {
-	addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
-	nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
-    }
-
-    miFillArcSetup(arc, &info);
-    MIFILLARCSETUP();
-    xorg += pDraw->x;
-    yorg += pDraw->y;
-    addrlb = addrlt;
-    addrlt += nlwidth * (yorg - y);
-    addrlb += nlwidth * (yorg + y + dy);
-    while (y)
-    {
-	addrlt += nlwidth;
-	addrlb -= nlwidth;
-	MIFILLARCSTEP(slw);
-	if (!slw)
-	    continue;
-	xpos = xorg - x;
-	addrl = addrlt + (xpos >> PWSH);
-	if (((xpos & PIM) + slw) < PPW)
-	{
-	    maskpartialbits(xpos, slw, startmask);
-	    UPDRW(addrl,startmask);
-	    if (miFillArcLower(slw))
-	    {
-		addrl = addrlb + (xpos >> PWSH);
-		UPDRW(addrl,startmask);
-	    }
-	    continue;
-	}
-	maskbits(xpos, slw, startmask, endmask, nlmiddle);
-	if (startmask)
-	{
-	    UPDRW(addrl,startmask); addrl++;
-	}
-	n = nlmiddle;
-	while (n--) {
-	    UPDRW(addrl,~0); addrl++;
-	}
-	if (endmask)
-	{
-	    UPDRW(addrl,endmask);
-	}
-	if (!miFillArcLower(slw))
-	    continue;
-	addrl = addrlb + (xpos >> PWSH);
-	if (startmask)
-	{
-	    UPDRW(addrl,startmask); addrl++;
-	}
-	n = nlmiddle;
-	while (n--) {
-	    UPDRW(addrl,~0); addrl++;
-	}
-	if (endmask)
-	{
-	    UPDRW(addrl,endmask);
-	}
-    }
-}
-
-#define FILLSPAN(xl,xr,addr) \
-    if (xr >= xl) \
-    { \
-	width = xr - xl + 1; \
-	addrl = addr + (xl >> PWSH); \
-	if (((xl & PIM) + width) < PPW) \
-	{ \
-	    maskpartialbits(xl, width, startmask); \
-	    UPDRW(addrl,startmask); \
-	} \
-	else \
-	{ \
-	    maskbits(xl, width, startmask, endmask, nlmiddle); \
-	    if (startmask) \
-	    { \
-		UPDRW(addrl,startmask); addrl++; \
-	    } \
-	    n = nlmiddle; \
-		while (n--) { \
-		    UPDRW(addrl,~0); addrl++; \
-		} \
-	    if (endmask) \
-	    { \
-		UPDRW(addrl,endmask); \
-	    } \
-	} \
-    }
-
-#define FILLSLICESPANS(flip,addr) \
-    if (!flip) \
-    { \
-	FILLSPAN(xl, xr, addr); \
-    } \
-    else \
-    { \
-	xc = xorg - x; \
-	FILLSPAN(xc, xr, addr); \
-	xc += slw - 1; \
-	FILLSPAN(xl, xc, addr); \
-    }
-
-static void
-v16FillArcSliceSolidCopy
-(
-    DrawablePtr pDraw,
-    GCPtr pGC,
-    xArc *arc
-)
-{
-    register int *addrl;
-    register int n;
-    int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
-    register int x, y, e;
-    miFillArcRec info;
-    miArcSliceRec slice;
-    int xl, xr, xc;
-    int *addrlt, *addrlb;
-    int nlwidth;
-    int width;
-    int startmask, endmask, nlmiddle;
-
-    if (pDraw->type == DRAWABLE_WINDOW)
-    {
-	addrlt = (int *)
-	       (((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
-	nlwidth = (int)
-	       (((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
-    }
-    else
-    {
-	addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
-	nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
-    }
-
-    miFillArcSetup(arc, &info);
-    miFillArcSliceSetup(arc, &slice, pGC);
-    MIFILLARCSETUP();
-    xorg += pDraw->x;
-    yorg += pDraw->y;
-    addrlb = addrlt;
-    addrlt += nlwidth * (yorg - y);
-    addrlb += nlwidth * (yorg + y + dy);
-    slice.edge1.x += pDraw->x;
-    slice.edge2.x += pDraw->x;
-    while (y > 0)
-    {
-	addrlt += nlwidth;
-	addrlb -= nlwidth;
-	MIFILLARCSTEP(slw);
-	MIARCSLICESTEP(slice.edge1);
-	MIARCSLICESTEP(slice.edge2);
-	if (miFillSliceUpper(slice))
-	{
-	    MIARCSLICEUPPER(xl, xr, slice, slw);
-	    FILLSLICESPANS(slice.flip_top, addrlt);
-	}
-	if (miFillSliceLower(slice))
-	{
-	    MIARCSLICELOWER(xl, xr, slice, slw);
-	    FILLSLICESPANS(slice.flip_bot, addrlb);
-	}
-    }
-}
-
-static void
-xf4bppPolyFillArcSolid
-(
-    register DrawablePtr pDraw,
-    GCPtr	pGC,
-    int		narcs,
-    xArc	*parcs
-)
-{
-    register xArc *arc;
-    register int i;
-    BoxRec box;
-    RegionPtr cclip;
-#if 0
-    mfbPrivGC *priv;
-    int rop;
-
-    priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey());
-    rop = priv->rop;
-    if ((rop == RROP_NOP) || !(pGC->planemask & 1))
-#else
-    if ( !(pGC->planemask & 0x0F))
-#endif
-	return;
-    cclip = pGC->pCompositeClip;
-    for (arc = parcs, i = narcs; --i >= 0; arc++)
-    {
-	if (miFillArcEmpty(arc))
-	    continue;
-	if (miCanFillArc(arc))
-	{
-	    box.x1 = arc->x + pDraw->x;
-	    box.y1 = arc->y + pDraw->y;
-	    box.x2 = box.x1 + (int)arc->width + 1;
-	    box.y2 = box.y1 + (int)arc->height + 1;
-	    if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
-	    {
-		if ((arc->angle2 >= FULLCIRCLE) ||
-		    (arc->angle2 <= -FULLCIRCLE))
-		    DO_WM3(pGC,v16FillEllipseSolid(pDraw, arc))
-		else
-		    DO_WM3(pGC,v16FillArcSliceSolidCopy(pDraw, pGC, arc)) 
-		continue;
-	    }
-	}
-	miPolyFillArc(pDraw, pGC, 1, arc);
-    }
-}
-
-void
-xf4bppPolyFillArc(pDraw, pGC, narcs, parcs)
-    register DrawablePtr pDraw;
-    GCPtr	pGC;
-    int		narcs;
-    xArc	*parcs;
-{
-    if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema || (pGC->fillStyle != FillSolid) ) {
-	miPolyFillArc(pDraw, pGC, narcs, parcs);
-    } else {
-        xf4bppPolyFillArcSolid(pDraw, pGC, narcs, parcs);
-    }
-}
diff --git a/hw/xfree86/xf4bpp/mfbhrzvert.c b/hw/xfree86/xf4bpp/mfbhrzvert.c
deleted file mode 100644
index 3444f48..0000000
--- a/hw/xfree86/xf4bpp/mfbhrzvert.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* GJA -- modified this file for vga16 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "wm3.h"
-
-/* horizontal solid line
-   abs(len) > 1
-*/
-
-void
-xf4bppHorzS(addrl, nlwidth, x1, y1, len)
-register PixelType *addrl;	/* pointer to base of bitmap */
-register int nlwidth;	/* width in longwords of bitmap */
-int x1;			/* initial point */ 
-int y1;
-int len;		/* length of line */
-{
-    register PixelType startmask;
-    register PixelType endmask;
-    register int nlmiddle;
-
-
-    /* force the line to go left to right
-       but don't draw the last point
-    */
-    if (len < 0)
-    {
-	x1 += len;
-	x1 += 1;
-	len = -len;
-    }
-
-    addrl = mfbScanline(addrl, x1, y1, nlwidth);
-
-    /* all bits inside same longword */
-    if ( ((x1 & PIM) + len) < PPW)
-    {
-	maskpartialbits(x1, len, startmask);
-	UPDRW(addrl,startmask);
-    }
-    else
-    {
-	maskbits(x1, len, startmask, endmask, nlmiddle);
-	if (startmask) {
-	    UPDRW(addrl,startmask); addrl++;
-	}
-	Duff (nlmiddle, UPDRW(addrl,~0); addrl++);
-	if (endmask) {
-	    UPDRW(addrl,endmask);
-	}
-    }
-}
-
-/* vertical solid line
-   this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
-   better code.  sigh.  we know that len will never be 0 or 1, so
-   it's OK to use it.
-*/
-
-void
-xf4bppVertS(addrl, nlwidth, x1, y1, len)
-register PixelType *addrl;	/* pointer to base of bitmap */
-register int nlwidth;	/* width in longwords of bitmap */
-int x1, y1;		/* initial point */
-register int len;	/* length of line */
-{
-    register PixelType bitmask;
-
-    addrl = mfbScanline(addrl, x1, y1, nlwidth);
-
-    if (len < 0)
-    {
-	nlwidth = -nlwidth;
-	len = -len;
-    }
- 
-    bitmask = mfbGetmask(x1 & PIM);
-    Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth);
-}
diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c
deleted file mode 100644
index 4f95611..0000000
--- a/hw/xfree86/xf4bpp/mfbimggblt.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "dixfontstr.h"
-#include "ppcGCstr.h"
-#include "wm3.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-/*
-    we should eventually special-case fixed-width fonts for ImageText.
-
-    this works for fonts with glyphs <= 32 bits wide.
-
-    the clipping calculations are done for worst-case fonts.
-we make no assumptions about the heights, widths, or bearings
-of the glyphs.  if we knew that the glyphs are all the same height,
-we could clip the tops and bottoms per clipping box, rather
-than per character per clipping box.  if we knew that the glyphs'
-left and right bearings were wlle-behaved, we could clip a single
-character at the start, output until the last unclipped
-character, and then clip the last one.  this is all straightforward
-to determine based on max-bounds and min-bounds from the font.
-    there is some inefficiency introduced in the per-character
-clipping to make what's going on clearer.
-
-    (it is possible, for example, for a font to be defined in which the
-next-to-last character in a font would be clipped out, but the last
-one wouldn't.  the code below deals with this.)
-
-    Image text looks at the bits in the glyph and the fg and bg in the
-GC.  it paints a rectangle, as defined in the protocol dcoument,
-and the paints the characters.
-
-   to avoid source proliferation, this file is compiled
-three times:
-	MFBIMAGEGLYPHBLT	OPEQ
-	mfbImageGlyphBltWhite	|=
-	mfbImageGlyphBltBlack	&=~
-
-    the register allocations for startmask and endmask may not
-be the right thing.  are there two other deserving candidates?
-xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
-*/
-
-/* Forward declarations -- GJA */
-static void doImageGlyphBlt(
-    DrawablePtr,
-    GC *,
-    int,
-    int,
-    unsigned int,
-    CharInfoPtr *,
-    unsigned char *,
-    ExtentInfoRec *
-);
-
-void
-xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
-    DrawablePtr pDrawable;
-    GC 		*pGC;
-    int 	x, y;
-    unsigned int nglyph;
-    CharInfoPtr *ppci;		/* array of character info */
-    pointer	pglyphBase;	/* start of array of glyphs */
-{
-    ExtentInfoRec info;	/* used by QueryGlyphExtents() */
-    xRectangle backrect;/* backing rectangle to paint.
-			   in the general case, NOT necessarily
-			   the same as the string's bounding box
-			*/
-    /* GJA -- I agree, this ALL should be moved to GC validation. */
-    if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) ||
-         !xf86Screens[pDrawable->pScreen->myNum]->vtSema ||
-         ((pGC->font) &&
-	    (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
-	     FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
-	     FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) {
-       miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-    } else {
-       ppcPrivGC *pPrivGC;
-       int oldfillStyle, oldfg, oldalu;
-
-       if (!(pGC->planemask & 0x0F))
-   	   return;
-
-       QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
-
-       backrect.x = x;
-       backrect.y = y - FONTASCENT(pGC->font);
-       backrect.width = info.overallWidth;
-       backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
-
-
-       pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					       mfbGetGCPrivateKey());
-       oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
-       oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
-       oldalu = pPrivGC->colorRrop.alu; /* GJA */
-
-       pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */
-       pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */
-       pGC->fgPixel = pGC->bgPixel;
-       pPrivGC->colorRrop.alu = GXcopy; /* GJA */
-       pGC->alu = GXcopy;
-
-       /* Required fields:
-        * colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel
-        */
-       xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect);
-
-       pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */
-       pGC->fgPixel = oldfg;
-
-       /* the faint-hearted can open their eyes now */
-
-       DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci,
-			pglyphBase,&info))
-
-       pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */
-       pPrivGC->colorRrop.alu = oldalu; /* GJA */
-       pGC->alu = oldalu;
-    }
-
-}
-
-static void
-doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
-    DrawablePtr pDrawable;
-    GC 		*pGC;
-    int 	x, y;
-    unsigned int nglyph;
-    CharInfoPtr *ppci;		/* array of character info */
-    unsigned char *pglyphBase;	/* start of array of glyphs */
-    ExtentInfoRec* infop;	/* used by QueryGlyphExtents() */
-{
-    BoxRec bbox;	/* string's bounding box */
-
-    CharInfoPtr pci;
-    int xorg, yorg;	/* origin of drawable in bitmap */
-    int widthDst;	/* width of dst in longwords */
-
-			/* these keep track of the character origin */
-    CARD32 *pdstBase;
-			/* points to longword with character origin */
-    int xchar;		/* xorigin of char (mod 32) */
-
-			/* these are used for placing the glyph */
-    register int xoff;	/* x offset of left edge of glyph (mod 32) */
-    register CARD32 *pdst;
-			/* pointer to current longword in dst */
-
-    int w;		/* width of glyph in bits */
-    int h;		/* height of glyph */
-    int widthGlyph;	/* width of glyph, in bytes */
-    register unsigned char *pglyph;
-			/* pointer to current row of glyph */
-
-			/* used for putting down glyph */    
-    register unsigned int tmpSrc;
-			/* for getting bits from glyph */
-    register int startmask;
-    register int endmask;
-
-    register int nFirst;/* bits of glyph in current longword */
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    if (pDrawable->type == DRAWABLE_WINDOW)
-    {
-	pdstBase = (CARD32 *)
-		(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
-	widthDst = (int)
-		 (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
-    }
-    else
-    {
-	pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
-	widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
-    }
-
-    x += xorg;
-    y += yorg;
-    bbox.x1 = x + infop->overallLeft;
-    bbox.x2 = x + infop->overallRight;
-    bbox.y1 = y - infop->overallAscent;
-    bbox.y2 = y + infop->overallDescent;
-
-    /* UNCLEAN CODE
-       we know the mfbPolyFillRect uses only three fields in
-       devPrivate[mfbGetGCPrivateIndex()].ptr, two of which (the rotated
-       tile/stipple and the ropFillArea) are 
-       irrelevant for solid filling, so we just poke the FillArea
-       field.  the GC is now in an inconsistent state, but we'll fix
-       it as soon as PolyFillRect returns.  fortunately, the server
-       is single threaded.
-
-    NOTE:
-       if you are not using the standard mfbFillRectangle code, you
-       need to poke any fields in the GC the rectangle stuff need
-       (probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGetGCPrivateIndex()].ptr
-       (probably rop or ropFillArea.)  You could just call ValidateGC,
-       but that is usually not a cheap thing to do.
-    */
-
-    switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
-    {
-      case rgnOUT:
-	break;
-      case rgnIN:
-        pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
-        xchar = x & PIM;
-
-        while(nglyph--)
-        {
-	    pci = *ppci;
-	    pglyph = FONTGLYPHBITS(pglyphBase, pci);
-	    w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
-	    h = pci->metrics.ascent + pci->metrics.descent;
-	    widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    /* start at top scanline of glyph */
-	    pdst = pdstBase - (pci->metrics.ascent * widthDst);
-
-	    /* find correct word in scanline and x offset within it
-	       for left edge of glyph
-	    */
-	    xoff = xchar + pci->metrics.leftSideBearing;
-	    if (xoff > PIM)
-	    {
-	        pdst++;
-	        xoff &= PIM;
-	    }
-	    else if (xoff < 0)
-	    {
-	        xoff += PPW;
-	        pdst--;
-	    }
-
-	    if ((xoff + w) <= PPW)
-	    {
-	        /* glyph all in one longword */
-	        maskpartialbits(xoff, w, startmask);
-
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
-		    pglyph += widthGlyph;
-		    pdst += widthDst;
-	        }
-	    }
-	    else
-	    {
-	        /* glyph crosses longword boundary */
-	        maskPPWbits(xoff, w, startmask, endmask);
-	        nFirst = PPW - xoff;
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
-		    UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
-		    pglyph += widthGlyph;
-		    pdst += widthDst;
-	        }
-	    } /* glyph crosses longwords boundary */
-
-	    /* update character origin */
-	    x += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-	        xchar -= PPW;
-	        pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-	        xchar += PPW;
-	        pdstBase--;
-	    }
-	    ppci++;
-        } /* while nglyph-- */
-	break;
-      case rgnPART:
-      {
-	TEXTPOS *ppos;
-	int nbox;
-	BoxPtr pbox;
-	RegionPtr cclip;
-	int xpos;		/* x position of char origin */
-	unsigned int i;
-	BoxRec clip;
-	int leftEdge, rightEdge;
-	int topEdge, bottomEdge;
-	int glyphRow;		/* first row of glyph not wholly
-				   clipped out */
-	int glyphCol;		/* leftmost visible column of glyph */
-#if GETLEFTBITS_ALIGNMENT > 1
-	int getWidth;		/* bits to get from glyph */
-#endif
-
-	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
-	    return;
-
-        pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
-        xpos = x;
-	xchar = xpos & PIM;
-
-	for (i=0; i<nglyph; i++)
-	{
-	    pci = ppci[i];
-
-	    ppos[i].xpos = xpos;
-	    ppos[i].xchar = xchar;
-	    ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
-	    ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
-	    ppos[i].topEdge = y - pci->metrics.ascent;
-	    ppos[i].bottomEdge = y + pci->metrics.descent;
-	    ppos[i].pdstBase = pdstBase;
-	    ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    xpos += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-		xchar &= PIM;
-		pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-		xchar += PPW;
-		pdstBase--;
-	    }
-	}
-
-	cclip = pGC->pCompositeClip;
-	pbox = REGION_RECTS(cclip);
-	nbox = REGION_NUM_RECTS(cclip);
-
-	/* HACK ALERT
-	   since we continue out of the loop below so often, it
-	   is easier to increment pbox at the  top than at the end.
-	   don't try this at home.
-	*/
-	pbox--;
-	while(nbox--)
-	{
-	    pbox++;
-	    clip.x1 = max(bbox.x1, pbox->x1);
-	    clip.y1 = max(bbox.y1, pbox->y1);
-	    clip.x2 = min(bbox.x2, pbox->x2);
-	    clip.y2 = min(bbox.y2, pbox->y2);
-	    if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
-		continue;
-
-	    for(i=0; i<nglyph; i++)
-	    {
-		pci = ppci[i];
-		xchar = ppos[i].xchar;
-
-		/* clip the left and right edges */
-		if (ppos[i].leftEdge < clip.x1)
-		    leftEdge = clip.x1;
-		else
-		    leftEdge = ppos[i].leftEdge;
-
-		if (ppos[i].rightEdge > clip.x2)
-		    rightEdge = clip.x2;
-		else
-		    rightEdge = ppos[i].rightEdge;
-
-		w = rightEdge - leftEdge;
-		if (w <= 0)
-		    continue;
-
-		/* clip the top and bottom edges */
-		if (ppos[i].topEdge < clip.y1)
-		    topEdge = clip.y1;
-		else
-		    topEdge = ppos[i].topEdge;
-
-		if (ppos[i].bottomEdge > clip.y2)
-		    bottomEdge = clip.y2;
-		else
-		    bottomEdge = ppos[i].bottomEdge;
-
-		h = bottomEdge - topEdge;
-		if (h <= 0)
-		    continue;
-
-		glyphRow = (topEdge - y) + pci->metrics.ascent;
-		widthGlyph = ppos[i].widthGlyph;
-		pglyph = FONTGLYPHBITS(pglyphBase, pci);
-		pglyph += (glyphRow * widthGlyph);
-
-		pdst = ppos[i].pdstBase - ((y-topEdge) * widthDst);
-
-		glyphCol = (leftEdge - ppos[i].xpos) -
-			   (pci->metrics.leftSideBearing);
-#if GETLEFTBITS_ALIGNMENT > 1
-		getWidth = w + glyphCol;
-#endif
-		xoff = xchar + (leftEdge - ppos[i].xpos);
-		if (xoff > PLST)
-		{
-		    xoff &= PIM;
-		    pdst++;
-		}
-		else if (xoff < 0)
-		{
-		    xoff += PPW;
-		    pdst--;
-		}
-
-		if ((xoff + w) <= PPW)
-		{
-		    maskpartialbits(xoff, w, startmask);
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
-			pglyph += widthGlyph;
-			pdst += widthDst;
-		    }
-		}
-		else
-		{
-		    maskPPWbits(xoff, w, startmask, endmask);
-		    nFirst = PPW - xoff;
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
-			UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
-			pglyph += widthGlyph;
-			pdst += widthDst;
-		    }
-		}
-	    } /* for each glyph */
-	} /* while nbox-- */
-	xfree(ppos);
-	break;
-      }
-      default:
-	break;
-    }
-}
-
diff --git a/hw/xfree86/xf4bpp/mfbline.c b/hw/xfree86/xf4bpp/mfbline.c
deleted file mode 100644
index d2d4e0b..0000000
--- a/hw/xfree86/xf4bpp/mfbline.c
+++ /dev/null
@@ -1,976 +0,0 @@
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* GJA -- modified this file for vga16 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "miline.h"
-#include "vgaVideo.h"
-#include "wm3.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-/* single-pixel lines on a color frame buffer
-
-   NON-SLOPED LINES
-   horizontal lines are always drawn left to right; we have to
-move the endpoints right by one after they're swapped.
-   horizontal lines will be confined to a single band of a
-region.  the code finds that band (giving up if the lower
-bound of the band is above the line we're drawing); then it
-finds the first box in that band that contains part of the
-line.  we clip the line to subsequent boxes in that band.
-   vertical lines are always drawn top to bottom (y-increasing.)
-this requires adding one to the y-coordinate of each endpoint
-after swapping.
-
-   SLOPED LINES
-   when clipping a sloped line, we bring the second point inside
-the clipping box, rather than one beyond it, and then add 1 to
-the length of the line before drawing it.  this lets us use
-the same box for finding the outcodes for both endpoints.  since
-the equation for clipping the second endpoint to an edge gives us
-1 beyond the edge, we then have to move the point towards the
-first point by one step on the major axis.
-   eventually, there will be a diagram here to explain what's going
-on.  the method uses Cohen-Sutherland outcodes to determine
-outsideness, and a method similar to Pike's layers for doing the
-actual clipping.
-
-*/
-#ifdef POLYSEGMENT
-static void DoV16SegmentSS(
-    DrawablePtr, GCPtr, int, xSegment*
-);
-
-void
-xf4bppSegmentSS (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-{
-    if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
-	miPolySegment(pDrawable, pGC, nseg, pSeg);
-    } else {
-	DO_WM3(pGC,DoV16SegmentSS (pDrawable, pGC, nseg, pSeg));
-    }
-}
-
-#else
-static void DoV16LineSS(
-    DrawablePtr, GCPtr, int, int, DDXPointPtr
-);
-
-void
-xf4bppLineSS (pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		mode;		/* Origin or Previous */
-    int		npt;		/* number of points */
-    DDXPointPtr pptInit;
-{
-    if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
-	miZeroLine(pDrawable, pGC, mode, npt, pptInit);
-    } else {
-	DO_WM3(pGC,DoV16LineSS (pDrawable, pGC, mode, npt, pptInit));
-    }
-}
-#endif
-
-static void
-#ifdef POLYSEGMENT
-DoV16SegmentSS (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-#else
-DoV16LineSS (pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		mode;		/* Origin or Previous */
-    int		npt;		/* number of points */
-    DDXPointPtr pptInit;
-#endif
-{
-    int nboxInit;
-    register int nbox;
-    BoxPtr pboxInit;
-    register BoxPtr pbox;
-#ifndef POLYSEGMENT
-    register DDXPointPtr ppt;	/* pointer to list of translated points */
-#endif
-
-    unsigned int oc1;		/* outcode of point 1 */
-    unsigned int oc2;		/* outcode of point 2 */
-
-    PixelType *addrlBase;	/* pointer to start of drawable */
-#ifndef POLYSEGMENT
-    PixelType *addrl;		/* address of destination pixmap */
-#endif
-    int nlwidth;		/* width in longwords of destination pixmap */
-    int xorg, yorg;		/* origin of window */
-
-    int adx;		/* abs values of dx and dy */
-    int ady;
-    int signdx;		/* sign of dx and dy */
-    int signdy;
-    int e, e1, e2;		/* bresenham error and increments */
-    int len;			/* length of segment */
-    int axis;			/* major axis */
-    int octant;
-    unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-
-				/* a bunch of temporaries */
-    register int y1, y2;
-    register int x1, x2;
-    RegionPtr cclip;
-#ifndef POLYSEGMENT
-    int	     alu = pGC->alu; /* GJA */
-#endif
-
-    if (!(pGC->planemask & 0x0F))
-	return;
-
-    cclip = pGC->pCompositeClip;
-    pboxInit = REGION_RECTS(cclip);
-    nboxInit = REGION_NUM_RECTS(cclip);
-
-    nlwidth = BYTES_PER_LINE(pDrawable) >> 2;	/* GJA */
-    addrlBase = (PixelType *)VIDBASE(pDrawable);		/* GJA */
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-#ifdef POLYSEGMENT
-    while (nseg--)
-#else
-    ppt = pptInit;
-    x2 = ppt->x + xorg;
-    y2 = ppt->y + yorg;
-    while(--npt)
-#endif
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-
-#ifdef POLYSEGMENT
-	x1 = pSeg->x1 + xorg;
-	y1 = pSeg->y1 + yorg;
-	x2 = pSeg->x2 + xorg;
-	y2 = pSeg->y2 + yorg;
-	pSeg++;
-#else
-	x1 = x2;
-	y1 = y2;
-	++ppt;
-	if (mode == CoordModePrevious)
-	{
-	    xorg = x1;
-	    yorg = y1;
-	}
-	x2 = ppt->x + xorg;
-	y2 = ppt->y + yorg;
-#endif
-
-	if (x1 == x2) /* vertical line */
-	{
-	    /* make the line go top to bottom of screen, keeping
-	       endpoint semantics
-	    */
-	    if (y1 > y2)
-	    {
-		register int tmp;
-
-		tmp = y2;
-		y2 = y1 + 1;
-		y1 = tmp + 1;
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    y1--;
-#endif
-	    }
-#ifdef POLYSEGMENT
-	    else if (pGC->capStyle != CapNotLast)
-		y2++;
-#endif
-	    /* get to first band that might contain part of line */
-	    while ((nbox) && (pbox->y2 <= y1))
-	    {
-		pbox++;
-		nbox--;
-	    }
-
-	    if (nbox)
-	    {
-		/* stop when lower edge of box is beyond end of line */
-		while((nbox) && (y2 >= pbox->y1))
-		{
-		    if ((x1 >= pbox->x1) && (x1 < pbox->x2))
-		    {
-			int y1t, y2t;
-			/* this box has part of the line in it */
-			y1t = max(y1, pbox->y1);
-			y2t = min(y2, pbox->y2);
-			if (y1t != y2t)
-			{
-			    xf4bppVertS (addrlBase, nlwidth, 
-				      x1, y1t, y2t-y1t);
-			}
-		    }
-		    nbox--;
-		    pbox++;
-		}
-	    }
-#ifndef POLYSEGMENT
-	    y2 = ppt->y + yorg;
-#endif
-	}
-	else if (y1 == y2) /* horizontal line */
-	{
-	    /* force line from left to right, keeping
-	       endpoint semantics
-	    */
-	    if (x1 > x2)
-	    {
-		register int tmp;
-
-		tmp = x2;
-		x2 = x1 + 1;
-		x1 = tmp + 1;
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    x1--;
-#endif
-	    }
-#ifdef POLYSEGMENT
-	    else if (pGC->capStyle != CapNotLast)
-		x2++;
-#endif
-
-	    /* find the correct band */
-	    while( (nbox) && (pbox->y2 <= y1))
-	    {
-		pbox++;
-		nbox--;
-	    }
-
-	    /* try to draw the line, if we haven't gone beyond it */
-	    if ((nbox) && (pbox->y1 <= y1))
-	    {
-		int tmp;
-
-		/* when we leave this band, we're done */
-		tmp = pbox->y1;
-		while((nbox) && (pbox->y1 == tmp))
-		{
-		    int	x1t, x2t;
-
-		    if (pbox->x2 <= x1)
-		    {
-			/* skip boxes until one might contain start point */
-			nbox--;
-			pbox++;
-			continue;
-		    }
-
-		    /* stop if left of box is beyond right of line */
-		    if (pbox->x1 >= x2)
-		    {
-			nbox = 0;
-			break;
-		    }
-
-		    x1t = max(x1, pbox->x1);
-		    x2t = min(x2, pbox->x2);
-		    if (x1t != x2t)
-		    {
-			xf4bppHorzS (addrlBase, nlwidth, 
-				  x1t, y1, x2t-x1t);
-		    }
-		    nbox--;
-		    pbox++;
-		}
-	    }
-#ifndef POLYSEGMENT
-	    x2 = ppt->x + xorg;
-#endif
-	}
-	else	/* sloped line */
-	{
-	    CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
-			   1, 1, octant);
-
-	    if (adx > ady)
-	    {
-		axis = X_AXIS;
-		e1 = ady << 1;
-		e2 = e1 - (adx << 1);
-		e = e1 - adx;
-	    }
-	    else
-	    {
-		axis = Y_AXIS;
-		e1 = adx << 1;
-		e2 = e1 - (ady << 1);
-		e = e1 - ady;
-		SetYMajorOctant(octant);
-	    }
-
-	    FIXUP_ERROR(e, octant, bias);
-
-	    /* we have bresenham parameters and two points.
-	       all we have to do now is clip and draw.
-	    */
-
-	    while(nbox--)
-	    {
-		oc1 = 0;
-		oc2 = 0;
-		OUTCODES(oc1, x1, y1, pbox);
-		OUTCODES(oc2, x2, y2, pbox);
-		if ((oc1 | oc2) == 0)
-		{
-		    if (axis == X_AXIS)
-			len = adx;
-		    else
-			len = ady;
-#ifdef POLYSEGMENT
-		    if (pGC->capStyle != CapNotLast)
-			len++;
-#endif
-		    xf4bppBresS (addrlBase, nlwidth,
-			  signdx, signdy, axis, x1, y1,
-			  e, e1, e2, len);
-		    break;
-		}
-		else if (oc1 & oc2)
-		{
-		    pbox++;
-		}
-		else
-		{
-		    int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
-		    int clip1 = 0, clip2 = 0;
-		    int clipdx, clipdy;
-		    int err;
-		    
-		    if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
-				       pbox->y2-1,
-				       &new_x1, &new_y1, &new_x2, &new_y2,
-				       adx, ady, &clip1, &clip2,
-				       octant, bias, oc1, oc2) == -1)
-		    {
-			pbox++;
-			continue;
-		    }
-
-		    if (axis == X_AXIS)
-			len = abs(new_x2 - new_x1);
-		    else
-			len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
-		    if (clip2 != 0 || pGC->capStyle != CapNotLast)
-			len++;
-#else
-		    len += (clip2 != 0);
-#endif
-		    if (len)
-		    {
-			/* unwind bresenham error term to first point */
-			if (clip1)
-			{
-			    clipdx = abs(new_x1 - x1);
-			    clipdy = abs(new_y1 - y1);
-			    if (axis == X_AXIS)
-				err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
-			    else
-				err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
-			}
-			else
-			    err = e;
-			xf4bppBresS (addrlBase, nlwidth,
-			     signdx, signdy, axis, new_x1, new_y1,
-			     err, e1, e2, len);
-		    }
-		    pbox++;
-		}
-	    } /* while (nbox--) */
-	} /* sloped line */
-    } /* while (nline--) */
-
-#ifndef POLYSEGMENT
-
-    /* paint the last point if the end style isn't CapNotLast.
-       (Assume that a projecting, butt, or round cap that is one
-        pixel wide is the same as the single pixel of the endpoint.)
-    */
-
-    if ((pGC->capStyle != CapNotLast) &&
-	((ppt->x + xorg != pptInit->x + pDrawable->x) ||
-	 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
-	 (ppt == pptInit + 1)))
-    {
-	PixelType _mask;
-
-	if (alu == RROP_BLACK)
-		_mask = mfbGetrmask(x2 & PIM);
-	else
-		_mask = mfbGetmask(x2 & PIM);
-
-	nbox = nboxInit;
-	pbox = pboxInit;
-	while (nbox--)
-	{
-	    if ((x2 >= pbox->x1) &&
-		(y2 >= pbox->y1) &&
-		(x2 <  pbox->x2) &&
-		(y2 <  pbox->y2))
-	    {
-		addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
-		UPDRW(addrl,_mask);
-		break;
-	    }
-	    else
-		pbox++;
-	}
-    }
-#endif
-}
-
-/*
- * Draw dashed 1-pixel lines.
- */
-
-#ifdef POLYSEGMENT
-static void DoV16SegmentSD(
-    DrawablePtr, GCPtr, int, xSegment*
-);
-
-void
-xf4bppSegmentSD (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-{
-    if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
-	miPolySegment(pDrawable, pGC, nseg, pSeg);
-    } else {
-	DO_WM3(pGC,DoV16SegmentSD (pDrawable, pGC, nseg, pSeg));
-    }
-}
-
-#else
-static void DoV16LineSD(
-    DrawablePtr, GCPtr, int, int, DDXPointPtr
-);
-
-void
-xf4bppLineSD (pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		mode;		/* Origin or Previous */
-    int		npt;		/* number of points */
-    DDXPointPtr pptInit;
-{
-    if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
-	miZeroDashLine(pDrawable, pGC, mode, npt, pptInit);
-    } else {
-	DO_WM3(pGC,DoV16LineSD (pDrawable, pGC, mode, npt, pptInit));
-    }
-}
-#endif
-
-static void
-#ifdef POLYSEGMENT
-DoV16SegmentSD (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    register GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-#else
-DoV16LineSD( pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    register GCPtr pGC;
-    int mode;		/* Origin or Previous */
-    int npt;		/* number of points */
-    DDXPointPtr pptInit;
-#endif
-{
-    int nboxInit;
-    register int nbox;
-    BoxPtr pboxInit;
-    register BoxPtr pbox;
-#ifndef POLYSEGMENT
-    register DDXPointPtr ppt;	/* pointer to list of translated points */
-#endif
-
-    register unsigned int oc1;	/* outcode of point 1 */
-    register unsigned int oc2;	/* outcode of point 2 */
-
-    PixelType *addrl;		/* address of destination pixmap */
-    int nlwidth;		/* width in longwords of destination pixmap */
-    int xorg, yorg;		/* origin of window */
-
-    int adx;		/* abs values of dx and dy */
-    int ady;
-    int signdx;		/* sign of dx and dy */
-    int signdy;
-    int e, e1, e2;		/* bresenham error and increments */
-    int len;			/* length of segment */
-    int axis;			/* major axis */
-    int octant;
-    unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-    int x1, x2, y1, y2;
-    RegionPtr cclip;
-    int		    fgink, bgink; /* GJA */
-    unsigned char   *pDash;
-    int		    dashOffset;
-    int		    numInDashList;
-    int		    dashIndex;
-    int		    isDoubleDash;
-    int		    dashIndexTmp, dashOffsetTmp;
-    int		    unclippedlen;
-
-    if (!(pGC->planemask & 0x0F))
-	return;
-
-    cclip = pGC->pCompositeClip;
-    fgink = bgink = pGC->fgPixel;	/* GJA */
-    pboxInit = REGION_RECTS(cclip);
-    nboxInit = REGION_NUM_RECTS(cclip);
-
-    nlwidth = BYTES_PER_LINE(pDrawable) >> 2;	/* GJA */
-    addrl = (PixelType *)VIDBASE(pDrawable);	/* GJA */
-
-    /* compute initial dash values */
-     
-    pDash = (unsigned char *) pGC->dash;
-    numInDashList = pGC->numInDashList;
-    isDoubleDash = (pGC->lineStyle == LineDoubleDash);
-    dashIndex = 0;
-    dashOffset = 0;
-    miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
-		numInDashList, &dashOffset);
-
-    if (isDoubleDash)
-	bgink = pGC->bgPixel; /* GJA */
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-#ifdef POLYSEGMENT
-    while (nseg--)
-#else
-    ppt = pptInit;
-    x2 = ppt->x + xorg;
-    y2 = ppt->y + yorg;
-    while(--npt)
-#endif
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-
-#ifdef POLYSEGMENT
-	x1 = pSeg->x1 + xorg;
-	y1 = pSeg->y1 + yorg;
-	x2 = pSeg->x2 + xorg;
-	y2 = pSeg->y2 + yorg;
-	pSeg++;
-#else
-	x1 = x2;
-	y1 = y2;
-	++ppt;
-	if (mode == CoordModePrevious)
-	{
-	    xorg = x1;
-	    yorg = y1;
-	}
-	x2 = ppt->x + xorg;
-	y2 = ppt->y + yorg;
-#endif
-
-	CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
-
-	if (adx > ady)
-	{
-	    axis = X_AXIS;
-	    e1 = ady << 1;
-	    e2 = e1 - (adx << 1);
-	    e = e1 - adx;
-	    unclippedlen = adx;
-	}
-	else
-	{
-	    axis = Y_AXIS;
-	    e1 = adx << 1;
-	    e2 = e1 - (ady << 1);
-	    e = e1 - ady;
-	    unclippedlen = ady;
-	    SetYMajorOctant(octant);
-	}
-
-	FIXUP_ERROR(e, octant, bias);
-
-	/* we have bresenham parameters and two points.
-	   all we have to do now is clip and draw.
-	*/
-
-	while(nbox--)
-	{
-	    oc1 = 0;
-	    oc2 = 0;
-	    OUTCODES(oc1, x1, y1, pbox);
-	    OUTCODES(oc2, x2, y2, pbox);
-	    if ((oc1 | oc2) == 0)
-	    {
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    unclippedlen++;
-		dashIndexTmp = dashIndex;
-		dashOffsetTmp = dashOffset;
-		xf4bppBresD (pDrawable, fgink, bgink,
-		      &dashIndexTmp, pDash, numInDashList,
-		      &dashOffsetTmp, isDoubleDash,
-		      addrl, nlwidth,
-		      signdx, signdy, axis, x1, y1,
-		      e, e1, e2, unclippedlen);
-		break;
-#else
-		xf4bppBresD (pDrawable, fgink, bgink,
-		      &dashIndex, pDash, numInDashList,
-		      &dashOffset, isDoubleDash,
-		      addrl, nlwidth,
-		      signdx, signdy, axis, x1, y1,
-		      e, e1, e2, unclippedlen);
-		goto dontStep;
-#endif
-	    }
-	    else if (oc1 & oc2)
-	    {
-		pbox++;
-	    }
-	    else /* have to clip */
-	    {
-		int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
-		int clip1 = 0, clip2 = 0;
-		int clipdx, clipdy;
-		int err;
-		
-		if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
-				   &new_x1, &new_y1, &new_x2, &new_y2,
-				   adx, ady, &clip1, &clip2,
-				   octant, bias, oc1, oc2) == -1)
-		{
-		    pbox++;
-		    continue;
-		}
-		dashIndexTmp = dashIndex;
-		dashOffsetTmp = dashOffset;
-		if (clip1)
-		{
-		    int dlen;
-		    
-		    if (axis == X_AXIS)
-			dlen = abs(new_x1 - x1);
-		    else
-			dlen = abs(new_y1 - y1);
-		    miStepDash (dlen, &dashIndexTmp, pDash,
-				numInDashList, &dashOffsetTmp);
-		}
-		if (axis == X_AXIS)
-		    len = abs(new_x2 - new_x1);
-		else
-		    len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
-		if (clip2 != 0 || pGC->capStyle != CapNotLast)
-		    len++;
-#else
-		len += (clip2 != 0);
-#endif
-		if (len)
-		{
-		    /* unwind bresenham error term to first point */
-		    if (clip1)
-		    {
-			clipdx = abs(new_x1 - x1);
-			clipdy = abs(new_y1 - y1);
-			if (axis == X_AXIS)
-			    err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
-			else
-			    err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
-		    }
-		    else
-			err = e;
-		    xf4bppBresD (pDrawable, fgink, bgink,
-			      &dashIndexTmp, pDash, numInDashList,
-			      &dashOffsetTmp, isDoubleDash,
-			      addrl, nlwidth,
-			      signdx, signdy, axis, new_x1, new_y1,
-			      err, e1, e2, len);
-		}
-		pbox++;
-	    }
-	} /* while (nbox--) */
-#ifndef POLYSEGMENT
-	/*
-	 * walk the dash list around to the next line
-	 */
-	miStepDash (unclippedlen, &dashIndex, pDash,
-		    numInDashList, &dashOffset);
-dontStep:	;
-#endif
-    } /* while (nline--) */
-
-#ifndef POLYSEGMENT
-    /* paint the last point if the end style isn't CapNotLast.
-       (Assume that a projecting, butt, or round cap that is one
-        pixel wide is the same as the single pixel of the endpoint.)
-    */
-
-    if ((pGC->capStyle != CapNotLast) &&
-        ((dashIndex & 1) == 0 || isDoubleDash) &&
-	((ppt->x + xorg != pptInit->x + pDrawable->x) ||
-	 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
-	 (ppt == pptInit + 1)))
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-	while (nbox--)
-	{
-	    if ((x2 >= pbox->x1) &&
-		(y2 >= pbox->y1) &&
-		(x2 <  pbox->x2) &&
-		(y2 <  pbox->y2))
-	    {
-		unsigned long _mask;
-
-		_mask = mfbGetmask(x2 & PIM);
-		addrl = mfbScanline(addrl, x2, y2, nlwidth);
-		UPDRW(addrl,_mask);
-		break;
-	    }
-	    else
-		pbox++;
-	}
-    }
-#endif
-}
-
-
-#if 0
-#ifndef POLYSEGMENT
-/*
-    the clipping code could be cleaned up some; most of its
-mess derives from originally being inline in the line code,
-then pulled out to make clipping dashes easier.
-*/
-
-int
-mfbClipLine(pbox, box,
-	    ppt1Orig, ppt1, ppt2, 
-	    adx, ady, signdx, signdy, axis,
-	    pclip1, pclip2)
-BoxPtr pbox;			/* box to clip to */
-BoxRec box;			/* box to do calculations with */
-DDXPointPtr ppt1Orig, ppt1, ppt2;
-int adx, ady;
-int signdx, signdy;
-register int axis;
-int *pclip1, *pclip2;
-{
-    DDXPointRec pt1Orig, pt1, pt2;
-    register int swapped = 0;
-    int clipDone = 0;
-    register unsigned int utmp;
-    register int oc1, oc2;
-    int clip1, clip2;
-
-    pt1Orig = *ppt1Orig;
-    pt1 = *ppt1;
-    pt2 = *ppt2;
-    clip1 = 0;
-    clip2 = 0;
-
-    do
-    {
-        oc1 = 0;
-        oc2 = 0;
-        OUTCODES(oc1, pt1.x, pt1.y, pbox);
-        OUTCODES(oc2, pt2.x, pt2.y, pbox);
-
-        if (oc1 & oc2)
-	    clipDone = -1;
-        else if ((oc1 | oc2) == 0)
-        {
-	    clipDone = 1;
-	    if (swapped)
-	    {
-	        SWAPPT(pt1, pt2);
-	        SWAPINT(oc1, oc2);
-	        SWAPINT(clip1, clip2);
-	    }
-        }
-        else /* have to clip */
-        {
-	    /* only clip one point at a time */
-	    if (!oc1)
-	    {
-	        SWAPPT(pt1, pt2);
-	        SWAPINT(oc1, oc2);
-	        SWAPINT(clip1, clip2);
-	        swapped = !swapped;
-	    }
-    
-	    clip1 |= oc1;
-	    if (oc1 & OUT_LEFT)
-	    {
-	      pt1.x = box.x1;
-	      utmp = abs(box.x1 - pt1Orig.x);
-	      utmp *= ady;
-	      if(axis==X_AXIS)
-	      {
-	        pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
-	      }
-	      else
-	      {
-		utmp <<= 1;
-		if (swapped)
-		    utmp += ady;
-		else
-		    utmp -= ady;
-		pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
-		if (swapped)
-		    pt1.y -= signdy;
-	      }
-	    }
-	    else if (oc1 & OUT_ABOVE)
-	    {
-	      pt1.y = box.y1;
-	      utmp = abs(box.y1 - pt1Orig.y);
-	      utmp *= adx;
-	      if (axis == Y_AXIS)
-	      {
-	        pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
-	      }
-	      else
-	      {
-		utmp <<= 1;
-		if (swapped)
-		    utmp += adx;
-		else
-		    utmp -= adx;
-		pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
-		if (swapped)
-		    pt1.x -= signdx;
-	      }
-	    }
-	    else if (oc1 & OUT_RIGHT)
-	    {
-	      pt1.x = box.x2;
-	      utmp = abs(pt1Orig.x - box.x2);
-	      utmp *= ady;
-	      if (axis == X_AXIS)
-	      {
-	        pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
-	      }
-	      else
-	      {
-		utmp <<= 1;
-		if (swapped)
-		    utmp += ady;
-		else
-		    utmp -= ady;
-		pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
-		if (swapped)
-		    pt1.y -= signdy;
-	      }
-	    }
-	    else if (oc1 & OUT_BELOW)
-	    {
-	      pt1.y = box.y2;
-	      utmp = abs(pt1Orig.y - box.y2);
-	      utmp *= adx;
-	      if (axis == Y_AXIS)
-	      {
-	        pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
-	      }
-	      else
-	      {
-		utmp <<= 1;
-		if (swapped)
-		    utmp += adx;
-		else
-		    utmp -= adx;
-		pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
-		if (swapped)
-		    pt1.x -= signdx;
-	      }
-	    }
-        } /* else have to clip */
-    } while(!clipDone);
-    *ppt1 = pt1;
-    *ppt2 = pt2;
-    *pclip1 = clip1;
-    *pclip2 = clip2;
-
-    return clipDone;
-}
-#endif
-#endif
diff --git a/hw/xfree86/xf4bpp/mfbzerarc.c b/hw/xfree86/xf4bpp/mfbzerarc.c
deleted file mode 100644
index 61fc7b1..0000000
--- a/hw/xfree86/xf4bpp/mfbzerarc.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/************************************************************
-
-Copyright (c) 1989  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-********************************************************/
-/* GJA -- Took mfb code and modified it. */
-
-/* Derived from:
- * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
- * by M. L. V. Pitteway
- * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "mizerarc.h"
-#include "wm3.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-/*
- * Note, LEFTMOST must be the bit leftmost in the actual screen
- * representation.  This depends on both BITMAP_BIT_ORDER and
- * IMAGE_BYTE_ORDER
- * DHD 10/92
- */
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#if (IMAGE_BYTE_ORDER == MSBFirst)
-#define LEFTMOST	((unsigned int) 0x80000000)
-#else
-#define LEFTMOST	((unsigned int) 0x80)
-#endif
-#else
-#if (IMAGE_BYTE_ORDER == LSBFirst)
-#define LEFTMOST	((unsigned int) 1)
-#else
-#define LEFTMOST	((unsigned int) 0x1000000)
-#endif
-#endif
-
-#define PixelateWhite(addr,off) \
-{ \
-    register int *tmpaddr = &((addr)[(off)>>PWSH]); \
-    UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \
-}
-#define PixelateBlack(addr,off) \
-{ \
-    register int *tmpaddr = &((addr)[(off)>>PWSH]); \
-    UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \
-}
-
-#define Pixelate(base,off) \
-{ \
-    paddr = base + ((off)>>PWSH); \
-    pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \
-    UPDRW(paddr,(pixel & pmask)); \
-}
-
-#define DoPix(bit,base,off) if (msk & bit) Pixelate(base,off);
-
-static void
-v16ZeroArcSS
-(
-    DrawablePtr pDraw,
-    GCPtr pGC,
-    xArc *arc
-)
-{
-    miZeroArcRec info;
-    Bool do360;
-    register int x, y, a, b, d, msk;
-    register int k1, k3, dx, dy;
-    int *addrl;
-    int *yorgl, *yorgol;
-    unsigned long pixel;
-    int nlwidth, yoffset, dyoffset;
-    int pmask;
-    register int *paddr;
-
-    if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-				       mfbGetGCPrivateKey()))->rop ==
-	RROP_BLACK)
-	pixel = 0;
-    else
-	pixel = ~0UL;
-
-    if (pDraw->type == DRAWABLE_WINDOW)
-    {
-	addrl = (int *)
-		(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
-	nlwidth = (int)
-		(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
-    }
-    else
-    {
-	addrl = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
-	nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
-    }
-
-    do360 = miZeroArcSetup(arc, &info, TRUE);
-    yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
-    yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
-    info.xorg += pDraw->x;
-    info.xorgo += pDraw->x;
-    MIARCSETUP();
-    yoffset = y ? nlwidth : 0;
-    dyoffset = 0;
-    msk = info.initialMask;
-    if (!(arc->width & 1))
-    {
-	DoPix(2, yorgl, info.xorgo);
-	DoPix(8, yorgol, info.xorgo);
-    }
-    if (!info.end.x || !info.end.y)
-    {
-	msk = info.end.mask;
-	info.end = info.altend;
-    }
-    if (do360 && (arc->width == arc->height) && !(arc->width & 1))
-    {
-	int xoffset = nlwidth;
-	int *yorghl = yorgl + (info.h * nlwidth);
-	int xorghp = info.xorg + info.h;
-	int xorghn = info.xorg - info.h;
-
-        while (1)
-        {
-	    PixelateWhite(yorgl + yoffset, info.xorg + x);
-	    PixelateWhite(yorgl + yoffset, info.xorg - x);
-	    PixelateWhite(yorgol- yoffset, info.xorg - x);
-	    PixelateWhite(yorgol - yoffset, info.xorg + x);
-	    if (a < 0)
-	        break;
-	    PixelateWhite(yorghl - xoffset, xorghp - y);
-	    PixelateWhite(yorghl - xoffset, xorghn + y);
-	    PixelateWhite(yorghl + xoffset, xorghn + y);
-	    PixelateWhite(yorghl + xoffset, xorghp - y);
-	    xoffset += nlwidth;
-	    MIARCCIRCLESTEP(yoffset += nlwidth;);
-        }
-	x = info.w;
-	yoffset = info.h * nlwidth;
-    }
-    else if (do360)
-    {
-	while (y < info.h || x < info.w)
-	{
-	    MIARCOCTANTSHIFT(dyoffset = nlwidth;);
-	    Pixelate(yorgl + yoffset, info.xorg + x);
-	    Pixelate(yorgl + yoffset, info.xorgo - x);
-	    Pixelate(yorgol - yoffset, info.xorgo - x);
-	    Pixelate(yorgol - yoffset, info.xorg + x);
-	    MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
-	}
-    }
-    else
-    {
-	while (y < info.h || x < info.w)
-	{
-	    MIARCOCTANTSHIFT(dyoffset = nlwidth;);
-	    if ((x == info.start.x) || (y == info.start.y))
-	    {
-		msk = info.start.mask;
-		info.start = info.altstart;
-	    }
-	    DoPix(1, yorgl + yoffset, info.xorg + x);
-	    DoPix(2, yorgl + yoffset, info.xorgo - x);
-	    DoPix(4, yorgol - yoffset, info.xorgo - x);
-	    DoPix(8, yorgol - yoffset, info.xorg + x);
-	    if ((x == info.end.x) || (y == info.end.y))
-	    {
-		msk = info.end.mask;
-		info.end = info.altend;
-	    }
-	    MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
-	}
-    }
-    if ((x == info.start.x) || (y == info.start.y))
-	msk = info.start.mask;
-    DoPix(1, yorgl + yoffset, info.xorg + x);
-    DoPix(4, yorgol - yoffset, info.xorgo - x);
-    if (arc->height & 1)
-    {
-	DoPix(2, yorgl + yoffset, info.xorgo - x);
-	DoPix(8, yorgol - yoffset, info.xorg + x);
-    }
-}
-
-static void
-xf4bppZeroPolyArcSS
-(
-    DrawablePtr	pDraw,
-    GCPtr	pGC,
-    int		narcs,
-    xArc	*parcs
-)
-{
-    register xArc *arc;
-    register int i;
-    BoxRec box;
-    RegionPtr cclip;
-
-    if (!pGC->planemask & 0x0F)
-	return;
-    cclip = pGC->pCompositeClip;
-    for (arc = parcs, i = narcs; --i >= 0; arc++)
-    {
-	if (miCanZeroArc(arc))
-	{
-	    box.x1 = arc->x + pDraw->x;
-	    box.y1 = arc->y + pDraw->y;
-	    box.x2 = box.x1 + (int)arc->width + 1;
-	    box.y2 = box.y1 + (int)arc->height + 1;
-	    if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
-		v16ZeroArcSS(pDraw, pGC, arc);
-	    else
-		miZeroPolyArc(pDraw, pGC, 1, arc);
-	}
-	else
-	    miPolyArc(pDraw, pGC, 1, arc);
-    }
-}
-
-void
-xf4bppZeroPolyArc(pDraw, pGC, narcs, parcs)
-    DrawablePtr	pDraw;
-    GCPtr	pGC;
-    int		narcs;
-    xArc	*parcs;
-{
-    if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema ) {
-	miZeroPolyArc(pDraw, pGC, narcs, parcs);
-    } else {
-        DO_WM3(pGC,xf4bppZeroPolyArcSS(pDraw, pGC, narcs, parcs));
-    }
-}
diff --git a/hw/xfree86/xf4bpp/offscreen.c b/hw/xfree86/xf4bpp/offscreen.c
deleted file mode 100644
index 3160e7e..0000000
--- a/hw/xfree86/xf4bpp/offscreen.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright 1993 Gerrit Jan Akkerman 
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of Gerrit Jan Akkerman not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * GERRIT JAN AKKERMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL GERRIT JAN AKKERMAN BE LIABLE FOR ANY SPECIAL, INDIRECT
- * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
-*/
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "vgaVideo.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-#define saved_screen(pWin) \
-        ((unsigned char *)(((PixmapPtr)((pWin)->drawable.pScreen->devPrivate))->devPrivate.ptr))
-
-#define SAVEDSCREEN(pWin, x, y) \
-	(*(saved_screen(pWin) + (y) * (BYTES_PER_LINE(pWin)) + (x)))
-
-#define DO_ROP(src,dst,alu,planes) \
-	((dst) = do_rop((src),(dst),(alu),(planes)))
-
-/* NOTE:
- * The following to functions don't do anything. They're just there to
- * provide a stable interface to the rest of the system.
- */
-
-static int
-do_rop
-(
-	int src,
-	int dst,
-	int alu,
-	const unsigned long planes
-)
-{ 
-	int _dst;	/* New dst */
-
-	switch ( alu ) { 
-		case GXclear:		/* 0x0 Zero 0 */ 
-			_dst = 0; break ; 
-		case GXinvert:		/* 0xa NOT dst */ 
-			_dst = ~dst; break ; 
-		case GXset:		/* 0xf 1 */ 
-			_dst = src; break ; 
-		default:
-		case GXnoop:		/* 0x5 dst */ 
-			return dst; 
-		case GXnor:		/* 0x8 NOT src AND NOT dst */ 
-			_dst = ~src & ~dst; break ; 
-		case GXandInverted:	/* 0x4 NOT src AND dst */ 
-			_dst = ~src & dst; break ; 
-		case GXand:		/* 0x1 src AND dst */ 
-			_dst = src & dst; break ; 
-		case GXequiv:		/* 0x9 NOT src XOR dst */ 
-			_dst = ~src ^ dst; break ; 
-		case GXxor:		/* 0x6 src XOR dst */ 
-			_dst = src ^ dst; break ; 
-		case GXandReverse:	/* 0x2 src AND NOT dst */ 
-			_dst = src & ~dst; break ; 
-		case GXnand:		/* 0xe NOT src OR NOT dst */ 
-			_dst = ~src | ~dst; break ; 
-		case GXorReverse:	/* 0xb src OR NOT dst */ 
-			_dst = src | ~dst; break ; 
-		case GXorInverted:	/* 0xd NOT src OR dst */ 
-			_dst = ~src | dst; break ; 
-		case GXor:		/* 0x7 src OR dst */ 
-			_dst = src | dst; break ; 
-		case GXcopyInverted:	/* 0xc NOT src */ 
-			_dst = ~src; break ; 
-		case GXcopy:		/* 0x3 src */ 
-			_dst = src; break ; 
-	} 
-	return (dst & ~planes) | (_dst & planes); 
-}
-
-/* File vgaBitBlt.c */
-void
-xf4bppOffBitBlt( pWin, alu, writeplanes, x0, y0, x1, y1, w, h )
-WindowPtr pWin; /* GJA */
-const int alu, writeplanes ;
-register int x0 ;
-int y0 ;
-register int x1 ;
-int y1 ;
-register int w, h ;
-{
-	int x,y;
-
-	switch ( alu ) {
-		case GXclear:		/* 0x0 Zero 0 */
-		case GXinvert:		/* 0xa NOT dst */
-		case GXset:		/* 0xf 1 */
-			xf4bppOffFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes,
-				x0, y0, w, h ) ;
-		case GXnoop:		/* 0x5 dst */
-			return ;
-		default:
-			break ;
-	}
-
-	if ( (w <= 0) || (h <= 0) ) return;
-
-	for ( y = 0 ; y < h ; y++ ) {
-		for ( x = 0 ; x < w ; x++ ) {
-			DO_ROP(SAVEDSCREEN(pWin,x0+x,y0+y),SAVEDSCREEN(pWin,x1+x,y1+y),
-				alu,writeplanes);
-		}
-	}
-}
-
-/* for file vgaImages.c */
-
-void
-xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
-WindowPtr pWin; /* GJA */
-int x, y ;
-register int w, h ;
-unsigned char *data ;
-register int RowIncrement ;
-const int alu ;
-const unsigned long int planes ;
-{
-	int dx,dy;
-
-	for ( dy = 0 ; dy < h ; dy++ ) {
-		for ( dx = 0 ; dx < w ; dx++ ) {
-			DO_ROP(	data[dy * RowIncrement + dx],
-				SAVEDSCREEN(pWin,x+dx,y+dy), alu, planes);
-		}
-	}
-}
-
-void
-xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
-WindowPtr pWin; /* GJA */
-int x, y ;
-int lx, ly ;
-unsigned char *data ;
-int RowIncrement ;
-{
-	int dx, dy;
-
-	if ( ( lx <= 0 ) || ( ly <= 0 ) )
-		return ;
-
-	for ( dy = 0 ; dy < ly ; dy++ ) {
-		for ( dx = 0 ; dx < lx ; dx++ ) {
-			data[dy*RowIncrement+dx] = SAVEDSCREEN(pWin,x+dx,y+dy);
-		}
-	}
-}
-
-/* For file vgaSolid.c */
-
-void xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
-WindowPtr pWin; /* GJA */
-unsigned long int color ;
-const int alu ;
-unsigned long int planes ;
-register int x0 ;
-register const int y0 ;
-register int lx ;
-register const int ly ;		/* MUST BE > 0 !! */
-{
-	int dx, dy;
-
-	if ( ( lx == 0 ) || ( ly == 0 ) )
-		return;
-
-	for ( dy = 0 ; dy < ly ; dy++ ) {
-		for ( dx = 0 ; dx < lx ; dx++ ) {
-			DO_ROP(color,SAVEDSCREEN(pWin, x0+dx,y0+dy),alu,planes);
-		}
-	}
-}
-	
-/* For file vgaStipple.c */
-
-/* GJA -- modified this to take both Width and Height, and to
- * reduce x and y to Width and Height by taking remainders.
- */
-static unsigned char
-xygetbits
-(
-	register int x,
-	register int y,
-        register const unsigned int Width,
-	register const unsigned int paddedByteWidth,
-	register const unsigned int Height,
-	register const unsigned char * const data
-)
-{
-	register unsigned char bits ;
-	unsigned const char *lineptr, *cptr ;
-	register int shift ;
-	register int wrap ;
-
-	x = x % Width;
-	y = y % Height;
-
-	lineptr = data + (y * paddedByteWidth);
-	cptr = lineptr + (x >> 3) ;
-	bits = *cptr ;
-	if ((shift = x & 7))
-		bits = SCRLEFT8( bits, shift ) |
-			SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
-	if ( ( wrap = x + 8 - Width ) > 0 ) {
-		bits &= SCRLEFT8( 0xFF, wrap ) ;
-		bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
-	}
-
-	return bits ;
-}
-
-static void
-DoMono
-(
-	WindowPtr pWin, /* GJA */
-	int w,
-	int x,
-	int y,
-	register const unsigned char *mastersrc,
-	int h,
-	unsigned int width,
-	register unsigned int paddedByteWidth,
-	unsigned int height,
-	int xshift,
-	int yshift,
-	int alu,
-	int planes,
-	int fg
-)
-{
-	int dy, dx, i;
-	int byte;
-
-	for ( dy = 0 ; dy < h ; dy++ ) {
-		for ( dx = 0; dx <= w - 8 ; dx += 8 ) {
-			/* get next byte */
-			byte = xygetbits(dx+xshift,dy+yshift,width,
-					paddedByteWidth, height, mastersrc);
-			for ( i = 0 ; i < 8 ; i++ ) {
-				if ( byte & (128 >> i) ) {
-					DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
-						alu,planes);
-				}
-			}
-		}
-		/* get last bits */
-		byte = xygetbits(dx+xshift,dy+yshift,width,
-				paddedByteWidth, height, mastersrc);
-		for ( i = 0 ; i < (w - dx) ; i++ ) {
-			if ( byte & (128 >> i) ) {
-				DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
-					alu,planes);
-			}
-		}
-	}
-}
-
-void
-xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
-WindowPtr pWin; /* GJA */
-register PixmapPtr const pStipple ;
-unsigned long int fg ;
-const int alu ;
-unsigned long int planes ;
-int x, y, w, h ;
-const int xSrc, ySrc ;
-{
-	unsigned int width ;
-	unsigned int height ;
-	int xshift ;
-	int yshift ;
-
-	if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
-		return ;
-
-	/* Figure Bit Offsets & Source Address */
-	width = pStipple->drawable.width ;
-	if ( ( xshift = ( x - xSrc ) ) < 0 )
-		xshift = width - ( ( - xshift ) % width ) ;
-	else
-		xshift %= width ;
-
-	height = pStipple->drawable.height ;
-	if ( ( yshift = ( y - ySrc ) ) < 0 )
-		yshift = height - ( ( - yshift ) % height ) ;
-	else
-		yshift %= height ;
-
-	DoMono( pWin, w, x, y,
-		(const unsigned char *) pStipple->devPrivate.ptr,
-		h,
-		width,
-		( ( width + 31 ) & (unsigned)(~31) ) >> 3,
-		height,
-		xshift, yshift,
-		alu, (int)planes, (int)fg ) ;
-	return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcArea.c b/hw/xfree86/xf4bpp/ppcArea.c
deleted file mode 100644
index df7856a..0000000
--- a/hw/xfree86/xf4bpp/ppcArea.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* 
- * ppc solid area fill
- *
- * Tom Paquin 8/87 
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "ppcGCstr.h"
-#include "ibmTrace.h"
-
-void
-xf4bppFillArea( pWin, nboxes, pBox, pGC )
-    register WindowPtr pWin ;
-    register int nboxes ;
-    register BoxPtr pBox ;
-    GCPtr	pGC ;
-{
-register int x, y, w, h ;
-int alu ;
-unsigned long int fg, bg, pm ;
-int xSrc, ySrc ;
-PixmapPtr pPixmap ;
-ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
-
-TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
-
-if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes )
-	return ;
-
-xSrc = pGC->patOrg.x + pWin->drawable.x ;
-ySrc = pGC->patOrg.y + pWin->drawable.y ;
-
-pm = pPrivGC->colorRrop.planemask ;
-fg = pPrivGC->colorRrop.fgPixel ;
-bg = pPrivGC->colorRrop.bgPixel ;
-
-nboxes++ ;
-switch ( pPrivGC->colorRrop.fillStyle ) {
-	case FillTiled:
-		for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
-			if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
-			  && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
-				xf4bppTileRect( pWin, pPixmap, alu, pm,
-					     x, y, w, h, xSrc, ySrc ) ;
-		break ;
-	case FillOpaqueStippled:
-		for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
-			if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
-			  && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
-				xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm,
-					     x, y, w, h, xSrc, ySrc ) ;
-		break ;
-	case FillStippled:
-		for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
-			if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
-			  && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
-				xf4bppFillStipple( pWin, pPixmap, fg, alu, pm,
-					     x, y, w, h, xSrc, ySrc ) ;
-		break ;
-	case FillSolid:
-		for ( ; --nboxes ; pBox++ )
-			if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
-			  && ( h = pBox->y2 - ( y = pBox->y1 ) ) )
-				xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ;
-		break ;
-}
-
-}
diff --git a/hw/xfree86/xf4bpp/ppcCReduce.c b/hw/xfree86/xf4bpp/ppcCReduce.c
deleted file mode 100644
index c567e6f..0000000
--- a/hw/xfree86/xf4bpp/ppcCReduce.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "ppcGCstr.h"
-
-/* xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
- * An attempt to do "strength reduction" on color raster-ops
- * P. Shupak 1/88
- */
-
-static void 
-ppcReduceGeneral
-(
-	register int		alu,
-	register unsigned long	pm,
-	register unsigned long	fg,
-	register unsigned long	bg,
-	register int		fillStyle,
-	int			drawableDepth,
-	ppcReducedRrop		*returnLoc
-)
-{
-
-if ( ( alu == GXnoop )
-  || !( pm &= ( ( 1 << drawableDepth ) - 1 ) ) ) {
-	returnLoc->alu = GXnoop ;
-	return ;
-}
-
-#ifdef DELETE_THIS
-switch ( fillStyle ) {
-	case FillTiled:
-		switch ( alu ) {
-			case GXclear:		/* 0x0 Zero 0 */
-			case GXinvert:		/* 0xa NOT dst */
-			case GXset:		/* 0xf 1 */
-				fillStyle = FillSolid ;
-			default: /* We Can't Do Much Here */
-				break ;
-		}
-		break ;
-	case FillOpaqueStippled:
-		if ( ( fg & pm ) != ( bg & pm ) ) { /* else FillSolid */
-			switch ( alu ) {
-				case GXclear:	/* 0x0 Zero 0 */
-				case GXset:	/* 0xf 1 */
-				case GXinvert:	/* 0xa NOT dst */
-					fillStyle = FillSolid ;
-					break ;
-				case GXnor:	/* 0x8 NOT src AND NOT dst */
-				case GXnand:	/* 0xe NOT src OR NOT dst */
-				case GXcopy:	/* 0x3 src */
-					break ;
-				case GXandReverse: /* 0x2 src AND NOT dst */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXnor ;
-					break ;
-				case GXandInverted: /* 0x4 NOT src AND dst */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXand ; /* Fall Through */
-				case GXand:	/* 0x1 src AND dst */
-					pm &= ~( fg & bg ) ;
-					if ( ( bg & pm ) == pm ) {
-						fillStyle = FillStippled ;
-						alu = GXclear ;
-					}
-					break ;
-				case GXequiv:	/* 0x9 NOT src XOR dst */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXxor ; /* Fall Through */
-				case GXxor:	/* 0x6 src XOR dst */
-					pm &= ( fg | bg ) ;
-					if ( !( bg & pm ) ) {
-						fillStyle = FillStippled ;
-						alu = GXinvert ;
-					}
-					break ;
-				case GXorReverse:	/* 0xb src OR NOT dst */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXnand ;
-					break ;
-				case GXcopyInverted:	/* 0xc NOT src */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXcopy ;
-					break ;
-				case GXorInverted:	/* 0xd NOT src OR dst */
-					fg = ~fg ;
-					bg = ~bg ;
-					alu = GXor ; /* Fall Through */
-				case GXor:	/* 0x7 src OR dst */
-					pm &= ( fg | bg ) ;
-					if ( !( bg & pm ) ) {
-						fillStyle = FillStippled ;
-						alu = GXset ;
-					}
-					break ;
-				default:
-					ErrorF(
-			 "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
-					break ;
-			}
-			break ; /* Don't Fall Through */
-		}
-		else
-			fillStyle = FillSolid ;
-			/* Fall Through */
-	case FillStippled:
-	case FillSolid:
-		switch ( alu ) {
-			case GXclear:		/* 0x0 Zero 0 */
-			case GXset:		/* 0xf 1 */
-			case GXinvert:		/* 0xa NOT dst */
-				break ;
-			case GXand:		/* 0x1 src AND dst */
-				pm &= ~fg ;
-				alu = GXclear ;
-				break ;
-			case GXandReverse:	/* 0x2 src AND NOT dst */
-				fg = ~fg ;
-				alu = GXnor ; /* Fall Through */
-			case GXnor:		/* 0x8 NOT src AND NOT dst */
-				if ( !( fg & pm ) )
-					alu = GXclear ;
-				else if ( ( fg & pm ) == pm )
-					alu = GXinvert ;
-				break ;
-			case GXandInverted:	/* 0x4 NOT src AND dst */
-				pm &= fg ;
-				alu = GXclear ;
-				break ;
-			case GXxor:		/* 0x6 src XOR dst */
-				pm &= fg ;
-				alu = GXinvert ;
-				break ;
-			case GXor:		/* 0x7 src OR dst */
-				pm &= fg ;
-				alu = GXset ;
-				break ;
-			case GXequiv:		/* 0x9 NOT src XOR dst */
-				pm &= ~fg ;
-				alu = GXinvert ;
-				break ;
-			case GXorReverse:	/* 0xb src OR NOT dst */
-				fg = ~fg ;
-				alu = GXnand ; /* Fall Through */
-			case GXnand:		/* 0xe NOT src OR NOT dst */
-				if ( !( fg & pm ) )
-					alu = GXset ;
-				else if ( ( fg & pm ) == pm )
-					alu = GXinvert ;
-				break ;
-			case GXcopyInverted:	/* 0xc NOT src */
-				fg = ~fg ;
-				alu = GXcopy ; /* Fall Through */
-			case GXcopy:		/* 0x3 src */
-				if ( !( fg & pm ) )
-					alu = GXclear ;
-				else if ( ( fg & pm ) == pm )
-					alu = GXset ;
-				break ;
-			case GXorInverted:	/* 0xd NOT src OR dst */
-				pm &= ~fg ;
-				alu = GXset ;
-				break ;
-			default:
-				ErrorF(
-			 "xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
-				break ;
-		}
-		break;
-	default:
-		ErrorF("xf4bppGetReducedColorRrop: Bad Fillstyle\n");
-		break;
-}
-#endif
-
-/* Final Test On Restricted Plane Mask */
-if ( !pm )
-	alu = GXnoop ;
-
-/* Set Actual Returned Values */
-returnLoc->planemask = pm ;
-returnLoc->fgPixel   = fg ;
-returnLoc->bgPixel   = bg ;
-returnLoc->alu       = alu ;
-returnLoc->fillStyle = fillStyle ;
-
-return ;
-}
-
-void 
-xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
-GC		*pGC ;
-int		drawableDepth ;
-ppcReducedRrop	*returnLoc ;
-{
-
-ppcReduceGeneral( pGC->alu,
-		  pGC->planemask,
-		  pGC->fgPixel,
-		  pGC->bgPixel,
- 		  pGC->fillStyle,
-		  drawableDepth,
-		  returnLoc ) ;
-
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcClip.c b/hw/xfree86/xf4bpp/ppcClip.c
deleted file mode 100644
index 899dba6..0000000
--- a/hw/xfree86/xf4bpp/ppcClip.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-
-Copyright (c) 1987  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "scrnintstr.h"
-
-void
-xf4bppDestroyClip(pGC)
-    GCPtr	pGC;
-{
-    if(pGC->clientClipType == CT_NONE)
-	return;
-    else if (pGC->clientClipType == CT_PIXMAP)
-    {
-	mfbDestroyPixmap((PixmapPtr)(pGC->clientClip));
-    }
-    else
-    {
-	/* we know we'll never have a list of rectangles, since
-	   ChangeClip immediately turns them into a region 
-	*/
-        REGION_DESTROY(pGC->pScreen, pGC->clientClip);
-    }
-    pGC->clientClip = NULL;
-    pGC->clientClipType = CT_NONE;
-}
-
-void
-xf4bppChangeClip(pGC, type, pvalue, nrects)
-    GCPtr	    pGC;
-    int		    type;
-    pointer	    pvalue;
-    int		    nrects;
-{
-    xf4bppDestroyClip(pGC);
-    if(type == CT_PIXMAP)
-    {
-	/* convert the pixmap to a region */
-	pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue);
-	/* you wouldn't do this if you were leaving the pixmap in
-	   rather than converting it.
-	*/
-	(*pGC->pScreen->DestroyPixmap)(pvalue);
-    }
-    else if (type == CT_REGION)
-    {
-	/* stuff the region in the GC */
-	pGC->clientClip = pvalue;
-    }
-    else if (type != CT_NONE)
-    {
-	pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
-						    (xRectangle *)pvalue,
-						    type);
-	xfree(pvalue);
-    }
-    pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION :
-        CT_NONE;
-    pGC->stateChanges |= GCClipMask;
-}
-
-void
-xf4bppCopyClip (pgcDst, pgcSrc)
-    GCPtr pgcDst, pgcSrc;
-{
-    RegionPtr prgnNew;
-
-    switch(pgcSrc->clientClipType)
-    {
-      case CT_PIXMAP:
-	((PixmapPtr) pgcSrc->clientClip)->refcnt++;
-	/* Fall through !! */
-      case CT_NONE:
-	xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0);
-	break;
-      case CT_REGION:
-	prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
-	REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip));
-	xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0);
-	break;
-    }
-}
diff --git a/hw/xfree86/xf4bpp/ppcCpArea.c b/hw/xfree86/xf4bpp/ppcCpArea.c
deleted file mode 100644
index 9bdaf89..0000000
--- a/hw/xfree86/xf4bpp/ppcCpArea.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/***********************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#define PSZ 8
-#include "mfb.h"
-#include "mergerop.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-/*
- * Graft in the DoBitblt from cfb. It does everything correctly.
- */
-static void
-vga16DoBitblt
-(
-    DrawablePtr	    pSrc,
-    DrawablePtr	    pDst,
-    int		    alu,
-    RegionPtr	    prgnDst,
-    DDXPointPtr	    pptSrc,
-    unsigned long   planemask
-)
-{
-    int widthSrc, widthDst;	/* add to get to same position in next line */
-    BoxPtr pbox;
-    int nbox;
-    BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
-				/* temporaries for shuffling rectangles */
-    DDXPointPtr pptTmp, pptNew1, pptNew2;
-				/* shuffling boxes entails shuffling the
-				   source points too */
-    int w, h;
-    int careful;
-
-    widthSrc = mfbGetPixelWidth(pSrc);
-    widthDst = mfbGetPixelWidth(pDst);
-
-    /* XXX we have to err on the side of safety when both are windows,
-     * because we don't know if IncludeInferiors is being used.
-     */
-    careful = ((pSrc == pDst) ||
-	       ((pSrc->type == DRAWABLE_WINDOW) &&
-		(pDst->type == DRAWABLE_WINDOW)));
-
-    pbox = REGION_RECTS(prgnDst);
-    nbox = REGION_NUM_RECTS(prgnDst);
-
-    pboxNew1 = NULL;
-    pptNew1 = NULL;
-    pboxNew2 = NULL;
-    pptNew2 = NULL;
-    if (careful && (pptSrc->y < pbox->y1))
-    {
-        /* walk source botttom to top */
-	widthSrc = -widthSrc;
-	widthDst = -widthDst;
-
-	if (nbox > 1)
-	{
-	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
-	    if(!pboxNew1)
-		return;
-	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
-	    if(!pptNew1)
-	    {
-	        xfree(pboxNew1);
-	        return;
-	    }
-	    pboxBase = pboxNext = pbox+nbox-1;
-	    while (pboxBase >= pbox)
-	    {
-	        while ((pboxNext >= pbox) &&
-		       (pboxBase->y1 == pboxNext->y1))
-		    pboxNext--;
-	        pboxTmp = pboxNext+1;
-	        pptTmp = pptSrc + (pboxTmp - pbox);
-	        while (pboxTmp <= pboxBase)
-	        {
-		    *pboxNew1++ = *pboxTmp++;
-		    *pptNew1++ = *pptTmp++;
-	        }
-	        pboxBase = pboxNext;
-	    }
-	    pboxNew1 -= nbox;
-	    pbox = pboxNew1;
-	    pptNew1 -= nbox;
-	    pptSrc = pptNew1;
-        }
-    }
-
-    if (careful && (pptSrc->x < pbox->x1))
-    {
-	if (nbox > 1)
-	{
-	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
-	    if(!pboxNew2 || !pptNew2)
-	    {
-		if (pptNew2) xfree(pptNew2);
-		if (pboxNew2) xfree(pboxNew2);
-		if (pboxNew1)
-		{
-		    xfree(pptNew1);
-		    xfree(pboxNew1);
-		}
-	        return;
-	    }
-	    pboxBase = pboxNext = pbox;
-	    while (pboxBase < pbox+nbox)
-	    {
-	        while ((pboxNext < pbox+nbox) &&
-		       (pboxNext->y1 == pboxBase->y1))
-		    pboxNext++;
-	        pboxTmp = pboxNext;
-	        pptTmp = pptSrc + (pboxTmp - pbox);
-	        while (pboxTmp != pboxBase)
-	        {
-		    *pboxNew2++ = *--pboxTmp;
-		    *pptNew2++ = *--pptTmp;
-	        }
-	        pboxBase = pboxNext;
-	    }
-	    pboxNew2 -= nbox;
-	    pbox = pboxNew2;
-	    pptNew2 -= nbox;
-	    pptSrc = pptNew2;
-	}
-    }
-
-    while(nbox--)
-    {
-	w = pbox->x2 - pbox->x1;
-	h = pbox->y2 - pbox->y1;
-	
-	if( pSrc->type == DRAWABLE_WINDOW )
-		xf4bppBitBlt( (WindowPtr)pDst, alu, planemask,
-			pptSrc->x,		/* x0 */
-			pptSrc->y,		/* y0 */
-			pbox->x1,		/* x1 */
-			pbox->y1,		/* y1 */
-			w, h );			/* w, h */
-	    else /* DRAWABLE_PIXMAP */
-		xf4bppDrawColorImage( (WindowPtr)pDst,
-			pbox->x1, pbox->y1,
-			w,
-			h,
-			((unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr
-			 + pptSrc->x + (pptSrc->y*((PixmapPtr)pSrc)->devKind)),
-			((PixmapPtr)pSrc)->devKind,
-			alu, planemask ) ;
-	pbox++;
-	pptSrc++;
-    }
-    if (pboxNew2)
-    {
-	xfree(pptNew2);
-	xfree(pboxNew2);
-    }
-    if (pboxNew1)
-    {
-	xfree(pptNew1);
-	xfree(pboxNew1);
-    }
-}
-
-
-/*
- * Graft in the CopyArea from mfb/cfb. It does everything correctly.
- */
-
-RegionPtr
-xf4bppCopyArea(pSrcDrawable, pDstDrawable,
-	    pGC, srcx, srcy, width, height, dstx, dsty)
-register DrawablePtr pSrcDrawable;
-register DrawablePtr pDstDrawable;
-register GC *pGC;
-int srcx, srcy;
-int width, height;
-int dstx, dsty;
-{
-    RegionPtr prgnSrcClip = NULL;   /* may be a new region, or just a copy */
-    Bool freeSrcClip = FALSE;
-
-    RegionPtr prgnExposed;
-    RegionRec rgnDst;
-    DDXPointPtr pptSrc;
-    register DDXPointPtr ppt;
-    register BoxPtr pbox;
-    int i;
-    register int dx;
-    register int dy;
-    xRectangle origSource;
-    DDXPointRec origDest;
-    int numRects;
-    BoxRec fastBox;
-    int fastClip = 0;		/* for fast clipping with pixmap source */
-    int fastExpose = 0;		/* for fast exposures with pixmap source */
-
-    if ( pDstDrawable->type != DRAWABLE_WINDOW )
-	return miCopyArea( pSrcDrawable, pDstDrawable, pGC,
-			   srcx, srcy, width, height, dstx, dsty ) ;
-
-    /* Begin code from mfb/cfbCopyArea */
-
-    origSource.x = srcx;
-    origSource.y = srcy;
-    origSource.width = width;
-    origSource.height = height;
-    origDest.x = dstx;
-    origDest.y = dsty;
-
-    if ((pSrcDrawable != pDstDrawable) &&
-	pSrcDrawable->pScreen->SourceValidate)
-    {
-	(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
-    }
-
-    srcx += pSrcDrawable->x;
-    srcy += pSrcDrawable->y;
-
-    /* clip the source */
-
-    if (pSrcDrawable->type == DRAWABLE_PIXMAP)
-    {
-	if ((pSrcDrawable == pDstDrawable) &&
-	    (pGC->clientClipType == CT_NONE))
-	{
-	    prgnSrcClip = pGC->pCompositeClip;
-	}
-	else
-	{
-	    fastClip = 1;
-	}
-    }
-    else
-    {
-	if (pGC->subWindowMode == IncludeInferiors)
-	{
-	    if (!((WindowPtr) pSrcDrawable)->parent)
-	    {
-		/*
-		 * special case bitblt from root window in
-		 * IncludeInferiors mode; just like from a pixmap
-		 */
-		fastClip = 1;
-	    }
-	    else if ((pSrcDrawable == pDstDrawable) &&
-		(pGC->clientClipType == CT_NONE))
-	    {
-		prgnSrcClip = pGC->pCompositeClip;
-	    }
-	    else
-	    {
-		prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
-		freeSrcClip = TRUE;
-	    }
-	}
-	else
-	{
-	    prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
-	}
-    }
-
-    fastBox.x1 = srcx;
-    fastBox.y1 = srcy;
-    fastBox.x2 = srcx + width;
-    fastBox.y2 = srcy + height;
-
-    /* Don't create a source region if we are doing a fast clip */
-    if (fastClip)
-    {
-	fastExpose = 1;
-	/*
-	 * clip the source; if regions extend beyond the source size,
- 	 * make sure exposure events get sent
-	 */
-	if (fastBox.x1 < pSrcDrawable->x)
-	{
-	    fastBox.x1 = pSrcDrawable->x;
-	    fastExpose = 0;
-	}
-	if (fastBox.y1 < pSrcDrawable->y)
-	{
-	    fastBox.y1 = pSrcDrawable->y;
-	    fastExpose = 0;
-	}
-	if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
-	{
-	    fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
-	    fastExpose = 0;
-	}
-	if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
-	{
-	    fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
-	    fastExpose = 0;
-	}
-    }
-    else
-    {
-	REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
-    }
-
-    dstx += pDstDrawable->x;
-    dsty += pDstDrawable->y;
-
-    if (pDstDrawable->type == DRAWABLE_WINDOW)
-    {
-	if (!((WindowPtr)pDstDrawable)->realized)
-	{
-	    if (!fastClip)
-		REGION_UNINIT(pGC->pScreen, &rgnDst);
-	    if (freeSrcClip)
-		REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-	    return NULL;
-	}
-    }
-
-    dx = srcx - dstx;
-    dy = srcy - dsty;
-
-    /* Translate and clip the dst to the destination composite clip */
-    if (fastClip)
-    {
-	RegionPtr cclip;
-
-        /* Translate the region directly */
-        fastBox.x1 -= dx;
-        fastBox.x2 -= dx;
-        fastBox.y1 -= dy;
-        fastBox.y2 -= dy;
-
-	/* If the destination composite clip is one rectangle we can
-	   do the clip directly.  Otherwise we have to create a full
-	   blown region and call intersect */
-	cclip = pGC->pCompositeClip;
-        if (REGION_NUM_RECTS(cclip) == 1)
-        {
-	    BoxPtr pBox = REGION_RECTS(cclip);
-
-	    if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
-	    if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
-	    if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
-	    if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
-	    /* Check to see if the region is empty */
-	    if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
-	    {
-		REGION_NULL(pGC->pScreen, &rgnDst);
-	    }
-	    else
-	    {
-		REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	    }
-	}
-        else
-	{
-	    /* We must turn off fastClip now, since we must create
-	       a full blown region.  It is intersected with the
-	       composite clip below. */
-	    fastClip = 0;
-	    REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	}
-    }
-    else
-    {
-        REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
-    }
-
-    if (!fastClip)
-    {
-	REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
-    }
-
-    /* Do bit blitting */
-    numRects = REGION_NUM_RECTS(&rgnDst);
-    if (numRects && width && height)
-    {
-	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
-						  sizeof(DDXPointRec))))
-	{
-	    REGION_UNINIT(pGC->pScreen, &rgnDst);
-	    if (freeSrcClip)
-		REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-	    return NULL;
-	}
-	pbox = REGION_RECTS(&rgnDst);
-	ppt = pptSrc;
-	for (i = numRects; --i >= 0; pbox++, ppt++)
-	{
-	    ppt->x = pbox->x1 + dx;
-	    ppt->y = pbox->y1 + dy;
-	}
-
-	vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu,
-			&rgnDst, pptSrc, pGC->planemask );
-	xfree(pptSrc);
-    }
-
-    prgnExposed = NULL;
-    if (pGC->fExpose) 
-    {
-        /* Pixmap sources generate a NoExposed (we return NULL to do this) */
-        if (!fastExpose)
-	    prgnExposed =
-		miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
-				  origSource.x, origSource.y,
-				  (int)origSource.width,
-				  (int)origSource.height,
-				  origDest.x, origDest.y, (unsigned long)0);
-    }
-    REGION_UNINIT(pGC->pScreen, &rgnDst);
-    if (freeSrcClip)
-	REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-    return prgnExposed;
-}
diff --git a/hw/xfree86/xf4bpp/ppcDepth.c b/hw/xfree86/xf4bpp/ppcDepth.c
deleted file mode 100644
index 2fa19ff..0000000
--- a/hw/xfree86/xf4bpp/ppcDepth.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* Check to see if the alleged depth is acceptable for the Screen  
- *
- * T. Paquin 9/87
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "scrnintstr.h"
-
-Bool
-xf4bppDepthOK(pDraw,depth)
-register DrawablePtr pDraw;
-register int depth;
-{
-register ScreenPtr pScreen= pDraw->pScreen;
-register int i = pScreen->numDepths;
-
-    if ( ( pDraw->type == DRAWABLE_PIXMAP ) && ( depth == 1 ) )
-	return TRUE ;
-
-    while ( i-- )
-	if ( depth == pScreen->allowedDepths[i].depth )
-	    return TRUE ;
-
-    return FALSE ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcFillRct.c b/hw/xfree86/xf4bpp/ppcFillRct.c
deleted file mode 100644
index 3422c80..0000000
--- a/hw/xfree86/xf4bpp/ppcFillRct.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "scrnintstr.h"
-
-#define MODEQ(a, b) ((a) %= (b))
-
-/* 
-    filled rectangles.
-    translate the rectangles, clip them, and call the
-helper function in the GC.
-*/
-
-#define NUM_STACK_RECTS	1024
-
-void
-xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		nrectFill; 	/* number of rectangles to fill */
-    xRectangle	*prectInit;  	/* Pointer to first rectangle to fill */
-{
-    xRectangle	    *prect;
-    RegionPtr	    prgnClip;
-    register BoxPtr pbox;
-    register BoxPtr pboxClipped;
-    BoxPtr	    pboxClippedBase;
-    BoxPtr	    pextent;
-    BoxRec	    stackRects[NUM_STACK_RECTS];
-    int		    numRects;
-    int		    n;
-    int		    xorg, yorg;
-
-    if (!(pGC->planemask & 0x0F)) /* GJA */
-	return;
-
-    prgnClip = pGC->pCompositeClip;
-
-    prect = prectInit;
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    if (xorg || yorg)
-    {
-        prect = prectInit;
-	n = nrectFill;
-	Duff (n, prect->x += xorg; prect->y += yorg; prect++);
-    }
-
-
-    prect = prectInit;
-
-    numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
-    if (numRects > NUM_STACK_RECTS)
-    {
-	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
-	if (!pboxClippedBase)
-	    return;
-    }
-    else
-	pboxClippedBase = stackRects;
-
-    pboxClipped = pboxClippedBase;
-	
-    if (REGION_NUM_RECTS(prgnClip) == 1)
-    {
-	int x1, y1, x2, y2, bx2, by2;
-
-	pextent = REGION_RECTS(prgnClip);
-	x1 = pextent->x1;
-	y1 = pextent->y1;
-	x2 = pextent->x2;
-	y2 = pextent->y2;
-    	while (nrectFill--)
-    	{
-	    if ((pboxClipped->x1 = prect->x) < x1)
-		pboxClipped->x1 = x1;
-    
-	    if ((pboxClipped->y1 = prect->y) < y1)
-		pboxClipped->y1 = y1;
-    
-	    bx2 = (int) prect->x + (int) prect->width;
-	    if (bx2 > x2)
-		bx2 = x2;
-	    pboxClipped->x2 = bx2;
-    
-	    by2 = (int) prect->y + (int) prect->height;
-	    if (by2 > y2)
-		by2 = y2;
-	    pboxClipped->y2 = by2;
-
-	    prect++;
-	    if ((pboxClipped->x1 < pboxClipped->x2) &&
-		(pboxClipped->y1 < pboxClipped->y2))
-	    {
-		pboxClipped++;
-	    }
-    	}
-    }
-    else
-    {
-	int x1, y1, x2, y2, bx2, by2;
-
-	pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
-	x1 = pextent->x1;
-	y1 = pextent->y1;
-	x2 = pextent->x2;
-	y2 = pextent->y2;
-    	while (nrectFill--)
-    	{
-	    BoxRec box;
-    
-	    if ((box.x1 = prect->x) < x1)
-		box.x1 = x1;
-    
-	    if ((box.y1 = prect->y) < y1)
-		box.y1 = y1;
-    
-	    bx2 = (int) prect->x + (int) prect->width;
-	    if (bx2 > x2)
-		bx2 = x2;
-	    box.x2 = bx2;
-    
-	    by2 = (int) prect->y + (int) prect->height;
-	    if (by2 > y2)
-		by2 = y2;
-	    box.y2 = by2;
-    
-	    prect++;
-    
-	    if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
-	    	continue;
-    
-	    n = REGION_NUM_RECTS (prgnClip);
-	    pbox = REGION_RECTS(prgnClip);
-    
-	    /* clip the rectangle to each box in the clip region
-	       this is logically equivalent to calling Intersect()
-	    */
-	    while(n--)
-	    {
-		pboxClipped->x1 = max(box.x1, pbox->x1);
-		pboxClipped->y1 = max(box.y1, pbox->y1);
-		pboxClipped->x2 = min(box.x2, pbox->x2);
-		pboxClipped->y2 = min(box.y2, pbox->y2);
-		pbox++;
-
-		/* see if clipping left anything */
-		if(pboxClipped->x1 < pboxClipped->x2 && 
-		   pboxClipped->y1 < pboxClipped->y2)
-		{
-		    pboxClipped++;
-		}
-	    }
-    	}
-    }
-    if (pboxClipped != pboxClippedBase)
-	xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase,
-		       pboxClippedBase, pGC);
-    if (pboxClippedBase != stackRects)
-    	xfree(pboxClippedBase);
-}
diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c
deleted file mode 100644
index 7ef312d..0000000
--- a/hw/xfree86/xf4bpp/ppcGC.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
-
-Copyright (c) 1987  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mi.h"
-#include "scrnintstr.h"
-#include "ppcGCstr.h"
-#include "vgaVideo.h"
-#include "ibmTrace.h"
-
-#define ppcGCInterestValidateMask \
-( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \
-| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT         \
-| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
-
-static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr);
-static void xf4bppDestroyGC(GC *);
-
-static GCFuncs vgaGCFuncs = {
-	xf4bppValidateGC,
-	(void (*)(GCPtr, unsigned long))NoopDDA,
-	(void (*)(GCPtr, unsigned long, GCPtr))NoopDDA,
-	xf4bppDestroyGC,
-	xf4bppChangeClip,
-	xf4bppDestroyClip,
-	xf4bppCopyClip,
-	{ NULL }
-};
-
-
-static ppcPrivGC vgaPrototypeGCPriv = {
-	GXcopy,	/* unsigned char	rop */
-	0,	/* unsigned char	ropOpStip */
-	0,	/* unsigned char	ropFillArea */
-	{0, },	/* unsigned char	unused[sizeof(long) - 3] */
-	NULL,	/* mfbFillAreaProcPtr  	FillArea */
-		{
-		    VGA_ALLPLANES,	/* unsigned long	planemask */
-		    1,			/* unsigned long	fgPixel */
-		    0,			/* unsigned long	bgPixel */
-		    GXcopy,		/* int			alu */
-		    FillSolid,		/* int			fillStyle */
-		}, /* ppcReducedRrop	colorRrop  */
-	-1,	/* short lastDrawableType */
-	-1,	/* short lastDrawableDepth */
-	0	/* pointer devPriv */
-} ;
-
-static GCOps vgaGCOps = {
-	xf4bppSolidWindowFS,	/*  void (* FillSpans)() */
-	xf4bppSetSpans,		/*  void (* SetSpans)()	 */
-	miPutImage,		/*  void (* PutImage)()	 */
-	xf4bppCopyArea,		/*  RegionPtr (* CopyArea)()	 */
-	miCopyPlane,		/*  void (* CopyPlane)() */
-	xf4bppPolyPoint,		/*  void (* PolyPoint)() */
-	miZeroLine,		/*  void (* Polylines)() */
-	miPolySegment,		/*  void (* PolySegment)() */
-	miPolyRectangle,	/*  void (* PolyRectangle)() */
-	xf4bppZeroPolyArc,		/*  void (* PolyArc)()	 */
-	miFillPolygon,		/*  void (* FillPolygon)() */
-	miPolyFillRect,		/*  void (* PolyFillRect)() */
-	xf4bppPolyFillArc,		/*  void (* PolyFillArc)() */
-	miPolyText8,		/*  int (* PolyText8)()	 */
-	miPolyText16,		/*  int (* PolyText16)() */
-	miImageText8,		/*  void (* ImageText8)() */
-	miImageText16,		/*  void (* ImageText16)() */
-	xf4bppImageGlyphBlt,	/*  GJA -- void (* ImageGlyphBlt)() */
-	miPolyGlyphBlt,		/*  GJA -- void (* PolyGlyphBlt)() */
-	miPushPixels,		/*  void (* PushPixels)() */
-	{NULL}			/* devPrivate */
-};
-
-Bool
-xf4bppCreateGC( pGC )
-register GCPtr pGC ;
-{
-	ppcPrivGC *pPriv ;
-	GCOps *pOps ;
-
-	if ( pGC->depth == 1 )
-		{
-		return (mfbCreateGC(pGC));
-		}
-
-	if ( !( pPriv = xalloc( sizeof( ppcPrivGC ) ) ) )
-		return FALSE ;
-
-	if ( !( pOps = xalloc( sizeof( GCOps ) ) ) ) {
-		xfree(pPriv);
-		return FALSE;
-	}
-	
-        /* Now we initialize the GC fields */
-	pGC->miTranslate = 1;
-	pGC->unused = 0;
-	pGC->planemask = VGA_ALLPLANES;
-	pGC->fgPixel = VGA_BLACK_PIXEL;
-	pGC->bgPixel = VGA_WHITE_PIXEL;
-	pGC->funcs = &vgaGCFuncs;
-	/* ops, -- see below */
-
-	pGC->fExpose = TRUE;
-	pGC->freeCompClip = FALSE;
-
-	/* GJA: I don't like this code:
-         * they allocated a mfbPrivGC, ignore the allocated data and place
-         * a pointer to a ppcPrivGC in its slot.
-         */
-	*pPriv = vgaPrototypeGCPriv;
-	dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
-
-	/* Set the vgaGCOps */
-	*pOps = vgaGCOps;
-	pOps->devPrivate.val = 1;
-	pGC->ops = pOps;
-
-	return TRUE ;
-}
-
-static void
-xf4bppDestroyGC( pGC )
-    register GC	*pGC ;
-
-{
-    TRACE( ( "xf4bppDestroyGC(pGC=0x%x)\n", pGC ) ) ;
-
-    if ( pGC->freeCompClip && pGC->pCompositeClip )
-	REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
-    if(pGC->ops->devPrivate.val) xfree( pGC->ops );
-    xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
-    return ;
-}
-
-static Mask
-ppcChangePixmapGC
-(
-	register GC *pGC,
-	register Mask changes
-)
-{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
-register unsigned long int idx ; /* used for stepping through bitfields */
-
-#define LOWBIT( x ) ( x & - x ) /* Two's complement */
-while ((idx = LOWBIT(changes))) {
-    switch ( idx ) {
-
-	case GCLineStyle:
-	case GCLineWidth:
-	    pGC->ops->Polylines = ( ! pGC->lineWidth )
-		 ? miZeroLine
-		 : ( ( pGC->lineStyle == LineSolid )
-			 ? miWideLine : miWideDash ) ;
-	    changes &= ~( GCLineStyle | GCLineWidth ) ;
-	    break ;
-
-	case GCJoinStyle:
-	    changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
-	    break ;
-
-	case GCBackground:
-	    if ( pGC->fillStyle != FillOpaqueStippled ) {
-		changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
-		break ;
-	    } /* else Fall Through */
-	case GCForeground:
-	    if ( pGC->fillStyle == FillTiled ) {
-		changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
-		break ;
-	    } /* else Fall Through */
-	case GCFunction:
-	case GCPlaneMask:
-	case GCFillStyle:
-	    { /* new_fill */
-		int fillStyle = devPriv->colorRrop.fillStyle ;
-		/* install a suitable fillspans */
-		if ( fillStyle == FillSolid )
-		    pGC->ops->FillSpans = xf4bppSolidPixmapFS ;
-		else if ( fillStyle == FillStippled )
-		    pGC->ops->FillSpans = xf4bppStipplePixmapFS ;
-		else if ( fillStyle == FillOpaqueStippled )
-		    pGC->ops->FillSpans = xf4bppOpStipplePixmapFS ;
-		else /*  fillStyle == FillTiled */
-		    pGC->ops->FillSpans = xf4bppTilePixmapFS ;
-		changes &= ~( GCBackground | GCForeground
-			    | GCFunction | GCPlaneMask | GCFillStyle ) ;
-		break ;
-	    } /* end of new_fill */
-
-	default:
-	    ErrorF( "ppcChangePixmapGC: Unexpected GC Change\n" ) ;
-	    changes &= ~ idx ; /* Remove it anyway */
-	    break ;
-	}
-}
-
-return 0 ;
-}
-
-/* Clipping conventions
-	if the drawable is a window
-	    CT_REGION ==> pCompositeClip really is the composite
-	    CT_other ==> pCompositeClip is the window clip region
-	if the drawable is a pixmap
-	    CT_REGION ==> pCompositeClip is the translated client region
-		clipped to the pixmap boundary
-	    CT_other ==> pCompositeClip is the pixmap bounding box
-*/
-
-static void
-xf4bppValidateGC( pGC, changes, pDrawable )
-    GCPtr         pGC;
-    unsigned long changes;
-    DrawablePtr   pDrawable;
-{
-    register ppcPrivGCPtr devPriv ;
-    WindowPtr pWin ;
-
-    devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
-					     mfbGetGCPrivateKey());
-    if ( pDrawable->type != devPriv->lastDrawableType ) {
-	devPriv->lastDrawableType = pDrawable->type ;
-	xf4bppChangeGCtype( pGC, devPriv ) ;
-	changes = (unsigned)~0 ;
-    }
-
-    if ( pDrawable->depth == 1 ) {
-/*	ibmAbort(); */
-	xf4bppNeverCalled();
-    }
-
-    if ( pDrawable->type == DRAWABLE_WINDOW ) {
-	pWin = (WindowPtr) pDrawable ;
-	pGC->lastWinOrg.x = pWin->drawable.x ;
-	pGC->lastWinOrg.y = pWin->drawable.y ;
-    }
-    else {
-	pWin = (WindowPtr) NULL ;
-	pGC->lastWinOrg.x = 0 ;
-	pGC->lastWinOrg.y = 0 ;
-    }
-
-    changes &= ppcGCInterestValidateMask ;
-    /* If Nothing REALLY Changed, Just Return */
-    if ( pDrawable->serialNumber == (pGC->serialNumber & DRAWABLE_SERIAL_BITS) )
-	if ( !( changes &= ~ GC_CALL_VALIDATE_BIT ) )
-	    return ;
-
-    /* GJA -- start of cfb code */
-    /*
-     * if the client clip is different or moved OR the subwindowMode has
-     * changed OR the window's clip has changed since the last validation
-     * we need to recompute the composite clip 
-     */
-  
-     if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
- 	(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
- 	)
-     {
- 	if (pWin) {
- 	    RegionPtr   pregWin;
- 	    Bool        freeTmpClip, freeCompClip;
-  
- 	    if (pGC->subWindowMode == IncludeInferiors) {
- 		pregWin = NotClippedByChildren(pWin);
- 		freeTmpClip = TRUE;
-  	    }
-  	    else {
- 		pregWin = &pWin->clipList;
- 		freeTmpClip = FALSE;
-  	    }
- 	    freeCompClip = pGC->freeCompClip;
-  
- 	    /*
- 	     * if there is no client clip, we can get by with just keeping
- 	     * the pointer we got, and remembering whether or not should
- 	     * destroy (or maybe re-use) it later.  this way, we avoid
- 	     * unnecessary copying of regions.  (this wins especially if
- 	     * many clients clip by children and have no client clip.) 
- 	     */
- 	    if (pGC->clientClipType == CT_NONE) {
- 		if (freeCompClip)
- 		    REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
- 		pGC->pCompositeClip = pregWin;
- 		pGC->freeCompClip = freeTmpClip;
-  	    }
-  	    else {
- 		/*
- 		 * we need one 'real' region to put into the composite
- 		 * clip. if pregWin the current composite clip are real,
- 		 * we can get rid of one. if pregWin is real and the
- 		 * current composite clip isn't, use pregWin for the
- 		 * composite clip. if the current composite clip is real
- 		 * and pregWin isn't, use the current composite clip. if
- 		 * neither is real, create a new region. 
- 		 */
-  
- 		REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-				 pDrawable->x + pGC->clipOrg.x,
-				 pDrawable->y + pGC->clipOrg.y);
- 						  
- 		if (freeCompClip)
- 		{
- 		    REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
-				     pregWin, pGC->clientClip);
- 		    if (freeTmpClip)
- 			REGION_DESTROY(pGC->pScreen, pregWin);
-  		}
- 		else if (freeTmpClip)
- 		{
- 		    REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
-				     pGC->clientClip);
- 		    pGC->pCompositeClip = pregWin;
-  		}
- 		else
- 		{
- 		    pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
- 		    REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
-				     pregWin, pGC->clientClip);
- 		}
- 		pGC->freeCompClip = TRUE;
- 		REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-				 -(pDrawable->x + pGC->clipOrg.x),
-				 -(pDrawable->y + pGC->clipOrg.y));
- 						  
-  	    }
- 	}			/* end of composite clip for a window */
-  	else {
- 	    BoxRec      pixbounds;
-  
- 	    /* XXX should we translate by drawable.x/y here ? */
- 	    pixbounds.x1 = 0;
- 	    pixbounds.y1 = 0;
- 	    pixbounds.x2 = pDrawable->width;
- 	    pixbounds.y2 = pDrawable->height;
-  
- 	    if (pGC->freeCompClip) {
- 		REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
-  	    } else {
- 		pGC->freeCompClip = TRUE;
- 		pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
-  	    }
-  
- 	    if (pGC->clientClipType == CT_REGION)
- 	    {
- 		REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-				 -pGC->clipOrg.x, -pGC->clipOrg.y);
- 		REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
-				 pGC->pCompositeClip, pGC->clientClip);
- 		REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-				 pGC->clipOrg.x, pGC->clipOrg.y);
- 	    }
-	}			/* end of composute clip for pixmap */
-     }
-    /* GJA -- End of cfb code */
-
-    changes &= ~ ( GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode
-		| GC_CALL_VALIDATE_BIT ) ;
-
-    /* If needed, Calculate the Color Reduced Raster-Op */
-    if ( changes & ( GCFillStyle | GCBackground | GCForeground
-		   | GCPlaneMask | GCFunction ) )
-		xf4bppGetReducedColorRrop( pGC, pDrawable->depth,
-					&devPriv->colorRrop ) ;
-
-	(* ( ( pDrawable->type == DRAWABLE_WINDOW )
-	     ? xf4bppChangeWindowGC
-	     : ppcChangePixmapGC ) )( pGC, changes ) ;
-
-    return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcGCstr.h b/hw/xfree86/xf4bpp/ppcGCstr.h
deleted file mode 100644
index 82d1f2d..0000000
--- a/hw/xfree86/xf4bpp/ppcGCstr.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "gc.h"
-#include "mfb.h"
-
-typedef struct {
-    unsigned long	planemask ;
-    unsigned long	fgPixel ;
-    unsigned long	bgPixel ;
-    int			alu ;
-    int			fillStyle ;
-    } ppcReducedRrop ;
-
-/* ************************************************************************ */
-
-/* private field of GC */
-typedef struct {
-/* The next five (5) fields MUST CORRESPOND to
- * the fields of a "mfbPrivGC" struct
- * ----- BEGINNING OF "DO-NOT-CHANGE" REGION -----
- */
-    unsigned char	rop ;		/* reduction of rasterop to 1 of 3 */
-    unsigned char	ropOpStip ;	/* rop for opaque stipple */
-    unsigned char	ropFillArea ;	/*  == alu, rop, or ropOpStip */
-    unsigned char	unused[sizeof(long) - 3];
-    mfbFillAreaProcPtr 	FillArea;	/* fills regions; look at the code */
-/* ----- END OF "DO-NOT-CHANGE" REGION ----- */
-    ppcReducedRrop	colorRrop ;
-    short lastDrawableType ;	/* was last drawable a window or a pixmap? */
-    short lastDrawableDepth ;	/* was last drawable 1 or 8 planes? */
-    pointer devPriv ;		/* Private area for device specific stuff */
-    } ppcPrivGC ;
-typedef ppcPrivGC *ppcPrivGCPtr ;
-
-/* ppcCReduce.c */
-void xf4bppGetReducedColorRrop(
-    GCPtr,
-    int,
-    ppcReducedRrop *
-);
-
-/* vgaGC.c */
-void xf4bppChangeGCtype(
-    GCPtr,
-    ppcPrivGCPtr
-);
diff --git a/hw/xfree86/xf4bpp/ppcGetSp.c b/hw/xfree86/xf4bpp/ppcGetSp.c
deleted file mode 100644
index d88abe0..0000000
--- a/hw/xfree86/xf4bpp/ppcGetSp.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "servermd.h"
-#include "ibmTrace.h"
-
-/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
- * and continuing for pwidth[i] bits
- * Each scanline returned will be server scanline padded, i.e., it will come
- * out to an integral number of words.
- */
-void
-xf4bppGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart )
-    DrawablePtr		pDrawable ;	/* drawable from which to get bits */
-    int			wMax ;		/* largest value of all *pwidths */
-    DDXPointPtr		ppt ;		/* points to start copying from */
-    int			*pwidth ;	/* list of number of bits to copy */
-    int			nspans ;	/* number of scanlines to copy */
-    char 		*pdstStart ;
-{
-    register int		j ;
-    register unsigned char	*pdst ;	/* where to put the bits */
-    register unsigned char	*psrc ;	/* where to get the bits */
-    register int		pixmapStride ;
-
-
-    TRACE( ( "xf4bppGetSpans(pDrawable=0x%x,wMax=%d,ppt=0x%x,pwidth=0x%x,nspans=%d)\n", 
-	pDrawable, wMax, ppt, pwidth, nspans ) ) ;
-
-    if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) )
-	{
-	mfbGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ;
-	return;
-	}
-
-    pixmapStride = PixmapBytePad( wMax, pDrawable->depth ) ;
-    pdst = (unsigned char *) /* GJA */ pdstStart ;
-
-    if ( pDrawable->type == DRAWABLE_WINDOW ) {
-	for ( ; nspans-- ; ppt++, pwidth++ ) {
-		xf4bppReadColorImage(  (WindowPtr)pDrawable,
-			ppt->x, ppt->y, j = *pwidth, 1, pdst, pixmapStride ) ;
-		pdst += j ; /* width is in 32 bit words */
-		j = ( -j ) & 3 ;
-		while ( j-- ) /* Pad out to 32-bit boundary */
-		    *pdst++ = 0 ;
-	}
-    }
-    else {  /* OK, if we are here, we had better be a DRAWABLE PIXMAP */
-	register int widthSrc =  /* width of pixmap in bytes */
-	 (int) ( (PixmapPtr) pDrawable )->devKind ;
-
-	psrc = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
-	for ( ; nspans-- ; ppt++, pwidth++ ) {
-	    MOVE( psrc + ( ppt->y * widthSrc ) + ppt->x,
-		  pdst, j = *pwidth ) ;
-	    pdst += j ;
-	    j = ( -j ) & 3 ;
-	    while ( j-- ) /* Pad out to 32-bit boundary */
-	    	*pdst++ = 0 ;
-	}
-    }
-    return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcIO.c b/hw/xfree86/xf4bpp/ppcIO.c
deleted file mode 100644
index 83952d1..0000000
--- a/hw/xfree86/xf4bpp/ppcIO.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-
-Copyright (c) 1990  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mi.h"
-#include "micmap.h"
-#include "scrnintstr.h"
-#include "vgaVideo.h"
-
-#if 0
-/* XXX This remains to remind of the PC98 difference */
-static VisualRec vgaVisuals[] = {
-/* StaticColor needs to be first so is can be used as the default */
-/* vid class     bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
-#ifdef	PC98
-{   0, StaticColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, StaticGray,  4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, GrayScale,   4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, PseudoColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-#else
-{   0, StaticColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, StaticGray,  6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, GrayScale,   6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-{   0, PseudoColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
-#endif
-} ;
-#endif
-
-void
-xf4bppNeverCalled()
-{
-	FatalError("xf4bppNeverCalled was nevertheless called\n");
-}
-
-/*ARGSUSED*/
-static Bool
-vgaScreenClose
-(
-	int       idx,
-	ScreenPtr pScreen
-)
-{
-	pScreen->defColormap = 0 ;
-	return TRUE;
-}
-
-
-static GCPtr sampleGCperDepth[MAXFORMATS+1] = { 0 };
-static PixmapPtr samplePixmapPerDepth[1] = { 0 };
-
-/* GJA -- Took this from miscrinit.c.
- * We want that devKind contains the distance in bytes between two scanlines.
- * The computation that mi does is not appropriate for planar VGA.
- * Therefore we provide here our own routine.
- */
-
-/* GJA -- WARNING: this is an internal structure declaration, taken from
- * miscrinit.c
- */
-typedef struct
-{
-    pointer pbits; /* pointer to framebuffer */
-    int width;    /* delta to add to a framebuffer addr to move one row down */
-} miScreenInitParmsRec, *miScreenInitParmsPtr;
-
-/* With the introduction of pixmap privates, the "screen pixmap" can no
- * longer be created in miScreenInit, since all the modules that could
- * possibly ask for pixmap private space have not been initialized at
- * that time.  pScreen->CreateScreenResources is called after all
- * possible private-requesting modules have been inited; we create the
- * screen pixmap here.
- */
-static Bool
-v16CreateScreenResources
-(
-    ScreenPtr pScreen
-)
-{
-    miScreenInitParmsPtr pScrInitParms;
-    pointer value;
-
-    pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
-
-    /* if width is non-zero, pScreen->devPrivate will be a pixmap
-     * else it will just take the value pbits
-     */
-    if (pScrInitParms->width)
-    {
-	PixmapPtr pPixmap;
-
-	/* create a pixmap with no data, then redirect it to point to
-	 * the screen
-	 */
-	pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
-	if (!pPixmap)
-	    return FALSE;
-
-	if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
-		    pScreen->height, pScreen->rootDepth, 8 /* bits per pixel */,
-/* GJA: was 	    PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */
-#define BITS_PER_BYTE_SHIFT 3
-		    pScrInitParms->width >> BITS_PER_BYTE_SHIFT,
-		    pScrInitParms->pbits))
-	    return FALSE;
-	value = (pointer)pPixmap;
-    }
-    else
-    {
-	value = pScrInitParms->pbits;
-    }
-    xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
-    pScreen->devPrivate = value; /* pPixmap or pbits */
-    return TRUE;
-}
-
-
-Bool
-xf4bppScreenInit( pScreen, pbits, virtx, virty, dpix, dpiy, width )
-    ScreenPtr pScreen;
-    pointer pbits;
-    int virtx, virty;
-    int dpix, dpiy;
-    int width;
-{
-  Bool ret;
-  VisualPtr visuals;
-  DepthPtr depths;
-  int nvisuals;
-  int ndepths;
-  int rootdepth;
-  VisualID defaultVisual;
-
-  rootdepth = 0;
-  ret = miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
-		      &defaultVisual, (unsigned long)1 << 8, 6, -1);
-  if (!ret)
-	return FALSE;
-
-  pScreen-> id = 0;
-  pScreen->defColormap = FakeClientID(0);
-  pScreen-> whitePixel = VGA_WHITE_PIXEL;
-  pScreen-> blackPixel = VGA_BLACK_PIXEL;
-  pScreen-> rgf = 0;
-  *(pScreen-> GCperDepth) = *(sampleGCperDepth);
-  *(pScreen-> PixmapPerDepth) = *(samplePixmapPerDepth);
-  pScreen-> CloseScreen = vgaScreenClose;
-  pScreen-> QueryBestSize = xf4bppQueryBestSize;
-  pScreen-> GetImage = xf4bppGetImage;
-  pScreen-> GetSpans = xf4bppGetSpans;
-  pScreen-> CreateWindow = xf4bppCreateWindowForXYhardware;
-  pScreen-> DestroyWindow = xf4bppDestroyWindow;
-  pScreen-> PositionWindow = xf4bppPositionWindow;
-  pScreen-> CopyWindow = xf4bppCopyWindow;
-  pScreen-> CreatePixmap = xf4bppCreatePixmap;
-  pScreen-> CreateGC = xf4bppCreateGC;
-  pScreen-> CreateColormap = xf4bppInitializeColormap;
-  pScreen-> DestroyColormap = (DestroyColormapProcPtr)NoopDDA;
-  pScreen-> InstallColormap = miInstallColormap;
-  pScreen-> UninstallColormap = miUninstallColormap;
-  pScreen-> ListInstalledColormaps = miListInstalledColormaps;
-  pScreen-> StoreColors = (StoreColorsProcPtr)NoopDDA;
-  pScreen-> ResolveColor = xf4bppResolveColor;
-  mfbFillInScreen(pScreen);
-
-  if (!mfbAllocatePrivates(pScreen, NULL))
-	return FALSE;
-
-  if (!miScreenInit(pScreen, pbits, virtx, virty, dpix, dpiy, width,
-	rootdepth, ndepths, depths, defaultVisual /* See above */,
-	nvisuals, visuals))
-     return FALSE;
-
-  /* GJA -- Now we override the supplied default: */
-  pScreen -> CreateScreenResources = v16CreateScreenResources;
-
-  mfbRegisterCopyPlaneProc(pScreen,miCopyPlane); /* GJA -- R4->R5 */
-  return TRUE;
-}
diff --git a/hw/xfree86/xf4bpp/ppcImg.c b/hw/xfree86/xf4bpp/ppcImg.c
deleted file mode 100644
index 33c6b89..0000000
--- a/hw/xfree86/xf4bpp/ppcImg.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mi.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-
-/* Was MIGETIMAGE -- public entry for the GetImage Request
- * We're getting the image into a memory buffer. While we have to use GetSpans
- * to read a line from the device ( since we don't know what that looks like ) ,
- * we can just write into the destination buffer
- *
- * two different strategies are used, depending on whether we're getting the
- * image in Z format or XY format
- * Z format:
- * Line at a time, GetSpans a line and bcopy it to the destination
- * buffer, except that if the planemask is not all ones, we create a
- * temporary pixmap and do a SetSpans into it ( to get bits turned off ) 
- * and then another GetSpans to get stuff back ( because pixmaps are
- * opaque, and we are passed in the memory to write into ) .  This is
- * completely ugly and slow but works, but the interfaces just aren't
- * designed for this case.  Life is hard.
- * XY format:
- * get the single plane specified in planemask
- */
-void
-xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) 
-    DrawablePtr pDraw ;
-    int	sx, sy, w, h ;
-    unsigned int format ;
-    unsigned long planeMask ;
-    char *	     pdstLine ;
-{
-#if 1
-    int	    depth, i, linelength, width ;
-    DDXPointRec	pt ;
-    char *pbits ;
-    XID gcv[2] ;
-    PixmapPtr	pPixmap = (PixmapPtr) NULL ;
-    GCPtr	pGC ;
-    char *pDst = pdstLine ;
-
-    depth = pDraw->depth ;
-    if ( format == ZPixmap ) {
-	linelength = PixmapBytePad( w, depth ) ;
-/*	if ( pDraw->type == DRAWABLE_WINDOW ) { */
-	    sx += pDraw->x ;
-	    sy += pDraw->y ;
-/*	} */
-	if ( ( ( ( 1 << pDraw->depth ) - 1 ) & planeMask )
-		 != (unsigned)( 1 << pDraw->depth ) - 1 ) {
-	    pGC = GetScratchGC( depth, pDraw->pScreen ) ;
-	    pPixmap = (PixmapPtr)
-	      (* pDraw->pScreen->CreatePixmap)( pDraw->pScreen, w, h, depth,
-						CREATE_PIXMAP_USAGE_SCRATCH) ;
-	    gcv[0] = GXcopy ;
-	    gcv[1] = planeMask ;
-	    DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ;
-	    ValidateGC( (DrawablePtr)pPixmap, pGC ) ;
-
-	    pbits = (char *)xalloc(w);
-
-	    for ( i = 0 ; i < h ; i++ ) {
-		pt.x = sx ;
-		pt.y = sy + i ;
-		width = w ;
-		(* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pbits ) ;
-		pt.x = 0 ;
-		pt.y = i ;
-		width = w ;
-		if ( planeMask & ((1 << depth) - 1) ) /* GJA -- mfb bug */ 
-		  (* pGC->ops->SetSpans)( (DrawablePtr)pPixmap, pGC, pbits, &pt, &width, 1, TRUE ) ;
-		(* pDraw->pScreen->GetSpans)( (DrawablePtr)pPixmap, w, &pt, &width, 1, pDst ) ;
-		pDst += linelength ;
-	    }
-
-	    xfree(pbits) ;
-	    (* pGC->pScreen->DestroyPixmap)( pPixmap ) ;
-	    FreeScratchGC( pGC ) ;
-	    return ;
-	}
-
-	for ( i = 0 ; i < h ; i++ ) {
-	    pt.x = sx ;
-	    pt.y = sy + i ;
-	    width = w ;
-	    (* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pDst ) ;
-	    pDst += linelength ;
-	}
-    }
-    else
-#endif
-       miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c
deleted file mode 100644
index 9fd29ef..0000000
--- a/hw/xfree86/xf4bpp/ppcPixFS.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/******************************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "mispans.h"
-#include "ppcGCstr.h"
-#include "ppcSpMcro.h"
-#include "vgaVideo.h"
-#include "ibmTrace.h"
-
-#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
-
-/* GJA -- copied this from VGA */
-#define SCRLEFT8(lw, n)	( (unsigned char) (((unsigned char) lw) << (n)) )
-#define SCRRIGHT8(lw, n)	( (unsigned char) (((unsigned char)lw) >> (n)) )
-/*
-********** ********** ********** ********** ********** ********** **********
-   these routines all clip.  they assume that anything that has called
-them has already translated the points (i.e. pGC->miTranslate is
-non-zero, which is howit gets set in mfbCreateGC().)
-
-   the number of new scnalines created by clipping ==
-MaxRectsPerBand * nSpans.
-********** ********** ********** ********** ********** ********** **********
-*/
-/* A mod definition that goes smoothly into the negative.
- */
-static int
-modulo
-(
-      int n1,
-      int n2
-)
-{
-      int tmp;
-      if ( n1 < 0 ) {
-              tmp = (-n1) % n2;
-              if ( tmp == 0 ) {
-                      return 0;
-              } else {
-                      return n2 - tmp;
-              }
-      } else {
-              return n1 % n2;
-      }
-}
-
-void
-xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-    DrawablePtr pDrawable ;
-    GCPtr	pGC ;
-    int		nInit ;			/* number of spans to fill */
-    DDXPointPtr pptInit ;		/* pointer to list of start points */
-    int		*pwidthInit ;		/* pointer to list of n widths */
-    int 	fSorted ;
-{
-    register unsigned long int pm, npm ;
-    register unsigned long int fg ;
-    register int alu ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    register unsigned char *addrl ;	/* pointer to current longword in bitmap */
-    int i ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE(("xf4bppSolidPixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
-
-    if ( pDrawable->type != DRAWABLE_PIXMAP ) {
-	ErrorF("xf4bppSolidPixmapFS: drawable is not a pixmap\n") ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
-	return ;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
-    if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
-	return ;
-    pwidth = pwidthFree ;
-
-    if ( !( pptFree = (DDXPointRec *)
-	    xalloc( n * sizeof( DDXPointRec ) ) ) ) {
-	xfree( pwidth ) ;
-	return ;
-    }
-    ppt = pptFree ;
-
-    n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
-	ppt, pwidth, fSorted ) ;
-
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-    npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
-
-    for ( ; n-- ; ppt++, pwidth++ ) {
-        addrl = ( (unsigned char *) ( ( (PixmapPtr) pDrawable )->devPrivate.ptr ) )
-	      + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
-	      + ppt->x ;
-	for ( i = *pwidth ; i-- ; addrl++ )
-	    {
-	    unsigned _p;
-	    DoRop( _p, alu, fg, *addrl );
-	    *addrl = ( *addrl & npm ) | ( pm & _p ) ;
-	    }
-#ifdef notdef /* PURDUE */
-	    *addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ;
-#endif /* PURDUE */
-    }
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
-
-/* GJA -- copied from vgaStipple.c */
-static unsigned char
-vgagetbits
-(
-	register const int x,
-	register const unsigned int patternWidth,
-	register const unsigned char * const lineptr
-)
-{
-register unsigned char bits ;
-register const unsigned char *cptr ;
-register int shift ;
-register int wrap ;
-
-cptr = lineptr + ( x >> 3 ) ;
-bits = *cptr ;
-if ((shift = x & 7))
-      bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
-if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
-      bits &= SCRLEFT8( 0xFF, wrap ) ;
-      bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
-}
-
-/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
- * I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
- */
-switch (patternWidth) {
-case 1:	/* Not really useful. */
-	bits &= ~SCRRIGHT8(0xFF,1);
-	bits |= SCRRIGHT8(bits,1); 
-	bits |= SCRRIGHT8(bits,2);
-	bits |= SCRRIGHT8(bits,4);
-	break;
-case 2:
-	bits &= ~SCRRIGHT8(0xFF,2);
-	bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
-case 3:
-	bits &= ~SCRRIGHT8(0xFF,3);
-	bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
-case 4:
-	bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
-case 5:
-	bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
-case 6:
-	bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
-case 7:
-	bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
-default:
-	;
-	/* Do nothing, of course */
-}
-
-return bits ;
-}
-
-void
-xf4bppStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-register DrawablePtr pDrawable ;
-GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-    register unsigned char *pdst ; /* pointer to current word in bitmap */
-    register unsigned long int pm, npm ;
-    register unsigned long int fg ;
-    register int alu ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    PixmapPtr	pTile ;		/* pointer to tile we want to fill with */
-    int		width,  x, xSrc, ySrc ;
-    int 	tlwidth, tileWidth ;
-    unsigned char *psrcT ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-    int xoff, count, stip, i ;
-
-    TRACE(("xf4bppStipplePixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n",
-		 pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
-
-    if ( pDrawable->type != DRAWABLE_PIXMAP ) {
-	ErrorF( "xf4bppStippleWindowFS: drawable is not a pixmap\n") ;
-	return ;
-    }
-    if ( pGC->stipple->drawable.depth != 1 ) {
-	ErrorF( "ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
-		pDrawable->type, pGC->stipple->drawable.depth ) ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		pptFree, pwidth, ppt, fSorted ) ;
-
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-
-    pTile = pGC->stipple ;
-    tlwidth = pTile->devKind ;
-
-    tileWidth = pTile->drawable.width ;
-
-    npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
-
-    /* this replaces rotating the stipple.  Instead, we just adjust the offset
-     * at which we start grabbing bits from the stipple */
-    xSrc = pGC->patOrg.x + pDrawable->x;
-    ySrc = pGC->patOrg.y + pDrawable->y;
-
-    while ( n-- ) {
-        pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
-	     + ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
-	     + ppt->x ;
-        psrcT = (unsigned char *)pTile->devPrivate.ptr
-	      + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
-	x = ppt->x ;
-
-        xoff = modulo( x - xSrc, tileWidth) ;
-        for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
- 
-            if ( xoff >= tileWidth ) xoff -= tileWidth;
- 
-            if ( width < 8 )
-                count = width;
-            else
-                count = 8;
- 
-            stip = vgagetbits( xoff, tileWidth, psrcT ) ;
- 
-            for ( i = count ; i-- ; ) {
-                if ( stip & 128 )
-		    {
-		    unsigned _p;
-		    DoRop( _p, alu, fg, *pdst ) ;
-		    *pdst = ( *pdst & npm ) | ( pm & _p ) ;
-		    }
-#ifdef notdef /* PURDUE */
-		    *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
-#endif /* PURDUE */
-		pdst++ ;
-		stip = SCRLEFT( stip, 1 ) ;
-	    }
-	}
-	ppt++ ;
-	pwidth++ ;
-    }
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
-
-void
-xf4bppOpStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-DrawablePtr pDrawable ;
-GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-    register unsigned char *pdst ;	/* pointer to current word in bitmap */
-    register unsigned long int pm, npm ;
-    register unsigned long int fg, bg ;
-    register int alu ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    PixmapPtr pTile ;		/* pointer to tile we want to fill with */
-    int	width ;
-    int xSrc, ySrc ;
-    int tlwidth, tileWidth ;
-    unsigned char *psrcT ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-    int xoff, count, stip, i ;
-
-    TRACE( ( "xf4bppOpStipplePixmapFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	   pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( pGC->stipple->drawable.depth != 1 ) {
-	ErrorF( "xf4bppOpStipplePixmapFS: bad depth\ntype = %d, depth = %d\n",
-		pDrawable->type, pGC->stipple->drawable.depth ) ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		 pptFree, pwidth, ppt, fSorted ) ;
-
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-    bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
-
-    pTile = pGC->stipple ;
-    tlwidth = pTile->devKind ;
-    tileWidth = pTile->drawable.width ;
-
-    xSrc = pGC->patOrg.x + pDrawable->x;
-    ySrc = pGC->patOrg.y + pDrawable->y;
-
-    /* this replaces rotating the stipple.  Instead, we just adjust the offset
-     * at which we start grabbing bits from the stipple */
-    for ( ; n-- ; ppt++, pwidth++ ) {
-        pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
-	     + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
-	     + ppt->x ;
-        psrcT = (unsigned char *)pTile->devPrivate.ptr
-            + ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
- 
-        xoff = modulo( ppt->x - xSrc, tileWidth) ;
- 
-        for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
- 
-            if ( xoff >= tileWidth ) xoff -= tileWidth;
- 
-            if ( width < 8 )
-                count = width;
-            else
-                count = 8;
- 
-            stip = vgagetbits( xoff, tileWidth, psrcT ) ;
-            for ( i = count ; i-- ; pdst++, stip = SCRLEFT( stip, 1 ) )
-                if ( stip & 128 )
-		    {
-		    unsigned _p;
-		    DoRop( _p, alu, fg, *pdst ) ;
-		    *pdst = ( *pdst & npm ) | ( pm & _p ) ;
-		    }
-#ifdef notdef /* PURDUE */
-		    *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
-#endif /* PURDUE */
-		else
-		    {
-		    unsigned _p;
-		    DoRop( _p, alu, bg, *pdst ) ;
-		    *pdst = ( *pdst & npm ) | ( pm & _p ) ;
-		    }
-#ifdef notdef /* PURDUE */
-		    *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, bg, *pdst ) ) ;
-#endif /* PURDUE */
-	}
-    }
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
-
-void
-xf4bppTilePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-register DrawablePtr pDrawable ;
-GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    register unsigned char *pdst ;	/* pointer to current word in bitmap */
-    register unsigned char *psrc ;	/* pointer to current word in tile */
-    register PixmapPtr pTile ;	/* pointer to tile we want to fill with */
-    int i ;
-    int alu ;
-    unsigned char pm, npm ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    int tileWidth ;
-    int xSrc, ySrc;
-    unsigned char *psrcT ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE( ( "ppcTileFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	    pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
-	mfbTileFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ;
-	return ;
-    }
-    if ( !xf4bppDepthOK( pDrawable, pGC->tile.pixmap->drawable.depth ) ) {
-	ErrorF( "ppcTileFS: bad depth\ntype = %d, depth = %d\n",
-		pDrawable->type, pDrawable->depth) ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		 pptFree, pwidth, ppt, fSorted ) ;
-
-    /* the following code is for 8 bits per pixel addressable memory only */
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
-    pTile = pGC->tile.pixmap ;
-    tileWidth = pTile->drawable.width ;
-
-     xSrc = pGC->patOrg.x + pDrawable->x;
-     ySrc = pGC->patOrg.y + pDrawable->y;
-    /* this replaces rotating the tile. Instead we just adjust the offset
-     * at which we start grabbing bits from the tile */
-    for ( ; n-- ; ppt++, pwidth++ ) {
-        pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
-	     + ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
-	     + ppt->x ;
-        psrcT = (unsigned char *) pTile->devPrivate.ptr
-        + ( modulo( ppt->y - ySrc, pTile->drawable.height) * pTile->devKind ) ;
- 
-        psrc = psrcT + modulo( ppt->x - xSrc, tileWidth ) ;
-	for ( i = *pwidth ; i-- ; pdst++, psrc++ ) {
-	    if ( psrc >= ( psrcT + tileWidth ) )
-		psrc = psrcT ;
-	    {
-	    unsigned _p;
-	    DoRop( _p, alu, *psrc, *pdst ) ;
-	    *pdst = ( *pdst & npm ) | ( pm & _p ) ;
-	    }
-#ifdef notdef /* PURDUE */
-	    *pdst = ( *pdst & npm ) | ( pm & DoRop( alu, *psrc, *pdst ) ) ;
-#endif /* PURDUE */
-	}
-    }
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c
deleted file mode 100644
index d04aacf..0000000
--- a/hw/xfree86/xf4bpp/ppcPixmap.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "xf4bpp.h"
-#include "servermd.h"
-#include "OScompiler.h"
-#include "ibmTrace.h"
-#include "scrnintstr.h"
-
-PixmapPtr
-xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint )
-    ScreenPtr	pScreen ;
-    int		width ;
-    int		height ;
-    int		depth ;
-    unsigned	usage_hint ;
-{
-    register PixmapPtr pPixmap  = (PixmapPtr)NULL;
-    size_t size ;
-    
-    TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d, usage_hint=%d)\n", pScreen, width, height, depth, usage_hint)) ;
-
-    if ( depth > 8 )
-	return (PixmapPtr) NULL ;
-
-    size = PixmapBytePad(width, depth);
-
-    if (size / 4 > 32767 || height > 32767)
-	return (PixmapPtr) NULL ;
-    
-    pPixmap = AllocatePixmap (pScreen, (height * size));
-    
-    if ( !pPixmap )
-	return (PixmapPtr) NULL ;
-    pPixmap->drawable.type = DRAWABLE_PIXMAP ;
-    pPixmap->drawable.class = 0 ;
-    pPixmap->drawable.pScreen = pScreen ;
-    pPixmap->drawable.depth = depth ;
-    pPixmap->drawable.id = 0 ;
-    pPixmap->drawable.bitsPerPixel = ( depth == 1 ) ? 1 : 8 ;
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER ;
-    pPixmap->drawable.x = 0 ;
-    pPixmap->drawable.y = 0 ;
-    pPixmap->drawable.width = width ;
-    pPixmap->drawable.height = height ;
-    pPixmap->devKind = size;
-    pPixmap->refcnt = 1 ;
-    size = height * pPixmap->devKind ;
-    pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
-					 + pScreen->totalPixmapSize);
-    bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
-    pPixmap->usage_hint = usage_hint;
-    return pPixmap ;
-}
-
-PixmapPtr
-xf4bppCopyPixmap(pSrc)
-    register PixmapPtr	pSrc;
-{
-    register PixmapPtr	pDst;
-    int		size;
-
-    TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc)) ;
-    size = pSrc->drawable.height * pSrc->devKind;
-    pDst = xalloc(sizeof(PixmapRec) + size);
-    if (!pDst)
-	return NullPixmap;
-    pDst->devPrivates = NULL;
-    pDst->drawable = pSrc->drawable;
-    pDst->drawable.id = 0;
-    pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    pDst->devKind = pSrc->devKind;
-    pDst->refcnt = 1;
-    pDst->devPrivate.ptr = (pointer)(pDst + 1);
-    MOVE( (char *)pSrc->devPrivate.ptr, (char *)pDst->devPrivate.ptr, size ) ;
-    return pDst;
-}
diff --git a/hw/xfree86/xf4bpp/ppcPolyPnt.c b/hw/xfree86/xf4bpp/ppcPolyPnt.c
deleted file mode 100644
index c61fd6d..0000000
--- a/hw/xfree86/xf4bpp/ppcPolyPnt.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-
-Copyright (c) 1987  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mi.h"
-#include "scrnintstr.h"
-#include "ppcGCstr.h"
-#include "ibmTrace.h"
-
-void
-xf4bppPolyPoint( pDrawable, pGC, mode, npt, pptInit )
-DrawablePtr	pDrawable ;
-GCPtr		pGC ;
-int		mode ;				/* Origin or Previous */
-int		npt ;
-xPoint		*pptInit ;
-{
-register xPoint *ppt ;
-ppcPrivGC *devPriv ;
-int alu ;
-int nptTmp ;
-
-TRACE( ("xf4bppPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
-	pDrawable, pGC, mode, npt, pptInit ) ) ;
-
-if ( pDrawable->type == DRAWABLE_PIXMAP ) {
-	if ( pGC->alu != GXnoop )
-		miPolyPoint( pDrawable, pGC, mode, npt, pptInit ) ;
-	return ;
-}
-
-devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
-if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
-	return ;
-
-/* make pointlist origin relative */
-if ( mode == CoordModePrevious )
-	for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; ) {
-		ppt++ ;
-		ppt->x += (ppt-1)->x ;
-		ppt->y += (ppt-1)->y ;
-	}
-
-if ( pGC->miTranslate ) {
-	register int xorg = pDrawable->x ;
-	register int yorg = pDrawable->y ;
-	for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ ) {
-		ppt->x += xorg ;
-		ppt->y += yorg ;
-	}
-}
-
-{
-	register RegionPtr pRegion = pGC->pCompositeClip ;
-	register unsigned long int fg = devPriv->colorRrop.fgPixel ;
-	register unsigned long int pm = devPriv->colorRrop.planemask ;
-	BoxRec box ; /* Scratch Space */
-
-	if ( ! REGION_NUM_RECTS(pRegion))
-		return ;
-
-	for ( ppt = pptInit ; npt-- ; ppt++ )
-		if (POINT_IN_REGION(pDrawable->pScreen, pRegion,
-				    ppt->x, ppt->y, &box))
-			xf4bppFillSolid( (WindowPtr)pDrawable,
-				fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
-}
-
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcQuery.c b/hw/xfree86/xf4bpp/ppcQuery.c
deleted file mode 100644
index d42360d..0000000
--- a/hw/xfree86/xf4bpp/ppcQuery.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-
-void
-xf4bppQueryBestSize
-(
-	register int class,
-	register unsigned short *pwidth,
-	register unsigned short *pheight,
-	ScreenPtr pScreen
-)
-{
-if ( class == CursorShape )
-  *pwidth = *pheight = 32 ; /* ppc's cursor max out at 32 by 32 */
-else /* either TileShape or StippleShape */
-  /* Round Up To Nearest Multiple Of 8 -- We don't care what height they use */
-  *pwidth = ( *pwidth + 0x7 ) & ~ 0x7 ;
-
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcRslvC.c b/hw/xfree86/xf4bpp/ppcRslvC.c
deleted file mode 100644
index 0337feb..0000000
--- a/hw/xfree86/xf4bpp/ppcRslvC.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/************************************************************
-Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
-
-                    All Rights Reserved
-
-Permission  to  use,  copy,  modify,  and  distribute   this
-software  and  its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright no-
-tice  appear  in all copies and that both that copyright no-
-tice and this permission notice appear in  supporting  docu-
-mentation,  and  that the names of Sun or X Consortium
-not be used in advertising or publicity pertaining to 
-distribution  of  the software  without specific prior 
-written permission. Sun and X Consortium make no 
-representations about the suitability of this software for 
-any purpose. It is provided "as is" without any express or 
-implied warranty.
-
-SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
-NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
-ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
-PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* Generic Color Resolution Scheme
- * P. Shupak 12/31/87
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "scrnintstr.h"
-
-/*
- * New colormap routines that can support multiple Visual types.
- */
-
-static unsigned short defstaticpalette[16][3] = {
-	/*   R       G       B   */
-	{ 0x0000, 0x0000, 0x0000 },	/* black */
-	{ 0xFFFF, 0xFFFF, 0xFFFF },	/* white */
-	{ 0xAAAA, 0xAAAA, 0xAAAA },	/* grey */
-	{ 0x0000, 0x0000, 0xAAAA },	/* dark blue */
-	{ 0x0000, 0x0000, 0xFFFF },	/* medium blue */
-	{ 0x0000, 0xAAAA, 0xFFFF },	/* light blue */
-	{ 0x0000, 0xFFFF, 0xFFFF },	/* cyan */
-	{ 0x0000, 0xAAAA, 0x0000 },	/* dark green */
-	{ 0x0000, 0xFFFF, 0x0000 },	/* green */
-	{ 0xAAAA, 0xFFFF, 0x5555 },	/* pale green */
-	{ 0xAAAA, 0x5555, 0x0000 },	/* brown */
-	{ 0xFFFF, 0xAAAA, 0x0000 },	/* light brown */
-	{ 0xFFFF, 0xFFFF, 0x0000 },	/* yellow */
-	{ 0xAAAA, 0x0000, 0xAAAA },	/* purple */
-	{ 0xFFFF, 0x0000, 0xFFFF },	/* magenta */
-	{ 0xFFFF, 0x0000, 0x0000 },	/* red */
-	};
-
-Bool
-xf4bppInitializeColormap(pmap)
-    register ColormapPtr	pmap;
-{
-    register unsigned i;
-    register VisualPtr pVisual;
-    unsigned lim, maxent, shift;
-
-    pVisual = pmap->pVisual;
-    lim = (1 << pVisual->bitsPerRGBValue) - 1;
-    shift = 16 - pVisual->bitsPerRGBValue;
-    maxent = pVisual->ColormapEntries - 1;
-
-    switch( pVisual->class )
-	{
-	case StaticGray:
-	    for ( i = 0 ; i < maxent ; i++ ) {
-		pmap->red[i].co.local.red   =
-		pmap->red[i].co.local.green =
-		pmap->red[i].co.local.blue  =
-		    ((((i * 65535) / maxent) >> shift) * 65535) / lim;
-	    }
-	    break;
-	case StaticColor:
-	    for ( i = 0 ; i < 16 ; i++ ) {
-		pmap->red[i].co.local.red   = (defstaticpalette[i][0]);
-		pmap->red[i].co.local.green = (defstaticpalette[i][1]);
-		pmap->red[i].co.local.blue  = (defstaticpalette[i][2]);
-	    }
-	    break;
-	case GrayScale:
-	case PseudoColor:
-	    for(i=0;i<=maxent;i++) {
-	        int a,b,c;
-		a = i << 10;
-		b = i << 12;
-		c = i << 14;
-		pmap->red[i].co.local.red   = a;
-		pmap->red[i].co.local.green = b;
-		pmap->red[i].co.local.blue  = c;
-	    }
-	    break;
-	case TrueColor:
-	case DirectColor:
-	default:
-	    ErrorF( "Unsupported Visual class %d\b", pVisual->class );
-	    return FALSE;
-	}
-    return TRUE;
-}
-
-void
-xf4bppResolveColor( pred, pgreen, pblue, pVisual )
-register unsigned short* pred ;
-register unsigned short* pgreen ;
-register unsigned short* pblue ;
-register VisualPtr pVisual ;
-{ 
-    unsigned lim, maxent, shift;
-
-    lim = (1 << pVisual->bitsPerRGBValue) - 1;
-    shift = 16 - pVisual->bitsPerRGBValue;
-    maxent = pVisual->ColormapEntries - 1;
-
-    switch( pVisual->class )
-	{
-	case StaticGray:
-	    *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
-	    *pred = (((*pred * (maxent + 1)) >> 16) * 65535) / maxent;
-	    *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
-	    break;
-	case StaticColor:
-	    break;
-	case GrayScale:
-	    *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
-	    *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
-	    break;
-	case PseudoColor:
-	    /* rescale to rgb bits */
-	    *pred = ((*pred >> shift) * 65535) / lim;
-	    *pgreen = ((*pgreen >> shift) * 65535) / lim;
-	    *pblue = ((*pblue >> shift) * 65535) / lim;
-	    break;
-	case TrueColor:
-	case DirectColor:
-	default:
-	    ErrorF( "Unsupported Visual class %d\b", pVisual->class );
-	}
-}
-
diff --git a/hw/xfree86/xf4bpp/ppcSetSp.c b/hw/xfree86/xf4bpp/ppcSetSp.c
deleted file mode 100644
index 7659384..0000000
--- a/hw/xfree86/xf4bpp/ppcSetSp.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/***********************************************************
-
-Copyright (c) 1987  X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "servermd.h"
-
-/* SetScanline -- copies the bits from psrc to the drawable starting at
- * (xStart, y) and continuing to (xEnd, y).  xOrigin tells us where psrc 
- * starts on the scanline. (I.e., if this scanline passes through multiple
- * boxes, we may not want to start grabbing bits at psrc but at some offset
- * further on.) 
- */
-static void
-ppcSetScanline
-(
-    register int	   pixCount,	/* width of scanline in bits */
-    register char          *psrc,
-    register unsigned char *pdst,	/* where to put the bits */
-    register int	   pm,		/* plane mask */
-    const int		   alu		/* raster op */
-)
-{
-register int npm = ~pm ;	/* inverted plane mask */
-register char tmpx ;
-
-pm &= 0x0F; npm &= 0x0F; /* GJA */
-
-switch ( alu ) {
-	case GXclear:		/* 0x0 Zero 0 */
-		while ( pixCount-- )
-			*pdst++ &= npm ;
-		break ;
-	case GXand:		/* 0x1 src AND dst */
-		while ( pixCount-- )
-			*pdst++ &= *psrc++ | npm ;
-		break ;
-	case GXandReverse:	/* 0x2 src AND NOT dst */
-		for ( ; pixCount-- ; pdst++, psrc++ ) {
-			tmpx = *pdst;
-			*pdst = ( tmpx & npm ) | ( pm & *psrc & ~tmpx ) ;
-		}
-		break ;
-	case GXcopy:		/* 0x3 src */
-		for ( ; pixCount-- ; pdst++, psrc++ )
-			*pdst = ( *pdst & npm ) | ( pm & *psrc ) ;
-		break ;
-	case GXandInverted:	/* 0x4 NOT src AND dst */
-		while ( pixCount-- )
-			*pdst++ &= npm | ~*psrc++ ;
-		break ;
-	case GXnoop:		/* 0x5 dst */
-		break ;
-	case GXxor:		/* 0x6 src XOR dst */
-		while ( pixCount-- )
-			*pdst++ ^= pm & *psrc++ ;
-		break ;
-	case GXor:		/* 0x7 src OR dst */
-		while ( pixCount-- )
-			*pdst++ |= *psrc++ & pm ;
-		break ;
-	case GXnor:		/* 0x8 NOT src AND NOT dst */
-		for ( ; pixCount-- ; pdst++, psrc++ ) {
-			tmpx = *pdst;
-			*pdst = ( tmpx & npm ) | ( pm & ~( tmpx | *psrc ) ) ;
-		}
-		break ;
-	case GXequiv:		/* 0x9 NOT src XOR dst */
-		while ( pixCount-- )
-			*pdst++ ^= pm & ~ *psrc++ ;
-		break ;
-	case GXorReverse:	/* 0xb src OR NOT dst */
-		for ( ; pixCount-- ; pdst++, psrc++ ) {
-			tmpx = *pdst;
-			*pdst = ( tmpx & npm ) | ( pm & ( *psrc | ~tmpx ) ) ;
-		}
-		break ;
-	case GXinvert:		/* 0xa NOT dst */
-		while ( pixCount-- )
-			*pdst++ ^= pm ;
-		break ;
-	case GXcopyInverted:	/* 0xc NOT src */
-		for ( ; pixCount-- ; pdst++, psrc++ )
-			*pdst = ( *pdst & npm ) | ( pm & ~ *psrc ) ;
-		break ;
-	case GXorInverted:	/* 0xd NOT src OR dst */
-		while ( pixCount-- )
-			*pdst++ |= pm & ~ *psrc++ ;
-		break ;
-	case GXnand:		/* 0xe NOT src OR NOT dst */
-		for ( ; pixCount-- ; pdst++, psrc++ ) {
-			tmpx = *pdst;
-			*pdst = ( tmpx & npm ) | ( pm & ~( tmpx & *psrc ) ) ;
-		}
-		break ;
-	case GXset:		/* 0xf 1 */
-		while ( pixCount-- )
-			*pdst++ |= pm ;
-		break ;
-	default:
-		ErrorF( "ppcSetScanLine: bad alu value == 0x%02X\n", alu ) ;
-		break ;
-}
-
-return ;
-}
-
-/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
- * ppt[i] using the raster op from the GC.  If fSorted is TRUE, the scanlines
- * are in increasing Y order.
- * Source bit lines are server scanline padded so that they always begin
- * on a word boundary.
- */ 
-void
-xf4bppSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted )
-    register DrawablePtr	pDrawable ;
-    GCPtr			pGC ;
-    char			*psrc ;
-    register DDXPointPtr	ppt ;
-    int				*pwidth ;
-    int				nspans ;
-    int				fSorted ;
-{
-    unsigned char	*pdstBase = NULL;	/* start of dst bitmap */
-    int 		widthDst = 0;		/* width of bitmap in words */
-    register BoxPtr 	pbox, pboxLast, pboxTest ;
-    register DDXPointPtr pptLast ;
-    RegionPtr 		prgnDst ;
-    register int	width ;
-    int			xStart, xEnd ;
-    int			yMax ;
-    int			alu ;
-    int			pm ;
-
-    /* allow for 1-deep windows on nfb machines (eg apa8, aed) */
-    if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
-	mfbSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) ;
-	return ;
-    }
-
-    if ( !( pm = pGC->planemask & ~( (~0) << pDrawable->depth ) )
-      || ( ( alu = pGC->alu ) == GXnoop ) )
-	return ;
-
-    prgnDst = pGC->pCompositeClip ;
-
-    if ( ! REGION_NUM_RECTS(prgnDst))
-	return ;
-
-    pboxLast = ( pbox = REGION_RECTS(prgnDst) ) + REGION_NUM_RECTS(prgnDst);
-    pptLast = ppt + nspans ;
-
-    if ( pDrawable->type == DRAWABLE_WINDOW ) {
-	yMax = (int) pDrawable->height + pDrawable->y ;
-    }
-    else {
-	pdstBase = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
-	widthDst = (int) ( (PixmapPtr) pDrawable )->devKind ;
-	yMax = pDrawable->height ;
-    }
-
-    if ( fSorted ) {
-    /* scan lines sorted in ascending order. Because they are sorted, we
-     * don't have to check each scanline against each clip box.  We can be
-     * sure that this scanline only has to be clipped to boxes at or after the
-     * beginning of this y-band 
-     */
-	for ( pboxTest = pbox ;
-	      ( ppt < pptLast ) && ( ppt->y < yMax ) ;
-	      ppt++, pwidth++,
-	      psrc += PixmapBytePad( width, pDrawable->depth ) ) {
-	    width = *pwidth ;
-	    for ( pbox = pboxTest ;
-	          pbox < pboxLast ;
-		  pbox++ ) {
-		if ( pbox->y2 <= ppt->y ) {
-		    /* clip box is before scanline */
-		    pboxTest = pbox + 1 ;
-		}
-		else if ( ( pbox->y1 > ppt->y )
-		       || ( pbox->x1 > ppt->x + width ) )
-		    break ; /* scanline before clip box or left of clip box */
-		else if ( pbox->x2 > ppt->x ) {
-		    /* some of the scanline is in the current clip box */
-		    xStart = MAX( pbox->x1, ppt->x ) ;
-		    xEnd = MIN( ppt->x + width, pbox->x2 ) ;
-		    if ( pDrawable->type == DRAWABLE_PIXMAP )
-			    ppcSetScanline( xEnd - xStart,
-					    psrc + ( xStart - ppt->x ),
-					    pdstBase + xStart
-					    + ( ppt->y * widthDst ),
-				            pm, alu ) ;
-		    else
-			xf4bppDrawColorImage( (WindowPtr)pDrawable,
-			      xStart, ppt->y, xEnd - xStart, 1,
-			      (unsigned char *)psrc + ( xStart - ppt->x ),
-			      xEnd - xStart, alu, pm ) ;
-		    if ( ppt->x + width <= pbox->x2 )
-		        break ; /* End of the line, as it were */
-		}
-	    }
-	    /* We've tried this line against every box ; it must be outside them
-	     * all.  move on to the next point */
-	}
-    }
-    else {
-    /* scan lines not sorted. We must clip each line against all the boxes */
-	for ( ;
-	      ppt < pptLast ;
-	      ppt++, pwidth++,
-	      psrc += PixmapBytePad( width, pDrawable->depth ) ) {
-	    width = *pwidth ;
-	    if ( ppt->y >= 0 && ppt->y < yMax ) {
-		for ( pbox = REGION_RECTS(prgnDst) ; pbox < pboxLast ; pbox++ ) {
-		    if ( pbox->y1 > ppt->y )
-			break ; /* rest of clip region is above this scanline */
-		    else if ( ( pbox->y2 > ppt->y )
-			   && ( pbox->x1 <= ppt->x + width )
-			   && ( pbox->x2 > ppt->x ) ) {
-			xStart = MAX( pbox->x1, ppt->x ) ;
-			xEnd = MIN( pbox->x2, ppt->x + width ) ;
-    			if ( pDrawable->type == DRAWABLE_PIXMAP )
-				ppcSetScanline( xEnd - xStart,
-						psrc + ( xStart - ppt->x ),
-						/* ^ GJA */
-						( ( pdstBase
-						 + ( ppt->y * widthDst ) )
-						 + xStart ),
-						pm, alu ) ;
-    			else	/* pDrawable->type == DRAWABLE_WINDOW */
-			    xf4bppDrawColorImage( (WindowPtr)pDrawable,
-				  xStart, ppt->y, xEnd - xStart, 1,
-				  (unsigned char *)psrc + ( xStart - ppt->x ),
-							/* GJA ^ */
-				  xEnd - xStart, alu, pm ) ;
-		    }
-
-		}
-	    }
-	}
-    }
-    return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcSpMcro.h b/hw/xfree86/xf4bpp/ppcSpMcro.h
deleted file mode 100644
index 655a883..0000000
--- a/hw/xfree86/xf4bpp/ppcSpMcro.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/* This screwy macro is used in all the spans routines and you find
-   it all over the place, so it is a macro just to tidy things up.
-*/
-
-#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT)		\
-	{								\
-	N = IN * miFindMaxBand(pGC->pCompositeClip);			\
-	if(!(PW = (int *)xalloc(N * sizeof(int))))		\
-		return;							\
-	if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
-		{							\
-		free(PW);					\
-		return;							\
-    		}							\
-	FPW = PW;							\
-	FPPT = PPT;							\
-	N = miClipSpans(pGC->pCompositeClip, IPPT, IPW, IN,		\
-		PPT, PW, FSORT);					\
-	}
-
diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c
deleted file mode 100644
index 1522afd..0000000
--- a/hw/xfree86/xf4bpp/ppcWinFS.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-/******************************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mi.h"
-#include "mispans.h"
-#include "ppcGCstr.h"
-#include "ppcSpMcro.h"
-#include "ibmTrace.h"
-
-#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
-/*
-********** ********** ********** ********** ********** ********** **********
-   these routines all clip.  they assume that anything that has called
-them has already translated the points (i.e. pGC->miTranslate is
-non-zero, which is howit gets set in mfbCreateGC().)
-
-   the number of new scanlines created by clipping ==
-MaxRectsPerBand * nSpans.
-********** ********** ********** ********** ********** ********** **********
-*/
-
-void
-xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-    DrawablePtr pDrawable ;
-    GCPtr	pGC ;
-    int		nInit ;			/* number of spans to fill */
-    DDXPointPtr pptInit ;		/* pointer to list of start points */
-    int		*pwidthInit ;		/* pointer to list of n widths */
-    int 	fSorted ;
-{
-    register unsigned long int pm ;
-    register unsigned long int fg ;
-    register int alu ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE( ( "xf4bppSolidWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	    pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( pDrawable->type != DRAWABLE_WINDOW ) {
-	ErrorF( "xf4bppSolidWindowFS: drawable is not a window\n") ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
-    if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
-	return ;
-    pwidth = pwidthFree ;
-
-    if ( !( pptFree = (DDXPointRec *)
-			xalloc( n * sizeof( DDXPointRec ) ) ) ) {
-	xfree( pwidth ) ;
-	return ;
-    }
-    ppt = pptFree ;
-
-    n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
-	ppt, pwidth, fSorted ) ;
-
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-
-    for ( ; n-- ; ppt++, pwidth++ )
-	if ( *pwidth )
-	    xf4bppFillSolid( (WindowPtr)pDrawable,
-		           fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ;
-
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
-
-void
-xf4bppStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-DrawablePtr pDrawable ;
-register GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-    register unsigned long int pm ;
-    register unsigned long int fg ;
-    register int alu ;
-				/* next three parameters are post-clip */
-    int n ;			/* number of spans to fill */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    PixmapPtr	pTile ;		/* pointer to tile we want to fill with */
-    int xSrc ;
-    int ySrc ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE( ( "xf4bppStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	   pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( pDrawable->type != DRAWABLE_WINDOW ) {
-	ErrorF( "xf4bppStippleWindowFS: drawable is not a window\n" ) ;
-	return ;
-    }
-
-    if ( pGC->stipple->drawable.depth != 1 ) {
-	ErrorF("ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
-		pDrawable->type, pGC->stipple->drawable.depth ) ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		 pptFree, pwidth, ppt, fSorted ) ;
-
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-
-    xSrc = pGC->patOrg.x + pDrawable->x ;
-    ySrc = pGC->patOrg.y + pDrawable->y ;
-    pTile = pGC->stipple ;
-
-    for ( ; n-- ; ppt++, pwidth++ )
-	xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm,
-			ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
-
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-
-    return ;
-}
-
-void
-xf4bppOpStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-DrawablePtr pDrawable ;
-register GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    int n ;			/* number of spans to fill */
-    int xSrc ;
-    int ySrc ;
-    unsigned long int pm ;
-    unsigned long int fg, bg ;
-    int alu ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE( ( "xf4bppOpStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	    pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( pGC->stipple->drawable.depth != 1 ) {
-	ErrorF( "xf4bppOpStippleWindowFS: bad depth\ntype = %d, depth = %d\n",
-		pDrawable->type, pGC->stipple->drawable.depth ) ;
-	return ;
-    }
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		 pptFree, pwidth, ppt, fSorted ) ;
-
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-    fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
-    bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
-
-    xSrc = pGC->patOrg.x + pDrawable->x ;
-    ySrc = pGC->patOrg.y + pDrawable->y ;
-
-    for ( ; n-- ; ppt++, pwidth++ )
-	xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm,
-		ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
-
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
-
-void
-xf4bppTileWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
-DrawablePtr pDrawable ;
-register GC *pGC ;
-int nInit ;			/* number of spans to fill */
-DDXPointPtr pptInit ;		/* pointer to list of start points */
-int *pwidthInit ;		/* pointer to list of n widths */
-int fSorted ;
-{
-				/* next three parameters are post-clip */
-    register DDXPointPtr ppt ;	/* pointer to list of start points */
-    register int *pwidth ;	/* pointer to list of n widths */
-    int n ;			/* number of spans to fill */
-    unsigned char pm ;
-    int alu ;
-    int xSrc ;
-    int ySrc ;
-    int *pwidthFree ;		/* copies of the pointers to free */
-    DDXPointPtr pptFree ;
-
-    TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
-	    pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
-
-    if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
-	return ;
-
-    SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
-		 pptFree, pwidth, ppt, fSorted ) ;
-
-    xSrc = pGC->patOrg.x + pDrawable->x ;
-    ySrc = pGC->patOrg.y + pDrawable->y ;
-    pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
-
-    for ( ; n-- ; ppt++, pwidth++ )
-	    xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
-		     ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
-
-    xfree( pptFree ) ;
-    xfree( pwidthFree ) ;
-    return ;
-}
diff --git a/hw/xfree86/xf4bpp/ppcWindow.c b/hw/xfree86/xf4bpp/ppcWindow.c
deleted file mode 100644
index 6165e04..0000000
--- a/hw/xfree86/xf4bpp/ppcWindow.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
-
-Copyright (c) 1987  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "scrnintstr.h"
-#include "ibmTrace.h"
-
-/*
-   xf4bppCopyWindow copies only the parts of the destination that are
-visible in the source.
-*/
-
-void 
-xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
-    register WindowPtr pWin ;
-    DDXPointRec ptOldOrg ;
-    RegionPtr prgnSrc ;
-{
-    RegionPtr prgnDst ;
-    register BoxPtr pbox ;
-    register int dx, dy ;
-    register int nbox ;
-    register int pm ;
-
-    BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ;
-				/* temporaries for shuffling rectangles */
-
-    TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ;
-
-
-    dx = ptOldOrg.x - pWin->drawable.x ;
-    dy = ptOldOrg.y - pWin->drawable.y ;
-    REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-
-    prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
-    REGION_INTERSECT(pWin->drawable.pScreen, prgnDst,
-		     &pWin->borderClip, prgnSrc);
-
-    if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
-	return;
-
-    pbox = REGION_RECTS(prgnDst);
-
-    pboxNew = 0 ;
-    if ( nbox > 1 ) {
-	if ( dy < 0 ) {
-	    if ( dx > 0 ) {
-		/* walk source bottom to top */
-		/* keep ordering in each band, reverse order of bands */
-		if ( !( pboxNew =
-			(BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) )
-			return ;
-		pboxBase = pboxNext = pbox+nbox - 1 ;
-		while ( pboxBase >= pbox ) {
-			while ( ( pboxNext >= pbox )
-			     && ( pboxBase->y1 == pboxNext->y1 ) )
-				pboxNext-- ;
-			pboxTmp = pboxNext + 1 ;
-			while ( pboxTmp <= pboxBase )
-				*pboxNew++ = *pboxTmp++ ;
-			pboxBase = pboxNext ;
-		}
-		pboxNew -= nbox ;
-		pbox = pboxNew ;
-	    }
-	    else { /* dx <= 0 */
-		/* we can just reverse the entire list in place */
-		/* Do three-position swaps */
-		BoxRec tmpBox ;
-
-		pboxBase = pbox ;
-		pboxNext = pbox + nbox - 1 ;
-		while ( pboxBase < pboxNext ) {
-			/* ****** Warning Structure Assignment !! ****** */
-			tmpBox    = *pboxBase ;
-			*pboxBase = *pboxNext ;
-			*pboxNext = tmpBox ;
-			pboxBase++ ;
-			pboxNext-- ;
-		}
-	    }
-	}
-        else if ( dx < 0 ) {
-	/* walk source right to left */
-	    /* reverse order of rects in each band */
-	    if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) )
-		return ;
-	    pboxBase = pboxNext = pbox ;
-	    while (pboxBase < pbox+nbox)
-	    {
-		while ((pboxNext < pbox+nbox) &&
-		       (pboxNext->y1 == pboxBase->y1))
-		    pboxNext++ ;
-		pboxTmp = pboxNext ;
-		while (pboxTmp != pboxBase)
-		    *pboxNew++ = *--pboxTmp ;
-		pboxBase = pboxNext ;
-	    }
-	    pboxNew -= nbox ;
-	    pbox = pboxNew ;
-	}
-    } /* END if nbox > 1 */
-
-    /*
-     * call blit several times, the parms are:
-     *   blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ;
-     */
-
-    pm = ( 1 << pWin->drawable.depth ) - 1 ;
-    for ( ; nbox-- ; pbox++ )
-	xf4bppBitBlt( pWin, GXcopy, pm,
-		 pbox->x1 + dx, pbox->y1 + dy, 
-		 pbox->x1, pbox->y1, 
-		 pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ;
-
-    /* free up stuff */
-    if ( pboxNew )
-	xfree( pboxNew ) ;
-
-    REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
-}
-
-Bool xf4bppPositionWindow(pWin, x, y)
-register WindowPtr pWin ;
-register int x, y ;
-{
-    return TRUE ;
-}
-
-Bool 
-xf4bppDestroyWindow(pWin)
-register WindowPtr pWin ;
-{
-return pWin ? TRUE : FALSE ;
-}
-
-/* As The Name Says -- Used For ega, vga and apa8c */
-Bool
-xf4bppCreateWindowForXYhardware(pWin)
-register WindowPtr pWin ;
-{
-    TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin));
-
-    return TRUE;
-}
diff --git a/hw/xfree86/xf4bpp/vgaBitBlt.c b/hw/xfree86/xf4bpp/vgaBitBlt.c
deleted file mode 100644
index 2e89f43..0000000
--- a/hw/xfree86/xf4bpp/vgaBitBlt.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* GJA -- span move routines */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "vgaReg.h"
-#include "vgaVideo.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-#ifndef	PC98_EGC	/* not PC98_EGC */
-/* NOTE: It seems that there is no way to program the VGA to copy just
- * a part of a byte in the smarter modes. Therefore we copy the boundaries
- * plane by plane.
- */
-#define WORDSZ 8
- /* The fast blit code requires WORDSZ = 8 for its read-modify write cycle.
-  * Therefore, we do not fully implement the other options.
-  */
-#define HIGHPLANEMASK 0x08
-#define HIGHPLANEINDEX 3
-
-/* Of course, we want the following anyway:
- * (Yes, they're identical now.)
- */
-#define SMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
-#define DMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
-
-#define WORD8 unsigned char
-#define LW8 BYTES_PER_LINE(pWin) /* Line width */
-#define WSHIFT8 0x3
-#define WMASK8 0x07
-/* NOTE: lmask[8] matters. It must be different from lmask[0] */
-static unsigned char lmasktab[] = {
-	0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF
-} ;
-static unsigned char rmasktab[] = {
-	0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00
-} ;
-
-#define LMASK8(n) lmasktab[n]
-#define RMASK8(n) rmasktab[n]
-#define SWAPB8(x) (x)
-
-#if (WORDSZ == 8)
-
-#define WORD WORD8
-#define LW LW8
-#define WSHIFT WSHIFT8
-#define WMASK WMASK8
-
-#define LMASK(n) LMASK8(n)
-#define RMASK(n) RMASK8(n)
-#define SWAPB(x) SWAPB8(x)
-
-#endif /* WORDSZ == 8 */
-
-#define DO_ALU(dst,src,mask,alu) {\
-	int _ndst, _odst; _odst = dst; \
-	switch ( alu ) { \
-	case GXclear: \
-		_ndst = 0;			break; \
-	case GXand: \
-		_ndst = src & _odst;		break; \
-	case GXandReverse: \
-		_ndst = src & ~ _odst;		break; \
-	case GXcopy: \
-		_ndst = src;			break; \
-	case GXandInverted: \
-		_ndst = ~ src & _odst;		break; \
-	default: \
-	case GXnoop: \
-		_ndst = _odst;			break; \
-	case GXxor: \
-		_ndst = src ^ _odst;		break; \
-	case GXor: \
-		_ndst = src | _odst;		break; \
-	case GXnor: \
-		_ndst = ~ src & ~ _odst;	break; \
-	case GXequiv: \
-		_ndst = ~ src ^ _odst;		break; \
-	case GXinvert: \
-		_ndst = ~ _odst;		break; \
-	case GXorReverse: \
-		_ndst = src | ~ _odst;		break; \
-	case GXcopyInverted: \
-		_ndst = ~ src;			break; \
-	case GXorInverted: \
-		_ndst = ~ src | _odst;		break; \
-	case GXnand: \
-		_ndst = ~ src | ~ _odst;	break; \
-	case GXset: \
-		_ndst = ~0;			break; \
-	} \
-	dst = (_odst & ~(mask)) | (_ndst & (mask)); \
-	}
-
-static void aligned_blit(
-    WindowPtr, int, int, int, int, int, int, int, int
-);
-
-static void aligned_blit_center(
-    WindowPtr, int, int, int, int, int, int
-);
-
-static void shift(
-    WindowPtr, int, int, int, int, int, int, int
-);
-
-static void shift_thin_rect(
-    WindowPtr, int, int, int, int, int, int, int
-);
-
-static void shift_center(
-    WindowPtr, int, int, int, int, int, int, int
-);
-
-void xf4bppBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h)
-WindowPtr pWin; /* GJA */
-int alu;
-int writeplanes; /* planes */
-int x0, y0, x1, y1, w, h;
-{
-    IOADDRESS REGBASE;
-    int plane, bit;
-
-    if ( !w || !h ) return;
-
-    if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-        xf4bppOffBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h);
-        return;
-    }
-
-    REGBASE =
-	xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
-
-    /* 0x7, not WMASK: it is hardware dependant */
-    if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) {
-	/* Use slow copy */
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
-		plane ; plane >>= 1, bit-- )
-	{
-
-		if ( writeplanes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-			shift(pWin,x0,x1,y0,y1,w,h,alu);
-		}
-	}
-    } else {
-        aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,writeplanes);
-    }
-}
-
-/* Copy a span a number of places to the right.
- */
-static void
-shift(pWin,x0,x1,y0,y1,w,h,alu)
-WindowPtr pWin; /* GJA */
-int x0;  /* left edge of source */
-int x1;  /* left edge of target */
-int y0;
-int y1;
-int w; /* length of source, and of target */
-int h;
-int alu;
-{
-  if ( ((x1 & WMASK) + w) <= WORDSZ ) {
-     shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
-  } else if ( x1 > x0 ) { /* Shift right: start right */
-     int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
-
-     if ( r1 ) /* right edge */
-        shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
-     shift_center(pWin,x0,x1,y0,y1,w,h,alu);
-     if ( l1 ) /* left edge */
-        shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
-  } else {
-     int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
-
-     if ( l1 ) /* left edge */
-        shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
-     shift_center(pWin,x0,x1,y0,y1,w,h,alu);
-     if ( r1 ) /* right edge */
-        shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
-  }
-}
-
-/* The whole rectangle is so thin that it fits in one byte written */
-static void
-shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu)
-WindowPtr pWin; /* GJA */
-int x0;  /* left edge of source */
-int x1;  /* left edge of target */
-int y0;
-int y1;
-int w; /* length of source, and of target */
-int h;
-int alu;
-{
-  int l0 = x0 & WMASK; /* Left edge of source, as bit */
-  int l1 = x1 & WMASK; /* Left edge of target, as bit */
-  int L0 = x0 >> WSHIFT; /* Left edge of source, as byte */
-  int L1 = x1 >> WSHIFT; /* Left edge of target, as byte */
-  int pad;
-  int htmp;
-  int mask;
-  int tmp;
-  int bs;
-  
-  volatile unsigned char *sp, *dp;
-
-  mask = RMASK(l1) & LMASK(l1+w);
-  bs = (x1 - x0) & WMASK;
-
-  if ( y1 > y0 ) { /* Move down, start at the bottom */
-    pad = - BYTES_PER_LINE(pWin);
-    sp = SMEM(L0,y0+h-1);
-    dp = DMEM(L1,y1+h-1);
-  } else { /* Move up, start at the top */
-    pad = BYTES_PER_LINE(pWin);
-    sp = SMEM(L0,y0);
-    dp = DMEM(L1,y1);
-  }
-
-  if ( l0+w > WORDSZ ) {
-    /* Need two bytes */
-    for ( htmp = h ; htmp ; htmp-- ) {
-      tmp = (sp[0] << (WORDSZ - bs));
-      sp++;
-      tmp |= (sp[0] >> bs);
-      sp--;
-      DO_ALU(dp[0],tmp,mask,alu);
-      dp += pad;
-      sp += pad;
-    }
-  } else if ( l0 <= l1 ) {
-    /* Need one byte, shifted right */
-    for ( htmp = h ; htmp ; htmp-- ) {
-      tmp = (sp[0] >> bs);
-      DO_ALU(dp[0],tmp,mask,alu);
-      dp += pad;
-      sp += pad;
-    }
-  } else {
-    /* Need one byte, shifted left */
-    for ( htmp = h ; htmp ; htmp-- ) {
-      tmp = (sp[0] << (WORDSZ - bs));
-      DO_ALU(dp[0],tmp,mask,alu);
-      dp += pad;
-      sp += pad;
-    }
-  }
-}
-
-static void
-shift_center(pWin,x0,x1,y0,y1,w,h,alu)
-WindowPtr pWin; /* GJA */
-int x0;  /* left edge of source */
-int x1;  /* left edge of target */
-int y0;
-int y1;
-int w; /* length of source, and of target */
-int h;
-int alu;
-{
-  int l1 = x1 & WMASK; /* Left edge of target, as bit */
-  int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
-  int pad;
-  int htmp, wtmp; /* Temporaries for indices over height and width */
-  volatile unsigned char tmp; /* Temporary result of the shifts */
-  int bs;
-  int rem; /* Remaining bits; temporary in loop */
-  int bytecnt;
-  
-  volatile unsigned char *sp, *dp;
-
-  bs = (x1 - x0) & WMASK;
-
-  if ( l1 ) {
-     bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
-     sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
-     dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
-  } else {
-     bytecnt = (w - r1) >> WSHIFT;
-     sp = SMEM( (x0 >> WSHIFT), y0);
-     dp = DMEM( (x1 >> WSHIFT), y1);
-  }
-
-  if ( y1 > y0 ) { /* Move down, start at the bottom */
-    if ( x1 > x0 ) { /* Move right, start right */
-       pad = - BYTES_PER_LINE(pWin) + bytecnt;
-       sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
-       dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
-    } else { /* Move left, start left */
-       pad = - BYTES_PER_LINE(pWin) - bytecnt;
-       sp += BYTES_PER_LINE(pWin) * (h - 1);
-       dp += BYTES_PER_LINE(pWin) * (h - 1);
-    }
-  } else { /* Move up, start at the top */
-    if ( x1 > x0 ) { /* Move right, start right */
-       pad = BYTES_PER_LINE(pWin) + bytecnt;
-       sp += bytecnt - 1;
-       dp += bytecnt - 1;
-    } else { /* Move left, start left */
-       pad = BYTES_PER_LINE(pWin) - bytecnt;
-       sp += 0;
-       dp += 0;
-    }
-  }
-
-  if ( x1 > x0 ) { /* Move right, start right */
-    if ( bs == 0 ) { /* No shift. Need one byte only */
-      for ( htmp = h ; htmp ; htmp-- ) {
-        for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-          tmp = sp[0];
-          DO_ALU(dp[0],tmp,~0,alu); 
-	  dp--;
-          sp--;
-        }
-        dp += pad;
-        sp += pad;
-      } 
-    } else {
-      for ( htmp = h ; htmp ; htmp-- ) {
-	if ( bytecnt ) {
-	   sp++;
-   	   rem = sp[0];
-	   sp--;
-           for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-             tmp = (rem >> bs);
-             rem = sp[0];
-             tmp |= (rem << (WORDSZ - bs)) ;
-             DO_ALU(dp[0],tmp,~0,alu); 
-	     dp--;
-             sp--;
-           }
-        }
-        dp += pad;
-        sp += pad;
-      } 
-    }
-  } else { /* x1 <= x0 */ /* Move left, start left */
-    if ( bs == 0 ) { /* No shift. Need one byte only */
-      for ( htmp = h ; htmp ; htmp-- ) {
-        for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-          tmp = sp[0];
-          DO_ALU(dp[0],tmp,~0,alu); 
-	  dp++;
-          sp++;
-        }
-        dp += pad;
-        sp += pad;
-      } 
-    } else {
-      for ( htmp = h ; htmp ; htmp-- ) {
-        if ( bytecnt ) {
-          rem = sp[0];
-          for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-            tmp = (rem << (WORDSZ - bs));
-	    sp++;
-	    rem = sp[0];
-	    sp--;
-            tmp |= (rem >> bs);
-            DO_ALU(dp[0],tmp,~0,alu); 
-	    dp++;
-            sp++;
-          }
-        }
-        dp += pad;
-        sp += pad;
-      } 
-    }
-  }
-}
-
-/* Copy a rectangle.
- */
-static void
-aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,planes)
-WindowPtr pWin; /* GJA */
-int x0;  /* left edge of source */
-int x1;  /* left edge of target */
-int y0;
-int y1;
-int w; /* length of source, and of target */
-int h;
-int alu;
-int planes;
-{
-  IOADDRESS REGBASE =
-	xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
-  int plane, bit;
-
-  if ( ((x1 & WMASK) + w) <= WORDSZ ) {
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
-		plane ; plane >>= 1, bit-- )
-	{
-		if ( planes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-     			shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
-		}
-	}
-  } else if ( x1 > x0 ) { /* Shift right: start right */
-     int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
-
-     if ( r1 ) { /* right edge */
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
-		plane ; plane >>= 1, bit-- )
-	{
-		if ( planes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-		        shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
-		}
-	}
-     }
-
-     /* Center */
-     SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
-     SetVideoSequencer(Mask_MapIndex, planes);
-
-     aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
-
-     if ( l1 ) { /* left edge */
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
-		plane ; plane >>= 1, bit-- )
-	{
-		if ( planes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-        		shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
-		}
-	}
-     }
-  } else {
-     int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
-
-     if ( l1 ) { /* left edge */
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
-		plane ; plane >>= 1, bit-- )
-	{
-		if ( planes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-        		shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
-		}
-	}
-     }
-
-     /* Center */
-     SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
-     SetVideoSequencer(Mask_MapIndex, planes);
-
-     aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
-
-     if ( r1 ) { /* right edge */
-	SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
-	SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
-	SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
-	SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
-
-	for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
-		plane ; plane >>= 1, bit-- )
-	{
-		if ( planes & plane) {
-			SetVideoGraphics(Read_Map_SelectIndex, bit);
-			SetVideoSequencer(Mask_MapIndex, plane);
-
-        		shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
-		}
-	}
-     }
-  }
-}
-
-static void
-aligned_blit_center(pWin,x0,x1,y0,y1,w,h)
-WindowPtr pWin; /* GJA */
-int x0;  /* left edge of source */
-int x1;  /* left edge of target */
-int y0;
-int y1;
-int w; /* length of source, and of target */
-int h;
-{
-  int l1 = x1 & WMASK; /* Left edge of target, as bit */
-  int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
-  int pad;
-  int htmp, wtmp; /* Temporaries for indices over height and width */
-  volatile unsigned char tmp; /* Temporary result of the shifts */
-  int bytecnt;
-  
-  volatile unsigned char *sp, *dp;
-
-  if ( l1 ) {
-     bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
-     sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
-     dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
-  } else {
-     bytecnt = (w - r1) >> WSHIFT;
-     sp = SMEM( (x0 >> WSHIFT), y0);
-     dp = DMEM( (x1 >> WSHIFT), y1);
-  }
-
-  if ( y1 > y0 ) { /* Move down, start at the bottom */
-    if ( x1 > x0 ) { /* Move right, start right */
-       pad = - BYTES_PER_LINE(pWin) + bytecnt;
-       sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
-       dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
-    } else { /* Move left, start left */
-       pad = - BYTES_PER_LINE(pWin) - bytecnt;
-       sp += BYTES_PER_LINE(pWin) * (h - 1);
-       dp += BYTES_PER_LINE(pWin) * (h - 1);
-    }
-  } else { /* Move up, start at the top */
-    if ( x1 > x0 ) { /* Move right, start right */
-       pad = BYTES_PER_LINE(pWin) + bytecnt;
-       sp += bytecnt - 1;
-       dp += bytecnt - 1;
-    } else { /* Move left, start left */
-       pad = BYTES_PER_LINE(pWin) - bytecnt;
-       sp += 0;
-       dp += 0;
-    }
-  }
-
-  if ( x1 > x0 ) { /* Move right, start right */
-      for ( htmp = h ; htmp ; htmp-- ) {
-        for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-          tmp = sp[0];
-	  dp[0] = tmp;
-	  dp--;
-          sp--;
-        }
-        dp += pad;
-        sp += pad;
-      } 
-  } else { /* x1 <= x0 */ /* Move left, start left */
-      for ( htmp = h ; htmp ; htmp-- ) {
-        for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
-          tmp = sp[0];
-          dp[0] = tmp;
-	  dp++;
-          sp++;
-        }
-        dp += pad;
-        sp += pad;
-      } 
-  }
-}
-#else	/* PC98_EGC */
-
-static void
-egc_fast_blt (pWin, alu, writeplanes, x0, y0, x1, y1, w, h)
-WindowPtr pWin;	
-const	int alu, writeplanes ;
-register int x0, x1 ;
-int	     y0, y1 ;
-register int w, h ;
-{
-register volatile unsigned char *src ;
-register volatile unsigned char *dst ;
-unsigned short *src_x ;
-unsigned short *dst_x ;
-int x_direction, y_interval ;
-int	src_off, dst_off ;
-register int k, i ;
-unsigned short ROP_value;
-
-src = (unsigned char *)SCREENADDRESS( pWin, 0, y0);
-dst = (unsigned char *)SCREENADDRESS( pWin, 0, y1);
-
-/* Set Map Mask */
-outw(EGC_PLANE, ~(writeplanes & VGA_ALLPLANES));
-switch(alu) {
-case GXnor:		/* ~(S|D) */
-    ROP_value = 0x2903;
-    break;
-case GXandInverted:	/* ~S&D */
-    ROP_value = 0x290c;
-    break;
-case GXand:		/* S&D */
-    ROP_value = 0x29c0;
-    break;
-case GXequiv:		/* ~S ^ D */
-    ROP_value = 0x29c3;
-    break;
-case GXxor:		/* S^D */
-    ROP_value = 0x293c;
-    break;
-case GXandReverse:	/* S&~D */
-    ROP_value = 0x2930;
-    break;
-case GXorReverse:	/* S|~D */
-    ROP_value = 0x29f3;
-    break;
-case GXnand:		/* ~(S&D) */
-    ROP_value = 0x293f;
-    break;
-case GXorInverted:	/* ~S|D */
-    ROP_value = 0x29cf;
-    break;
-case GXor:		/* S|D */
-    ROP_value = 0x29fa;
-    break;
-case GXcopyInverted:	/* ~S */
-    ROP_value = 0x290f;
-    break;
-case GXcopy:		/* S */
-default:
-    ROP_value = 0x29f0;
-}
-outw(EGC_MODE, ROP_value);
-if ( y1 > y0 ) {
-	y_interval = - BYTES_PER_LINE(pWin) * 8 ;
-	src += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
-	dst += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
-}
-else {
-	y_interval = BYTES_PER_LINE(pWin) * 8 ;
-}
-
-src = (unsigned char *)((int)src << 3) ;
-dst = (unsigned char *)((int)dst << 3) ;
-
-if ( y1 > y0) {
-	x_direction = 0x1000 ;
-	src += x0 + w - 1 ;
-	dst += x1 + w - 1 ;
-} else if ( y1 < y0 ) {
-	x_direction = 0 ;
-	src += x0 ;
-	dst += x1 ;
-} else {
-	if ( x1 < x0 ) {
-		x_direction = 0 ;
-		src += x0 ;
-		dst += x1 ;
-	} else {
-		x_direction = 0x1000 ;
-		src += x0 + w - 1 ;
-		dst += x1 + w - 1 ;
-	}
-}
-	outw ( EGC_LENGTH , w - 1 ) ;
-
-for ( ; h-- ; ) {
-	if ( x_direction ) {
-		src_off = 15 - (int)src & 0xf ;
-		dst_off = 15 - (int)dst & 0xf ;
-	} else {
-		src_off = (int)src & 0xf ;
-		dst_off = (int)dst & 0xf ;
-	}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	src_x   = (unsigned short *)(((unsigned int)src >> 4 ) << 1) ;
-	dst_x   = (unsigned short *)(((unsigned int)dst >> 4 ) << 1) ;
-#else
-	src_x   = (unsigned short *)(((int)src >> 4 ) << 1) ;
-	dst_x   = (unsigned short *)(((int)dst >> 4 ) << 1) ;
-#endif
-	k = ( src_off + w + 15 ) >> 4 ;
-	if ( src_off < dst_off ) {
-		if ( ((src_off + w - 1 ) >> 4) < ((dst_off + w - 1) >> 4)) k++ ;
-	}
-	if ( src_off > dst_off ) {
-		if ( ((src_off + w - 1) >> 4 ) == ((dst_off + w - 1) >> 4) ) k++ ;
-		if ( x_direction ) dst_x ++ ;
-			else	   dst_x -- ;
-	}
-	outw ( EGC_ADD , x_direction | src_off | dst_off << 4 );
-	if ( x_direction ) {
-		wcopyl ( src_x, dst_x, k, VIDBASE(pWin) ) ;
-	} else {
-		wcopyr ( src_x, dst_x, k, VIDBASE(pWin) ) ;
-	}
-src += y_interval ;
-dst += y_interval ;
-}
-outw ( EGC_ADD, 0 ) ;
-outw ( EGC_LENGTH , 0xf );
-return;
-}
-
-void
-xf4bppBitBlt( pWin,alu, writeplanes, x0, y0, x1, y1, w, h )
-WindowPtr pWin; /* GJA */
-int alu;
-int writeplanes; /* planes */
-int x0, y0, x1, y1, w, h;
-{
-	if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-		xf4bppOffBitBlt( pWin, alu, writeplanes,
-			   x0, y0, x1, y1, w, h );
-		return;
-	}
-
-switch ( alu ) {
-	case GXclear:		/* 0x0 Zero 0 */
-	case GXinvert:		/* 0xa NOT dst */
-	case GXset:		/* 0xf 1 */
-		xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, x1, y1, w, h ) ;
-			/* x1, y1, GJA */
-	case GXnoop:		/* 0x5 dst */
-		return ;
-	default:
-		break ;
-}
-
-egc_fast_blt ( pWin, alu, writeplanes, x0, y0, x1, y1, w, h);
-return;
-}
-#endif
diff --git a/hw/xfree86/xf4bpp/vgaGC.c b/hw/xfree86/xf4bpp/vgaGC.c
deleted file mode 100644
index 6495e56..0000000
--- a/hw/xfree86/xf4bpp/vgaGC.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-
-Copyright (c) 1987  X Consortium
-
-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 X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-Copyright IBM Corporation 1987,1988,1989
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that 
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of IBM not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "mfbmap.h"
-#include "mfb.h"
-#include "mi.h"
-#include "ppcGCstr.h"
-
-void
-xf4bppChangeGCtype( pGC, devPriv )
-register GC *pGC ;
-register ppcPrivGCPtr devPriv ;
-{
-	if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) {
-	    pGC->ops->CopyArea	= miCopyArea ;
-	    pGC->ops->PolyFillRect	= miPolyFillRect ;
-	    pGC->ops->PushPixels	= miPushPixels ;
-	    pGC->ops->PolyArc	= miPolyArc ;
-	    pGC->ops->PolyFillArc	= miPolyFillArc ;
-	    pGC->ops->PolySegment	= miPolySegment ;
-	}
-	else {
-	    pGC->ops->CopyArea	= xf4bppCopyArea ;
-	    pGC->ops->PolyFillRect	= xf4bppPolyFillRect ;
-	    pGC->ops->PushPixels	= miPushPixels ; /* GJA */
-	    pGC->ops->PolyArc	= xf4bppZeroPolyArc ;
-	    pGC->ops->PolyFillArc	= xf4bppPolyFillArc ;
-	    pGC->ops->PolySegment	= xf4bppSegmentSS ;
-	}
-	return;
-}
-
-Mask
-xf4bppChangeWindowGC( pGC, changes )
-register GC *pGC ;
-register Mask changes ;
-{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
-register unsigned long int idx ; /* used for stepping through bitfields */
-
-#define LOWBIT( x ) ( x & - x ) /* Two's complement */
-    while ((idx = LOWBIT(changes))) {
-	switch ( idx ) {
-
-	  case GCLineStyle:
-	  case GCLineWidth:
-	    pGC->ops->PolyArc = ( ( pGC->lineStyle == LineSolid )
-		? ( ( pGC->lineWidth == 0 ) ? xf4bppZeroPolyArc
-					    : miPolyArc )
-		: miPolyArc ) ;
-	    pGC->ops->PolySegment = ( ( pGC->lineStyle == LineSolid )
-		? ( ( pGC->lineWidth == 0 )
-			? ( ( pGC->fillStyle == FillSolid ) ?
-				xf4bppSegmentSS : miPolySegment )
-			: miPolySegment )
-		: ( ( pGC->lineWidth == 0 )
-			? ( ( pGC->fillStyle == FillSolid ) ?
-				xf4bppSegmentSD : miPolySegment )
-			: miPolySegment ) ) ;
-	    pGC->ops->Polylines = ( ( pGC->lineStyle == LineSolid )
-		? ( ( pGC->lineWidth == 0 )
-			? ( (pGC->fillStyle == FillSolid ) ?
-				xf4bppLineSS : miZeroLine )
-			: miWideLine )
-		: ( ( pGC->lineWidth == 0 )
-			? ( (pGC->fillStyle == FillSolid ) ?
-				xf4bppLineSD : miWideDash )
-			: miWideDash ) ) ;
-	    /*
-	     * If these are just square boxes with no funny business
-	     * going on we can call the fast routine that draws
-	     * rectangles without floating point.
-	     */
-/* too buggy */
-#if 0
-	    if ( ( pGC->lineStyle == LineSolid ) 
-			&& ( pGC->joinStyle == JoinMiter ) 
-			&& ( pGC->lineWidth != 0 ) )
-		pGC->ops->PolyRectangle = xf4bppPolyRectangle;
-	    else
-#endif
-		pGC->ops->PolyRectangle = miPolyRectangle;
-
-	    changes &= ~( GCLineStyle | GCLineWidth ) ;
-	    break ;
-	  case GCJoinStyle:
-	    /*
-	     * If these are just square boxes with no funny business
-	     * going on we can call the fast routine that draws
-	     * rectangles without floating point.
-	     */
-/* too buggy */
-#if 0
-	    if ( ( pGC->lineStyle == LineSolid ) 
-			&& ( pGC->joinStyle == JoinMiter ) 
-			&& ( pGC->lineWidth != 0 ) )
-		pGC->ops->PolyRectangle = xf4bppPolyRectangle;
-	    else
-#endif
-		pGC->ops->PolyRectangle = miPolyRectangle;
-	    changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
-	    break ;
-
-	  case GCBackground:
-	    if ( pGC->fillStyle != FillOpaqueStippled ) {
-		changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
-		break ;
-	    } /* else Fall Through */
-	  case GCForeground:
-	    if ( pGC->fillStyle == FillTiled ) {
-		changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
-		break ;
-	    } /* else Fall Through */
-	  case GCFunction:
-	  case GCPlaneMask:
-	  case GCFillStyle:
-	    { /* new_fill */
-		int fillStyle = devPriv->colorRrop.fillStyle ;
-		/* install a suitable fillspans */
-		if ( fillStyle == FillSolid )
-		    pGC->ops->FillSpans = xf4bppSolidWindowFS ;
-		else if ( fillStyle == FillStippled )
-		    pGC->ops->FillSpans = xf4bppStippleWindowFS ;
-		else if ( fillStyle == FillOpaqueStippled )
-		    pGC->ops->FillSpans = xf4bppOpStippleWindowFS ;
-		else /*  fillStyle == FillTiled */
-		    pGC->ops->FillSpans = xf4bppTileWindowFS ;
-	    } /* end of new_fill */
-	    changes &= ~( GCBackground | GCForeground
-		     | GCFunction
-		     | GCPlaneMask | GCFillStyle ) ;
-	    break ;
-
-	default:
-	    ErrorF("xf4bppChangeWindowGC: Unexpected GC Change\n") ;
-	    changes &= ~ idx ; /* Remove it anyway */
-	    break ;
-	}
-    }
-    return changes;
-}
diff --git a/hw/xfree86/xf4bpp/vgaImages.c b/hw/xfree86/xf4bpp/vgaImages.c
deleted file mode 100644
index bea2d0a..0000000
--- a/hw/xfree86/xf4bpp/vgaImages.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "vgaReg.h"
-#include "vgaVideo.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-#undef TRUE
-#undef FALSE
-#define TRUE 1
-#define FALSE 0
-
-void
-xf4bppDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
-WindowPtr pWin; /* GJA */
-int x, y ;
-register int w, h ;
-unsigned char *data ;
-register int RowIncrement ;
-const int alu ;
-const unsigned long int planes ;
-{
-IOADDRESS REGBASE;
-register unsigned long int tmp ;
-register const unsigned char *src ;
-register volatile unsigned char *dst ;
-register int Pixel_Count ;
-register unsigned int currMask ;
-register unsigned int InitialMask ;
-register volatile unsigned char *StartByte ;
-unsigned int invert_source_data = FALSE ;
-#ifdef	PC98_EGC	/* new EGC test */
-register unsigned char tmp1;
-#endif
-
-{	/* Start GJA */
-	if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-		xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes );
-		return;
-	}
-}	/* End GJA */
-
-{
-	unsigned int invert_existing_data = FALSE ;
-	unsigned int data_rotate_value = VGA_COPY_MODE ;
-#ifdef	PC98_EGC
-	unsigned short ROP_value;
-#endif
-
-	REGBASE = 0x300 +
-	    xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
-
-	switch ( alu ) {
-		case GXclear:		/* 0x0 Zero 0 */
-		case GXinvert:		/* 0xa NOT dst */
-		case GXset:		/* 0xf 1 */
-			xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, planes, x, y, w, h ) ;
-		case GXnoop:		/* 0x5 dst */
-			return ;
-		case GXnor:		/* 0x8 NOT src AND NOT dst */
-			invert_existing_data = TRUE ;
-		case GXandInverted:	/* 0x4 NOT src AND dst */
-			invert_source_data = TRUE ;
-		case GXand:		/* 0x1 src AND dst */
-			data_rotate_value = VGA_AND_MODE ;
-			break ;
-		case GXequiv:		/* 0x9 NOT src XOR dst */
-			invert_source_data = TRUE ;
-		case GXxor:		/* 0x6 src XOR dst */
-			data_rotate_value = VGA_XOR_MODE ;
-			break ;
-		case GXandReverse:	/* 0x2 src AND NOT dst */
-			invert_existing_data = TRUE ;
-			data_rotate_value = VGA_AND_MODE ;
-			break ;
-		case GXnand:		/* 0xe NOT src OR NOT dst */
-			invert_source_data = TRUE ;
-		case GXorReverse:	/* 0xb src OR NOT dst */
-			invert_existing_data = TRUE ;
-			/* GJA -- moved this here */
-			data_rotate_value = VGA_OR_MODE ;
-			break ;
-		case GXorInverted:	/* 0xd NOT src OR dst */
-			invert_source_data = TRUE ;
-		case GXor:		/* 0x7 src OR dst */
-			data_rotate_value = VGA_OR_MODE ;
-			break ;
-		case GXcopyInverted:	/* 0xc NOT src */
-			invert_source_data = TRUE ;
-		case GXcopy:		/* 0x3 src */
-		default:
-			break ;
-	}
-
-#ifdef	PC98_EGC
-	/* Setup EGC Registers */
-	switch(data_rotate_value) {
-/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
-	case VGA_AND_MODE:
-	    if (invert_existing_data)
-		ROP_value = EGC_AND_INV_MODE;
-	    else
-		ROP_value = EGC_AND_MODE;
-	    break;
-	case VGA_OR_MODE:
-	    if (invert_existing_data)
-		ROP_value = EGC_OR_INV_MODE;
-	    else
-		ROP_value = EGC_OR_MODE;
-	    break;
-	case VGA_XOR_MODE:
-	    if (invert_existing_data)
-		ROP_value = EGC_XOR_INV_MODE;
-	    else
-		ROP_value = EGC_XOR_MODE;
-	    break;
-	case VGA_COPY_MODE:
-	default:
-	    ROP_value = EGC_COPY_MODE;
-	    break;
-	}
-	outw(EGC_PLANE, ~(planes & VGA_ALLPLANES));
-	outw(EGC_MODE, ROP_value);
-	outw(EGC_FGC, 0x0000);
-	tmp1 = 0;
-#else
-	if ( invert_existing_data )
-		xf4bppFillSolid( pWin, VGA_ALLPLANES, GXinvert, planes, x, y, w, h ) ;
-	/* Setup VGA Registers */
-	SetVideoSequencer( Mask_MapIndex, planes & VGA_ALLPLANES ) ;
-	/* Set Raster Op */
-	SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
-	SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ;
-#endif
-}
-
-StartByte = SCREENADDRESS(pWin, x, y);
-InitialMask = SCRRIGHT8( LeftmostBit, BIT_OFFSET( x ) ) ;
-if ( invert_source_data )
-#ifdef	PC98_EGC
-#if 0 /* New EGC version */
-	egc_image_invert ( StartByte, data, InitialMask, w, h,
-					 RowIncrement ) ;
-#else	/* new EGC c version */
-	for ( ;
-	      h-- ;
-	      data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
-		dst = StartByte;
-		for ( src = data,
-		      Pixel_Count = w, currMask = InitialMask ;
-		      Pixel_Count-- ;
-		      src++ ) {
-			if (tmp1 != (~*src & VGA_ALLPLANES)) {
-				tmp1 = ~*src & VGA_ALLPLANES;
-				/* set FGC */
-				outw(EGC_FGC, ~*src & VGA_ALLPLANES);
-			}
-			*((VgaMemoryPtr) dst) = currMask;
-			if ( currMask & RightmostBit ) {
-				currMask = LeftmostBit ;
-				dst++;
-			}
- 			else
-				currMask = SCRRIGHT8( currMask, 1 ) ;
-		}
-	}
-#endif	/* new EGC  */
-#else	/* original */
-	for ( ;
-	      h-- ;
-	      data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
-		dst = StartByte;
-		for ( src = data,
-		      Pixel_Count = w, currMask = InitialMask ;
-		      Pixel_Count-- ;
-		      src++ ) {
-			/* Set The Bit Mask Reg */
-			SetVideoGraphics( Bit_MaskIndex, currMask ) ;
-			/* Read To Load vga Data Latches */
-			tmp = *( (VgaMemoryPtr) dst ) ;
-			(void) tmp;
-			*( (VgaMemoryPtr) dst ) = ~ *src ;
-			if ( currMask & RightmostBit ) {
-				currMask = LeftmostBit ;
-				dst++;
-			}
-			else
-				currMask = SCRRIGHT8( currMask, 1 ) ;
-		}
-	}
-#endif
-else /* invert_source_data == FALSE */
-#ifdef	PC98_EGC
-#if 0	/* new EGC version */
-		egc_image ( StartByte, data, InitialMask, w, h,
-				RowIncrement );
-#else	/* new EGC c version */
-	for ( ;
-	      h-- ;
-	      data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
-		dst = StartByte;
-		for ( src = data,
-		      Pixel_Count = w, currMask = InitialMask ;
-		      Pixel_Count-- ;
-		      src++ ) {
-			if (tmp1 != *src & VGA_ALLPLANES) {
-				tmp1 = *src & VGA_ALLPLANES;
-				outw(EGC_FGC, tmp1);	/* set FGC */
-			}
-			*((VgaMemoryPtr) dst) = currMask;	/* write with mask */
-			if ( currMask & RightmostBit ) {
-				currMask = LeftmostBit ;
-				dst++;
-			}
-			else
-				currMask = SCRRIGHT8( currMask, 1 ) ;
-		}
-	}
-#endif	/* new EGC version */
-#else	/* original */
-	for ( ;
-	      h-- ;
-	      data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
-		dst = StartByte;
-		for ( src = data,
-		      Pixel_Count = w, currMask = InitialMask ;
-		      Pixel_Count-- ;
-		      src++ ) {
-			/* Set The Bit Mask Reg */
-			SetVideoGraphics( Bit_MaskIndex, currMask ) ; /* GJA */
-			/* Read To Load vga Data Latches */
-			tmp = *( (VgaMemoryPtr) dst ) ;
-			(void) tmp;
-			*( (VgaMemoryPtr) dst ) = *src ;
-			if ( currMask & RightmostBit ) {
-				currMask = LeftmostBit ;
-				dst++;
-			}
-			else
-				currMask = SCRRIGHT8( currMask, 1 ) ;
-		}
-	}
-#endif	/* original */
-
-return ;
-}
-
-#ifndef	PC98_EGC
-static unsigned long int
-read8Z
-(
-	IOADDRESS REGBASE,
-	register volatile unsigned char *screen_ptr
-)
-{
-register unsigned long int i ;
-register unsigned long int j ;
-
-/* Read One Byte At A Time to get
- *	i ==	[ Plane 3 ] [ Plane 2 ] [ Plane 1 ] [ Plane 0 ]
- * into a single register
- */
-SetVideoGraphicsData( 3 ) ;
-i = *( (VgaMemoryPtr) screen_ptr ) << 8 ;
-SetVideoGraphicsData( 2 ) ;
-i |= *( (VgaMemoryPtr) screen_ptr ) ;
-i <<= 8 ;
-SetVideoGraphicsData( 1 ) ;
-i |= *( (VgaMemoryPtr) screen_ptr ) ;
-i <<= 8 ;
-SetVideoGraphicsData( 0 ) ;
-i |= *( (VgaMemoryPtr) screen_ptr ) ;
-
-/* Push Bits To Get
- * j ==	[Pixel 7][Pixel 6][Pixel 5][Pixel 4][Pixel 3][Pixel 2][Pixel 1][Pixel 0]
- * into one register
- */
-
-j = ( i & 0x1 ) << 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-j <<= 4 ;
-j |= ( i >>= 1 ) & 0x1 ;
-
-j |= ( i & 0x2 ) << 28 ;
-j |= ( ( i >>= 1 ) & 0x2 ) << 24 ;
-j |= ( ( i >>= 1 ) & 0x2 ) << 20 ;
-j |= ( ( i >>= 1 ) & 0x2 ) << 16 ;
-j |= ( ( i >>= 1 ) & 0x2 ) << 12 ;
-j |= ( ( i >>= 1 ) & 0x2 ) <<  8 ;
-j |= ( ( i >>= 1 ) & 0x2 ) <<  4 ;
-j |= ( i >>= 1 ) & 0x2 ;
-
-j |= ( i & 0x4 ) << 28 ;
-j |= ( ( i >>= 1 ) & 0x4 ) << 24 ;
-j |= ( ( i >>= 1 ) & 0x4 ) << 20 ;
-j |= ( ( i >>= 1 ) & 0x4 ) << 16 ;
-j |= ( ( i >>= 1 ) & 0x4 ) << 12 ;
-j |= ( ( i >>= 1 ) & 0x4 ) <<  8 ;
-j |= ( ( i >>= 1 ) & 0x4 ) <<  4 ;
-j |= ( i >>= 1 ) & 0x4 ;
-
-j |= ( i & 0x8 ) << 28 ;
-j |= ( ( i >>= 1 ) & 0x8 ) << 24 ;
-j |= ( ( i >>= 1 ) & 0x8 ) << 20 ;
-j |= ( ( i >>= 1 ) & 0x8 ) << 16 ;
-j |= ( ( i >>= 1 ) & 0x8 ) << 12 ;
-j |= ( ( i >>= 1 ) & 0x8 ) <<  8 ;
-j |= ( ( i >>= 1 ) & 0x8 ) <<  4 ;
-j |= ( i >>= 1 ) & 0x8 ;
-
-return j ;
-}
-#endif		/* not PC98_EGC */
-
-void
-xf4bppReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
-WindowPtr pWin; /* GJA */
-int x, y ;
-int lx, ly ;
-register unsigned char *data ;
-int RowIncrement ;
-{
-IOADDRESS REGBASE;
-register unsigned long int tmp ;
-register volatile unsigned char *src ;
-volatile unsigned char *masterSrc ;
-int savCenterWidth ;
-int dx ;
-int skip ;
-int center_width ;
-int ignore ;
-int pad ;
-unsigned char tmpc;
-
-{	/* Start GJA */
-	if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-		xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement );
-		return;
-	}
-}	/* End GJA */
-
-if ( ( lx <= 0 ) || ( ly <= 0 ) )
-	return ;
-
-	REGBASE = 0x300 +
-	    xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
-
-/* Setup VGA Registers */
-#ifndef	PC98_EGC
-SetVideoGraphicsIndex( Graphics_ModeIndex ) ;
-tmpc = inb( GraphicsDataRegister );
-SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */
-SetVideoGraphicsIndex( Read_Map_SelectIndex ) ;
-#else
-outw(EGC_MODE, 0x0800);
-#endif
-
-skip = BIT_OFFSET( x ) ;
-pad = RowIncrement - lx ;
-ignore = BIT_OFFSET( x + lx ) ;
-masterSrc = SCREENADDRESS( pWin, x, y ) ;
-center_width = ROW_OFFSET( x + lx ) - ROW_OFFSET( ( x + 0x7 ) & ~0x7 ) ;
-
-#define SINGLE_STEP 	*data++ = tmp & VGA_ALLPLANES ; tmp >>= 4
-
-
-if ( center_width < 0 ) {
-	src = masterSrc;
-	for ( ; ly-- ; ) {
-		tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ;
-		for ( dx = lx + 1 ; --dx ; ) {
-			SINGLE_STEP ;
-		}
-		data += pad ;
-		src += BYTES_PER_LINE(pWin);
-	}
-} else
-	for ( savCenterWidth = center_width ;
-	      ly-- ;
-	      center_width = savCenterWidth,
-	      masterSrc += BYTES_PER_LINE(pWin) ) {
-		src = masterSrc ;
-		tmp = read8Z( REGBASE, src ) ; src++;
-		if ((dx = skip))
-			tmp >>= ( dx << 2 ) ;
-		else
-		if ( lx < 8 ) {			/* kludge -- GJA */
-			--center_width ;	/* kludge -- GJA */
-			dx = 8 - lx ;		/* kludge -- GJA */
-		} else				/* kludge -- GJA */
-			--center_width ;
-	BranchPoint:
-		switch ( dx ) {
-		LoopTop:
-		case 0x0: SINGLE_STEP ;
-		case 0x1: SINGLE_STEP ;
-		case 0x2: SINGLE_STEP ;
-		case 0x3: SINGLE_STEP ;
-		case 0x4: SINGLE_STEP ;
-		case 0x5: SINGLE_STEP ;
-		case 0x6: SINGLE_STEP ;
-		case 0x7: *data++ = tmp & VGA_ALLPLANES ;
-
-			/* Fall Through To End Of Inner Loop */
-			if ( center_width > 0 ) {
-				tmp = read8Z( REGBASE, src ) ; src++;
-				center_width-- ;
-				goto LoopTop ;
-			}
-			else if ( ( center_width == 0 )
-			       && ( dx = ( - ignore ) & 07 ) ) {
-				tmp = read8Z( REGBASE, src ) ; src++;
-				center_width-- ;
-				goto BranchPoint ; /* Do Mod 8 edge */
-			}
-			else /* End of this line */
-				data += pad ;
-		}
-	}
-
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/vgaReg.h b/hw/xfree86/xf4bpp/vgaReg.h
deleted file mode 100644
index 32ec0da..0000000
--- a/hw/xfree86/xf4bpp/vgaReg.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#define SET_BYTE_REGISTER( ioport, value )	outb( ioport, value )
-#define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
-#define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
-/* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became
- * superfluous.
- */
-#define SET_INDEXED_REGISTER(RegGroup, Index, Value) \
-	(SET_BYTE_REGISTER(RegGroup, Index), \
-	 SET_BYTE_REGISTER((RegGroup) + 1, Value))
-
-/* There is a jumper on the ega to change this to 0x200 instead !! */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#if 0	/* This is now a stack variable, as needed */
-#define REGBASE				0x300
-#endif
-
-#define AttributeIndexRegister		REGBASE + 0xC0
-#define AttributeDataWriteRegister	REGBASE + 0xC0
-#define AttributeDataReadRegister	REGBASE + 0xC1
-#define AttributeRegister		AttributeIndexRegister
-#define AttributeModeIndex		0x30
-#define OverScanColorIndex		0x31
-#define ColorPlaneEnableIndex		0x32
-#define HorizPelPanIndex		0x33
-#define ColorSelectIndex		0x34
-#ifndef	PC98_EGC
-#define SetVideoAttributeIndex( index ) \
-	SET_INDEX_REGISTER( AttributeIndexRegister, index )
-#define SetVideoAttribute( index, value ) \
-	SetVideoAttributeIndex( index ) ; \
-	SET_BYTE_REGISTER( AttributeDataWriteRegister, value )
-#endif
-
-	/* Graphics Registers  03CE & 03CF */
-#define GraphicsIndexRegister		REGBASE + 0xCE
-#define GraphicsDataRegister		REGBASE + 0xCF
-#define GraphicsRegister		GraphicsIndexRegister
-#define Set_ResetIndex			0x00
-#define Enb_Set_ResetIndex		0x01
-#define Color_CompareIndex		0x02
-#define Data_RotateIndex		0x03
-#define Read_Map_SelectIndex		0x04
-#define Graphics_ModeIndex		0x05
-#define MiscellaneousIndex		0x06
-#define Color_Dont_CareIndex		0x07
-#define Bit_MaskIndex			0x08
-#ifndef	PC98_EGC
-#define SetVideoGraphicsIndex( index ) \
-	SET_INDEX_REGISTER( GraphicsIndexRegister, index )
-#define SetVideoGraphicsData( value ) \
-	SET_INDEX_REGISTER( GraphicsDataRegister, value )
-#define SetVideoGraphics( index, value ) \
-	SET_INDEXED_REGISTER( GraphicsRegister, index, value )
-#endif
-
-/* Sequencer Registers  03C4 & 03C5 */
-#define SequencerIndexRegister		REGBASE + 0xC4
-#define SequencerDataRegister		REGBASE + 0xC5
-#define SequencerRegister		SequencerIndexRegister
-#define Seq_ResetIndex			00
-#define Clock_ModeIndex			01
-#define Mask_MapIndex			02
-#define Char_Map_SelectIndex		03
-#define Memory_ModeIndex		04
-#ifndef	PC98_EGC
-#define SetVideoSequencerIndex( index ) \
-	SET_INDEX_REGISTER( SequencerIndexRegister, index )
-#define SetVideoSequencer( index, value ) \
-	SET_INDEXED_REGISTER( SequencerRegister, index, value )
-#endif
-
-/* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */
-/* for the Graphics' Data_Rotate Register */
-#define VGA_ROTATE_FUNC_SHIFT 3
-#define VGA_COPY_MODE	( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */
-#define VGA_AND_MODE	( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */
-#define VGA_OR_MODE	( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */
-#define VGA_XOR_MODE	( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */
-/* for the Graphics' Graphics_Mode Register */
-#define VGA_READ_MODE_SHIFT 3
-#define VGA_WRITE_MODE_0	0
-#define VGA_WRITE_MODE_1	1
-#define VGA_WRITE_MODE_2	2
-#define VGA_WRITE_MODE_3	3
-#define VGA_READ_MODE_0		( 0 << VGA_READ_MODE_SHIFT )
-#define VGA_READ_MODE_1		( 1 << VGA_READ_MODE_SHIFT )
-
-#ifdef	PC98_EGC
-/* I/O port address define for extended EGC */
-#define		EGC_PLANE	0x4a0	/* EGC active plane select */
-#define		EGC_READ	0x4a2	/* EGC FGC,EGC,Read Plane  */
-#define		EGC_MODE	0x4a4	/* EGC Mode register & ROP */
-#define		EGC_FGC		0x4a6	/* EGC Forground color     */
-#define		EGC_MASK	0x4a8	/* EGC Mask register       */
-#define		EGC_BGC		0x4aa	/* EGC Background color    */
-#define		EGC_ADD		0x4ac	/* EGC Dest/Source address */
-#define		EGC_LENGTH	0x4ae	/* EGC Bit length          */
-
-#define		PALETTE_ADD	0xa8	/* Palette address         */
-#define		PALETTE_GRE	0xaa	/* Palette Green           */
-#define		PALETTE_RED	0xac	/* Palette Red             */
-#define		PALETTE_BLU	0xae	/* Palette Blue            */
-					
-#define EGC_AND_MODE		0x2c8c	/* (S&P&D)|(~S&D) */
-#define EGC_AND_INV_MODE	0x2c2c	/* (S&P&~D)|(~S&D) */
-#define EGC_OR_MODE		0x2cec	/* S&(P|D)|(~S&D) */
-#define EGC_OR_INV_MODE		0x2cbc	/* S&(P|~D)|(~S&D) */
-#define EGC_XOR_MODE		0x2c6c	/* (S&(P&~D|~P&D))|(~S&D) */
-#define EGC_XOR_INV_MODE	0x2c9c	/* (S&(P&D)|(~P&~D))|(~S&D) */
-#define EGC_COPY_MODE		0x2cac /* (S&P)|(~S&D) */
-#endif
diff --git a/hw/xfree86/xf4bpp/vgaSolid.c b/hw/xfree86/xf4bpp/vgaSolid.c
deleted file mode 100644
index 0ef18cf..0000000
--- a/hw/xfree86/xf4bpp/vgaSolid.c
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "vgaReg.h"
-#include "vgaVideo.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-#undef TRUE
-#undef FALSE
-#define TRUE 1
-#define FALSE 0
-
-#ifndef	PC98_EGC
-#ifdef USE_ASM
-extern void fastFill();
-extern void fastFillRMW();
-#else
-
-static void fastFill
-(
-	register volatile unsigned char *destination,
-	register const unsigned int bytes_per_line,
-	register const unsigned int bytewidth,	/* MUST BE > 0 !! */
-	register unsigned int height		/* MUST BE > 0 !! */
-)
-{
-int stop_count = bytewidth ;
-register int row_jump = bytes_per_line - bytewidth ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
-register const unsigned int notZero = ((unsigned char)(~0x0));
-#else
-#define notZero ((unsigned char)(~0))
-#endif
-
-#define SINGLE_STORE \
-    ( *( (VgaMemoryPtr) destination ) = notZero ); \
-    destination++; stop_count--;
-
-/* TOP OF FIRST LOOP */
-BranchPoint:
-
-switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
-	LoopTop :
-	case 0x0 : SINGLE_STORE ;
-	case 0xF : SINGLE_STORE ;
-	case 0xE : SINGLE_STORE ;
-	case 0xD : SINGLE_STORE ;
-	case 0xC : SINGLE_STORE ;
-	case 0xB : SINGLE_STORE ;
-	case 0xA : SINGLE_STORE ;
-	case 0x9 : SINGLE_STORE ;
-	case 0x8 : SINGLE_STORE ;
-	case 0x7 : SINGLE_STORE ;
-	case 0x6 : SINGLE_STORE ;
-	case 0x5 : SINGLE_STORE ;
-	case 0x4 : SINGLE_STORE ;
-	case 0x3 : SINGLE_STORE ;
-	case 0x2 : SINGLE_STORE ;
-	case 0x1 : SINGLE_STORE ;
-/* FIRST LOOP */
-		if ( stop_count )
-			goto LoopTop ;
-/* SECOND LOOP */
-		if ( --height ) {
-			destination += row_jump ;
-			stop_count = bytewidth ;
-			goto BranchPoint ;
-		}
-		else
-			return ;
-#undef SINGLE_STORE
-}
-/*NOTREACHED*/
-}
-
-/* For Read-Modify-Write Case */
-static void fastFillRMW
-(
-	register volatile unsigned char *destination,
-	register const unsigned int bytes_per_line,
-	register const unsigned int bytewidth,	/* MUST BE > 0 !! */
-	register unsigned int height		/* MUST BE > 0 !! */
-)
-{
-int stop_count = bytewidth ;
-register int row_jump = bytes_per_line - bytewidth ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
-register const unsigned int notZero = ((unsigned char)(~0x0));
-#endif
-register int tmp ;
-
-#define SINGLE_STORE \
-    tmp = *( (VgaMemoryPtr) destination ) ;  (void)tmp; \
-    ( *( (VgaMemoryPtr) destination ) = notZero ) ; \
-    destination++; stop_count-- ;
-
-/* TOP OF FIRST LOOP */
-BranchPoint:
-
-switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
-	LoopTop :
-	case 0x0 : SINGLE_STORE ;
-	case 0xF : SINGLE_STORE ;
-	case 0xE : SINGLE_STORE ;
-	case 0xD : SINGLE_STORE ;
-	case 0xC : SINGLE_STORE ;
-	case 0xB : SINGLE_STORE ;
-	case 0xA : SINGLE_STORE ;
-	case 0x9 : SINGLE_STORE ;
-	case 0x8 : SINGLE_STORE ;
-	case 0x7 : SINGLE_STORE ;
-	case 0x6 : SINGLE_STORE ;
-	case 0x5 : SINGLE_STORE ;
-	case 0x4 : SINGLE_STORE ;
-	case 0x3 : SINGLE_STORE ;
-	case 0x2 : SINGLE_STORE ;
-	case 0x1 : SINGLE_STORE ;
-/* FIRST LOOP */
-		if ( stop_count )
-			goto LoopTop ;
-/* SECOND LOOP */
-		if ( --height ) {
-			destination += row_jump ;
-			stop_count = bytewidth ;
-			goto BranchPoint ;
-		}
-		else
-			return ;
-}
-#undef SINGLE_STORE
-/*NOTREACHED*/
-}
-#endif
-
-
-void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
-WindowPtr pWin; /* GJA */
-unsigned long int color ;
-const int alu ;
-unsigned long int planes ;
-register int x0 ;
-register const int y0 ;
-register int lx ;
-register const int ly ;		/* MUST BE > 0 !! */
-{
-IOADDRESS REGBASE;
-register volatile unsigned char *dst ;
-register int tmp ;
-register int tmp2 ;
-register int tmp3 ;
-unsigned int data_rotate_value = VGA_COPY_MODE ;
-unsigned int read_write_modify = FALSE ;
-unsigned int invert_existing_data = FALSE ;
-
-{	/* Start GJA */
-	if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-		xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
-		return;
-	}
-}	/* End GJA */
-
-if ( ( lx == 0 ) || ( ly == 0 ) )
-	return;
-
-switch ( alu ) {
-	case GXclear:		/* 0x0 Zero 0 */
-		color = 0 ;
-		break ;
-	case GXnor:		/* 0x8 NOT src AND NOT dst */
-		invert_existing_data = TRUE ;
-	case GXandInverted:	/* 0x4 NOT src AND dst */
-		color = ~color ;
-	case GXand:		/* 0x1 src AND dst */
-		data_rotate_value = VGA_AND_MODE ;
-		read_write_modify = TRUE ;
-	case GXcopy:		/* 0x3 src */
-		break ;
-	case GXnoop:		/* 0x5 dst */
-		return ;
-	case GXequiv:		/* 0x9 NOT src XOR dst */
-		color = ~color ;
-	case GXxor:		/* 0x6 src XOR dst */
-		data_rotate_value = VGA_XOR_MODE ;
-		read_write_modify = TRUE ;
-		planes &= color ;
-		break ;
-	case GXandReverse:	/* 0x2 src AND NOT dst */
-		invert_existing_data = TRUE ;
-		data_rotate_value = VGA_AND_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXorReverse:	/* 0xb src OR NOT dst */
-		invert_existing_data = TRUE ;
-		data_rotate_value = VGA_OR_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXnand:		/* 0xe NOT src OR NOT dst */
-		invert_existing_data = TRUE ;
-	case GXorInverted:	/* 0xd NOT src OR dst */
-		color = ~color ;
-	case GXor:		/* 0x7 src OR dst */
-		data_rotate_value = VGA_OR_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXcopyInverted:	/* 0xc NOT src */
-		color = ~color ;
-		break ;
-	case GXinvert:		/* 0xa NOT dst */
-		data_rotate_value = VGA_XOR_MODE ;
-		read_write_modify = TRUE ;
-	case GXset:		/* 0xf 1 */
-		color = VGA_ALLPLANES ;
-	default:
-		break ;
-}
-
-if ( !( planes &= VGA_ALLPLANES ) )
-	return ;
-
-REGBASE =
-    xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
-
-/*
- * Set The Plane-Enable
- */
-SetVideoSequencer( Mask_MapIndex, planes ) ;
-SetVideoGraphics( Enb_Set_ResetIndex, planes ) ;
-/*
- * Put Display Into SET/RESET Write Mode
- */
-SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
-/*
- * Set The Color in The Set/Reset Register
- */
-SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
-/*
- * Set The Function-Select In The Data Rotate Register
- */
-SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
-
-/* Do Left Edge */
-if ((tmp = x0 & 07)) {
-	tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp ) ;
-	/* Catch The Cases Where The Entire Region Is Within One Byte */
-	if ( ( lx -= 8 - tmp ) < 0 ) {
-		tmp2 &= SCRLEFT8( 0xFF, -lx ) ;
-		lx = 0 ;
-	}
-	/* Set The Bit Mask Reg */
-        SetVideoGraphics(Bit_MaskIndex, tmp2 ) ;
-	if ( invert_existing_data == TRUE ) {
-                SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
-		dst = SCREENADDRESS( pWin, x0, y0 );
-		for ( tmp = ly;
-		      tmp-- ; ) {
-			tmp3 = *( (VgaMemoryPtr) dst ) ;
-			(void)tmp3;
-			*( (VgaMemoryPtr) dst ) = tmp2 ;
-			dst += BYTES_PER_LINE(pWin);
-		}
-                SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
-			/* Un-Set XOR */
-	}
-	dst = SCREENADDRESS( pWin, x0, y0 );
-	for ( tmp = ly;
-	      tmp-- ; ) {
-		tmp3 = *( (VgaMemoryPtr) dst ) ;
-		(void)tmp3;
-		*( (VgaMemoryPtr) dst ) = tmp2 ;
-		dst += BYTES_PER_LINE(pWin);
-	}
-	if ( !lx ) { /* All Handled In This Byte */
-		return ;
-	}
-	x0 = ( x0 + 8 ) & ~07 ;
-}
-
-/* Fill The Center Of The Box */
-if ( ROW_OFFSET( lx ) ) {
-	SetVideoGraphics(Bit_MaskIndex, 0xFF ) ;
-	if ( invert_existing_data == TRUE ) {
-                SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
-		fastFillRMW( SCREENADDRESS( pWin, x0, y0 ),
-			     BYTES_PER_LINE(pWin),
-			     ROW_OFFSET( lx ), ly ) ;
-                SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
-			/* Un-Set XOR */
-		/* Point At The Bit Mask Reg */
-	}
-	(* ( ( read_write_modify == FALSE ) ? fastFill : fastFillRMW ) )
-		( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
-		  ROW_OFFSET( lx ), ly ) ;
-}
-
-/* Do Right Edge */
-if ((tmp = BIT_OFFSET(lx))) { /* x0 Now Is Byte Aligned */
-	/* Set The Bit Mask */
-	SetVideoGraphics( Bit_MaskIndex,
-		(tmp2 = SCRLEFT8( 0xFF, ( 8 - tmp ) ) ) ) ;
-	if ( invert_existing_data == TRUE ) {
-                SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
-		dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
-		for ( tmp = ly; 
-		      tmp-- ; ) {
-			tmp3 = *( (VgaMemoryPtr) dst ) ;
-			(void)tmp3;
-			*( (VgaMemoryPtr) dst ) = tmp2 ;
-			dst += BYTES_PER_LINE(pWin);
-		}
-                SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
-		SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
-			/* Un-Set XOR */
-	}
-	dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
-	for ( tmp = ly; 
-	      tmp-- ; ) {
-		tmp3 = *( (VgaMemoryPtr) dst ) ;
-		(void)tmp3;
-		*( (VgaMemoryPtr) dst ) = tmp2 ;
-		dst += BYTES_PER_LINE(pWin) ;
-	}
-}
-/* Disable Set/Reset Register */
-SetVideoGraphics( Enb_Set_ResetIndex, 0 ) ;
-
-
-return ;
-}
-
-#else	/* for PC98 EGC */
-static void WordfastFill( destination, bytes_per_line, wordwidth, height )
-register volatile unsigned char *destination ;
-register const unsigned int bytes_per_line ;
-register const unsigned int wordwidth ;	/* MUST BE > 0 !! */
-register unsigned int height ;		/* MUST BE > 0 !! */
-{
-int stop_count = wordwidth ;
-register int row_jump = bytes_per_line - wordwidth*2 ;
-#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0
-register const int notZero = ~0x0 ;
-#else
-#define notZero ( ~0 )
-#endif
-
-#define SINGLE_STORE \
-    ( *( (unsigned short *) destination++ ) = notZero ); \
-    destination++; stop_count--;
-
-/* TOP OF FIRST LOOP */
-BranchPoint:
-
-switch ( wordwidth & 0xF ) { /* Jump into loop at mod 16 remainder */
-	LoopTop :
-	case 0x0 : SINGLE_STORE ;
-	case 0xF : SINGLE_STORE ;
-	case 0xE : SINGLE_STORE ;
-	case 0xD : SINGLE_STORE ;
-	case 0xC : SINGLE_STORE ;
-	case 0xB : SINGLE_STORE ;
-	case 0xA : SINGLE_STORE ;
-	case 0x9 : SINGLE_STORE ;
-	case 0x8 : SINGLE_STORE ;
-	case 0x7 : SINGLE_STORE ;
-	case 0x6 : SINGLE_STORE ;
-	case 0x5 : SINGLE_STORE ;
-	case 0x4 : SINGLE_STORE ;
-	case 0x3 : SINGLE_STORE ;
-	case 0x2 : SINGLE_STORE ;
-	case 0x1 : SINGLE_STORE ;
-/* FIRST LOOP */
-		if ( stop_count )
-			goto LoopTop ;
-/* SECOND LOOP */
-		if ( --height ) {
-			destination += row_jump ;
-			stop_count = wordwidth ;
-			goto BranchPoint ;
-		}
-		else
-			return ;
-#undef SINGLE_STORE
-}
-/*NOTREACHED*/
-}
-
-void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
-WindowPtr pWin; /* GJA */
-unsigned long int color ;
-const int alu ;
-unsigned long int planes ;
-register int x0 ;
-register const int y0 ;
-register int lx ;
-register const int ly ;		/* MUST BE > 0 !! */
-{
-register volatile unsigned char *dst ;
-register tmp ;
-register tmp2 ;
-register unsigned short tmp3 ;
-unsigned short ROP_value;
-unsigned int data_rotate_value = VGA_COPY_MODE ;
-unsigned int read_write_modify = FALSE ;
-unsigned int invert_existing_data = FALSE ;
-
-{	/* Start GJA */
-	if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-		xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
-		return;
-	}
-}	/* End GJA */
-
-if ( ( lx == 0 ) || ( ly == 0 ) )
-	return;
-
-switch ( alu ) {
-	case GXclear:		/* 0x0 Zero 0 */
-		color = 0 ;
-		break ;
-	case GXnor:		/* 0x8 NOT src AND NOT dst */
-		invert_existing_data = TRUE ;
-	case GXandInverted:	/* 0x4 NOT src AND dst */
-		color = ~color ;
-	case GXand:		/* 0x1 src AND dst */
-		data_rotate_value = VGA_AND_MODE ;
-		read_write_modify = TRUE ;
-	case GXcopy:		/* 0x3 src */
-		break ;
-	case GXnoop:		/* 0x5 dst */
-		return ;
-	case GXequiv:		/* 0x9 NOT src XOR dst */
-		color = ~color ;
-	case GXxor:		/* 0x6 src XOR dst */
-		data_rotate_value = VGA_XOR_MODE ;
-		read_write_modify = TRUE ;
-		planes &= color ;
-		break ;
-	case GXandReverse:	/* 0x2 src AND NOT dst */
-		invert_existing_data = TRUE ;
-		data_rotate_value = VGA_AND_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXorReverse:	/* 0xb src OR NOT dst */
-		invert_existing_data = TRUE ;
-		data_rotate_value = VGA_OR_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXnand:		/* 0xe NOT src OR NOT dst */
-		invert_existing_data = TRUE ;
-	case GXorInverted:	/* 0xd NOT src OR dst */
-		color = ~color ;
-	case GXor:		/* 0x7 src OR dst */
-		data_rotate_value = VGA_OR_MODE ;
-		read_write_modify = TRUE ;
-		break ;
-	case GXcopyInverted:	/* 0xc NOT src */
-		color = ~color ;
-		break ;
-	case GXinvert:		/* 0xa NOT dst */
-		data_rotate_value = VGA_XOR_MODE ;
-		read_write_modify = TRUE ;
-	case GXset:		/* 0xf 1 */
-		color = VGA_ALLPLANES ;
-	default:
-		break ;
-}
-
-if ( !( planes &= VGA_ALLPLANES ) )
-	return ;
-
-/* Set Access Planes */
-outw(EGC_PLANE, ~planes);
-switch(data_rotate_value) {
-/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
- case VGA_AND_MODE:
-    if (invert_existing_data)
-	ROP_value = EGC_AND_INV_MODE;
-    else
-	ROP_value = EGC_AND_MODE;
-    break;
- case VGA_OR_MODE:
-    if (invert_existing_data)
-	ROP_value = EGC_OR_INV_MODE;
-    else
-	ROP_value = EGC_OR_MODE;
-    break;
- case VGA_XOR_MODE:
-    if (invert_existing_data)
-	ROP_value = EGC_XOR_INV_MODE;
-    else
-	ROP_value = EGC_XOR_MODE;
-    break;
- case VGA_COPY_MODE:
- default:
-    ROP_value = EGC_COPY_MODE;
-    break;
-}
-outw(EGC_MODE, ROP_value);
-outw(EGC_FGC, color & VGA_ALLPLANES);
-/* Do Left Edge */
-if ( tmp = x0 & 0x0f ) {
-	dst = (unsigned char *)((int)(SCREENADDRESS(pWin,x0,y0)) & ~0x01);
-	tmp3 = (unsigned)0xffff >>tmp;
-	/* Catch The Cases Where The Entire Region Is Within One Word */
-	if ( ( lx -= 16 - tmp ) < 0 ) {
-		tmp3 &= (unsigned)0xffff << -lx;
-		lx = 0 ;
-	}
-	tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
-	for ( tmp = ly;
-	      tmp-- ; ) {
-		*((unsigned short *) dst ) = tmp3 ;
-		dst += BYTES_PER_LINE(pWin);
-	}
-	if ( !lx ) { /* All Handled In This Word */
-		return ;
-	}
-	x0 = ( x0 + 0x0f ) & ~0x0f ;
-}
-
-/* Fill The Center Of The Box */
-if (lx >> 4) {
-	WordfastFill( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin), 
-		     (lx >> 4), ly ) ;
-}
-
-/* Do Right Edge */
-if ( tmp = lx & 0x0f ) { /* x0 Now Is Word Aligned */
-	/* Set The Bit Mask */
-	tmp3 = (unsigned)0xffff << ( 16 - tmp );
-	dst = (unsigned char*)((int)SCREENADDRESS(pWin,(x0+lx),y0) & ~0x01);
-	tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
-	for ( tmp = ly;
-	      tmp-- ; ) {
-		*( (unsigned short *) dst ) = tmp3 ;
-		dst += BYTES_PER_LINE(pWin);
-	}
-}
-
-return ;
-}
-#endif
diff --git a/hw/xfree86/xf4bpp/vgaStipple.c b/hw/xfree86/xf4bpp/vgaStipple.c
deleted file mode 100644
index 5ad5302..0000000
--- a/hw/xfree86/xf4bpp/vgaStipple.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "vgaReg.h"
-#include "vgaVideo.h"
-
-#include "xf86str.h" /* for pScrn->vtSema */
-extern ScrnInfoPtr *xf86Screens;
-
-#ifndef	PC98_EGC
-static unsigned char
-getbits
-(
-	register const int x,
-	register const unsigned int patternWidth,
-	register const unsigned char * const lineptr
-)
-{
-register unsigned char bits ;
-register const unsigned char *cptr ;
-register int shift ;
-register int wrap ;
-
-cptr = lineptr + ( x >> 3 ) ;
-bits = *cptr ;
-if ((shift = x & 7))
-	bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
-if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
-	bits &= SCRLEFT8( 0xFF, wrap ) ;
-	bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
-}
-
-/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
- * I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
- */
-switch (patternWidth) {
-case 1:	/* Not really useful. */
-	bits &= ~SCRRIGHT8(0xFF,1);
-	bits |= SCRRIGHT8(bits,1); 
-	bits |= SCRRIGHT8(bits,2);
-	bits |= SCRRIGHT8(bits,4);
-	break;
-case 2:
-	bits &= ~SCRRIGHT8(0xFF,2);
-	bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
-case 3:
-	bits &= ~SCRRIGHT8(0xFF,3);
-	bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
-case 4:
-	bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
-case 5:
-	bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
-case 6:
-	bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
-case 7:
-	bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
-default:
-	;
-	/* Do nothing, of course */
-}
-return bits ;
-}
-#endif
-
-/* GJA --
- * Basically, in the code below, we will draw a stipple in the usual
- * three parts: left edge, center and right edge.
- * For efficiency reasons, the center will be drawn byte aligned, so that
- * we will have to shuffle the bits in the left and right edges.
- * The hard cases will be stipples with width < 8: In order to get 8
- * bits from those, we will need a loop. One single 'if' will never do.
- * This is taken care of above.
- */
-static void
-DoMonoSingle
-(
-	WindowPtr pWin, /* GJA */
-	int w,
-	int x,
-	int y,
-	register const unsigned char *mastersrc,
-	int h,
-	register unsigned int width,
-	register unsigned int paddedByteWidth,
-	unsigned int height,
-	int xshift,
-	int yshift
-)
-{
-IOADDRESS REGBASE =
-    xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
-register volatile unsigned char *xDst ;
-register VideoAdapterObject tmp2 ;
-register int NeedValX ;
-register int counter ;
-register int tmp1 ;
-unsigned int rowCounter ;
-int byte_cnt ;
-#ifdef	PC98_EGC
-unsigned char bitmask;
-#endif
-
-/* Do Left Edge */
-if ((tmp1 = x & 07)) {
-	tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
-	/* Catch The Cases Where The Entire Region Is Within One Byte */
-	if ( ( w -= 8 - tmp1 ) < 0 ) {
-		tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
-		w = 0 ;
-	}
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
-#else
-	bitmask = tmp2; /* Set The Bit Mask */
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	xDst = SCREENADDRESS( pWin, x, y );
-	for ( tmp1 = yshift, rowCounter = h;
-	      rowCounter ;
-	      rowCounter-- , tmp1++ ) {
-
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-#ifndef	PC98_EGC
-		/* Read To Save */
-		tmp2 = *( (VgaMemoryPtr) xDst) ;
-#endif
-		/* Write Pattern */
-		*( (VgaMemoryPtr) xDst ) =
-#ifndef	PC98_EGC
-			getbits( xshift /* GJA */, width,
-				 mastersrc
-				 + ( tmp1 * paddedByteWidth ) ) >> (x & 07) ;
-#else
-#if 0
-			(getbits( xshift /* GJA */, width,
-				  mastersrc
-				 + ( tmp1 * paddedByteWidth ) ) >> (x & 07)
-			 & bitmask);
-#else
-			(getbits_x( xshift /* GJA */, width,
-				  mastersrc
-				 + ( tmp1 * paddedByteWidth ), (x & 07))
-			 & bitmask);
-#endif
-#endif
- 		xDst += BYTES_PER_LINE(pWin);
-	}
-	NeedValX = (xshift + 8 - (x & 07)) % width;
-	x = ( x + 7 ) & ~07 ;
-}
-else {
-	NeedValX = xshift ;
-}
-
-if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
-	int SavNeedX = NeedValX ;
-
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	xDst = SCREENADDRESS( pWin, x, y );
-	for ( tmp1 = yshift, rowCounter = h;
-	      rowCounter ;
-	      rowCounter-- , tmp1++ ) {
-		register const unsigned char *l_ptr ;
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-		l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
-		/*
-		 * For Each Byte Across The Pattern In X
-		 */
-		for ( counter = byte_cnt, NeedValX = SavNeedX ;
-		      counter-- ; ) {
-#ifndef	PC98_EGC
-			/* Read To Save */
-			tmp2 = *( (VgaMemoryPtr) xDst) ;
-#endif
-			/* Write Pattern */
-			*( (VgaMemoryPtr) xDst ) =
-#ifndef	PC98_EGC
-				getbits( NeedValX, width, l_ptr ) ;
-#else
-#if 0
-				getbits( NeedValX, width, l_ptr ) ;
-#else
-				getbits_x ( NeedValX, width, l_ptr, 0 ) ;
-#endif
-#endif
-			/* GJA -- The '%' is there since width could be < 8 */
-			NeedValX = (NeedValX + 8) % width;
-			xDst++;
-		}
-		xDst += BYTES_PER_LINE(pWin) - byte_cnt;
-	}
-}
-
-/* Do Right Edge */
-if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
-	/* Set The Bit Mask */
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
-#else
-	bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ));
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	xDst = SCREENADDRESS( pWin, ( x + w ), y );
-	for ( tmp1 = yshift, rowCounter = h;
-	      rowCounter ;
-	      rowCounter-- , tmp1++ ) {
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-#ifndef	PC98_EGC
-		/* Read To Save */
-		tmp2 = *( (VgaMemoryPtr) xDst) ;
-#endif
-		/* Write Pattern */
-		*( (VgaMemoryPtr) xDst ) =
-#ifndef	PC98_EGC
-			getbits( NeedValX, width,
-				 mastersrc
-				 + ( tmp1 * paddedByteWidth ) ) ;
-#else
-#if 0
-			(getbits( NeedValX, width,
-				 mastersrc
-				 + ( tmp1 * paddedByteWidth ) ) & bitmask);
-#else
-			(getbits_x( NeedValX, width,
-				 mastersrc
-				 + ( tmp1 * paddedByteWidth ), 0 ) & bitmask);
-#endif
-#endif
-		xDst += BYTES_PER_LINE(pWin) ;
-	}
-}
-
-return ;
-}
-
-static void
-DoMonoMany
-(
-	WindowPtr pWin, /* GJA */
-	int w,
-	int x,
-	int y,
-	register const unsigned char *mastersrc,
-	int h,
-	register unsigned int width,
-	register unsigned int paddedByteWidth,
-	unsigned int height,
-	int xshift,
-	int yshift
-)
-{
-IOADDRESS REGBASE =
-    xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
-register volatile unsigned char *xDst ;
-register VideoAdapterObject tmp2 ;
-register int NeedValX ;
-register int byte_cnt ;
-register int tmp1 ;
-unsigned DestinationRow ;
-unsigned int SourceRow ;
-volatile unsigned char *dst ;
-int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ;
-#ifdef	PC98_EGC
-unsigned char bitmask;
-#endif
-
-/* Do Left Edge */
-if ((tmp1 = x & 07)) {
-	tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
-	/* Catch The Cases Where The Entire Region Is Within One Byte */
-	if ( ( w -= 8 - tmp1 ) < 0 ) {
-		tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
-		w = 0 ;
-	}
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
-#else
-	bitmask = tmp2; /* Set The Bit Mask */
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
-	      SourceRow < height ;
-	      tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
-		register unsigned bitPattern ;
-
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-		/*
-		 * For Each Time Pattern Repeats In The Y Dimension
-		 */
-		xDst = dst;
-		for ( DestinationRow = SourceRow,
-#ifndef	PC98_EGC
-		      bitPattern = getbits( xshift, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ) ) ;
-#else
-#if 0
-		      bitPattern = getbits( xshift, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ) ) ;
-#else
-		      bitPattern = getbits_x( xshift, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ), 0 ) ;
-#endif
-#endif
-		      (int)DestinationRow < h ;
-		      DestinationRow += height ) {
-#ifndef	PC98_EGC
-			/* Read To Save */
-			tmp2 = *( (VgaMemoryPtr) xDst ) ;
-#endif
-			/* Write Pattern */
-#ifndef	PC98_EGC
-			*( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07);
-#else
-			*( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask;
-#endif
-		        xDst += scr_incr;
-		}
-	}
-	NeedValX = (xshift + 8 - (x & 07)) % width;
-	x = ( x + 7 ) & ~07 ;
-}
-else {
-	NeedValX = xshift ;
-}
-
-if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
-	int SavNeedX = NeedValX ;
-
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
-	      SourceRow < height ;
-	      tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) {
-		register const unsigned char *l_ptr ;
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-		l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
-		/*
-		 * For Each Byte Across The Pattern In X
-		 */
-		for ( tmp2 = byte_cnt, NeedValX = SavNeedX ;
-		      tmp2-- ;
-		      dst++ ) {
-			register unsigned bitPattern ;
-#ifndef PC98_EGC
-			register VideoAdapterObject tmp3 ;
-#endif
-			/*
-			 * For Each Time Pattern Repeats In Y
-			 */
-			xDst = dst;
-			for ( DestinationRow = SourceRow,
-#ifndef	PC98_EGC
-			      bitPattern = getbits( NeedValX, width, l_ptr ) ;
-#else
-#if 0
-			      bitPattern = getbits( NeedValX, width, l_ptr ) ;
-#else
-			      bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ;
-#endif
-#endif
-			      (int)DestinationRow < h ;
-			      DestinationRow += height ) {
-#ifndef	PC98_EGC
-				/* Read To Save */
-				tmp3 = *( (VgaMemoryPtr) xDst) ;
-				(void)tmp3;
-#endif
-				/* Write Pattern */
-				*( (VgaMemoryPtr) xDst ) = bitPattern ;
-			        xDst += scr_incr;
-			}
-			NeedValX = (NeedValX + 8) % width;
-		}
-	}
-}
-
-/* Do Right Edge */
-if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
-	/* Set The Bit Mask */
-#ifndef	PC98_EGC
-	SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
-#else
-	bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) );
-#endif
-	/*
-	 * For Each Line In The Source Pixmap
-	 */
-	for ( tmp1 = yshift, SourceRow = 0,
-	      dst = SCREENADDRESS( pWin, ( x + w ), y ) ;
-	      SourceRow < height ;
-	      tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
-		register unsigned bitPattern ;
-		if ( tmp1 >= (int)height )
-			tmp1 -= height ;
-		/*
-		 * For Each Time Pattern Repeats In The Y Dimension
-		 */
-		xDst = dst;
-		for ( DestinationRow = SourceRow,
-#ifndef	PC98_EGC
-		      bitPattern = getbits( NeedValX, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ) ) ;
-#else
-#if 0
-		      bitPattern = getbits( NeedValX, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ) ) ;
-#else
-		      bitPattern = getbits_x( NeedValX, width,
-					    mastersrc
-					+ ( tmp1 * paddedByteWidth ), 0 ) ;
-#endif
-#endif
-		      (int)DestinationRow < h ;
-		      DestinationRow += height ) {
-#ifndef	PC98_EGC
-			/* Read To Save */
-			tmp2 = *( (VgaMemoryPtr) xDst) ;
-#endif
-			/* Write Pattern */
-#ifndef	PC98_EGC
-			*( (VgaMemoryPtr) xDst ) = bitPattern ;
-#else
-			*( (VgaMemoryPtr) xDst ) = bitPattern & bitmask;
-#endif
-		        xDst += scr_incr;
-		}
-	}
-}
-
-return ;
-}
-
-#define DO_RECURSE 0x10000
-
-static void
-vgaSetMonoRegisters
-(
-	DrawablePtr pDrawable,
-	register unsigned long int plane_mask,
-	register unsigned long int desiredState
-)
-{
-IOADDRESS REGBASE =
-    xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
-#ifndef	PC98_EGC
-/* Setup VGA Registers */
-/*
- * Set The Plane-Enable
- */
-SetVideoSequencer( Mask_MapIndex, plane_mask ) ;
-SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ;
-/*
- * Put Display Into SET-AND (i.e. Write Mode 3 )
- */
-SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
-/*
- * Set The Color in The Set/Reset Register
- */
-SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ;
-/*
- * Set The Vga's Alu Function
- */
-SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ;
-#else	/* PC98_EGC */
-unsigned short ROP_value;
-/* Setup VGA Registers */
-/*
- * Set The Plane-Enable
- */
-outw(EGC_PLANE, ~plane_mask);
-switch((desiredState >> 8)&0x18) {
-/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
- case VGA_AND_MODE:
-    if (desiredState & DO_RECURSE)
-	ROP_value = EGC_AND_INV_MODE;
-    else
-	ROP_value = EGC_AND_MODE;
-    break;
- case VGA_OR_MODE:
-    if (desiredState & DO_RECURSE)
-	ROP_value = EGC_OR_INV_MODE;
-    else
-	ROP_value = EGC_OR_MODE;
-    break;
- case VGA_XOR_MODE:
-    if (desiredState & DO_RECURSE)
-	ROP_value = EGC_XOR_INV_MODE;
-    else
-	ROP_value = EGC_XOR_MODE;
-    break;
- case VGA_COPY_MODE:
- default:
-    ROP_value = EGC_COPY_MODE;
-    break;
-}
-outw(EGC_MODE, ROP_value);
-outw(EGC_FGC, desiredState & VGA_ALLPLANES);
-#endif
-
-return ;
-}
-
-static unsigned long
-vgaCalcMonoMode
-(
-	int rasterOp,
-	register unsigned long int color
-)
-{
-register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ;
-register unsigned int invert_existing_data = 0 ;
-
-/* Test The Raster-Op */
-switch ( rasterOp ) {
-	case GXclear:		/* 0x0 Zero 0 */
-		color = 0 ;
-		break ;
-	case GXinvert:		/* 0xa NOT dst */
-		data_rotate_value = VGA_XOR_MODE << 8 ;
-	case GXset:		/* 0xf 1 */
-		color = VGA_ALLPLANES ;
-		break ;
-	case GXnor:		/* 0x8 NOT src AND NOT dst */
-		invert_existing_data = DO_RECURSE ;
-	case GXandInverted:	/* 0x4 NOT src AND dst */
-		color = ~color ;
-	case GXand:		/* 0x1 src AND dst */
-		data_rotate_value = VGA_AND_MODE << 8 ;
-	case GXcopy:		/* 0x3 src */
-		break ;
-	case GXequiv:		/* 0x9 NOT src XOR dst */
-		color = ~color ;
-	case GXxor:		/* 0x6 src XOR dst */
-		data_rotate_value = VGA_XOR_MODE << 8 ;
-		break ;
-	case GXandReverse:	/* 0x2 src AND NOT dst */
-		invert_existing_data = DO_RECURSE ;
-		data_rotate_value = VGA_AND_MODE << 8 ;
-		break ;
-	case GXorReverse:	/* 0xb src OR NOT dst */
-		invert_existing_data = DO_RECURSE ;
-		data_rotate_value = VGA_OR_MODE << 8 ;
-		break ;
-	case GXnand:		/* 0xe NOT src OR NOT dst */
-		invert_existing_data = DO_RECURSE ;
-	case GXorInverted:	/* 0xd NOT src OR dst */
-		color = ~color ;
-	case GXor:		/* 0x7 src OR dst */
-		data_rotate_value = VGA_OR_MODE << 8 ;
-		break ;
-	case GXcopyInverted:	/* 0xc NOT src */
-		color = ~color ;
-		break ;
-	case GXnoop:		/* 0x5 dst */
-		; /* Shouldn't Get Here !! */
-}
-
-return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ;
-}
-
-static void
-vgaDrawMonoImage
-(
-	WindowPtr pWin, /* GJA */
-	unsigned char *data,
-	int x,
-	int y,
-	int w,
-	int h,
-	unsigned long int fg,
-	int alu,
-	unsigned long int planes
-)
-{
-unsigned long regState ;
-
-if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-	xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes );
-	return;
-}
-
-if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
-	return ;
-
-#ifndef	PC98_EGC
-if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
-	vgaDrawMonoImage( pWin, data, x, y, w, h,
-			  VGA_ALLPLANES, GXinvert, planes ) ;
-	regState &= ~DO_RECURSE ;
-}
-#else
-regState = vgaCalcMonoMode(alu, (char)fg);
-#endif
-
-
-vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
-
-DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h,
-	      w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ;
-
-
-return ;
-}
-
-void
-xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
-WindowPtr pWin; /* GJA */
-register PixmapPtr const pStipple ;
-unsigned long int fg ;
-const int alu ;
-unsigned long int planes ;
-int x, y, w, h ;
-const int xSrc, ySrc ;
-{
-unsigned int width ;
-unsigned int height ;
-int xshift ;
-int yshift ;
-unsigned long regState ;
-
-if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
-	xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes,
-			x, y, w, h, xSrc, ySrc );
-	return;
-}
-
-if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
-	return ;
-
-#if 1
-if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
-	xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes,
-			x, y, w, h, xSrc, ySrc ) ;
-	regState &= ~DO_RECURSE ;
-}
-#else
-regState = vgaCalcMonoMode(alu, (char)fg);
-#endif
-
-
-vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
-
-/* Figure Bit Offsets & Source Address */
-width = pStipple->drawable.width ;
-if ( ( xshift = ( x - xSrc ) ) < 0 )
-	xshift = width - ( ( - xshift ) % width ) ;
-else
-	xshift %= width ;
-if ( xshift == (int)width ) xshift = 0;
-
-height = pStipple->drawable.height ;
-if ( ( yshift = ( y - ySrc ) ) < 0 )
-	yshift = height - ( ( - yshift ) % height ) ;
-else
-	yshift %= height ;
-if ( yshift == (int)height ) yshift = 0;
-
-	(* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) (
-			pWin, w, x, y,
-			(const unsigned char *) pStipple->devPrivate.ptr,
-			h,
-			width,
-			( ( width + 31 ) & ((unsigned)(~31)) ) >> 3,
-			height,
-			xshift, yshift
-			) ;
-
-return ;
-}
diff --git a/hw/xfree86/xf4bpp/vgaVideo.h b/hw/xfree86/xf4bpp/vgaVideo.h
deleted file mode 100644
index 60afa5b..0000000
--- a/hw/xfree86/xf4bpp/vgaVideo.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that 
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"	/* GJA -- for pointer data type */
-#ifdef lint
-#if defined(volatile)
-#undef volatile
-#endif
-#define volatile /**/
-#if defined(const)
-#undef const
-#endif
-#define const /**/
-#if defined(signed)
-#undef signed
-#endif
-#define signed /**/
-#endif
-
-/*
- * References to all pc ( i.e. '286 ) memory in the
- * regions used by the [ev]ga server ( the 128K windows )
- * MUST be long-word ( i.e. 32-bit ) reads or writes.
- * This definition will change for other memory architectures
- * ( e.g. AIX-Rt )
- */
-typedef unsigned char VideoAdapterObject ;
-typedef volatile VideoAdapterObject *VideoMemoryPtr ;
-typedef volatile VideoAdapterObject *VgaMemoryPtr ;
-#if !defined(BITMAP_BIT_ORDER)
-#define BITMAP_BIT_ORDER MSBFirst
-#endif
-
-#if !defined(IMAGE_BYTE_ORDER)
-#define IMAGE_BYTE_ORDER LSBFirst
-#endif
-
-/* Bit Ordering Macros */
-#if !defined(SCRLEFT8)
-#define SCRLEFT8(lw, n)	( (unsigned char) (((unsigned char) lw) << (n)) )
-#endif
-#if !defined(SCRRIGHT8)
-#define SCRRIGHT8(lw, n)	( (unsigned char) (((unsigned char)lw) >> (n)) )
-#endif
-/* These work ONLY on 8-bit wide Quantities !! */
-#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
-#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
-
-/*
- * [ev]ga video screen defines & macros
- */
-#define VGA_BLACK_PIXEL 0
-#define VGA_WHITE_PIXEL 1
-
-#define VGA_MAXPLANES 4
-#define VGA_ALLPLANES 0xFL
-
-#define VIDBASE(pDraw) ((volatile unsigned char *) \
-	(((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
-		devPrivate.ptr))
-#define BYTES_PER_LINE(pDraw) \
-   ((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
-
-#define ROW_OFFSET( x ) ( ( x ) >> 3 )
-#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
-#define SCREENADDRESS( pWin, x, y ) \
-	( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )
-
-
diff --git a/hw/xfree86/xf4bpp/vgamodule.c b/hw/xfree86/xf4bpp/vgamodule.c
deleted file mode 100644
index e732491..0000000
--- a/hw/xfree86/xf4bpp/vgamodule.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 1998 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(xf4bppSetup);
-
-static XF86ModuleVersionInfo VersRec =
-{
-        "xf4bpp",
-        MODULEVENDORSTRING,
-        MODINFOSTRING1,
-        MODINFOSTRING2,
-        XORG_VERSION_CURRENT,
-        1, 0, 0,
-        ABI_CLASS_ANSIC,	/* Only need ansic layer */
-        ABI_ANSIC_VERSION,
-        MOD_CLASS_NONE,
-        {0,0,0,0}       /* signature, to be patched into the file by a tool */
-};
-
-_X_EXPORT XF86ModuleData xf4bppModuleData = { &VersRec, xf4bppSetup, NULL };
-
-static pointer
-xf4bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
-    /* This module requires xf1bpp for bitmap support */
-    return LoadSubModule(module, "xf1bpp", NULL, NULL, NULL, NULL,
-			 errmaj, errmin);
-}
diff --git a/hw/xfree86/xf4bpp/wm3.c b/hw/xfree86/xf4bpp/wm3.c
deleted file mode 100644
index 3a57221..0000000
--- a/hw/xfree86/xf4bpp/wm3.c
+++ /dev/null
@@ -1,203 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-#include "OScompiler.h"
-#include "wm3.h"
-#include "vgaVideo.h"
-#include "xf86.h"
-
-/* Ferraro is wrong. GJA */
-#define COPY (0 << 3)
-#define AND  (1 << 3)
-#define OR   (2 << 3)
-#define XOR  (3 << 3)
-
-int
-wm3_set_regs(pGC)
-GC *pGC;
-{
-#ifndef	PC98_EGC
-    IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300;
-    int post_invert = 0;
-    int ALU;
-
-    switch(pGC->alu) {
-    case GXclear:        /* rop0 = RROP_BLACK;  rop1 = RROP_BLACK; */
-        pGC->fgPixel = 0;
-        pGC->bgPixel = 0;
-        ALU = COPY;
-        break;
-    case GXand:          /* rop0 = RROP_BLACK;  rop1 = RROP_NOP; */
-        ALU = AND;
-        break;
-    case GXandReverse:   /* rop0 = RROP_BLACK;  rop1 = RROP_INVERT; -- TRICKY */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = OR;
-        post_invert = 1;
-        break;
-    case GXcopy:         /* rop0 = RROP_BLACK;  rop1 = RROP_WHITE; */
-        ALU = COPY;
-        break;
-    case GXandInverted:  /* rop0 = RROP_NOP;    rop1 = RROP_BLACK; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = AND;
-        break;
-    default:
-    case GXnoop:         /* rop0 = RROP_NOP;    rop1 = RROP_NOP; */
-        return 0;
-    case GXxor:          /* rop0 = RROP_NOP;    rop1 = RROP_INVERT; */
-        ALU = XOR;
-        break;
-    case GXor:           /* rop0 = RROP_NOP;    rop1 = RROP_WHITE; */
-        ALU = OR;
-        break;
-    case GXnor:          /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
-        ALU = OR;
-        post_invert = 1;
-        break;
-    case GXequiv:        /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = XOR;
-        break;
-    case GXinvert:       /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
-        pGC->fgPixel = 0x0F;
-        pGC->bgPixel = 0x0F;
-        ALU = XOR;
-        break;
-    case GXorReverse:    /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = AND;
-        post_invert = 1;
-        break;
-    case GXcopyInverted: /* rop0 = RROP_WHITE;  rop1 = RROP_BLACK; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = COPY;
-        break;
-    case GXorInverted:   /* rop0 = RROP_WHITE;  rop1 = RROP_NOP; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = OR;
-        break;
-    case GXnand:         /* rop0 = RROP_WHITE;  rop1 = RROP_INVERT; -- TRICKY */
-        ALU = AND;
-        post_invert = 1;
-        break;
-    case GXset:          /* rop0 = RROP_WHITE;  rop1 = RROP_WHITE; */
-        pGC->fgPixel = 0x0F;
-        pGC->bgPixel = 0x0F;
-        ALU = COPY;
-        break;
-    }
-
-
-    SetVideoSequencer(Mask_MapIndex, (pGC->planemask & VGA_ALLPLANES));
-    SetVideoGraphics(Enb_Set_ResetIndex, VGA_ALLPLANES);
-    SetVideoGraphics(Set_ResetIndex, pGC->fgPixel);
-    SetVideoGraphics(Bit_MaskIndex, 0xFF);
-    SetVideoGraphics(Graphics_ModeIndex, 3); /* Write Mode 3 */
-    SetVideoGraphics(Data_RotateIndex, ALU);
-
-    return post_invert;
-#else
-    int ALU;
-
-    switch(pGC->alu) {
-    case GXclear:        /* rop0 = RROP_BLACK;  rop1 = RROP_BLACK; */
-        pGC->fgPixel = 0;
-        pGC->bgPixel = 0;
-        ALU = EGC_COPY_MODE;
-        break;
-    case GXand:          /* rop0 = RROP_BLACK;  rop1 = RROP_NOP; */
-        ALU = EGC_AND_MODE;
-        break;
-    case GXandReverse:   /* rop0 = RROP_BLACK;  rop1 = RROP_INVERT; -- TRICKY */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_OR_INV_MODE;
-        break;
-    case GXcopy:         /* rop0 = RROP_BLACK;  rop1 = RROP_WHITE; */
-        ALU = EGC_COPY_MODE;
-        break;
-    case GXandInverted:  /* rop0 = RROP_NOP;    rop1 = RROP_BLACK; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_AND_MODE;
-        break;
-    case GXnoop:         /* rop0 = RROP_NOP;    rop1 = RROP_NOP; */
-        return 0;
-    case GXxor:          /* rop0 = RROP_NOP;    rop1 = RROP_INVERT; */
-        ALU = EGC_XOR_MODE;
-        break;
-    case GXor:           /* rop0 = RROP_NOP;    rop1 = RROP_WHITE; */
-        ALU = EGC_OR_MODE;
-        break;
-    case GXnor:          /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
-        ALU = EGC_OR_INV_MODE;
-        break;
-    case GXequiv:        /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_XOR_MODE;
-        break;
-    case GXinvert:       /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
-        pGC->fgPixel = 0x0F;
-        pGC->bgPixel = 0x0F;
-        ALU = EGC_XOR_MODE;
-        break;
-    case GXorReverse:    /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_AND_INV_MODE;
-        break;
-    case GXcopyInverted: /* rop0 = RROP_WHITE;  rop1 = RROP_BLACK; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_COPY_MODE;
-        break;
-    case GXorInverted:   /* rop0 = RROP_WHITE;  rop1 = RROP_NOP; */
-        pGC->fgPixel = ~pGC->fgPixel;
-        pGC->bgPixel = ~pGC->bgPixel;
-        ALU = EGC_OR_MODE;
-        break;
-    case GXnand:         /* rop0 = RROP_WHITE;  rop1 = RROP_INVERT; -- TRICKY */
-        ALU = EGC_OR_INV_MODE;
-        break;
-    case GXset:          /* rop0 = RROP_WHITE;  rop1 = RROP_WHITE; */
-        pGC->fgPixel = 0x0F;
-        pGC->bgPixel = 0x0F;
-        ALU = EGC_COPY_MODE;
-        break;
-    }
-
-    outw(EGC_PLANE, ~(pGC->planemask & VGA_ALLPLANES));
-    outw(EGC_MODE, ALU);
-    outw(EGC_FGC, pGC->fgPixel & VGA_ALLPLANES); /* set FGC */
-
-    return 0;
-#endif
-}
-
-/*
-   Now we will have to set the alu.
-   Problematic is: How do we handle IsDoubleDash, which draws with both fg
-   and bg colour?
-   The answer is: We take care to store the ink colour in one register only.
-   Then we need set only this register to change the ink.
- */
- 
-/* -- MORE NOTES:
-   We might try to 'wrap' the mfb functions in a 16-colour wrapper that does
-   all operations once. However, this does not work:
-   Some operations (esp) CopyArea may for example cause expositions.
-   Such expositions will cause data to be copied in from backing store,
-   and this copying in may damage the contents of the VGA registers.
-   So we must take care to set the VGA registers at each place where they could
-   be modified.
- */
diff --git a/hw/xfree86/xf4bpp/wm3.h b/hw/xfree86/xf4bpp/wm3.h
deleted file mode 100644
index 1137232..0000000
--- a/hw/xfree86/xf4bpp/wm3.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "vgaReg.h"
-
-#ifdef	PC98_EGC
-#define VGA_ALLPLANES 0xFL
-#endif
-
-/* Do call in Write Mode 3.
- * We take care of the possibility that two passes are needed.
- */
-#ifndef	PC98_EGC
-#define DO_WM3(pgc,call) \
-   { int _tp, _fg, _bg, _alu; \
-	_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
-	_tp = wm3_set_regs(pgc); \
-        (call); \
-	if ( _tp ) { \
-           _alu = pgc->alu; \
-	   pgc->alu = GXinvert; \
-	   _tp = wm3_set_regs(pgc); \
-	   (call); \
-           pgc->alu = _alu; \
-	} \
-	pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
-    }
-#else
-#define DO_WM3(pgc,call) \
-   { int _tp, _fg, _bg; \
-	_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
-	_tp = wm3_set_regs(pgc); \
-        (call); \
-	pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
-    }
-#endif
-
-#ifndef PC98_EGC
-#define WM3_SET_INK(ink) \
-    SetVideoGraphics(Set_ResetIndex, ink)
-#else
-#define WM3_SET_INK(ink) \
-	outw(EGC_FGC, ink)
-#endif
-
-/* GJA -- Move a long word to screen memory.
- * The reads into 'dummy' are here to load the VGA latches.
- * This is a RMW operation except for trivial cases.
- * Notice that we ignore the operation.
- */
-#ifdef	PC98_EGC
-#define UPDRW(destp,src) \
-	{ volatile unsigned short *_dtmp = \
-		(volatile unsigned short *)(destp); \
-	  unsigned int _stmp = (src); \
-	  *_dtmp = _stmp; _dtmp++; _stmp >>= 16; \
-	  *_dtmp = _stmp; }
-#else
-#define UPDRW(destp,src) \
-	{ volatile char *_dtmp = (volatile char *)(destp); \
-	  unsigned int _stmp = (src); \
-	  volatile int dummy; /* Bit bucket. */ \
-	  _stmp = ldl_u(&_stmp); \
-	  dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
-	  dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
-	  dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
-	  dummy = *_dtmp; *_dtmp = _stmp; }
-#endif
-
-#define UPDRWB(destp,src) \
-	{ volatile int dummy; /* Bit bucket. */ \
-	  dummy = *(destp); *(destp) = (src); }
diff --git a/hw/xfree86/xf4bpp/xf4bpp.h b/hw/xfree86/xf4bpp/xf4bpp.h
deleted file mode 100644
index cf08224..0000000
--- a/hw/xfree86/xf4bpp/xf4bpp.h
+++ /dev/null
@@ -1,622 +0,0 @@
-
-#ifndef __XF4BPP_H__
-#define __XF4BPP_H__
-
-
-#include "windowstr.h"
-#include "gcstruct.h"
-#include "colormapst.h"
-#include <X11/fonts/fontstruct.h>
-#ifndef PixelType
-#define PixelType CARD32
-#endif
-
-/* ppcArea.c */
-void xf4bppFillArea(
-    WindowPtr,
-    int,
-    BoxPtr,
-    GCPtr
-);
-
-/* ppcClip.c */
-void xf4bppDestroyClip(
-    GCPtr
-);
-void xf4bppChangeClip(
-    GCPtr,
-    int,
-    pointer,
-    int
-);
-void xf4bppCopyClip(
-    GCPtr,
-    GCPtr
-);
-
-/* ppcCpArea.c */
-RegionPtr xf4bppCopyArea(
-    DrawablePtr,
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* ppcDepth.c */
-Bool xf4bppDepthOK(
-    DrawablePtr,
-    int
-);
-
-/* ppcFillRct.c */
-void xf4bppPolyFillRect(
-    DrawablePtr,
-    GCPtr,
-    int,
-    xRectangle *
-);
-
-/* ppcWindowFS.c */
-void xf4bppSolidWindowFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppStippleWindowFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppOpStippleWindowFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppTileWindowFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-
-/* xf4bppPixmapFS.c */
-void xf4bppSolidPixmapFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppStipplePixmapFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppOpStipplePixmapFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-void xf4bppTilePixmapFS(
-    DrawablePtr,
-    GCPtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int
-);
-
-/* ppcGC.c */
-Bool xf4bppCreateGC(
-    GCPtr
-);
-
-/* ppcGetSp.c */
-void xf4bppGetSpans(
-    DrawablePtr,
-    int,
-    DDXPointPtr,
-    int *,
-    int,
-    char *
-);
-
-/* ppcImg.c */
-void xf4bppGetImage(
-    DrawablePtr,
-    int,
-    int,
-    int,
-    int,
-    unsigned int,
-    unsigned long,
-    char *
-);
-
-/* ppcLine.c */
-void xf4bppScrnZeroLine(
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    DDXPointPtr
-);
-void xf4bppScrnZeroDash(
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    DDXPointPtr
-);
-void xf4bppScrnZeroSegs(
-    DrawablePtr,
-    GCPtr,
-    int,
-    xSegment *
-);
-
-/* ppcPixmap.c */
-PixmapPtr xf4bppCreatePixmap(
-    ScreenPtr,
-    int,
-    int,
-    int,
-    unsigned
-);
-PixmapPtr xf4bppCopyPixmap(
-    PixmapPtr
-);
-
-/* ppcPolyPnt.c */
-void xf4bppPolyPoint(
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    xPoint *
-);
-
-/* ppcPolyRec.c */
-void xf4bppPolyRectangle(
-    DrawablePtr,
-    GCPtr,
-    int,
-    xRectangle *
-);
-
-/* ppcQuery.c */
-void xf4bppQueryBestSize(
-    int,
-    unsigned short *,
-    unsigned short *,
-    ScreenPtr
-);
-
-/* ppcRslvC.c */
-void xf4bppResolveColor(
-    unsigned short *,
-    unsigned short *,
-    unsigned short *,
-    VisualPtr
-);
-Bool xf4bppInitializeColormap(
-    ColormapPtr
-);
-
-/* ppcSetSp.c */
-void xf4bppSetSpans(
-    DrawablePtr,
-    GCPtr,
-    char *,
-    DDXPointPtr,
-    int *,
-    int,
-    int
-);
-
-/* ppcWindow.c */
-void xf4bppCopyWindow(
-    WindowPtr,
-    DDXPointRec,
-    RegionPtr
-);
-Bool xf4bppPositionWindow(
-    WindowPtr,
-    int,
-    int
-);
-Bool xf4bppUnrealizeWindow(
-    WindowPtr,
-    int,
-    int
-);
-Bool xf4bppDestroyWindow(
-    WindowPtr
-);
-Bool xf4bppCreateWindowForXYhardware(
-    WindowPtr
-);
-
-/* emulOpStip.c */
-void xf4bppOpaqueStipple(
-    WindowPtr,
-    PixmapPtr,
-    unsigned long int,
-    unsigned long int,
-    int,
-    unsigned long int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* emulRepAre.c */
-void xf4bppReplicateArea(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* emulTile.c */
-void xf4bppTileRect(
-    WindowPtr,
-    PixmapPtr,
-    const int,
-    const unsigned long int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* vgaGC.c */
-Mask xf4bppChangeWindowGC(
-    GCPtr,
-    Mask
-);
-
-/* vgaBitBlt.c */
-void xf4bppBitBlt(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* vgaImages.c */
-void xf4bppDrawColorImage(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    unsigned char *,
-    int,
-    const int,
-    const unsigned long int
-);
-void xf4bppReadColorImage(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    unsigned char *,
-    int
-);
-
-/* vgaLine.c */
-void xf4bppHorzLine(
-    WindowPtr,
-    unsigned long int,
-    int,
-    unsigned long int,
-    int,
-    int,
-    int
-);
-void xf4bppVertLine(
-    WindowPtr,
-    unsigned long int,
-    int,
-    unsigned long int,
-    int,
-    int,
-    int
-);
-void xf4bppBresLine(
-    WindowPtr,
-    unsigned long int,
-    int,
-    unsigned long int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    unsigned long int
-);
-
-/* vgaStipple.c */
-void xf4bppFillStipple(
-    WindowPtr,
-    const PixmapPtr,
-    unsigned long int,
-    const int,
-    unsigned long int,
-    int,
-    int,
-    int,
-    int,
-    const int,
-    const int
-);
-
-/* vgaSolid.c */
-void xf4bppFillSolid(
-    WindowPtr,
-    unsigned long int,
-    const int,
-    unsigned long int,
-    int,
-    const int,
-    int,
-    const int
-);
-
-/* offscreen.c */
-void xf4bppOffBitBlt(
-    WindowPtr,
-    const int,
-    const int,
-    int,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-void xf4bppOffDrawColorImage(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    unsigned char *,
-    int,
-    const int,
-    const unsigned long int
-);
-void xf4bppOffReadColorImage(
-    WindowPtr,
-    int,
-    int,
-    int,
-    int,
-    unsigned char *,
-    int
-);
-void xf4bppOffFillSolid(
-    WindowPtr,
-    unsigned long int,
-    const int,
-    unsigned long int,
-    int,
-    const int,
-    int,
-    const int
-);
-void xf4bppOffDrawMonoImage(
-    WindowPtr,
-    unsigned char *,
-    int,
-    int,
-    int,
-    int,
-    unsigned long int,
-    int,
-    unsigned long int
-);
-void xf4bppOffFillStipple(
-    WindowPtr,
-    const PixmapPtr,
-    unsigned long int,
-    const int,
-    unsigned long int,
-    int,
-    int,
-    int,
-    int,
-    const int,
-    const int
-);
-
-/* mfbimggblt.c */
-void xf4bppImageGlyphBlt(
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    unsigned int,
-    CharInfoPtr *,
-    pointer
-);
-
-/* wm3.c */
-int wm3_set_regs(
-    GC *
-);
-
-/* ppcIO.c */
-void xf4bppNeverCalled(
-    void
-);
-Bool xf4bppScreenInit(
-    ScreenPtr,
-    pointer,
-    int,
-    int,
-    int,
-    int,
-    int
-);
-
-/* mfbfillarc.c */
-void xf4bppPolyFillArc(
-    DrawablePtr,
-    GCPtr,
-    int,
-    xArc *
-);
-
-/* mfbzerarc.c */
-void xf4bppZeroPolyArc(
-    DrawablePtr,
-    GCPtr,
-    int,
-    xArc *
-);
-
-/* mfbline.c */
-void xf4bppSegmentSS (
-    DrawablePtr,
-    GCPtr,
-    int,
-    xSegment *
-);
-void xf4bppLineSS (
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    DDXPointPtr
-);
-void xf4bppSegmentSD (
-    DrawablePtr,
-    GCPtr,
-    int,
-    xSegment *
-);
-void xf4bppLineSD (
-    DrawablePtr,
-    GCPtr,
-    int,
-    int,
-    DDXPointPtr
-);
-
-/* mfbbres.c */
-void xf4bppBresS(
-	PixelType *,
-	int,
-	int,
-	int,
-	int,
-	int,
-	int,
-	int,
-	int,
-	int,
-	int
-);
-
-/* mfbbresd.c */
-void xf4bppBresD(
-	DrawablePtr,
-	int, int,
-	int *,
-	unsigned char *,
-	int,
-	int *,
-	int,
-	PixelType *,
-	int, int, int, int, int, int,
-	int, int,
-	int, int
-);
-
-/* mfbhrzvert.c */
-void xf4bppHorzS(
-	PixelType *,
-	int,
-	int,
-	int,
-	int
-);
-void xf4bppVertS(
-	PixelType *,
-	int,
-	int,
-	int,
-	int
-);
-
-#ifdef PC98_EGC
-
-/* egc_asm.s */
-unsigned char getbits_x(
-	int,
-	unsigned int,
-	pointer,
-	unsigned int
-);
-void wcopyr(
-	pointer,
-	pointer,
-	int,
-	pointer
-);
-void wcopyl(
-	pointer,
-	pointer,
-	int,
-	pointer
-);
-unsigned long int read8Z(
-	pointer
-);
-
-#endif /* PC98_EGC */
-
-#endif /* __XF4BPP_H__ */
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index a885289..c61a613 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -46,7 +46,6 @@ SRCS_NATIVEGDI = \
 	winnativegdi.c \
 	winpixmap.c \
 	winpolyline.c \
-	winpushpxl.c \
 	winrop.c \
 	winsetsp.c
 DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index 107d87a..1f37752 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -119,7 +119,7 @@ const GCOps winGCOps = {
   miImageGlyphBlt,
   miPolyGlyphBlt,
 #endif
-  winPushPixels
+  miPushPixels,
 };
 
 
diff --git a/hw/xwin/winpushpxl.c b/hw/xwin/winpushpxl.c
deleted file mode 100644
index 72ef2d5..0000000
--- a/hw/xwin/winpushpxl.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "miscstruct.h"
-#include "../mfb/maskbits.h"
-#include "mi.h"
-
-#define NPT 128
-
-/* winPushPixels -- squeegees the fill style of pGC through pBitMap
- * into pDrawable.  pBitMap is a stencil (dx by dy of it is used, it may
- * be bigger) which is placed on the drawable at xOrg, yOrg.  Where a 1 bit
- * is set in the bitmap, the fill style is put onto the drawable using
- * the GC's logical function. The drawable is not changed where the bitmap
- * has a zero bit or outside the area covered by the stencil.
-
-WARNING:
-    this code works if the 1-bit deep pixmap format returned by GetSpans
-is the same as the format defined by the mfb code (i.e. 32-bit padding
-per scanline, scanline unit = 32 bits; later, this might mean
-bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
-
- */
-
-/*
- * in order to have both (MSB_FIRST and LSB_FIRST) versions of this
- * in the server, we need to rename one of them
- */
-void
-winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
-	       int dx, int dy, int xOrg, int yOrg)
-{
-    int		h, dxDivPPW, ibEnd;
-    MiBits *pwLineStart;
-    register MiBits	*pw, *pwEnd;
-    register MiBits msk;
-    register int ib, w;
-    register int ipt;		/* index into above arrays */
-    Bool 	fInBox;
-    DDXPointRec	pt[NPT], ptThisLine;
-    int		width[NPT];
-    PixelType	startmask;
-
-
-    startmask = (MiBits)(-1) ^
-            LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
-
-    pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx));
-    if (!pwLineStart)
-	return;
-    ipt = 0;
-    dxDivPPW = dx/PPW;
-
-    for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0; 
-	h < dy; 
-	h++, ptThisLine.y++)
-    {
-
-	(*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx,
-			&ptThisLine, &dx, 1, (char *)pwLineStart);
-
-	pw = pwLineStart;
-	/* Process all words which are fully in the pixmap */
-	
-	fInBox = FALSE;
-	pwEnd = pwLineStart + dxDivPPW;
-	while(pw  < pwEnd)
-	{
-	    w = *pw;
-#ifdef XFree86Server
-	    msk = startmask;
-#else
-	    msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
-#endif
-	    for(ib = 0; ib < PPW; ib++)
-	    {
-		if(w & msk)
-		{
-		    if(!fInBox)
-		    {
-			pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
-			pt[ipt].y = h + yOrg;
-			/* start new box */
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			width[ipt] = ((pw - pwLineStart) << PWSH) + 
-				     ib + xOrg - pt[ipt].x;
-			if (++ipt >= NPT)
-			{
-			    (*pGC->ops->FillSpans)(pDrawable, pGC, 
-					      NPT, pt, width, TRUE);
-			    ipt = 0;
-			}
-			/* end box */
-			fInBox = FALSE;
-		    }
-		}
-#ifdef XFree86Server
-    		/* This is not quite right, but it'll do for now */
-		msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
-#else
-		msk = SCRRIGHT(msk, 1);
-#endif
-	    }
-	    pw++;
-	}
-	ibEnd = dx & PIM;
-	if(ibEnd)
-	{
-	    /* Process final partial word on line */
-	    w = *pw;
-#ifdef XFree86Server
-	    msk = startmask;
-#else
-	    msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1);
-#endif
-	    for(ib = 0; ib < ibEnd; ib++)
-	    {
-		if(w & msk)
-		{
-		    if(!fInBox)
-		    {
-			/* start new box */
-			pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
-			pt[ipt].y = h + yOrg;
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			/* end box */
-			width[ipt] = ((pw - pwLineStart) << PWSH) + 
-				     ib + xOrg - pt[ipt].x;
-			if (++ipt >= NPT)
-			{
-			    (*pGC->ops->FillSpans)(pDrawable, 
-					      pGC, NPT, pt, width, TRUE);
-			    ipt = 0;
-			}
-			fInBox = FALSE;
-		    }
-		}
-#ifdef XFree86Server
-    		/* This is not quite right, but it'll do for now */
-		msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1);
-#else
-		msk = SCRRIGHT(msk, 1);
-#endif
-	    }
-	}
-	/* If scanline ended with last bit set, end the box */
-	if(fInBox)
-	{
-	    width[ipt] = dx + xOrg - pt[ipt].x;
-	    if (++ipt >= NPT)
-	    {
-		(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
-		ipt = 0;
-	    }
-	}
-    }
-    xfree(pwLineStart);
-    /* Flush any remaining spans */
-    if (ipt)
-    {
-	(*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
-    }
-}
diff --git a/include/servermd.h b/include/servermd.h
index 8e6de09..0bfa7a0 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -49,6 +49,11 @@ SOFTWARE.
 #define SERVERMD_H 1
 
 /*
+ * Note: much of this is vestigial from mfb/cfb times.  This should
+ * really be simplified even further.
+ */
+
+/*
  * Machine dependent values:
  * GLYPHPADBYTES should be chosen with consideration for the space-time
  * trade-off.  Padding to 0 bytes means that there is no wasted space
@@ -61,63 +66,6 @@ SOFTWARE.
  * compiler what kind of padding you want because its defines are
  * kept separate from this.  See server/include/font.h for how
  * GLYPHPADBYTES is used.
- *
- * Along with this, you should choose an appropriate value for
- * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
- * constant choses what kind of memory references are guarenteed during
- * font access; either 1, 2 or 4, for byte, word or longword access,
- * respectively.  For instance, if you have decided to to have
- * GLYPHPADBYTES == 4, then it is pointless for you to have a
- * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
- * guarenteed you that your fonts are longword aligned.  On the other
- * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
- * also decide that the computing involved in aligning the pointer is more
- * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
- *
- * Next, choose the tuning parameters which are appropriate for your
- * hardware; these modify the behaviour of the raw frame buffer code
- * in ddx/mfb and ddx/cfb.  Defining these incorrectly will not cause
- * the server to run incorrectly, but defining these correctly will
- * cause some noticeable speed improvements:
- *
- *  AVOID_MEMORY_READ - (8-bit cfb only)
- *	When stippling pixels on the screen (polytext and pushpixels),
- *	don't read long words from the display and mask in the
- *	appropriate values.  Rather, perform multiple byte/short/long
- *	writes as appropriate.  This option uses many more instructions
- *	but runs much faster when the destination is much slower than
- *	the CPU and at least 1 level of write buffer is availible (2
- *	is much better).  Defined currently for SPARC and MIPS.
- *
- *  FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
- *	This define is used on machines which have no auto-increment
- *	addressing mode, but do have an effectively free constant-offset
- *	addressing mode.  Currently defined for MIPS and SPARC, even though
- *	I remember the cg6 as performing better without it (cg3 definitely
- *	performs better with it).
- *	
- *  LARGE_INSTRUCTION_CACHE -
- *	This define increases the number of times some loops are
- *	unrolled.  On 68020 machines (with 256 bytes of i-cache),
- *	this define will slow execution down as instructions miss
- *	the cache frequently.  On machines with real i-caches, this
- *	reduces loop overhead, causing a slight performance improvement.
- *	Currently defined for MIPS and SPARC
- *
- *  FAST_UNALIGNED_READS -
- *	For machines with more memory bandwidth than CPU, this
- *	define uses unaligned reads for 8-bit BitBLT instead of doing
- *	aligned reads and combining the results with shifts and
- *	logical-ors.  Currently defined for 68020 and vax.
- *  PLENTIFUL_REGISTERS -
- *	For machines with > 20 registers.  Currently used for
- *	unrolling the text painting code a bit more.  Currently
- *	defined for MIPS.
- *  SHARED_IDCACHE -
- *	For non-Harvard RISC machines, those which share the same
- *	CPU memory bus for instructions and data.  This unrolls some
- *	solid fill loops which are otherwise best left rolled up.
- *	Currently defined for SPARC.
  */
 
 #ifdef vax
@@ -125,8 +73,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the VAX only */
 #define BITMAP_BIT_ORDER	LSBFirst
 #define	GLYPHPADBYTES		1
-#define GETLEFTBITS_ALIGNMENT	4
-#define FAST_UNALIGNED_READS
 
 #endif /* vax */
 
@@ -135,8 +81,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER        MSBFirst
 #define BITMAP_BIT_ORDER        MSBFirst
 #define GLYPHPADBYTES           4
-#define GETLEFTBITS_ALIGNMENT   1
-#define AVOID_MEMORY_READ
 
 #endif /* __avr32__ */ 
 
@@ -155,9 +99,6 @@ SOFTWARE.
 # endif
 
 #define GLYPHPADBYTES           4
-#define GETLEFTBITS_ALIGNMENT   1
-#define LARGE_INSTRUCTION_CACHE
-#define AVOID_MEMORY_READ
 
 #endif /* __arm32__ */
 
@@ -166,13 +107,7 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	MSBFirst
 #define BITMAP_BIT_ORDER	MSBFirst
 #define GLYPHPADBYTES		4	/* to make fb work */
-#define GETLEFTBITS_ALIGNMENT	1	/* PA forces longs to 4 */
 					/* byte boundries */
-#define AVOID_MEMORY_READ
-#define FAST_CONSTANT_OFFSET_MODE
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
-
 #endif /* hpux || __hppa__ */
 
 #if defined(__powerpc__) || defined(__ppc__)
@@ -180,20 +115,12 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER        MSBFirst
 #define BITMAP_BIT_ORDER        MSBFirst
 #define GLYPHPADBYTES           4
-#define GETLEFTBITS_ALIGNMENT   1
 
 /* XXX Should this be for Lynx only? */
 #ifdef Lynx
 #define BITMAP_SCANLINE_UNIT	8
 #endif
 
-#define LARGE_INSTRUCTION_CACHE
-#define FAST_CONSTANT_OFFSET_MODE
-#define PLENTIFUL_REGISTERS
-#define AVOID_MEMORY_READ
-
-#define FAST_MEMCPY
-
 #endif /* PowerPC */
 
 #if defined(__sh__)
@@ -202,19 +129,12 @@ SOFTWARE.
 # define IMAGE_BYTE_ORDER	MSBFirst
 # define BITMAP_BIT_ORDER	MSBFirst
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
 #else
 # define IMAGE_BYTE_ORDER	LSBFirst
 # define BITMAP_BIT_ORDER	LSBFirst
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
 #endif
 
-#define AVOID_MEMORY_READ
-#define FAST_CONSTANT_OFFSET_MODE
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
-
 #endif /* SuperH */
 
 #if defined(__m32r__)
@@ -223,19 +143,12 @@ SOFTWARE.
 # define IMAGE_BYTE_ORDER      MSBFirst
 # define BITMAP_BIT_ORDER      MSBFirst
 # define GLYPHPADBYTES         4
-# define GETLEFTBITS_ALIGNMENT 1
 #else
 # define IMAGE_BYTE_ORDER      LSBFirst
 # define BITMAP_BIT_ORDER      LSBFirst
 # define GLYPHPADBYTES         4
-# define GETLEFTBITS_ALIGNMENT 1
 #endif
 
-#define AVOID_MEMORY_READ
-#define FAST_CONSTANT_OFFSET_MODE
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
-
 #endif /* __m32r__ */
 
 #if (defined(sun) && (defined(__sparc) || defined(sparc))) || \
@@ -256,37 +169,15 @@ SOFTWARE.
 # define BITMAP_BIT_ORDER	MSBFirst
 #endif
 
-#ifdef sparc
-# define AVOID_MEMORY_READ
-# define LARGE_INSTRUCTION_CACHE
-# define FAST_CONSTANT_OFFSET_MODE
-# define SHARED_IDCACHE
-#endif
-
-#ifdef mc68020
-#define FAST_UNALIGNED_READS
-#endif
-
 #define	GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
 
 #endif /* sun && !(i386 && SVR4) */
 
-
 #if defined(AIXV3)
 
 #define IMAGE_BYTE_ORDER        MSBFirst        /* Values for the RISC/6000 */
 #define BITMAP_BIT_ORDER        MSBFirst
 #define GLYPHPADBYTES           4
-#define GETLEFTBITS_ALIGNMENT   1
-
-#define LARGE_INSTRUCTION_CACHE
-#define FAST_CONSTANT_OFFSET_MODE
-#define PLENTIFUL_REGISTERS
-#define AVOID_MEMORY_READ
-
-#define FAST_MEMCPY
-#endif /* AIXV3 */
 
 #if defined(ibm032) || defined (ibm)
 
@@ -297,7 +188,6 @@ SOFTWARE.
 #endif
 #define BITMAP_BIT_ORDER	MSBFirst
 #define	GLYPHPADBYTES		1
-#define GETLEFTBITS_ALIGNMENT	4
 /* ibm pcc doesn't understand pragmas. */
 
 #ifdef __i386__
@@ -311,9 +201,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	MSBFirst        /* Values for Pegasus only */
 #define BITMAP_BIT_ORDER	MSBFirst
 #define GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
-
-#define FAST_UNALIGNED_READS
 
 #endif /* tektronix */
 
@@ -322,9 +209,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER      	MSBFirst        /* Values for the MacII only */
 #define BITMAP_BIT_ORDER      	MSBFirst
 #define GLYPHPADBYTES         	4
-#define GETLEFTBITS_ALIGNMENT 	1
-
-/* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */
 
 #endif /* macII */
 
@@ -334,19 +218,12 @@ SOFTWARE.
 # define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the PMAX only */
 # define BITMAP_BIT_ORDER	LSBFirst
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
 #else
 # define IMAGE_BYTE_ORDER	MSBFirst        /* Values for the MIPS only */
 # define BITMAP_BIT_ORDER	MSBFirst
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
 #endif
 
-#define AVOID_MEMORY_READ
-#define FAST_CONSTANT_OFFSET_MODE
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
-
 #endif /* mips */
 
 #if defined(__alpha) || defined(__alpha__) || defined(__alphaCross)
@@ -363,10 +240,6 @@ SOFTWARE.
 # endif
 
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
-# define FAST_CONSTANT_OFFSET_MODE
-# define LARGE_INSTRUCTION_CACHE
-# define PLENTIFUL_REGISTERS
 
 #endif /* alpha */
 
@@ -375,15 +248,10 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER      	MSBFirst
 #define BITMAP_BIT_ORDER      	MSBFirst
 #define GLYPHPADBYTES         	4
-#define GETLEFTBITS_ALIGNMENT  1	
 
 #define BITMAP_SCANLINE_UNIT	8
-#define LARGE_INSTRUCTION_CACHE
-#define FAST_CONSTANT_OFFSET_MODE
 #define FAST_UNALIGNED_READ
 
-#define FAST_MEMCPY
-
 #endif /* linux/s390 */
 
 #if defined (linux) && defined (__s390x__)
@@ -391,14 +259,10 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER       MSBFirst
 #define BITMAP_BIT_ORDER       MSBFirst
 #define GLYPHPADBYTES          4
-#define GETLEFTBITS_ALIGNMENT  1
 
 #define BITMAP_SCANLINE_UNIT	8
-#define LARGE_INSTRUCTION_CACHE
-#define FAST_CONSTANT_OFFSET_MODE
 #define FAST_UNALIGNED_READ
 
-#define FAST_MEMCPY
 #endif /* linux/s390x */
 
 
@@ -416,10 +280,6 @@ SOFTWARE.
 # endif
 
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
-# define FAST_CONSTANT_OFFSET_MODE
-# define LARGE_INSTRUCTION_CACHE
-# define PLENTIFUL_REGISTERS
 
 #endif /* ia64 */
 
@@ -437,11 +297,7 @@ SOFTWARE.
 # endif
 
 # define GLYPHPADBYTES		4
-# define GETLEFTBITS_ALIGNMENT	1
-# define LARGE_INSTRUCTION_CACHE
-# define FAST_CONSTANT_OFFSET_MODE
 /* ???? */
-# define FAST_UNALIGNED_READS
 #endif /* AMD64 */
 
 #ifdef stellar
@@ -449,7 +305,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	MSBFirst       /* Values for the stellar only*/
 #define BITMAP_BIT_ORDER	MSBFirst
 #define	GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	4
 #define IMAGE_BUFSIZE		(64*1024)
 /*
  * Use SysV random number generator.
@@ -463,14 +318,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER        MSBFirst   	/* Values for the OMRON only*/
 #define BITMAP_BIT_ORDER	MSBFirst
 #define	GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
-
-#ifndef mc68000
-#define FAST_CONSTANT_OFFSET_MODE
-#define AVOID_MEMORY_READ
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
-#endif
 
 #endif /* luna */
 
@@ -501,12 +348,8 @@ SOFTWARE.
 #define GLYPHPADBYTES           4
 #endif
 
-#define GETLEFTBITS_ALIGNMENT	1
-#define AVOID_MEMORY_READ
 #ifdef XSVGA
 #define AVOID_GLYPHBLT
-#define FAST_CONSTANT_OFFSET_MODE
-#define FAST_MEMCPY
 #define NO_ONE_RECT
 #endif
 
@@ -516,9 +359,7 @@ SOFTWARE.
 
 #define IMAGE_BYTE_ORDER       MSBFirst
 #define BITMAP_BIT_ORDER       MSBFirst
-#define FAST_UNALIGNED_READS
 #define GLYPHPADBYTES          4
-#define GETLEFTBITS_ALIGNMENT  1
 
 #endif /* linux/m68k */
 
@@ -527,11 +368,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	MSBFirst
 #define BITMAP_BIT_ORDER	MSBFirst
 #define GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
-#define AVOID_MEMORY_READ
-#define FAST_CONSTANT_OFFSET_MODE
-#define LARGE_INSTRUCTION_CACHE
-#define PLENTIFUL_REGISTERS
 
 #endif
 
@@ -540,7 +376,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	LSBFirst
 #define BITMAP_BIT_ORDER	LSBFirst
 #define GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
 #endif
 
 /* linux on IBM S/390 */
@@ -548,7 +383,6 @@ SOFTWARE.
 #define IMAGE_BYTE_ORDER	MSBFirst
 #define BITMAP_BIT_ORDER	MSBFirst
 #define GLYPHPADBYTES		4
-#define GETLEFTBITS_ALIGNMENT	1
 #endif /* linux/s390 */ 
 
 /* size of buffer to use with GetImage, measured in bytes. There's obviously
diff --git a/mfb/Makefile.am b/mfb/Makefile.am
deleted file mode 100644
index 274a32d..0000000
--- a/mfb/Makefile.am
+++ /dev/null
@@ -1,133 +0,0 @@
-noinst_LTLIBRARIES = libmfb.la
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
-
-libmfb_gen_sources = mfbseg.c mfbpgbwht.c mfbpgbblak.c mfbpgbinv.c mfbigbwht.c \
-	 mfbigbblak.c mfbpawhite.c mfbpablack.c mfbpainv.c mfbtewhite.c \
-	 mfbteblack.c mfbbltC.c mfbbltX.c mfbbltCI.c mfbbltO.c mfbbltG.c \
-	 mfbtileC.c mfbtileG.c mfbplywhite.c mfbplyblack.c mfbplyinv.c
-
-DISTCLEANFILES = $(libmfb_gen_sources)
-
-libmfb_la_SOURCES = mfbgc.c mfbwindow.c mfbfont.c \
-	 mfbfillrct.c maskbits.c mfbpixmap.c \
-	 mfbimage.c mfbline.c mfbbres.c mfbhrzvert.c mfbbresd.c \
-	 mfbpushpxl.c mfbzerarc.c mfbfillarc.c \
-         mfbfillsp.c mfbsetsp.c mfbscrinit.c mfbscrclse.c mfbclip.c \
-         mfbbitblt.c mfbgetsp.c mfbpolypnt.c \
-	 mfbcmap.c mfbmisc.c $(libmfb_gen_sources)
-
-EXTRA_DIST = maskbits.h mergerop.h fastblt.h mfbline.c mfbblt.c mfbtile.c \
-             mfbplygblt.c mfbimggblt.c mfbpntarea.c mfbtegblt.c mfbply1rct.c
-
-sdk_HEADERS = mfb.h
-
-mfbseg.c:
-	echo "#define POLYSEGMENT" > $@
-	echo "#include \"$(srcdir)/mfbline.c\"" >> $@
-
-mfbbltC.c:
-	echo "#define MROP Mcopy" > $@
-	echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
-
-mfbbltX.c:
-	echo "#define MROP Mxor" > $@
-	echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
-
-mfbbltCI.c:
-	echo "#define MROP McopyInverted" > $@
-	echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
-
-mfbbltO.c:
-	echo "#define MROP Mor" > $@
-	echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
-
-mfbbltG.c:
-	echo "#define MROP 0" > $@
-	echo "#include \"$(srcdir)/mfbblt.c\"" >> $@
-
-mfbtileC.c:
-	echo "#define MROP Mcopy" > $@
-	echo "#include \"$(srcdir)/mfbtile.c\"" >> $@
-
-mfbtileG.c:
-	echo "#define MROP 0" > $@
-	echo "#include \"$(srcdir)/mfbtile.c\"" >> $@
-
-mfbpgbwht.c:
-	echo "#define OPEQ MFB_OPEQ_WHITE" > $@
-	echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltWhite" >> $@
-	echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
-
-mfbpgbblak.c:
-	echo "#define OPEQ MFB_OPEQ_BLACK" > $@
-	echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltBlack" >> $@
-	echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
-
-mfbpgbinv.c:
-	echo "#define OPEQ MFB_OPEQ_INVERT" > $@
-	echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltInvert" >> $@
-	echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@
-
-mfbigbwht.c:
-	echo "#define OPEQ MFB_OPEQ_WHITE" > $@
-	echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltWhite" >> $@
-	echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@
-
-mfbigbblak.c:
-	echo "#define OPEQ MFB_OPEQ_BLACK" > $@
-	echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltBlack" >> $@
-	echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@
-
-mfbpawhite.c:
-	echo "#define OPEQ MFB_OPEQ_WHITE" > $@
-	echo "#define MFBSOLIDFILLAREA mfbSolidWhiteArea" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@
-	echo "#define MFBSTIPPLEFILLAREA mfbStippleWhiteArea" >> $@
-	echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
-
-mfbpablack.c:
-	echo "#define OPEQ MFB_OPEQ_BLACK" > $@
-	echo "#define MFBSOLIDFILLAREA mfbSolidBlackArea" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@
-	echo "#define MFBSTIPPLEFILLAREA mfbStippleBlackArea" >> $@
-	echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
-
-mfbpainv.c:
-	echo "#define OPEQ MFB_OPEQ_INVERT" > $@
-	echo "#define MFBSOLIDFILLAREA mfbSolidInvertArea" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@
-	echo "#define MFBSTIPPLEFILLAREA mfbStippleInvertArea" >> $@
-	echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@
-
-mfbtewhite.c:
-	echo "#define OP MFB_OP_WHITE" > $@
-	echo "#define MFBTEGLYPHBLT mfbTEGlyphBltWhite" >> $@
-	echo "#define CLIPTETEXT mfbImageGlyphBltWhite" >> $@
-	echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@
-
-mfbteblack.c:
-	echo "#define OP MFB_OP_BLACK" > $@
-	echo "#define MFBTEGLYPHBLT mfbTEGlyphBltBlack" >> $@
-	echo "#define CLIPTETEXT mfbImageGlyphBltBlack" >> $@
-	echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@
-
-mfbplywhite.c:
-	echo "#define OPEQ MFB_OPEQ_WHITE" > $@
-	echo "#define MFBFILLPOLY1RECT mfbFillPolyWhite" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@
-	echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
-
-mfbplyblack.c:
-	echo "#define OPEQ MFB_OPEQ_BLACK" > $@
-	echo "#define MFBFILLPOLY1RECT mfbFillPolyBlack" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@
-	echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
-
-mfbplyinv.c:
-	echo "#define OPEQ MFB_OPEQ_INVERT" > $@
-	echo "#define MFBFILLPOLY1RECT mfbFillPolyInvert" >> $@
-	echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@
-	echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@
diff --git a/mfb/fastblt.h b/mfb/fastblt.h
deleted file mode 100644
index 35ba5a2..0000000
--- a/mfb/fastblt.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/*
- * Fast bitblt macros for certain hardware.  If your machine has an addressing
- * mode of small constant + register, you'll probably want this magic specific
- * code.  It's 25% faster for the R2000.  I haven't studied the Sparc
- * instruction set, but I suspect it also has this addressing mode.  Also,
- * unrolling the loop by 32 is possibly excessive for mfb. The number of times
- * the loop is actually looped through is pretty small.
- */
-
-/*
- * WARNING:  These macros make *a lot* of assumptions about
- * the environment they are invoked in.  Plenty of implicit
- * arguments, lots of side effects.  Don't use them casually.
- */
-
-#define SwitchOdd(n) case n: BodyOdd(n)
-#define SwitchEven(n) case n: BodyEven(n)
-
-/* to allow mfb and cfb to share code... */
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef BitRight
-#define BitRight(a,b) SCRRIGHT(a,b)
-#define BitLeft(a,b) SCRLEFT(a,b)
-#endif
-
-#ifdef LARGE_INSTRUCTION_CACHE
-#define UNROLL 8
-#define PackedLoop \
-    switch (nl & (UNROLL-1)) { \
-    SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \
-    SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
-    } \
-    while ((nl -= UNROLL) >= 0) { \
-	LoopReset \
-	BodyEven( 8) \
-    	BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \
-    	BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
-    }
-#else
-#define UNROLL 4
-#define PackedLoop \
-    switch (nl & (UNROLL-1)) { \
-    SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \
-    } \
-    while ((nl -= UNROLL) >= 0) { \
-	LoopReset \
-    	BodyEven( 4) \
-    	BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \
-    }
-#endif
-
-#define DuffL(counter,label,body) \
-    switch (counter & 3) { \
-    label: \
-        body \
-    case 3: \
-	body \
-    case 2: \
-	body \
-    case 1: \
-	body \
-    case 0: \
-	if ((counter -= 4) >= 0) \
-	    goto label; \
-    }
diff --git a/mfb/maskbits.c b/mfb/maskbits.c
deleted file mode 100644
index 85b5f30..0000000
--- a/mfb/maskbits.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/*
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
-
-	All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "maskbits.h"
-#include "servermd.h"
-
-/*
-these tables are used by several macros in the mfb code.
-
-   the vax numbers everything left to right, so bit indices on the
-screen match bit indices in longwords.  the pc-rt and Sun number
-bits on the screen the way they would be written on paper,
-(i.e. msb to the left), and so a bit index n on the screen is
-bit index PPW-n in a longword
-
-   see also maskbits.h
-*/
-
-#if PPW != 32
-    ERROR MFB must be compiled with PPW 32
-#endif
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-/* NOTE:
-the first element in starttab could be 0xffffffff.  making it 0
-lets us deal with a full first word in the middle loop, rather
-than having to do the multiple reads and masks that we'd
-have to do if we thought it was partial.
-*/
-PixelType starttab[PPW+1] =
-    {
-	LONG2CHARS( 0x00000000 ),
-	LONG2CHARS( 0x7FFFFFFF ),
-	LONG2CHARS( 0x3FFFFFFF ),
-	LONG2CHARS( 0x1FFFFFFF ),
-	LONG2CHARS( 0x0FFFFFFF ),
-	LONG2CHARS( 0x07FFFFFF ),
-	LONG2CHARS( 0x03FFFFFF ),
-	LONG2CHARS( 0x01FFFFFF ),
-	LONG2CHARS( 0x00FFFFFF ),
-	LONG2CHARS( 0x007FFFFF ),
-	LONG2CHARS( 0x003FFFFF ),
-	LONG2CHARS( 0x001FFFFF ),
-	LONG2CHARS( 0x000FFFFF ),
-	LONG2CHARS( 0x0007FFFF ),
-	LONG2CHARS( 0x0003FFFF ),
-	LONG2CHARS( 0x0001FFFF ),
-	LONG2CHARS( 0x0000FFFF ),
-	LONG2CHARS( 0x00007FFF ),
-	LONG2CHARS( 0x00003FFF ),
-	LONG2CHARS( 0x00001FFF ),
-	LONG2CHARS( 0x00000FFF ),
-	LONG2CHARS( 0x000007FF ),
-	LONG2CHARS( 0x000003FF ),
-	LONG2CHARS( 0x000001FF ),
-	LONG2CHARS( 0x000000FF ),
-	LONG2CHARS( 0x0000007F ),
-	LONG2CHARS( 0x0000003F ),
-	LONG2CHARS( 0x0000001F ),
-	LONG2CHARS( 0x0000000F ),
-	LONG2CHARS( 0x00000007 ),
-	LONG2CHARS( 0x00000003 ),
-	LONG2CHARS( 0x00000001 ),
-	LONG2CHARS( 0x00000000 )
-    };
-
-PixelType endtab[PPW+1] =
-    {
-	LONG2CHARS( 0x00000000 ),
-	LONG2CHARS( 0x80000000 ),
-	LONG2CHARS( 0xC0000000 ),
-	LONG2CHARS( 0xE0000000 ),
-	LONG2CHARS( 0xF0000000 ),
-	LONG2CHARS( 0xF8000000 ),
-	LONG2CHARS( 0xFC000000 ),
-	LONG2CHARS( 0xFE000000 ),
-	LONG2CHARS( 0xFF000000 ),
-	LONG2CHARS( 0xFF800000 ),
-	LONG2CHARS( 0xFFC00000 ),
-	LONG2CHARS( 0xFFE00000 ),
-	LONG2CHARS( 0xFFF00000 ),
-	LONG2CHARS( 0xFFF80000 ),
-	LONG2CHARS( 0xFFFC0000 ),
-	LONG2CHARS( 0xFFFE0000 ),
-	LONG2CHARS( 0xFFFF0000 ),
-	LONG2CHARS( 0xFFFF8000 ),
-	LONG2CHARS( 0xFFFFC000 ),
-	LONG2CHARS( 0xFFFFE000 ),
-	LONG2CHARS( 0xFFFFF000 ),
-	LONG2CHARS( 0xFFFFF800 ),
-	LONG2CHARS( 0xFFFFFC00 ),
-	LONG2CHARS( 0xFFFFFE00 ),
-	LONG2CHARS( 0xFFFFFF00 ),
-	LONG2CHARS( 0xFFFFFF80 ),
-	LONG2CHARS( 0xFFFFFFC0 ),
-	LONG2CHARS( 0xFFFFFFE0 ),
-	LONG2CHARS( 0xFFFFFFF0 ),
-	LONG2CHARS( 0xFFFFFFF8 ),
-	LONG2CHARS( 0xFFFFFFFC ),
-	LONG2CHARS( 0xFFFFFFFE ),
-	LONG2CHARS( 0xFFFFFFFF )
-    };
-
-
-#ifdef NEED_OLD_MFB_MASKS
-/* a hack, for now, since the entries for 0 need to be all
-   1 bits, not all zeros.
-   this means the code DOES NOT WORK for segments of length
-   0 (which is only a problem in the horizontal line code.)
-*/
-PixelType startpartial[33] =
-    {
-	LONG2CHARS( 0xFFFFFFFF ),
-	LONG2CHARS( 0x7FFFFFFF ),
-	LONG2CHARS( 0x3FFFFFFF ),
-	LONG2CHARS( 0x1FFFFFFF ),
-	LONG2CHARS( 0x0FFFFFFF ),
-	LONG2CHARS( 0x07FFFFFF ),
-	LONG2CHARS( 0x03FFFFFF ),
-	LONG2CHARS( 0x01FFFFFF ),
-	LONG2CHARS( 0x00FFFFFF ),
-	LONG2CHARS( 0x007FFFFF ),
-	LONG2CHARS( 0x003FFFFF ),
-	LONG2CHARS( 0x001FFFFF ),
-	LONG2CHARS( 0x000FFFFF ),
-	LONG2CHARS( 0x0007FFFF ),
-	LONG2CHARS( 0x0003FFFF ),
-	LONG2CHARS( 0x0001FFFF ),
-	LONG2CHARS( 0x0000FFFF ),
-	LONG2CHARS( 0x00007FFF ),
-	LONG2CHARS( 0x00003FFF ),
-	LONG2CHARS( 0x00001FFF ),
-	LONG2CHARS( 0x00000FFF ),
-	LONG2CHARS( 0x000007FF ),
-	LONG2CHARS( 0x000003FF ),
-	LONG2CHARS( 0x000001FF ),
-	LONG2CHARS( 0x000000FF ),
-	LONG2CHARS( 0x0000007F ),
-	LONG2CHARS( 0x0000003F ),
-	LONG2CHARS( 0x0000001F ),
-	LONG2CHARS( 0x0000000F ),
-	LONG2CHARS( 0x00000007 ),
-	LONG2CHARS( 0x00000003 ),
-	LONG2CHARS( 0x00000001 ),
-	LONG2CHARS( 0x00000000 )
-    };
-
-PixelType endpartial[33] =
-    {
-	LONG2CHARS( 0xFFFFFFFF ),
-	LONG2CHARS( 0x80000000 ),
-	LONG2CHARS( 0xC0000000 ),
-	LONG2CHARS( 0xE0000000 ),
-	LONG2CHARS( 0xF0000000 ),
-	LONG2CHARS( 0xF8000000 ),
-	LONG2CHARS( 0xFC000000 ),
-	LONG2CHARS( 0xFE000000 ),
-	LONG2CHARS( 0xFF000000 ),
-	LONG2CHARS( 0xFF800000 ),
-	LONG2CHARS( 0xFFC00000 ),
-	LONG2CHARS( 0xFFE00000 ),
-	LONG2CHARS( 0xFFF00000 ),
-	LONG2CHARS( 0xFFF80000 ),
-	LONG2CHARS( 0xFFFC0000 ),
-	LONG2CHARS( 0xFFFE0000 ),
-	LONG2CHARS( 0xFFFF0000 ),
-	LONG2CHARS( 0xFFFF8000 ),
-	LONG2CHARS( 0xFFFFC000 ),
-	LONG2CHARS( 0xFFFFE000 ),
-	LONG2CHARS( 0xFFFFF000 ),
-	LONG2CHARS( 0xFFFFF800 ),
-	LONG2CHARS( 0xFFFFFC00 ),
-	LONG2CHARS( 0xFFFFFE00 ),
-	LONG2CHARS( 0xFFFFFF00 ),
-	LONG2CHARS( 0xFFFFFF80 ),
-	LONG2CHARS( 0xFFFFFFC0 ),
-	LONG2CHARS( 0xFFFFFFE0 ),
-	LONG2CHARS( 0xFFFFFFF0 ),
-	LONG2CHARS( 0xFFFFFFF8 ),
-	LONG2CHARS( 0xFFFFFFFC ),
-	LONG2CHARS( 0xFFFFFFFE ),
-	LONG2CHARS( 0xFFFFFFFF )
-    };
-#endif /* NEED_OLD_MFB_MASKS */
-
-
-PixelType partmasks[PPW][PPW] = {
-     {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ),
-      LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ),
-      LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFFE00000 ),
-      LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFFE0000 ),
-      LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFFE000 ),
-      LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFFE00 ),
-      LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFFE0 ),
-      LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFFE )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0x70000000 ),
-      LONG2CHARS( 0x78000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0x7F000000 ),
-      LONG2CHARS( 0x7F800000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0x7FF00000 ),
-      LONG2CHARS( 0x7FF80000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0x7FFF0000 ),
-      LONG2CHARS( 0x7FFF8000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0x7FFFF000 ),
-      LONG2CHARS( 0x7FFFF800 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0x7FFFFF00 ),
-      LONG2CHARS( 0x7FFFFF80 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0x7FFFFFF0 ),
-      LONG2CHARS( 0x7FFFFFF8 ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0x7FFFFFFF )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x38000000 ),
-      LONG2CHARS( 0x3C000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x3F800000 ),
-      LONG2CHARS( 0x3FC00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x3FF80000 ),
-      LONG2CHARS( 0x3FFC0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x3FFF8000 ),
-      LONG2CHARS( 0x3FFFC000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x3FFFF800 ),
-      LONG2CHARS( 0x3FFFFC00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x3FFFFF80 ),
-      LONG2CHARS( 0x3FFFFFC0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x3FFFFFF8 ),
-      LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x1C000000 ),
-      LONG2CHARS( 0x1E000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x1FC00000 ),
-      LONG2CHARS( 0x1FE00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x1FFC0000 ),
-      LONG2CHARS( 0x1FFE0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x1FFFC000 ),
-      LONG2CHARS( 0x1FFFE000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x1FFFFC00 ),
-      LONG2CHARS( 0x1FFFFE00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x1FFFFFC0 ),
-      LONG2CHARS( 0x1FFFFFE0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x1FFFFFFC ),
-      LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x0E000000 ),
-      LONG2CHARS( 0x0F000000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x0FE00000 ),
-      LONG2CHARS( 0x0FF00000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x0FFE0000 ),
-      LONG2CHARS( 0x0FFF0000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x0FFFE000 ),
-      LONG2CHARS( 0x0FFFF000 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x0FFFFE00 ),
-      LONG2CHARS( 0x0FFFFF00 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x0FFFFFE0 ),
-      LONG2CHARS( 0x0FFFFFF0 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x0FFFFFFE ),
-      LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x07000000 ),
-      LONG2CHARS( 0x07800000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x07F00000 ),
-      LONG2CHARS( 0x07F80000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x07FF0000 ),
-      LONG2CHARS( 0x07FF8000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x07FFF000 ),
-      LONG2CHARS( 0x07FFF800 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x07FFFF00 ),
-      LONG2CHARS( 0x07FFFF80 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x07FFFFF0 ),
-      LONG2CHARS( 0x07FFFFF8 ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x07FFFFFF ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x03800000 ),
-      LONG2CHARS( 0x03C00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x03F80000 ),
-      LONG2CHARS( 0x03FC0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x03FF8000 ),
-      LONG2CHARS( 0x03FFC000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x03FFF800 ),
-      LONG2CHARS( 0x03FFFC00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x03FFFF80 ),
-      LONG2CHARS( 0x03FFFFC0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x03FFFFF8 ),
-      LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x01C00000 ),
-      LONG2CHARS( 0x01E00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x01FC0000 ),
-      LONG2CHARS( 0x01FE0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x01FFC000 ),
-      LONG2CHARS( 0x01FFE000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x01FFFC00 ),
-      LONG2CHARS( 0x01FFFE00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x01FFFFC0 ),
-      LONG2CHARS( 0x01FFFFE0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x01FFFFFC ),
-      LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x00E00000 ),
-      LONG2CHARS( 0x00F00000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x00FE0000 ),
-      LONG2CHARS( 0x00FF0000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x00FFE000 ),
-      LONG2CHARS( 0x00FFF000 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x00FFFE00 ),
-      LONG2CHARS( 0x00FFFF00 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x00FFFFE0 ),
-      LONG2CHARS( 0x00FFFFF0 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x00FFFFFE ),
-      LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00700000 ),
-      LONG2CHARS( 0x00780000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x007F0000 ),
-      LONG2CHARS( 0x007F8000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x007FF000 ),
-      LONG2CHARS( 0x007FF800 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x007FFF00 ),
-      LONG2CHARS( 0x007FFF80 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x007FFFF0 ),
-      LONG2CHARS( 0x007FFFF8 ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x007FFFFF ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00380000 ),
-      LONG2CHARS( 0x003C0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x003F8000 ),
-      LONG2CHARS( 0x003FC000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x003FF800 ),
-      LONG2CHARS( 0x003FFC00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x003FFF80 ),
-      LONG2CHARS( 0x003FFFC0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x003FFFF8 ),
-      LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x001C0000 ),
-      LONG2CHARS( 0x001E0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x001FC000 ),
-      LONG2CHARS( 0x001FE000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x001FFC00 ),
-      LONG2CHARS( 0x001FFE00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x001FFFC0 ),
-      LONG2CHARS( 0x001FFFE0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x001FFFFC ),
-      LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x000E0000 ),
-      LONG2CHARS( 0x000F0000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x000FE000 ),
-      LONG2CHARS( 0x000FF000 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x000FFE00 ),
-      LONG2CHARS( 0x000FFF00 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x000FFFE0 ),
-      LONG2CHARS( 0x000FFFF0 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x000FFFFE ),
-      LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x00070000 ),
-      LONG2CHARS( 0x00078000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x0007F000 ),
-      LONG2CHARS( 0x0007F800 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x0007FF00 ),
-      LONG2CHARS( 0x0007FF80 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x0007FFF0 ),
-      LONG2CHARS( 0x0007FFF8 ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x0007FFFF ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00038000 ),
-      LONG2CHARS( 0x0003C000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0003F800 ),
-      LONG2CHARS( 0x0003FC00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0003FF80 ),
-      LONG2CHARS( 0x0003FFC0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0003FFF8 ),
-      LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x0001C000 ),
-      LONG2CHARS( 0x0001E000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0001FC00 ),
-      LONG2CHARS( 0x0001FE00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0001FFC0 ),
-      LONG2CHARS( 0x0001FFE0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0001FFFC ),
-      LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0000E000 ),
-      LONG2CHARS( 0x0000F000 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0000FE00 ),
-      LONG2CHARS( 0x0000FF00 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0000FFE0 ),
-      LONG2CHARS( 0x0000FFF0 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0000FFFE ),
-      LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x00007000 ),
-      LONG2CHARS( 0x00007800 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x00007F00 ),
-      LONG2CHARS( 0x00007F80 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x00007FF0 ),
-      LONG2CHARS( 0x00007FF8 ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x00007FFF ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00003800 ),
-      LONG2CHARS( 0x00003C00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00003F80 ),
-      LONG2CHARS( 0x00003FC0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00003FF8 ),
-      LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00001C00 ),
-      LONG2CHARS( 0x00001E00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00001FC0 ),
-      LONG2CHARS( 0x00001FE0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00001FFC ),
-      LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00000E00 ),
-      LONG2CHARS( 0x00000F00 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00000FE0 ),
-      LONG2CHARS( 0x00000FF0 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00000FFE ),
-      LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000700 ),
-      LONG2CHARS( 0x00000780 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x000007F0 ),
-      LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x000007FF ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000380 ),
-      LONG2CHARS( 0x000003C0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000003F8 ),
-      LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x000001C0 ),
-      LONG2CHARS( 0x000001E0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000001FC ),
-      LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000000E0 ),
-      LONG2CHARS( 0x000000F0 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000000FE ),
-      LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x00000070 ),
-      LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x0000007F ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000038 ),
-      LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x0000001C ),
-      LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000000E ),
-      LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x00000007 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-};
-
-#else		/* LSBFirst */
-/* NOTE:
-the first element in starttab could be LONG2CHARS( 0xffffffff.  making it 0
-lets us deal with a full first word in the middle loop ), rather
-than having to do the multiple reads and masks that we'd
-have to do if we thought it was partial.
-*/
-PixelType starttab[PPW+1] = 
-	{
-	LONG2CHARS( 0x00000000 ),
-	LONG2CHARS( 0xFFFFFFFE ),
-	LONG2CHARS( 0xFFFFFFFC ),
-	LONG2CHARS( 0xFFFFFFF8 ),
-	LONG2CHARS( 0xFFFFFFF0 ),
-	LONG2CHARS( 0xFFFFFFE0 ),
-	LONG2CHARS( 0xFFFFFFC0 ),
-	LONG2CHARS( 0xFFFFFF80 ),
-	LONG2CHARS( 0xFFFFFF00 ),
-	LONG2CHARS( 0xFFFFFE00 ),
-	LONG2CHARS( 0xFFFFFC00 ),
-	LONG2CHARS( 0xFFFFF800 ),
-	LONG2CHARS( 0xFFFFF000 ),
-	LONG2CHARS( 0xFFFFE000 ),
-	LONG2CHARS( 0xFFFFC000 ),
-	LONG2CHARS( 0xFFFF8000 ),
-	LONG2CHARS( 0xFFFF0000 ),
-	LONG2CHARS( 0xFFFE0000 ),
-	LONG2CHARS( 0xFFFC0000 ),
-	LONG2CHARS( 0xFFF80000 ),
-	LONG2CHARS( 0xFFF00000 ),
-	LONG2CHARS( 0xFFE00000 ),
-	LONG2CHARS( 0xFFC00000 ),
-	LONG2CHARS( 0xFF800000 ),
-	LONG2CHARS( 0xFF000000 ),
-	LONG2CHARS( 0xFE000000 ),
-	LONG2CHARS( 0xFC000000 ),
-	LONG2CHARS( 0xF8000000 ),
-	LONG2CHARS( 0xF0000000 ),
-	LONG2CHARS( 0xE0000000 ),
-	LONG2CHARS( 0xC0000000 ),
-	LONG2CHARS( 0x80000000 ),
-	LONG2CHARS( 0x00000000 )
-	};
-
-PixelType endtab[PPW+1] = 
-	{
-	LONG2CHARS( 0x00000000 ),
-	LONG2CHARS( 0x00000001 ),
-	LONG2CHARS( 0x00000003 ),
-	LONG2CHARS( 0x00000007 ),
-	LONG2CHARS( 0x0000000F ),
-	LONG2CHARS( 0x0000001F ),
-	LONG2CHARS( 0x0000003F ),
-	LONG2CHARS( 0x0000007F ),
-	LONG2CHARS( 0x000000FF ),
-	LONG2CHARS( 0x000001FF ),
-	LONG2CHARS( 0x000003FF ),
-	LONG2CHARS( 0x000007FF ),
-	LONG2CHARS( 0x00000FFF ),
-	LONG2CHARS( 0x00001FFF ),
-	LONG2CHARS( 0x00003FFF ),
-	LONG2CHARS( 0x00007FFF ),
-	LONG2CHARS( 0x0000FFFF ),
-	LONG2CHARS( 0x0001FFFF ),
-	LONG2CHARS( 0x0003FFFF ),
-	LONG2CHARS( 0x0007FFFF ),
-	LONG2CHARS( 0x000FFFFF ),
-	LONG2CHARS( 0x001FFFFF ),
-	LONG2CHARS( 0x003FFFFF ),
-	LONG2CHARS( 0x007FFFFF ),
-	LONG2CHARS( 0x00FFFFFF ),
-	LONG2CHARS( 0x01FFFFFF ),
-	LONG2CHARS( 0x03FFFFFF ),
-	LONG2CHARS( 0x07FFFFFF ),
-	LONG2CHARS( 0x0FFFFFFF ),
-	LONG2CHARS( 0x1FFFFFFF ),
-	LONG2CHARS( 0x3FFFFFFF ),
-	LONG2CHARS( 0x7FFFFFFF ),
-	LONG2CHARS( 0xFFFFFFFF )
-	};
-
-
-#ifdef NEED_OLD_MFB_MASKS
-/* a hack ), for now, since the entries for 0 need to be all
-   1 bits ), not all zeros.
-   this means the code DOES NOT WORK for segments of length
-   0 (which is only a problem in the horizontal line code.)
-*/
-PixelType startpartial[33] = 
-	{
-	LONG2CHARS( 0xFFFFFFFF ),
-	LONG2CHARS( 0xFFFFFFFE ),
-	LONG2CHARS( 0xFFFFFFFC ),
-	LONG2CHARS( 0xFFFFFFF8 ),
-	LONG2CHARS( 0xFFFFFFF0 ),
-	LONG2CHARS( 0xFFFFFFE0 ),
-	LONG2CHARS( 0xFFFFFFC0 ),
-	LONG2CHARS( 0xFFFFFF80 ),
-	LONG2CHARS( 0xFFFFFF00 ),
-	LONG2CHARS( 0xFFFFFE00 ),
-	LONG2CHARS( 0xFFFFFC00 ),
-	LONG2CHARS( 0xFFFFF800 ),
-	LONG2CHARS( 0xFFFFF000 ),
-	LONG2CHARS( 0xFFFFE000 ),
-	LONG2CHARS( 0xFFFFC000 ),
-	LONG2CHARS( 0xFFFF8000 ),
-	LONG2CHARS( 0xFFFF0000 ),
-	LONG2CHARS( 0xFFFE0000 ),
-	LONG2CHARS( 0xFFFC0000 ),
-	LONG2CHARS( 0xFFF80000 ),
-	LONG2CHARS( 0xFFF00000 ),
-	LONG2CHARS( 0xFFE00000 ),
-	LONG2CHARS( 0xFFC00000 ),
-	LONG2CHARS( 0xFF800000 ),
-	LONG2CHARS( 0xFF000000 ),
-	LONG2CHARS( 0xFE000000 ),
-	LONG2CHARS( 0xFC000000 ),
-	LONG2CHARS( 0xF8000000 ),
-	LONG2CHARS( 0xF0000000 ),
-	LONG2CHARS( 0xE0000000 ),
-	LONG2CHARS( 0xC0000000 ),
-	LONG2CHARS( 0x80000000 ),
-	LONG2CHARS( 0x00000000 )
-	};
-
-PixelType endpartial[33] = 
-	{
-	LONG2CHARS( 0xFFFFFFFF ),
-	LONG2CHARS( 0x00000001 ),
-	LONG2CHARS( 0x00000003 ),
-	LONG2CHARS( 0x00000007 ),
-	LONG2CHARS( 0x0000000F ),
-	LONG2CHARS( 0x0000001F ),
-	LONG2CHARS( 0x0000003F ),
-	LONG2CHARS( 0x0000007F ),
-	LONG2CHARS( 0x000000FF ),
-	LONG2CHARS( 0x000001FF ),
-	LONG2CHARS( 0x000003FF ),
-	LONG2CHARS( 0x000007FF ),
-	LONG2CHARS( 0x00000FFF ),
-	LONG2CHARS( 0x00001FFF ),
-	LONG2CHARS( 0x00003FFF ),
-	LONG2CHARS( 0x00007FFF ),
-	LONG2CHARS( 0x0000FFFF ),
-	LONG2CHARS( 0x0001FFFF ),
-	LONG2CHARS( 0x0003FFFF ),
-	LONG2CHARS( 0x0007FFFF ),
-	LONG2CHARS( 0x000FFFFF ),
-	LONG2CHARS( 0x001FFFFF ),
-	LONG2CHARS( 0x003FFFFF ),
-	LONG2CHARS( 0x007FFFFF ),
-	LONG2CHARS( 0x00FFFFFF ),
-	LONG2CHARS( 0x01FFFFFF ),
-	LONG2CHARS( 0x03FFFFFF ),
-	LONG2CHARS( 0x07FFFFFF ),
-	LONG2CHARS( 0x0FFFFFFF ),
-	LONG2CHARS( 0x1FFFFFFF ),
-	LONG2CHARS( 0x3FFFFFFF ),
-	LONG2CHARS( 0x7FFFFFFF ),
-	LONG2CHARS( 0xFFFFFFFF )
-	};
-#endif
-
-
-PixelType partmasks[PPW][PPW] = {
-     {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ),
-      LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ),
-      LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000007FF ),
-      LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00007FFF ),
-      LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0007FFFF ),
-      LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x007FFFFF ),
-      LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x07FFFFFF ),
-      LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x7FFFFFFF )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x0000000E ),
-      LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x000000FE ),
-      LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x00000FFE ),
-      LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x0000FFFE ),
-      LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x000FFFFE ),
-      LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x00FFFFFE ),
-      LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x0FFFFFFE ),
-      LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0xFFFFFFFE )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000001C ),
-      LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000001FC ),
-      LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00001FFC ),
-      LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0001FFFC ),
-      LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x001FFFFC ),
-      LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x01FFFFFC ),
-      LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x1FFFFFFC ),
-      LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x00000038 ),
-      LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000003F8 ),
-      LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00003FF8 ),
-      LONG2CHARS( 0X00007FF8 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0003FFF8 ),
-      LONG2CHARS( 0X0007FFF8 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x003FFFF8 ),
-      LONG2CHARS( 0X007FFFF8 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x03FFFFF8 ),
-      LONG2CHARS( 0X07FFFFF8 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x3FFFFFF8 ),
-      LONG2CHARS( 0X7FFFFFF8 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000070 ),
-      LONG2CHARS( 0X000000F0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000007F0 ),
-      LONG2CHARS( 0X00000FF0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00007FF0 ),
-      LONG2CHARS( 0X0000FFF0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0007FFF0 ),
-      LONG2CHARS( 0X000FFFF0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x007FFFF0 ),
-      LONG2CHARS( 0X00FFFFF0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x07FFFFF0 ),
-      LONG2CHARS( 0X0FFFFFF0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x7FFFFFF0 ),
-      LONG2CHARS( 0XFFFFFFF0 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x000000E0 ),
-      LONG2CHARS( 0X000001E0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x00000FE0 ),
-      LONG2CHARS( 0X00001FE0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x0000FFE0 ),
-      LONG2CHARS( 0X0001FFE0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x000FFFE0 ),
-      LONG2CHARS( 0X001FFFE0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x00FFFFE0 ),
-      LONG2CHARS( 0X01FFFFE0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x0FFFFFE0 ),
-      LONG2CHARS( 0X1FFFFFE0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0xFFFFFFE0 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000001C0 ),
-      LONG2CHARS( 0X000003C0 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00001FC0 ),
-      LONG2CHARS( 0X00003FC0 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0001FFC0 ),
-      LONG2CHARS( 0X0003FFC0 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x001FFFC0 ),
-      LONG2CHARS( 0X003FFFC0 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x01FFFFC0 ),
-      LONG2CHARS( 0X03FFFFC0 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x1FFFFFC0 ),
-      LONG2CHARS( 0X3FFFFFC0 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x00000380 ),
-      LONG2CHARS( 0X00000780 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00003F80 ),
-      LONG2CHARS( 0X00007F80 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0003FF80 ),
-      LONG2CHARS( 0X0007FF80 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x003FFF80 ),
-      LONG2CHARS( 0X007FFF80 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x03FFFF80 ),
-      LONG2CHARS( 0X07FFFF80 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x3FFFFF80 ),
-      LONG2CHARS( 0X7FFFFF80 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000700 ),
-      LONG2CHARS( 0X00000F00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00007F00 ),
-      LONG2CHARS( 0X0000FF00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0007FF00 ),
-      LONG2CHARS( 0X000FFF00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x007FFF00 ),
-      LONG2CHARS( 0X00FFFF00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x07FFFF00 ),
-      LONG2CHARS( 0X0FFFFF00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x7FFFFF00 ),
-      LONG2CHARS( 0XFFFFFF00 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000E00 ),
-      LONG2CHARS( 0X00001E00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x0000FE00 ),
-      LONG2CHARS( 0X0001FE00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x000FFE00 ),
-      LONG2CHARS( 0X001FFE00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x00FFFE00 ),
-      LONG2CHARS( 0X01FFFE00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x0FFFFE00 ),
-      LONG2CHARS( 0X1FFFFE00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0xFFFFFE00 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00001C00 ),
-      LONG2CHARS( 0X00003C00 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0001FC00 ),
-      LONG2CHARS( 0X0003FC00 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x001FFC00 ),
-      LONG2CHARS( 0X003FFC00 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x01FFFC00 ),
-      LONG2CHARS( 0X03FFFC00 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x1FFFFC00 ),
-      LONG2CHARS( 0X3FFFFC00 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00003800 ),
-      LONG2CHARS( 0X00007800 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0003F800 ),
-      LONG2CHARS( 0X0007F800 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x003FF800 ),
-      LONG2CHARS( 0X007FF800 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x03FFF800 ),
-      LONG2CHARS( 0X07FFF800 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x3FFFF800 ),
-      LONG2CHARS( 0X7FFFF800 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00007000 ),
-      LONG2CHARS( 0X0000F000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0007F000 ),
-      LONG2CHARS( 0X000FF000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x007FF000 ),
-      LONG2CHARS( 0X00FFF000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x07FFF000 ),
-      LONG2CHARS( 0X0FFFF000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x7FFFF000 ),
-      LONG2CHARS( 0XFFFFF000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x0000E000 ),
-      LONG2CHARS( 0X0001E000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x000FE000 ),
-      LONG2CHARS( 0X001FE000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x00FFE000 ),
-      LONG2CHARS( 0X01FFE000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x0FFFE000 ),
-      LONG2CHARS( 0X1FFFE000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0xFFFFE000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0001C000 ),
-      LONG2CHARS( 0X0003C000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x001FC000 ),
-      LONG2CHARS( 0X003FC000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x01FFC000 ),
-      LONG2CHARS( 0X03FFC000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x1FFFC000 ),
-      LONG2CHARS( 0X3FFFC000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x00038000 ),
-      LONG2CHARS( 0X00078000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x003F8000 ),
-      LONG2CHARS( 0X007F8000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x03FF8000 ),
-      LONG2CHARS( 0X07FF8000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x3FFF8000 ),
-      LONG2CHARS( 0X7FFF8000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00070000 ),
-      LONG2CHARS( 0X000F0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x007F0000 ),
-      LONG2CHARS( 0X00FF0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x07FF0000 ),
-      LONG2CHARS( 0X0FFF0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x7FFF0000 ),
-      LONG2CHARS( 0XFFFF0000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x000E0000 ),
-      LONG2CHARS( 0X001E0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x00FE0000 ),
-      LONG2CHARS( 0X01FE0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x0FFE0000 ),
-      LONG2CHARS( 0X1FFE0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0xFFFE0000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x001C0000 ),
-      LONG2CHARS( 0X003C0000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x01FC0000 ),
-      LONG2CHARS( 0X03FC0000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x1FFC0000 ),
-      LONG2CHARS( 0X3FFC0000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x00380000 ),
-      LONG2CHARS( 0X00780000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x03F80000 ),
-      LONG2CHARS( 0X07F80000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x3FF80000 ),
-      LONG2CHARS( 0X7FF80000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00700000 ),
-      LONG2CHARS( 0X00F00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x07F00000 ),
-      LONG2CHARS( 0X0FF00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x7FF00000 ),
-      LONG2CHARS( 0XFFF00000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00E00000 ),
-      LONG2CHARS( 0X01E00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x0FE00000 ),
-      LONG2CHARS( 0X1FE00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0xFFE00000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x01C00000 ),
-      LONG2CHARS( 0X03C00000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x1FC00000 ),
-      LONG2CHARS( 0X3FC00000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x03800000 ),
-      LONG2CHARS( 0X07800000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x3F800000 ),
-      LONG2CHARS( 0X7F800000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x07000000 ),
-      LONG2CHARS( 0X0F000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x7F000000 ),
-      LONG2CHARS( 0XFF000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x0E000000 ),
-      LONG2CHARS( 0X1E000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0xFE000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x1C000000 ),
-      LONG2CHARS( 0X3C000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x38000000 ),
-      LONG2CHARS( 0X78000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x70000000 ),
-      LONG2CHARS( 0XF0000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0xE0000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-     {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ),
-      LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )},
-};
-
-#endif /* BITMAP_BIT_ORDER */
-
-/* used for masking bits in bresenham lines
-   mask[n] is used to mask out all but bit n in a longword (n is a
-screen position).
-   rmask[n] is used to mask out the single bit at position n (n
-is a screen posiotion.)
-*/
-
-#define _1_ ((PixelType)1)
-
-#if (BITMAP_BIT_ORDER == MSBFirst)
-PixelType mask[PPW] =
-    {
-    LONG2CHARS( _1_<<31 ), LONG2CHARS( 1<<30 ), LONG2CHARS( 1<<29 ), 
-    LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<26 ), 
-    LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<23 ), 
-    LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<20 ), 
-    LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<17 ), 
-    LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<14 ), 
-    LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<11 ), 
-    LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<8 ),
-    LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<5 ), 
-    LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<2 ), 
-    LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<0 )
-    };
-
-PixelType rmask[] = 
-    {
-    0xffffffff ^ LONG2CHARS( _1_<<31 ), 0xffffffff ^ LONG2CHARS( 1<<30 ), 
-    0xffffffff ^ LONG2CHARS( 1<<29 ), 0xffffffff ^ LONG2CHARS( 1<<28), 
-    0xffffffff ^ LONG2CHARS( 1<<27 ), 0xffffffff ^ LONG2CHARS( 1<<26),
-    0xffffffff ^ LONG2CHARS( 1<<25 ), 0xffffffff ^ LONG2CHARS( 1<<24 ), 
-    0xffffffff ^ LONG2CHARS( 1<<23 ), 0xffffffff ^ LONG2CHARS( 1<<22), 
-    0xffffffff ^ LONG2CHARS( 1<<21 ), 0xffffffff ^ LONG2CHARS( 1<<20),
-    0xffffffff ^ LONG2CHARS( 1<<19 ), 0xffffffff ^ LONG2CHARS( 1<<18 ), 
-    0xffffffff ^ LONG2CHARS( 1<<17 ), 0xffffffff ^ LONG2CHARS( 1<<16),
-    0xffffffff ^ LONG2CHARS( 1<<15 ), 0xffffffff ^ LONG2CHARS( 1<<14),
-    0xffffffff ^ LONG2CHARS( 1<<13 ), 0xffffffff ^ LONG2CHARS( 1<<12 ),
-    0xffffffff ^ LONG2CHARS( 1<<11 ), 0xffffffff ^ LONG2CHARS( 1<<10), 
-    0xffffffff ^ LONG2CHARS( 1<<9 ),  0xffffffff ^ LONG2CHARS( 1<<8),
-    0xffffffff ^ LONG2CHARS( 1<<7 ),  0xffffffff ^ LONG2CHARS( 1<<6),  
-    0xffffffff ^ LONG2CHARS( 1<<5 ),  0xffffffff ^ LONG2CHARS( 1<<4),  
-    0xffffffff ^ LONG2CHARS( 1<<3 ),  0xffffffff ^ LONG2CHARS( 1<<2),
-    0xffffffff ^ LONG2CHARS( 1<<1 ),  0xffffffff ^ LONG2CHARS( 1<<0)
-    };
-#else	/* LSBFirst */
-PixelType mask[] =
-    {
-    LONG2CHARS( 1<<0 ), LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<2), 
-    LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<5), 
-    LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<8), 
-    LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<11), 
-    LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<14), 
-    LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<17), 
-    LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<20), 
-    LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<23),
-    LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<26), 
-    LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<29), 
-    LONG2CHARS( 1<<30 ), LONG2CHARS( _1_<<31 )
-    }; 
-PixelType rmask[] = 
-    {
-    0xffffffff ^ LONG2CHARS( 1<<0), 0xffffffff ^ LONG2CHARS( 1<<1), 
-    0xffffffff ^ LONG2CHARS( 1<<2), 0xffffffff ^ LONG2CHARS( 1<<3), 
-    0xffffffff ^ LONG2CHARS( 1<<4), 0xffffffff ^ LONG2CHARS( 1<<5),
-    0xffffffff ^ LONG2CHARS( 1<<6), 0xffffffff ^ LONG2CHARS( 1<<7), 
-    0xffffffff ^ LONG2CHARS( 1<<8), 0xffffffff ^ LONG2CHARS( 1<<9), 
-    0xffffffff ^ LONG2CHARS( 1<<10), 0xffffffff ^ LONG2CHARS( 1<<11),
-    0xffffffff ^ LONG2CHARS( 1<<12), 0xffffffff ^ LONG2CHARS( 1<<13), 
-    0xffffffff ^ LONG2CHARS( 1<<14), 0xffffffff ^ LONG2CHARS( 1<<15), 
-    0xffffffff ^ LONG2CHARS( 1<<16), 0xffffffff ^ LONG2CHARS( 1<<17),
-    0xffffffff ^ LONG2CHARS( 1<<18), 0xffffffff ^ LONG2CHARS( 1<<19), 
-    0xffffffff ^ LONG2CHARS( 1<<20), 0xffffffff ^ LONG2CHARS( 1<<21), 
-    0xffffffff ^ LONG2CHARS( 1<<22), 0xffffffff ^ LONG2CHARS( 1<<23),
-    0xffffffff ^ LONG2CHARS( 1<<24), 0xffffffff ^ LONG2CHARS( 1<<25), 
-    0xffffffff ^ LONG2CHARS( 1<<26), 0xffffffff ^ LONG2CHARS( 1<<27), 
-    0xffffffff ^ LONG2CHARS( 1<<28), 0xffffffff ^ LONG2CHARS( 1<<29),
-    0xffffffff ^ LONG2CHARS( 1<<30), 0xffffffff ^ LONG2CHARS( _1_<<31)
-    };
-#endif /* BITMAP_BIT_ORDER */
-
-#undef _1_
-
-PixelType mfbGetmask(int i) { return mask[i]; }
-PixelType mfbGetrmask(int i) { return rmask[i]; }
-PixelType mfbGetstarttab(int i) { return starttab[i]; }
-PixelType mfbGetendtab(int i) { return endtab[i]; }
-PixelType mfbGetpartmasks(int i, int j) { return partmasks[i][j]; }
-
-/*
- * Merge raster ops for full src + dest + plane mask
- *
- * More clever usage of boolean arithmetic to reduce the
- * cost of complex raster ops.  This is for bitblt and
- * reduces all 16 raster ops + planemask to a single
- * expression:
- *
- *  dst = dst & (src & ca1 ^ cx1) ^ (src & ca2 ^ cx2)
- *
- * The array below contains the values for c?? for each
- * raster op.  Those values are further modified by
- * planemasks on multi-plane displays as follows:
- *
- *  ca1 &= pm;
- *  cx1 |= ~pm;
- *  ca2 &= pm;
- *  cx2 &= pm;
- */
-
-#include "mergerop.h"
-
-#define O 0
-#define I ~((MfbBits)0)
-
-mergeRopRec mergeRopBits[16] = {
-{ O,O,O,O, },	/* clear	0x0		0 */
-{ I,O,O,O, },	/* and		0x1		src AND dst */
-{ I,O,I,O, },	/* andReverse	0x2		src AND NOT dst */
-{ O,O,I,O, },	/* copy		0x3		src */
-{ I,I,O,O, },	/* andInverted	0x4		NOT src AND dst */
-{ O,I,O,O, },	/* noop		0x5		dst */
-{ O,I,I,O, },	/* xor		0x6		src XOR dst */
-{ I,I,I,O, },	/* or		0x7		src OR dst */
-{ I,I,I,I, },	/* nor		0x8		NOT src AND NOT dst */
-{ O,I,I,I, },	/* equiv	0x9		NOT src XOR dst */
-{ O,I,O,I, },	/* invert	0xa		NOT dst */
-{ I,I,O,I, },	/* orReverse	0xb		src OR NOT dst */
-{ O,O,I,I, },	/* copyInverted	0xc		NOT src */
-{ I,O,I,I, },	/* orInverted	0xd		NOT src OR dst */
-{ I,O,O,I, },	/* nand		0xe		NOT src OR NOT dst */
-{ O,O,O,I, },	/* set		0xf		1 */
-};
-
-mergeRopPtr mergeGetRopBits(int i) {
-    return &mergeRopBits[i];
-}
-
-#undef O
-#undef I
diff --git a/mfb/maskbits.h b/mfb/maskbits.h
deleted file mode 100644
index 36a611f..0000000
--- a/mfb/maskbits.h
+++ /dev/null
@@ -1,689 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */
-/***********************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "servermd.h"
-
-
-/* the following notes use the following conventions:
-SCREEN LEFT				SCREEN RIGHT
-in this file and maskbits.c, left and right refer to screen coordinates,
-NOT bit numbering in registers.
-
-starttab[n]
-	bits[0,n-1] = 0	bits[n,PLST] = 1
-endtab[n] =
-	bits[0,n-1] = 1	bits[n,PLST] = 0
-
-startpartial[], endpartial[]
-	these are used as accelerators for doing putbits and masking out
-bits that are all contained between longword boudaries.  the extra
-256 bytes of data seems a small price to pay -- code is smaller,
-and narrow things (e.g. window borders) go faster.
-
-the names may seem misleading; they are derived not from which end
-of the word the bits are turned on, but at which end of a scanline
-the table tends to be used.
-
-look at the tables and macros to understand boundary conditions.
-(careful readers will note that starttab[n] = ~endtab[n] for n != 0)
-
------------------------------------------------------------------------
-these two macros depend on the screen's bit ordering.
-in both of them x is a screen position.  they are used to
-combine bits collected from multiple longwords into a
-single destination longword, and to unpack a single
-source longword into multiple destinations.
-
-SCRLEFT(dst, x)
-	takes dst[x, PPW] and moves them to dst[0, PPW-x]
-	the contents of the rest of dst are 0.
-	this is a right shift on LSBFirst (forward-thinking)
-	machines like the VAX, and left shift on MSBFirst
-	(backwards) machines like the 680x0 and pc/rt.
-
-SCRRIGHT(dst, x)
-	takes dst[0,x] and moves them to dst[PPW-x, PPW]
-	the contents of the rest of dst are 0.
-	this is a left shift on LSBFirst, right shift
-	on MSBFirst.
-
-
-the remaining macros are cpu-independent; all bit order dependencies
-are built into the tables and the two macros above.
-
-maskbits(x, w, startmask, endmask, nlw)
-	for a span of width w starting at position x, returns
-a mask for ragged bits at start, mask for ragged bits at end,
-and the number of whole longwords between the ends.
-
-maskpartialbits(x, w, mask)
-	works like maskbits(), except all the bits are in the
-	same longword (i.e. (x&PIM + w) <= PPW)
-
-maskPPWbits(x, w, startmask, endmask, nlw)
-	as maskbits, but does not calculate nlw.  it is used by
-	mfbGlyphBlt to put down glyphs <= PPW bits wide.
-
--------------------------------------------------------------------
-
-NOTE
-	any pointers passed to the following 4 macros are
-	guranteed to be PPW-bit aligned.
-	The only non-PPW-bit-aligned references ever made are
-	to font glyphs, and those are made with getleftbits()
-	and getshiftedleftbits (qq.v.)
-
-	For 64-bit server, it is assumed that we will never have font padding
-	of more than 4 bytes. The code uses int's to access the fonts
-	intead of longs.
-
-getbits(psrc, x, w, dst)
-	starting at position x in psrc (x < PPW), collect w
-	bits and put them in the screen left portion of dst.
-	psrc is a longword pointer.  this may span longword boundaries.
-	it special-cases fetching all w bits from one longword.
-
-	+--------+--------+		+--------+
-	|    | m |n|      |	==> 	| m |n|  |
-	+--------+--------+		+--------+
-	    x      x+w			0     w
-	psrc     psrc+1			dst
-			m = PPW - x
-			n = w - m
-
-	implementation:
-	get m bits, move to screen-left of dst, zeroing rest of dst;
-	get n bits from next word, move screen-right by m, zeroing
-		 lower m bits of word.
-	OR the two things together.
-
-putbits(src, x, w, pdst)
-	starting at position x in pdst, put down the screen-leftmost
-	w bits of src.  pdst is a longword pointer.  this may
-	span longword boundaries.
-	it special-cases putting all w bits into the same longword.
-
-	+--------+			+--------+--------+
-	| m |n|  |		==>	|    | m |n|      |
-	+--------+			+--------+--------+
-	0     w				     x     x+w
-	dst				pdst     pdst+1
-			m = PPW - x
-			n = w - m
-
-	implementation:
-	get m bits, shift screen-right by x, zero screen-leftmost x
-		bits; zero rightmost m bits of *pdst and OR in stuff
-		from before the semicolon.
-	shift src screen-left by m, zero bits n-PPW;
-		zero leftmost n bits of *(pdst+1) and OR in the
-		stuff from before the semicolon.
-
-putbitsrop(src, x, w, pdst, ROP)
-	like putbits but calls DoRop with the rasterop ROP (see mfb.h for
-	DoRop)
-
-putbitsrrop(src, x, w, pdst, ROP)
-	like putbits but calls DoRRop with the reduced rasterop ROP
-	(see mfb.h for DoRRop)
-
------------------------------------------------------------------------
-	The two macros below are used only for getting bits from glyphs
-in fonts, and glyphs in fonts are gotten only with the following two
-mcros.
-	You should tune these macros toyour font format and cpu
-byte ordering.
-
-NOTE
-getleftbits(psrc, w, dst)
-	get the leftmost w (w<=32) bits from *psrc and put them
-	in dst.  this is used by the mfbGlyphBlt code for glyphs
-	<=PPW bits wide.
-	psrc is declared (unsigned char *)
-
-	psrc is NOT guaranteed to be PPW-bit aligned.  on  many
-	machines this will cause problems, so there are several
-	versions of this macro.
-
-	this macro is called ONLY for getting bits from font glyphs,
-	and depends on the server-natural font padding.
-
-	for blazing text performance, you want this macro
-	to touch memory as infrequently as possible (e.g.
-	fetch longwords) and as efficiently as possible
-	(e.g. don't fetch misaligned longwords)
-
-getshiftedleftbits(psrc, offset, w, dst)
-	used by the font code; like getleftbits, but shifts the
-	bits SCRLEFT by offset.
-	this is implemented portably, calling getleftbits()
-	and SCRLEFT().
-	psrc is declared (unsigned char *).
-*/
-
-/* to match CFB and allow algorithm sharing ...
- * name	   mfb32  mfb64  explanation
- * ----	   ------ -----  -----------
- * PGSZ    32      64    pixel group size (in bits; same as PPW for mfb)
- * PGSZB    4      8     pixel group size (in bytes)
- * PPW	   32     64     pixels per word (pixels per pixel group)
- * PLST	   31     63     index of last pixel in a word (should be PPW-1)
- * PIM	   0x1f   0x3f   pixel index mask (index within a pixel group)
- * PWSH	   5       6     pixel-to-word shift (should be log2(PPW))
- *
- * The MFB_ versions are here so that cfb can include maskbits.h to get
- * the bitmap constants without conflicting with its own P* constants.
- * 
- * Keith Packard (keithp at suse.com):
- * Note mfb64 is no longer supported; it requires DIX support
- * for realigning images which costs too much
- */	    
-
-/* warning: PixelType definition duplicated in mfb.h */
-#ifndef PixelType
-#define PixelType CARD32
-#endif /* PixelType */
-#ifndef MfbBits
-#define MfbBits CARD32
-#endif
-
-#define MFB_PGSZB 4
-#define MFB_PPW		(MFB_PGSZB<<3) /* assuming 8 bits per byte */
-#define MFB_PGSZ	MFB_PPW
-#define MFB_PLST	(MFB_PPW-1)
-#define MFB_PIM		MFB_PLST
-
-/* set PWSH = log2(PPW) using brute force */
-
-#if MFB_PPW == 32
-#define MFB_PWSH 5
-#endif /* MFB_PPW == 32 */
-
-/* XXX don't use these five */
-extern PixelType starttab[];
-extern PixelType endtab[];
-extern PixelType partmasks[MFB_PPW][MFB_PPW];
-extern PixelType rmask[];
-extern PixelType mask[];
-/* XXX use these five */
-extern PixelType mfbGetstarttab(int);
-extern PixelType mfbGetendtab(int);
-extern PixelType mfbGetpartmasks(int, int);
-extern PixelType mfbGetrmask(int);
-extern PixelType mfbGetmask(int);
-
-#ifndef MFB_CONSTS_ONLY
-
-#define PGSZB	MFB_PGSZB
-#define PPW	MFB_PPW
-#define PGSZ	MFB_PGSZ
-#define PLST	MFB_PLST
-#define PIM	MFB_PIM
-#define PWSH	MFB_PWSH
-
-#define BitLeft(b,s)	SCRLEFT(b,s)
-#define BitRight(b,s)	SCRRIGHT(b,s)
-
-#if 1
-#define LONG2CHARSSAMEORDER(x) ((MfbBits)(x))
-#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
-                        | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
-                        | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
-                        | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
-#endif /* XFree86Server */
-
-#if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER)
-#define LONG2CHARS(x) ((MfbBits)(x))
-#else
-/*
- *  the unsigned case below is for compilers like
- *  the Danbury C and i386cc
- */
-#define LONG2CHARS( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \
-                        | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \
-                        | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \
-                        | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) )
-#endif /* BITMAP_BIT_ORDER */
-
-#ifdef STRICT_ANSI_SHIFT
-#define SHL(x,y)    ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) << (y)))
-#define SHR(x,y)    ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) >> (y)))
-#else
-#define SHL(x,y)    LONG2CHARS(LONG2CHARS(x) << (y))
-#define SHR(x,y)    LONG2CHARS(LONG2CHARS(x) >> (y))
-#endif
-
-#if (BITMAP_BIT_ORDER == MSBFirst)	/* pc/rt, 680x0 */
-#define SCRLEFT(lw, n)	SHL((PixelType)(lw),(n))
-#define SCRRIGHT(lw, n)	SHR((PixelType)(lw),(n))
-#else					/* vax, intel */
-#define SCRLEFT(lw, n)	SHR((PixelType)(lw),(n))
-#define SCRRIGHT(lw, n)	SHL((PixelType)(lw),(n))
-#endif
-
-#define DoRRop(alu, src, dst) \
-(((alu) == RROP_BLACK) ? ((dst) & ~(src)) : \
- ((alu) == RROP_WHITE) ? ((dst) | (src)) : \
- ((alu) == RROP_INVERT) ? ((dst) ^ (src)) : \
-  (dst))
-
-/* A generalized form of a x4 Duff's Device */
-#define Duff(counter, block) { \
-  while (counter >= 4) {\
-     { block; } \
-     { block; } \
-     { block; } \
-     { block; } \
-     counter -= 4; \
-  } \
-     switch (counter & 3) { \
-     case 3:	{ block; } \
-     case 2:	{ block; } \
-     case 1:	{ block; } \
-     case 0: \
-     counter = 0; \
-   } \
-}
-
-#define maskbits(x, w, startmask, endmask, nlw) \
-    startmask = mfbGetstarttab((x) & PIM); \
-    endmask = mfbGetendtab(((x)+(w)) & PIM); \
-    if (startmask) \
-	nlw = (((w) - (PPW - ((x) & PIM))) >> PWSH); \
-    else \
-	nlw = (w) >> PWSH;
-
-#define maskpartialbits(x, w, mask) \
-    mask = mfbGetpartmasks((x) & PIM, (w) & PIM);
-
-#define maskPPWbits(x, w, startmask, endmask) \
-    startmask = mfbGetstarttab((x) & PIM); \
-    endmask = mfbGetendtab(((x)+(w)) & PIM);
-
-#ifdef __GNUC__ /* XXX don't want for Alpha? */
-#ifdef vax
-#define FASTGETBITS(psrc,x,w,dst) \
-    __asm ("extzv %1,%2,%3,%0" \
-	 : "=g" (dst) \
-	 : "g" (x), "g" (w), "m" (*(char *)(psrc)))
-#define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst)
-
-#define FASTPUTBITS(src, x, w, pdst) \
-    __asm ("insv %3,%1,%2,%0" \
-	 : "=m" (*(char *)(pdst)) \
-	 : "g" (x), "g" (w), "g" (src))
-#define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst)
-#endif /* vax */
-#ifdef mc68020
-#define FASTGETBITS(psrc, x, w, dst) \
-    __asm ("bfextu %3{%1:%2},%0" \
-    : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define getbits(psrc,x,w,dst) \
-{ \
-    FASTGETBITS(psrc, x, w, dst);\
-    dst = SHL(dst,(32-(w))); \
-}
-
-#define FASTPUTBITS(src, x, w, pdst) \
-    __asm ("bfins %3,%0{%1:%2}" \
-	 : "=o" (*(char *)(pdst)) \
-	 : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#define putbits(src, x, w, pdst) FASTPUTBITS(SHR((src),32-(w)), x, w, pdst)
-
-#endif /* mc68020 */
-#endif /* __GNUC__ */
-
-/*  The following flag is used to override a bugfix for sun 3/60+CG4 machines,
- */
-
-/*  We don't need to be careful about this unless we're dealing with sun3's 
- *  We will default its usage for those who do not know anything, but will
- *  override its effect if the machine doesn't look like a sun3 
- */
-#if !defined(mc68020) || !defined(sun)
-#define NO_3_60_CG4
-#endif
-
-/* This is gross.  We want to #define u_putbits as something which can be used
- * in the case of the 3/60+CG4, but if we use /bin/cc or are on another
- * machine type, we want nothing to do with u_putbits.  What a hastle.  Here
- * I used slo_putbits as something which either u_putbits or putbits could be
- * defined as.
- *
- * putbits gets it iff it is not already defined with FASTPUTBITS above.
- * u_putbits gets it if we have FASTPUTBITS (putbits) from above and have not
- * 	overridden the NO_3_60_CG4 flag.
- */
-
-#define slo_putbits(src, x, w, pdst) \
-{ \
-    register int n = (x)+(w)-PPW; \
-    \
-    if (n <= 0) \
-    { \
-	register PixelType tmpmask; \
-	maskpartialbits((x), (w), tmpmask); \
-	*(pdst) = (*(pdst) & ~tmpmask) | \
-		(SCRRIGHT(src, x) & tmpmask); \
-    } \
-    else \
-    { \
-	register int d = PPW-(x); \
-	*(pdst) = (*(pdst) & mfbGetendtab(x)) | (SCRRIGHT((src), x)); \
-	(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | \
-		(SCRLEFT(src, d) & mfbGetendtab(n)); \
-    } \
-}
-
-#if defined(putbits) && !defined(NO_3_60_CG4)
-#define u_putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
-#else
-#define u_putbits(src, x, w, pdst) putbits(src, x, w, pdst)
-#endif
-
-#if !defined(putbits) 
-#define putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst)
-#endif
-
-/* Now if we have not gotten any really good bitfield macros, try some
- * moderately fast macros.  Alas, I don't know how to do asm instructions
- * without gcc.
- */
-
-#ifndef getbits
-#define getbits(psrc, x, w, dst) \
-{ \
-    dst = SCRLEFT(*(psrc), (x)); \
-    if ( ((x) + (w)) > PPW) \
-	dst |= (SCRRIGHT(*((psrc)+1), PPW-(x))); \
-}
-#endif
-
-/*  We have to special-case putbitsrop because of 3/60+CG4 combos
- */
-
-#define u_putbitsrop(src, x, w, pdst, rop) \
-{\
-	register PixelType t1, t2; \
-	register int n = (x)+(w)-PPW; \
-	\
-	t1 = SCRRIGHT((src), (x)); \
-	DoRop(t2, rop, t1, *(pdst)); \
-	\
-    if (n <= 0) \
-    { \
-	register PixelType tmpmask; \
-	\
-	maskpartialbits((x), (w), tmpmask); \
-	*(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
-    } \
-    else \
-    { \
-	int m = PPW-(x); \
-	*(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \
-	t1 = SCRLEFT((src), m); \
-	DoRop(t2, rop, t1, (pdst)[1]); \
-	(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \
-    } \
-}
-
-/* If our getbits and putbits are FAST enough,
- * do this brute force, it's faster
- */
-
-#if defined(FASTPUTBITS) && defined(FASTGETBITS) && defined(NO_3_60_CG4)
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define putbitsrop(src, x, w, pdst, rop) \
-{ \
-  register PixelType _tmp, _tmp2; \
-  FASTGETBITS(pdst, x, w, _tmp); \
-  _tmp2 = SCRRIGHT(src, PPW-(w)); \
-  DoRop(_tmp, rop, _tmp2, _tmp) \
-  FASTPUTBITS(_tmp, x, w, pdst); \
-}
-#define putbitsrrop(src, x, w, pdst, rop) \
-{ \
-  register PixelType _tmp, _tmp2; \
- \
-  FASTGETBITS(pdst, x, w, _tmp); \
-  _tmp2 = SCRRIGHT(src, PPW-(w)); \
-  _tmp= DoRRop(rop, _tmp2, _tmp); \
-  FASTPUTBITS(_tmp, x, w, pdst); \
-}
-#undef u_putbitsrop
-#else
-#define putbitsrop(src, x, w, pdst, rop) \
-{ \
-  register PixelType _tmp; \
-  FASTGETBITS(pdst, x, w, _tmp); \
-  DoRop(_tmp, rop, src, _tmp) \
-  FASTPUTBITS(_tmp, x, w, pdst); \
-}
-#define putbitsrrop(src, x, w, pdst, rop) \
-{ \
-  register PixelType _tmp; \
- \
-  FASTGETBITS(pdst, x, w, _tmp); \
-  _tmp= DoRRop(rop, src, _tmp); \
-  FASTPUTBITS(_tmp, x, w, pdst); \
-}
-#undef u_putbitsrop
-#endif
-#endif
-
-#ifndef putbitsrop
-#define putbitsrop(src, x, w, pdst, rop)  u_putbitsrop(src, x, w, pdst, rop)
-#endif 
-
-#ifndef putbitsrrop
-#define putbitsrrop(src, x, w, pdst, rop) \
-{\
-	register PixelType t1, t2; \
-	register int n = (x)+(w)-PPW; \
-	\
-	t1 = SCRRIGHT((src), (x)); \
-	t2 = DoRRop(rop, t1, *(pdst)); \
-	\
-    if (n <= 0) \
-    { \
-	register PixelType tmpmask; \
-	\
-	maskpartialbits((x), (w), tmpmask); \
-	*(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \
-    } \
-    else \
-    { \
-	int m = PPW-(x); \
-	*(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \
-	t1 = SCRLEFT((src), m); \
-	t2 = DoRRop(rop, t1, (pdst)[1]); \
-	(pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \
-    } \
-}
-#endif
-
-#if GETLEFTBITS_ALIGNMENT == 1
-#define getleftbits(psrc, w, dst)	dst = *((CARD32 *)(pointer) psrc)
-#endif /* GETLEFTBITS_ALIGNMENT == 1 */
-
-#if GETLEFTBITS_ALIGNMENT == 2
-#define getleftbits(psrc, w, dst) \
-    { \
-	if ( ((int)(psrc)) & 0x01 ) \
-		getbits( ((CARD32 *)(((char *)(psrc))-1)), 8, (w), (dst) ); \
-	else \
-		getbits(psrc, 0, w, dst); \
-    }
-#endif /* GETLEFTBITS_ALIGNMENT == 2 */
-
-#if GETLEFTBITS_ALIGNMENT == 4
-#define getleftbits(psrc, w, dst) \
-    { \
-	int off, off_b; \
-	off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \
-	getbits( \
-		(CARD32 *)( ((char *)(psrc)) - off), \
-		(off_b), (w), (dst) \
-	       ); \
-    }
-#endif /* GETLEFTBITS_ALIGNMENT == 4 */
-
-
-#define getshiftedleftbits(psrc, offset, w, dst) \
-	getleftbits((psrc), (w), (dst)); \
-	dst = SCRLEFT((dst), (offset));
-
-/* FASTGETBITS and FASTPUTBITS are not necessarily correct implementations of
- * getbits and putbits, but they work if used together.
- *
- * On a MSBFirst machine, a cpu bitfield extract instruction (like bfextu)
- * could normally assign its result to a 32-bit word register in the screen
- * right position.  This saves canceling register shifts by not fighting the
- * natural cpu byte order.
- *
- * Unfortunately, these fail on a 3/60+CG4 and cannot be used unmodified. Sigh.
- */
-#if defined(FASTGETBITS) && defined(FASTPUTBITS)
-#ifdef NO_3_60_CG4
-#define u_FASTPUT(aa, bb, cc, dd)  FASTPUTBITS(aa, bb, cc, dd)
-#else
-#define u_FASTPUT(aa, bb, cc, dd)  u_putbits(SCRLEFT(aa, PPW-(cc)), bb, cc, dd)
-#endif
-
-#define getandputbits(psrc, srcbit, dstbit, width, pdst) \
-{ \
-    register PixelType _tmpbits; \
-    FASTGETBITS(psrc, srcbit, width, _tmpbits); \
-    u_FASTPUT(_tmpbits, dstbit, width, pdst); \
-}
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
-  register PixelType _tmpsrc, _tmpdst; \
-  FASTGETBITS(pdst, dstbit, width, _tmpdst); \
-  FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
-  DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
-  u_FASTPUT(_tmpdst, dstbit, width, pdst); \
-}
-
-#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
-  register PixelType _tmpsrc, _tmpdst; \
-  FASTGETBITS(pdst, dstbit, width, _tmpdst); \
-  FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
-  _tmpdst = DoRRop(rop, _tmpsrc, _tmpdst); \
-  u_FASTPUT(_tmpdst, dstbit, width, pdst); \
-}
-
-#define getandputbits0(psrc, srcbit, width, pdst) \
-	getandputbits(psrc, srcbit, 0, width, pdst)
-
-#define getandputrop0(psrc, srcbit, width, pdst, rop) \
-    	getandputrop(psrc, srcbit, 0, width, pdst, rop)
-
-#define getandputrrop0(psrc, srcbit, width, pdst, rop) \
-    	getandputrrop(psrc, srcbit, 0, width, pdst, rop)
-
-
-#else /* Slow poke */
-
-/* pairs of getbits/putbits happen frequently. Some of the code can
- * be shared or avoided in a few specific instances.  It gets us a
- * small advantage, so we do it.  The getandput...0 macros are the only ones
- * which speed things here.  The others are here for compatibility w/the above
- * FAST ones
- */
-
-#define getandputbits(psrc, srcbit, dstbit, width, pdst) \
-{ \
-    register PixelType _tmpbits; \
-    getbits(psrc, srcbit, width, _tmpbits); \
-    putbits(_tmpbits, dstbit, width, pdst); \
-}
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
-    register PixelType _tmpbits; \
-    getbits(psrc, srcbit, width, _tmpbits) \
-    putbitsrop(_tmpbits, dstbit, width, pdst, rop) \
-}
-
-#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \
-{ \
-    register PixelType _tmpbits; \
-    getbits(psrc, srcbit, width, _tmpbits) \
-    putbitsrrop(_tmpbits, dstbit, width, pdst, rop) \
-}
-
-
-#define getandputbits0(psrc, sbindex, width, pdst) \
-{			/* unroll the whole damn thing to see how it * behaves */ \
-    register int          _flag = PPW - (sbindex); \
-    register PixelType _src; \
- \
-    _src = SCRLEFT (*(psrc), (sbindex)); \
-    if ((width) > _flag) \
-	_src |=  SCRRIGHT (*((psrc) + 1), _flag); \
- \
-    *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
-}
-
-
-#define getandputrop0(psrc, sbindex, width, pdst, rop) \
-{			\
-    register int          _flag = PPW - (sbindex); \
-    register PixelType _src; \
- \
-    _src = SCRLEFT (*(psrc), (sbindex)); \
-    if ((width) > _flag) \
-	_src |=  SCRRIGHT (*((psrc) + 1), _flag); \
-    DoRop(_src, rop, _src, *(pdst)); \
- \
-    *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
-}
-
-#define getandputrrop0(psrc, sbindex, width, pdst, rop) \
-{ \
-    int             _flag = PPW - (sbindex); \
-    register PixelType _src; \
- \
-    _src = SCRLEFT (*(psrc), (sbindex)); \
-    if ((width) > _flag) \
-	_src |=  SCRRIGHT (*((psrc) + 1), _flag); \
-    _src = DoRRop(rop, _src, *(pdst)); \
- \
-    *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \
-}
-
-#endif  /* FASTGETBITS && FASTPUTBITS */
-
-#endif /* MFB_CONSTS_ONLY */
diff --git a/mfb/mergerop.h b/mfb/mergerop.h
deleted file mode 100644
index b71bfcc..0000000
--- a/mfb/mergerop.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- *
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
- *
- * Author:  Keith Packard, MIT X Consortium
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef _MERGEROP_H_
-#define _MERGEROP_H_
-
-#ifndef GXcopy
-#include <X11/X.h>
-#endif
-
-typedef struct _mergeRopBits {
-    MfbBits   ca1, cx1, ca2, cx2;
-} mergeRopRec, *mergeRopPtr;
-
-extern mergeRopRec	mergeRopBits[16];
-extern mergeRopPtr	mergeGetRopBits(int i);
-
-#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ)	/* cfb */
-#define DeclareMergeRop() MfbBits   _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
-#define DeclarePrebuiltMergeRop()	MfbBits	_cca, _ccx;
-#if PSZ == 24  /* both for PGSZ == 32 and 64 */
-#define DeclareMergeRop24() \
-    MfbBits   _ca1u[4], _cx1u[4], _ca2u[4], _cx2u[4];
-    /*    int _unrollidx[3]={0,0,1,2};*/
-#define DeclarePrebuiltMergeRop24()	MfbBits	_ccau[4], _ccxu[4];
-#endif /* PSZ == 24 */
-#else /* mfb */
-#define DeclareMergeRop() MfbBits   _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0;
-#define DeclarePrebuiltMergeRop()	MfbBits	_cca, _ccx;
-#endif
-
-#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ)	/* cfb */
-#define InitializeMergeRop(alu,pm) {\
-    MfbBits   _pm; \
-    mergeRopPtr  _bits; \
-    _pm = PFILL(pm); \
-    _bits = mergeGetRopBits(alu); \
-    _ca1 = _bits->ca1 &  _pm; \
-    _cx1 = _bits->cx1 | ~_pm; \
-    _ca2 = _bits->ca2 &  _pm; \
-    _cx2 = _bits->cx2 &  _pm; \
-}
-#if PSZ == 24
-#if	(BITMAP_BIT_ORDER == MSBFirst)
-#define InitializeMergeRop24(alu,pm) {\
-    register int i; \
-    register MfbBits _pm = (pm) & 0xFFFFFF; \
-    mergeRopPtr  _bits = mergeGetRopBits(alu); \
-    MfbBits _bits_ca1 = _bits->ca1; \
-    MfbBits _bits_cx1 = _bits->cx1; \
-    MfbBits _bits_ca2 = _bits->ca2; \
-    MfbBits _bits_cx2 = _bits->cx2; \
-    _pm = (_pm << 8) | (_pm >> 16); \
-    for(i = 0; i < 4; i++){ \
-      _ca1u[i] = _bits_ca1 &  _pm; \
-      _cx1u[i] = _bits_cx1 | ~_pm; \
-      _ca2u[i] = _bits_ca2 &  _pm; \
-      _cx2u[i] = _bits_cx2 &  _pm; \
-      _pm = (_pm << 16)|(_pm >> 8); \
-    } \
-}
-#else	/*(BITMAP_BIT_ORDER == LSBFirst)*/
-#define InitializeMergeRop24(alu,pm) {\
-    register int i; \
-    register MfbBits _pm = (pm) & cfbmask[0]; \
-    mergeRopPtr  _bits = mergeGetRopBits(alu); \
-    MfbBits _bits_ca1 = _bits->ca1 & cfbmask[0]; \
-    MfbBits _bits_cx1 = _bits->cx1 & cfbmask[0]; \
-    MfbBits _bits_ca2 = _bits->ca2 & cfbmask[0]; \
-    MfbBits _bits_cx2 = _bits->cx2 & cfbmask[0]; \
-    _pm |= (_pm << 24); \
-    _bits_ca1 |= (_bits->ca1 << 24); \
-    _bits_cx1 |= (_bits->cx1 << 24); \
-    _bits_ca2 |= (_bits->ca2 << 24); \
-    _bits_cx2 |= (_bits->cx2 << 24); \
-    for(i = 0; i < 4; i++){ \
-      _ca1u[i] = _bits_ca1 &  _pm; \
-      _cx1u[i] = _bits_cx1 | ~_pm; \
-      _ca2u[i] = _bits_ca2 &  _pm; \
-      _cx2u[i] = _bits_cx2 &  _pm; \
-      _pm = (_pm << 16)|(_pm >> 8); \
-    } \
-}
-#endif	/*(BITMAP_BIT_ORDER == MSBFirst)*/
-#endif /* PSZ == 24 */
-#else /* mfb */
-#define InitializeMergeRop(alu,pm) {\
-    mergeRopPtr  _bits; \
-    _bits = mergeGetRopBits(alu); \
-    _ca1 = _bits->ca1; \
-    _cx1 = _bits->cx1; \
-    _ca2 = _bits->ca2; \
-    _cx2 = _bits->cx2; \
-}
-#endif
-
-/* AND has higher precedence than XOR */
-
-#define DoMergeRop(src, dst) \
-    (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2))
-
-#define DoMergeRop24u(src, dst, i)					\
-(((dst) & (((src) & _ca1u[i]) ^ _cx1u[i])) ^ (((src) & _ca2u[i]) ^ _cx2u[i]))
-
-#define DoMaskMergeRop24(src, dst, mask, index)  {\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src0 = (src);\
-	MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
-	MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
-	(((( _src1 |(~mask))<<cfb24Shift[idx])&cfbmask[idx]) ^ \
-	 ((( _src2&(mask))<<cfb24Shift[idx])&cfbmask[idx])))); \
-	idx++; \
-	(dst)++; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \
-	((((_src1 |(~mask))>>cfb24Shift[idx])&cfbmask[idx]) ^ \
-	 (((_src2 &(mask))>>cfb24Shift[idx])&cfbmask[idx])))); \
-	(dst)--; \
-	}
-
-#define DoMaskMergeRop(src, dst, mask) \
-    (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask)))
-
-#define DoMaskMergeRop24u(src, dst, mask, i)							\
-(((dst) & ((((src) & _ca1u[(i)]) ^ _cx1u[(i)]) | ~(mask))) ^ ((((src) & _ca2u[(i)]) ^ _cx2u[(i)]) & (mask)))
-
-#define DoMergeRop24(src,dst,index) {\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src0 = (src);\
-	MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \
-	MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
-	((_src1 << cfb24Shift[idx])&cfbmask[idx])) ^ \
-	((_src2 << cfb24Shift[idx])&cfbmask[idx]))); \
-	idx++; \
-	(dst)++; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \
-	((_src1 >> cfb24Shift[idx])&cfbmask[idx])) ^ \
-	((_src2 >> cfb24Shift[idx])&cfbmask[idx]))); \
-	(dst)--; \
-	}
-
-#define DoPrebuiltMergeRop(dst) (((dst) & _cca) ^ _ccx)
-
-#define DoPrebuiltMergeRop24(dst,index) { \
-	register int idx = ((index) & 3)<< 1; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
-	(( _cca <<cfb24Shift[idx])&cfbmask[idx])) ^ \
-	(( _ccx <<cfb24Shift[idx])&cfbmask[idx]))); \
-	idx++; \
-	(dst)++; \
-	*(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\
-	(( _cca >>cfb24Shift[idx])&cfbmask[idx])) ^ \
-	(( _ccx >>cfb24Shift[idx])&cfbmask[idx]))); \
-	(dst)--; \
-	}
-
-#define DoMaskPrebuiltMergeRop(dst,mask) \
-    (((dst) & (_cca | ~(mask))) ^ (_ccx & (mask)))
-
-#define PrebuildMergeRop(src) ((_cca = ((src) & _ca1) ^ _cx1), \
-			       (_ccx = ((src) & _ca2) ^ _cx2))
-
-#ifndef MROP
-#define MROP 0
-#endif
-
-#define Mclear		(1<<GXclear)
-#define Mand		(1<<GXand)
-#define MandReverse	(1<<GXandReverse)
-#define Mcopy		(1<<GXcopy)
-#define MandInverted	(1<<GXandInverted)
-#define Mnoop		(1<<GXnoop)
-#define Mxor		(1<<GXxor)
-#define Mor		(1<<GXor)
-#define Mnor		(1<<GXnor)
-#define Mequiv		(1<<GXequiv)
-#define Minvert		(1<<GXinvert)
-#define MorReverse	(1<<GXorReverse)
-#define McopyInverted	(1<<GXcopyInverted)
-#define MorInverted	(1<<GXorInverted)
-#define Mnand		(1<<GXnand)
-#define Mset		(1<<GXset)
-
-#define MROP_PIXEL24(pix, idx) \
-	(((*(pix) & cfbmask[(idx)<<1]) >> cfb24Shift[(idx)<<1])| \
-	((*((pix)+1) & cfbmask[((idx)<<1)+1]) << cfb24Shift[((idx)<<1)+1]))
-
-#define MROP_SOLID24P(src,dst,sindex, index) \
-	MROP_SOLID24(MROP_PIXEL24(src,sindex),dst,index)
-
-#define MROP_MASK24P(src,dst,mask,sindex,index)	\
-	MROP_MASK24(MROP_PIXEL24(src,sindex),dst,mask,index)
-
-#if (MROP) == Mcopy
-#define MROP_DECLARE()
-#define MROP_DECLARE_REG()
-#define MROP_INITIALIZE(alu,pm)
-#define MROP_SOLID(src,dst)	(src)
-#define MROP_SOLID24(src,dst,index)	    {\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = (src); \
-	*(dst) = (*(dst) & cfbrmask[idx])|((_src<<cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	*((dst)+1) = (*((dst)+1) & cfbrmask[idx])|((_src>>cfb24Shift[idx])&cfbmask[idx]); \
-	}
-#define MROP_MASK(src,dst,mask)	(((dst) & ~(mask)) | ((src) & (mask)))
-#define MROP_MASK24(src,dst,mask,index)	{\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = (src); \
-	*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
-		(((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
-	idx++; \
-	*((dst)+1) = (*((dst)+1) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
-		(((_src&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \
-	}
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,Copy)
-#endif
-
-#if (MROP) == McopyInverted
-#define MROP_DECLARE()
-#define MROP_DECLARE_REG()
-#define MROP_INITIALIZE(alu,pm)
-#define MROP_SOLID(src,dst)	(~(src))
-#define MROP_SOLID24(src,dst,index)	    {\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = ~(src); \
-	*(dst) = (*(dst) & cfbrmask[idx])|((_src << cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	(dst)++; \
-	*(dst) = (*(dst) & cfbrmask[idx])|((_src >>cfb24Shift[idx])&cfbmask[idx]); \
-	(dst)--; \
-	}
-#define MROP_MASK(src,dst,mask)	(((dst) & ~(mask)) | ((~(src)) & (mask)))
-#define MROP_MASK24(src,dst,mask,index)	{\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = ~(src); \
-	*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \
-		(((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx])); \
-	idx++; \
-	(dst)++; \
-	*(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)>>cfb24Shift[idx])&cfbmask[idx])) | \
-		((((_src & (mask))>>cfb24Shift[idx])&cfbmask[idx])); \
-	(dst)--; \
-	}
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,CopyInverted)
-#endif
-
-#if (MROP) == Mxor
-#define MROP_DECLARE()
-#define MROP_DECLARE_REG()
-#define MROP_INITIALIZE(alu,pm)
-#define MROP_SOLID(src,dst)	((src) ^ (dst))
-#define MROP_SOLID24(src,dst,index)	    {\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = (src); \
-	*(dst) ^= ((_src << cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	(dst)++; \
-	*(dst) ^= ((_src >>cfb24Shift[idx])&cfbmask[idx]); \
-	(dst)--; \
-	}
-#define MROP_MASK(src,dst,mask)	(((src) & (mask)) ^ (dst))
-#define MROP_MASK24(src,dst,mask,index)	{\
-	register int idx = ((index) & 3)<< 1; \
-	*(dst) ^= ((((src)&(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	(dst)++; \
-	*(dst) ^= ((((src)&(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
-	(dst)--; \
-	}
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,Xor)
-#endif
-
-#if (MROP) == Mor
-#define MROP_DECLARE()
-#define MROP_DECLARE_REG()
-#define MROP_INITIALIZE(alu,pm)
-#define MROP_SOLID(src,dst)	((src) | (dst))
-#define MROP_SOLID24(src,dst,index)	    {\
-	register int idx = ((index) & 3)<< 1; \
-	*(dst) |= (((src)<<cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	(dst)++; \
-	*(dst) |= (((src)>>cfb24Shift[idx])&cfbmask[idx]); \
-	(dst)--; \
-	}
-#define MROP_MASK(src,dst,mask)	(((src) & (mask)) | (dst))
-#define MROP_MASK24(src,dst,mask,index)	{\
-	register int idx = ((index) & 3)<< 1; \
-	MfbBits _src = (src); \
-	*(dst) |= (((_src &(mask))<<cfb24Shift[idx])&cfbmask[idx]); \
-	idx++; \
-	(dst)++; \
-	*(dst) |= (((_src &(mask))>>cfb24Shift[idx])&cfbmask[idx]); \
-	(dst)--; \
-	}
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,Or)
-#endif
-
-#if (MROP) == (Mcopy|Mxor|MandReverse|Mor)
-#define MROP_DECLARE()	MfbBits _ca1 = 0, _cx1 = 0;
-#define MROP_DECLARE_REG()	register MROP_DECLARE()
-#define MROP_INITIALIZE(alu,pm)	{ \
-    mergeRopPtr  _bits; \
-    _bits = mergeGetRopBits(alu); \
-    _ca1 = _bits->ca1; \
-    _cx1 = _bits->cx1; \
-}
-#define MROP_SOLID(src,dst) \
-    (((dst) & (((src) & _ca1) ^ _cx1)) ^ (src))
-#define MROP_MASK(src,dst,mask)	\
-    (((dst) & ((((src) & _ca1) ^ _cx1)) | (~(mask)) ^ ((src) & (mask))))
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,CopyXorAndReverseOr)
-#define MROP_PREBUILD(src)	PrebuildMergeRop(src)
-#define MROP_PREBUILT_DECLARE()	DeclarePrebuiltMergeRop()
-#define MROP_PREBUILT_SOLID(src,dst)	DoPrebuiltMergeRop(dst)
-#define MROP_PREBUILT_SOLID24(src,dst,index)	DoPrebuiltMergeRop24(dst,index)
-#define MROP_PREBUILT_MASK(src,dst,mask)    DoMaskPrebuiltMergeRop(dst,mask)
-#define MROP_PREBUILT_MASK24(src,dst,mask,index)    DoMaskPrebuiltMergeRop24(dst,mask,index)
-#endif
-
-#if (MROP) == 0
-#if !defined(PSZ) || (PSZ != 24)
-#define MROP_DECLARE()	DeclareMergeRop()
-#define MROP_DECLARE_REG()	register DeclareMergeRop()
-#define MROP_INITIALIZE(alu,pm)	InitializeMergeRop(alu,pm)
-#define MROP_SOLID(src,dst)	DoMergeRop(src,dst)
-#define MROP_MASK(src,dst,mask)	DoMaskMergeRop(src, dst, mask)
-#else
-#define MROP_DECLARE() \
-        DeclareMergeRop() \
-        DeclareMergeRop24()
-#define MROP_DECLARE_REG() \
-        register DeclareMergeRop()\
-        DeclareMergeRop24()
-#define MROP_INITIALIZE(alu,pm)	\
-        InitializeMergeRop(alu,pm)\
-        InitializeMergeRop24(alu,pm)
-#define MROP_SOLID(src,dst)	DoMergeRop24u(src,dst,((int)(&(dst)-pdstBase) % 3))
-#define MROP_MASK(src,dst,mask)	DoMaskMergeRop24u(src, dst, mask,((int)(&(dst) - pdstBase)%3))
-#endif
-#define MROP_SOLID24(src,dst,index)	DoMergeRop24(src,dst,index)
-#define MROP_MASK24(src,dst,mask,index)	DoMaskMergeRop24(src, dst, mask,index)
-#define MROP_NAME(prefix)	MROP_NAME_CAT(prefix,General)
-#define MROP_PREBUILD(src)	PrebuildMergeRop(src)
-#define MROP_PREBUILT_DECLARE()	DeclarePrebuiltMergeRop()
-#define MROP_PREBUILT_SOLID(src,dst)	DoPrebuiltMergeRop(dst)
-#define MROP_PREBUILT_SOLID24(src,dst,index)	DoPrebuiltMergeRop24(dst,index)
-#define MROP_PREBUILT_MASK(src,dst,mask)    DoMaskPrebuiltMergeRop(dst,mask)
-#define MROP_PREBUILT_MASK24(src,dst,mask,index) \
-	DoMaskPrebuiltMergeRop24(dst,mask,index)
-#endif
-
-#ifndef MROP_PREBUILD
-#define MROP_PREBUILD(src)
-#define MROP_PREBUILT_DECLARE()
-#define MROP_PREBUILT_SOLID(src,dst)	MROP_SOLID(src,dst)
-#define MROP_PREBUILT_SOLID24(src,dst,index)	MROP_SOLID24(src,dst,index)
-#define MROP_PREBUILT_MASK(src,dst,mask)    MROP_MASK(src,dst,mask)
-#define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index)
-#endif
-
-#if !defined(UNIXCPP) || defined(ANSICPP)
-#define MROP_NAME_CAT(prefix,suffix)	prefix##suffix
-#else
-#define MROP_NAME_CAT(prefix,suffix)	prefix/**/suffix
-#endif
-
-#endif
diff --git a/mfb/mfb.h b/mfb/mfb.h
deleted file mode 100644
index 36f1113..0000000
--- a/mfb/mfb.h
+++ /dev/null
@@ -1,1112 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#if !defined(_MFB_H_) || defined(MFB_PROTOTYPES_ONLY)
-#ifndef MFB_PROTOTYPES_ONLY
-#define _MFB_H_
-#endif
-
-/* Monochrome Frame Buffer definitions 
-   written by drewry, september 1986
-*/
-#include "pixmap.h"
-#include "region.h"
-#include "gc.h"
-#include "colormap.h"
-#include "privates.h"
-#include "miscstruct.h"
-#include "mibstore.h"
-
-extern int InverseAlu[];
-extern int mfbGetInverseAlu(int i);
-
-/* warning: PixelType definition duplicated in maskbits.h */
-#ifndef PixelType
-#define PixelType CARD32
-#endif /* PixelType */
-#ifndef MfbBits
-#define MfbBits CARD32
-#endif
-
-/* mfbbitblt.c */
-
-extern void mfbDoBitblt(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-
-extern RegionPtr mfbCopyArea(
-    DrawablePtr /*pSrcDrawable*/,
-    DrawablePtr /*pDstDrawable*/,
-    GCPtr/*pGC*/,
-    int /*srcx*/,
-    int /*srcy*/,
-    int /*width*/,
-    int /*height*/,
-    int /*dstx*/,
-    int /*dsty*/
-);
-
-extern Bool mfbRegisterCopyPlaneProc(
-    ScreenPtr /*pScreen*/,
-    RegionPtr (* /*proc*/)(
-	DrawablePtr         /* pSrcDrawable */,
-	DrawablePtr         /* pDstDrawable */,
-	GCPtr               /* pGC */,
-	int                 /* srcx */,
-	int                 /* srcy */,
-	int                 /* width */,
-	int                 /* height */,
-	int                 /* dstx */,
-	int                 /* dsty */,
-	unsigned long	    /* bitPlane */
-	)
-);
-
-extern RegionPtr mfbCopyPlane(
-    DrawablePtr /*pSrcDrawable*/,
-    DrawablePtr /*pDstDrawable*/,
-    GCPtr/*pGC*/,
-    int /*srcx*/,
-    int /*srcy*/,
-    int /*width*/,
-    int /*height*/,
-    int /*dstx*/,
-    int /*dsty*/,
-    unsigned long /*plane*/
-);
-/* mfbbltC.c */
-
-extern void mfbDoBitbltCopy(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-/* mfbbltCI.c */
-
-extern void mfbDoBitbltCopyInverted(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-/* mfbbltG.c */
-
-extern void mfbDoBitbltGeneral(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-/* mfbbltO.c */
-
-extern void mfbDoBitbltOr(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-/* mfbbltX.c */
-
-extern void mfbDoBitbltXor(
-    DrawablePtr /*pSrc*/,
-    DrawablePtr /*pDst*/,
-    int /*alu*/,
-    RegionPtr /*prgnDst*/,
-    DDXPointPtr /*pptSrc*/
-);
-/* mfbbres.c */
-
-extern void mfbBresS(
-    int /*rop*/,
-    PixelType * /*addrl*/,
-    int /*nlwidth*/,
-    int /*signdx*/,
-    int /*signdy*/,
-    int /*axis*/,
-    int /*x1*/,
-    int /*y1*/,
-    int /*e*/,
-    int /*e1*/,
-    int /*e2*/,
-    int /*len*/
-);
-/* mfbbresd.c */
-
-extern void mfbBresD(
-    int /*fgrop*/,
-    int /*bgrop*/,
-    int * /*pdashIndex*/,
-    unsigned char * /*pDash*/,
-    int /*numInDashList*/,
-    int * /*pdashOffset*/,
-    int /*isDoubleDash*/,
-    PixelType * /*addrl*/,
-    int /*nlwidth*/,
-    int /*signdx*/,
-    int /*signdy*/,
-    int /*axis*/,
-    int /*x1*/,
-    int /*y1*/,
-    int /*e*/,
-    int /*e1*/,
-    int /*e2*/,
-    int /*len*/
-);
-
-/* mfbclip.c */
-
-extern RegionPtr mfbPixmapToRegion(
-    PixmapPtr /*pPix*/
-);
-
-#ifndef MFB_PROTOTYPES_ONLY
-typedef RegionPtr (*mfbPixmapToRegionProc)(PixmapPtr);
-
-extern mfbPixmapToRegionProc *mfbPixmapToRegionWeak(void);
-#endif
-
-/* mfbcmap.c */
-
-extern int mfbListInstalledColormaps(
-    ScreenPtr /*pScreen*/,
-    Colormap * /*pmaps*/
-);
-
-extern void mfbInstallColormap(
-    ColormapPtr /*pmap*/
-);
-
-extern void mfbUninstallColormap(
-    ColormapPtr /*pmap*/
-);
-
-extern void mfbResolveColor(
-    unsigned short * /*pred*/,
-    unsigned short * /*pgreen*/,
-    unsigned short * /*pblue*/,
-    VisualPtr /*pVisual*/
-);
-
-extern Bool mfbCreateColormap(
-    ColormapPtr /*pMap*/
-);
-
-extern void mfbDestroyColormap(
-    ColormapPtr /*pMap*/
-);
-
-extern Bool mfbCreateDefColormap(
-    ScreenPtr /*pScreen*/
-);
-/* mfbfillarc.c */
-
-extern void mfbPolyFillArcSolid(
-    DrawablePtr /*pDraw*/,
-    GCPtr /*pGC*/,
-    int /*narcs*/,
-    xArc * /*parcs*/
-);
-/* mfbfillrct.c */
-
-extern void mfbPolyFillRect(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nrectFill*/,
-    xRectangle * /*prectInit*/
-);
-/* mfbfillsp.c */
-
-extern void mfbBlackSolidFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbWhiteSolidFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbInvertSolidFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbWhiteStippleFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbBlackStippleFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbInvertStippleFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbTileFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbUnnaturalTileFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-
-extern void mfbUnnaturalStippleFS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*nInit*/,
-    DDXPointPtr /*pptInit*/,
-    int * /*pwidthInit*/,
-    int /*fSorted*/
-);
-/* mfbfont.c */
-
-extern Bool mfbRealizeFont(
-    ScreenPtr /*pscr*/,
-    FontPtr /*pFont*/
-);
-
-extern Bool mfbUnrealizeFont(
-    ScreenPtr /*pscr*/,
-    FontPtr /*pFont*/
-);
-
-#ifndef MFB_PROTOTYPES_ONLY
-typedef void (*mfbRealizeFontProc)(ScreenPtr, FontPtr);
-typedef void (*mfbUnrealizeFontProc)(ScreenPtr, FontPtr);
-
-extern mfbRealizeFontProc *mfbRealizeFontWeak(void);
-extern mfbUnrealizeFontProc *mfbUnrealizeFontWeak(void);
-#endif
-
-/* mfbgc.c */
-
-extern Bool mfbCreateGC(
-    GCPtr /*pGC*/
-);
-
-extern void mfbValidateGC(
-    GCPtr /*pGC*/,
-    unsigned long /*changes*/,
-    DrawablePtr /*pDrawable*/
-);
-
-extern int mfbReduceRop(
-    int /*alu*/,
-    Pixel /*src*/
-);
-
-/* mfbgetsp.c */
-
-extern void mfbGetSpans(
-    DrawablePtr /*pDrawable*/,
-    int /*wMax*/,
-    DDXPointPtr /*ppt*/,
-    int * /*pwidth*/,
-    int /*nspans*/,
-    char * /*pdstStart*/
-);
-/* mfbhrzvert.c */
-
-extern void mfbHorzS(
-    int /*rop*/,
-    PixelType * /*addrl*/,
-    int /*nlwidth*/,
-    int /*x1*/,
-    int /*y1*/,
-    int /*len*/
-);
-
-extern void mfbVertS(
-    int /*rop*/,
-    PixelType * /*addrl*/,
-    int /*nlwidth*/,
-    int /*x1*/,
-    int /*y1*/,
-    int /*len*/
-);
-/* mfbigbblak.c */
-
-extern void mfbImageGlyphBltBlack(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbigbwht.c */
-
-extern void mfbImageGlyphBltWhite(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbimage.c */
-
-extern void mfbPutImage(
-    DrawablePtr /*dst*/,
-    GCPtr /*pGC*/,
-    int /*depth*/,
-    int /*x*/,
-    int /*y*/,
-    int /*w*/,
-    int /*h*/,
-    int /*leftPad*/,
-    int /*format*/,
-    char * /*pImage*/
-);
-
-extern void mfbGetImage(
-    DrawablePtr /*pDrawable*/,
-    int /*sx*/,
-    int /*sy*/,
-    int /*w*/,
-    int /*h*/,
-    unsigned int /*format*/,
-    unsigned long /*planeMask*/,
-    char * /*pdstLine*/
-);
-/* mfbline.c */
-
-extern void mfbLineSS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*mode*/,
-    int /*npt*/,
-    DDXPointPtr /*pptInit*/
-);
-
-extern void mfbLineSD(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*mode*/,
-    int /*npt*/,
-    DDXPointPtr /*pptInit*/
-);
-
-/* mfbmisc.c */
-
-extern void mfbQueryBestSize(
-    int /*class*/,
-    unsigned short * /*pwidth*/,
-    unsigned short * /*pheight*/,
-    ScreenPtr /*pScreen*/
-);
-
-#ifndef MFB_PROTOTYPES_ONLY
-typedef void (*mfbQueryBestSizeProc)(int, unsigned short *, unsigned short *,
-                                     ScreenPtr);
-
-extern mfbQueryBestSizeProc *mfbQueryBestSizeWeak(void);
-#endif
-
-/* mfbpablack.c */
-
-extern void mfbSolidBlackArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*nop*/
-);
-
-extern void mfbStippleBlackArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*pstipple*/
-);
-/* mfbpainv.c */
-
-extern void mfbSolidInvertArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*nop*/
-);
-
-extern void mfbStippleInvertArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*pstipple*/
-);
-/* mfbpawhite.c */
-
-extern void mfbSolidWhiteArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*nop*/
-);
-
-extern void mfbStippleWhiteArea(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*pstipple*/
-);
-
-/* mfbpgbinv.c */
-
-extern void mfbPolyGlyphBltBlack(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbpgbinv.c */
-
-extern void mfbPolyGlyphBltInvert(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbpgbwht.c */
-
-extern void mfbPolyGlyphBltWhite(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbpixmap.c */
-
-extern PixmapPtr mfbCreatePixmap(
-    ScreenPtr /*pScreen*/,
-    int /*width*/,
-    int /*height*/,
-    int /*depth*/,
-    unsigned /*usage_hint*/
-);
-
-extern Bool mfbDestroyPixmap(
-    PixmapPtr /*pPixmap*/
-);
-
-extern PixmapPtr mfbCopyPixmap(
-    PixmapPtr /*pSrc*/
-);
-
-extern void mfbPadPixmap(
-    PixmapPtr /*pPixmap*/
-);
-
-extern void mfbXRotatePixmap(
-    PixmapPtr /*pPix*/,
-    int /*rw*/
-);
-
-extern void mfbYRotatePixmap(
-    PixmapPtr /*pPix*/,
-    int /*rh*/
-);
-
-extern void mfbCopyRotatePixmap(
-    PixmapPtr /*psrcPix*/,
-    PixmapPtr * /*ppdstPix*/,
-    int /*xrot*/,
-    int /*yrot*/
-);
-/* mfbplyblack.c */
-
-extern void mfbFillPolyBlack(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*shape*/,
-    int /*mode*/,
-    int /*count*/,
-    DDXPointPtr /*ptsIn*/
-);
-/* mfbplyinv.c */
-
-extern void mfbFillPolyInvert(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*shape*/,
-    int /*mode*/,
-    int /*count*/,
-    DDXPointPtr /*ptsIn*/
-);
-
-/* mfbpntwin.c */
-
-extern void mfbFillPolyWhite(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*shape*/,
-    int /*mode*/,
-    int /*count*/,
-    DDXPointPtr /*ptsIn*/
-);
-/* mfbpolypnt.c */
-
-extern void mfbPolyPoint(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*mode*/,
-    int /*npt*/,
-    xPoint * /*pptInit*/
-);
-/* mfbpushpxl.c */
-
-extern void mfbSolidPP(
-    GCPtr /*pGC*/,
-    PixmapPtr /*pBitMap*/,
-    DrawablePtr /*pDrawable*/,
-    int /*dx*/,
-    int /*dy*/,
-    int /*xOrg*/,
-    int /*yOrg*/
-);
-
-extern void mfbPushPixels(
-    GCPtr /*pGC*/,
-    PixmapPtr /*pBitMap*/,
-    DrawablePtr /*pDrawable*/,
-    int /*dx*/,
-    int /*dy*/,
-    int /*xOrg*/,
-    int /*yOrg*/
-);
-
-#ifndef MFB_PROTOTYPES_ONLY
-typedef void (*mfbPushPixelsProc)(GCPtr, PixmapPtr, DrawablePtr, int, int,
-                                  int, int);
-
-extern mfbPushPixelsProc *mfbPushPixelsWeak(void);
-#endif
-
-/* mfbscrclse.c */
-
-extern Bool mfbCloseScreen(
-    int /*index*/,
-    ScreenPtr /*pScreen*/
-);
-/* mfbscrinit.c */
-
-extern Bool mfbAllocatePrivates(
-    ScreenPtr /*pScreen*/,
-    DevPrivateKey * /*pGCKey*/
-);
-
-extern Bool mfbScreenInit(
-    ScreenPtr /*pScreen*/,
-    pointer /*pbits*/,
-    int /*xsize*/,
-    int /*ysize*/,
-    int /*dpix*/,
-    int /*dpiy*/,
-    int /*width*/
-);
-
-extern PixmapPtr mfbGetWindowPixmap(
-    WindowPtr /*pWin*/
-);
-
-extern void mfbSetWindowPixmap(
-    WindowPtr /*pWin*/,
-    PixmapPtr /*pPix*/
-);
-
-extern void mfbFillInScreen(ScreenPtr pScreen);
-
-/* mfbseg.c */
-
-extern void mfbSegmentSS(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nseg*/,
-    xSegment * /*pSeg*/
-);
-
-extern void mfbSegmentSD(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    int /*nseg*/,
-    xSegment * /*pSeg*/
-);
-/* mfbsetsp.c */
-
-extern void mfbSetScanline(
-    int /*y*/,
-    int /*xOrigin*/,
-    int /*xStart*/,
-    int /*xEnd*/,
-    PixelType * /*psrc*/,
-    int /*alu*/,
-    PixelType * /*pdstBase*/,
-    int /*widthDst*/
-);
-
-extern void mfbSetSpans(
-    DrawablePtr /*pDrawable*/,
-    GCPtr /*pGC*/,
-    char * /*psrc*/,
-    DDXPointPtr /*ppt*/,
-    int * /*pwidth*/,
-    int /*nspans*/,
-    int /*fSorted*/
-);
-/* mfbteblack.c */
-
-extern void mfbTEGlyphBltBlack(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbtewhite.c */
-
-extern void mfbTEGlyphBltWhite(
-    DrawablePtr /*pDrawable*/,
-    GCPtr/*pGC*/,
-    int /*x*/,
-    int /*y*/,
-    unsigned int /*nglyph*/,
-    CharInfoPtr * /*ppci*/,
-    pointer /*pglyphBase*/
-);
-/* mfbtileC.c */
-
-extern void mfbTileAreaPPWCopy(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*ptile*/
-);
-/* mfbtileG.c */
-
-extern void mfbTileAreaPPWGeneral(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*ptile*/
-);
-
-extern void mfbTileAreaPPW(
-    DrawablePtr /*pDraw*/,
-    int /*nbox*/,
-    BoxPtr /*pbox*/,
-    int /*alu*/,
-    PixmapPtr /*ptile*/
-);
-/* mfbwindow.c */
-
-extern Bool mfbCreateWindow(
-    WindowPtr /*pWin*/
-);
-
-extern Bool mfbDestroyWindow(
-    WindowPtr /*pWin*/
-);
-
-extern Bool mfbMapWindow(
-    WindowPtr /*pWindow*/
-);
-
-extern Bool mfbPositionWindow(
-    WindowPtr /*pWin*/,
-    int /*x*/,
-    int /*y*/
-);
-
-extern Bool mfbUnmapWindow(
-    WindowPtr /*pWindow*/
-);
-
-extern void mfbCopyWindow(
-    WindowPtr /*pWin*/,
-    DDXPointRec /*ptOldOrg*/,
-    RegionPtr /*prgnSrc*/
-);
-
-extern Bool mfbChangeWindowAttributes(
-    WindowPtr /*pWin*/,
-    unsigned long /*mask*/
-);
-/* mfbzerarc.c */
-
-extern void mfbZeroPolyArcSS(
-    DrawablePtr /*pDraw*/,
-    GCPtr /*pGC*/,
-    int /*narcs*/,
-    xArc * /*parcs*/
-);
-
-#ifndef MFB_PROTOTYPES_ONLY
-/*
-   private filed of pixmap
-   pixmap.devPrivate = (PixelType *)pointer_to_bits
-   pixmap.devKind = width_of_pixmap_in_bytes
-
-   private field of screen
-   a pixmap, for which we allocate storage.  devPrivate is a pointer to
-the bits in the hardware framebuffer.  note that devKind can be poked to
-make the code work for framebuffers that are wider than their
-displayable screen (e.g. the early vsII, which displayed 960 pixels
-across, but was 1024 in the hardware.)
-
-   private field of GC 
-*/
-typedef void (*mfbFillAreaProcPtr)(
-	      DrawablePtr /*pDraw*/,
-	      int /*nbox*/,
-	      BoxPtr /*pbox*/,
-	      int /*alu*/,
-	      PixmapPtr /*nop*/
-	      );
-
-typedef struct {
-    unsigned char	rop;		/* reduction of rasterop to 1 of 3 */
-    unsigned char	ropOpStip;	/* rop for opaque stipple */
-    unsigned char	ropFillArea;	/*  == alu, rop, or ropOpStip */
-    unsigned char	unused1[sizeof(long) - 3];	/* Alignment */
-    mfbFillAreaProcPtr 	FillArea;	/* fills regions; look at the code */
-    } mfbPrivGC;
-typedef mfbPrivGC	*mfbPrivGCPtr;
-#endif
-
-extern DevPrivateKey mfbGetGCPrivateKey(void);
-#ifdef PIXMAP_PER_WINDOW
-extern DevPrivateKey frameGetWindowPrivateKey(void);
-#endif
-
-#ifndef MFB_PROTOTYPES_ONLY
-/* Common macros for extracting drawing information */
-
-#define mfbGetTypedWidth(pDrawable,wtype) (\
-    (((pDrawable)->type == DRAWABLE_WINDOW) ? \
-     (int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \
-     (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
-
-#define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char)
-
-#define mfbGetPixelWidth(pDrawable) mfbGetTypedWidth(pDrawable, PixelType)
-    
-#define mfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
-    PixmapPtr   _pPix; \
-    if ((pDrawable)->type == DRAWABLE_WINDOW) \
-	_pPix = (PixmapPtr) (pDrawable)->pScreen->devPrivate; \
-    else \
-	_pPix = (PixmapPtr) (pDrawable); \
-    (pointer) = (ptype *) _pPix->devPrivate.ptr; \
-    (width) = ((int) _pPix->devKind) / sizeof (wtype); \
-}
-
-#define mfbGetByteWidthAndPointer(pDrawable, width, pointer) \
-    mfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char)
-
-#define mfbGetPixelWidthAndPointer(pDrawable, width, pointer) \
-    mfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
-
-#define mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
-    PixmapPtr	_pPix = (PixmapPtr) (pWin)->drawable.pScreen->devPrivate; \
-    (pointer) = (ptype *) _pPix->devPrivate.ptr; \
-    (width) = ((int) _pPix->devKind) / sizeof (wtype); \
-}
-
-#define mfbGetWindowPixelWidthAndPointer(pWin, width, pointer) \
-    mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType)
-
-#define mfbGetWindowByteWidthAndPointer(pWin, width, pointer) \
-    mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char)
-
-/*  mfb uses the following macros to calculate addresses in drawables.
- *  To support banked framebuffers, the macros come in four flavors.
- *  All four collapse into the same definition on unbanked devices.
- *  
- *  mfbScanlineFoo - calculate address and do bank switching
- *  mfbScanlineFooNoBankSwitch - calculate address, don't bank switch
- *  mfbScanlineFooSrc - calculate address, switch source bank
- *  mfbScanlineFooDst - calculate address, switch destination bank
- */
-
-/* The NoBankSwitch versions are the same for banked and unbanked cases */
-
-#define mfbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off)
-#define mfbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off))
-#define mfbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \
-    mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w))
-#define mfbScanlineNoBankSwitch(_ptr, _x, _y, _w) \
-    mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
-
-#ifdef MFB_LINE_BANK
-
-#include "mfblinebank.h" /* get macro definitions from this file */
-
-#else /* !MFB_LINE_BANK - unbanked case */
-
-#define mfbScanlineInc(_ptr, _off)       mfbScanlineIncNoBankSwitch(_ptr, _off)
-#define mfbScanlineIncSrc(_ptr, _off)     mfbScanlineInc(_ptr, _off)
-#define mfbScanlineIncDst(_ptr, _off)     mfbScanlineInc(_ptr, _off)
-
-#define mfbScanlineOffset(_ptr, _off) mfbScanlineOffsetNoBankSwitch(_ptr, _off)
-#define mfbScanlineOffsetSrc(_ptr, _off)  mfbScanlineOffset(_ptr, _off)
-#define mfbScanlineOffsetDst(_ptr, _off)  mfbScanlineOffset(_ptr, _off)
-
-#define mfbScanlineSrc(_ptr, _x, _y, _w)  mfbScanline(_ptr, _x, _y, _w)
-#define mfbScanlineDst(_ptr, _x, _y, _w)  mfbScanline(_ptr, _x, _y, _w)
-
-#define mfbScanlineDeltaSrc(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
-#define mfbScanlineDeltaDst(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w)
-
-#endif /* MFB_LINE_BANK */
-
-#define mfbScanlineDelta(_ptr, _y, _w) \
-    mfbScanlineOffset(_ptr, (_y) * (_w))
-
-#define mfbScanline(_ptr, _x, _y, _w) \
-    mfbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH))
-
-
-/* precomputed information about each glyph for GlyphBlt code.
-   this saves recalculating the per glyph information for each box.
-*/
-typedef struct _pos{
-    int xpos;		/* xposition of glyph's origin */
-    int xchar;		/* x position mod 32 */
-    int leftEdge;
-    int rightEdge;
-    int topEdge;
-    int bottomEdge;
-    PixelType *pdstBase;	/* longword with character origin */
-    int widthGlyph;	/* width in bytes of this glyph */
-} TEXTPOS;
-
-/* reduced raster ops for mfb */
-#define RROP_BLACK	GXclear
-#define RROP_WHITE	GXset
-#define RROP_NOP	GXnoop
-#define RROP_INVERT	GXinvert
-
-/* macros for mfbbitblt.c, mfbfillsp.c
-   these let the code do one switch on the rop per call, rather
-than a switch on the rop per item (span or rectangle.)
-*/
-
-#define fnCLEAR(src, dst)	(0)
-#define fnAND(src, dst) 	(src & dst)
-#define fnANDREVERSE(src, dst)	(src & ~dst)
-#define fnCOPY(src, dst)	(src)
-#define fnANDINVERTED(src, dst)	(~src & dst)
-#define fnNOOP(src, dst)	(dst)
-#define fnXOR(src, dst)		(src ^ dst)
-#define fnOR(src, dst)		(src | dst)
-#define fnNOR(src, dst)		(~(src | dst))
-#define fnEQUIV(src, dst)	(~src ^ dst)
-#define fnINVERT(src, dst)	(~dst)
-#define fnORREVERSE(src, dst)	(src | ~dst)
-#define fnCOPYINVERTED(src, dst)(~src)
-#define fnORINVERTED(src, dst)	(~src | dst)
-#define fnNAND(src, dst)	(~(src & dst))
-#undef fnSET
-#define fnSET(src, dst)		(MfbBits)(~0)
-
-/*  Using a "switch" statement is much faster in most cases
- *  since the compiler can do a look-up table or multi-way branch
- *  instruction, depending on the architecture.  The result on
- *  A Sun 3/50 is at least 2.5 times faster, assuming a uniform
- *  distribution of RasterOp operation types.
- *
- *  However, doing some profiling on a running system reveals
- *  GXcopy is the operation over 99.5% of the time and
- *  GXxor is the next most frequent (about .4%), so we make special
- *  checks for those first.
- *
- *  Note that this requires a change to the "calling sequence"
- *  since we can't engineer a "switch" statement to have an lvalue.
- */
-#undef DoRop
-#define DoRop(result, alu, src, dst) \
-{ \
-    if (alu == GXcopy) \
-	result = fnCOPY (src, dst); \
-    else if (alu == GXxor) \
-        result = fnXOR (src, dst); \
-    else \
-	switch (alu) \
-	{ \
-	  case GXclear: \
-	    result = fnCLEAR (src, dst); \
-	    break; \
-	  case GXand: \
-	    result = fnAND (src, dst); \
-	    break; \
-	  case GXandReverse: \
-	    result = fnANDREVERSE (src, dst); \
-	    break; \
-	  case GXandInverted: \
-	    result = fnANDINVERTED (src, dst); \
-	    break; \
-	  default: \
-	  case GXnoop: \
-	    result = fnNOOP (src, dst); \
-	    break; \
-	  case GXor: \
-	    result = fnOR (src, dst); \
-	    break; \
-	  case GXnor: \
-	    result = fnNOR (src, dst); \
-	    break; \
-	  case GXequiv: \
-	    result = fnEQUIV (src, dst); \
-	    break; \
-	  case GXinvert: \
-	    result = fnINVERT (src, dst); \
-	    break; \
-	  case GXorReverse: \
-	    result = fnORREVERSE (src, dst); \
-	    break; \
-	  case GXcopyInverted: \
-	    result = fnCOPYINVERTED (src, dst); \
-	    break; \
-	  case GXorInverted: \
-	    result = fnORINVERTED (src, dst); \
-	    break; \
-	  case GXnand: \
-	    result = fnNAND (src, dst); \
-	    break; \
-	  case GXset: \
-	    result = fnSET (src, dst); \
-	    break; \
-	} \
-}
-
-
-/*  C expression fragments for various operations.  These get passed in
- *  as -D's on the compile command line.  See mfb/Imakefile.  This
- *  fixes XBUG 6319.
- *
- *  This seems like a good place to point out that mfb's use of the
- *  words black and white is an unfortunate misnomer.  In mfb code, black
- *  means zero, and white means one.
- */
-#define MFB_OPEQ_WHITE  |=
-#define MFB_OPEQ_BLACK  &=~
-#define MFB_OPEQ_INVERT ^=
-#define MFB_EQWHOLEWORD_WHITE   =~0
-#define MFB_EQWHOLEWORD_BLACK   =0
-#define MFB_EQWHOLEWORD_INVERT  ^=~0
-#define MFB_OP_WHITE    /* nothing */
-#define MFB_OP_BLACK    ~
-
-#endif /* MFB_PROTOTYPES_ONLY */
-#endif /* _MFB_H_ */
diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c
deleted file mode 100644
index 344c655..0000000
--- a/mfb/mfbbitblt.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-
-#include <stdlib.h>
-
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "mi.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-
-/* CopyArea and CopyPlane for a monchrome frame buffer
-
-
-    clip the source rectangle to the source's available bits.  (this
-avoids copying unnecessary pieces that will just get exposed anyway.)
-this becomes the new shape of the destination.
-    clip the destination region to the composite clip in the
-GC.  this requires translating the destination region to (dstx, dsty).
-    build a list of source points, one for each rectangle in the
-destination.  this is a simple translation.
-    go do the multiple rectangle copies
-    do graphics exposures
-*/
-/** Optimized for drawing pixmaps into windows, especially when drawing into
- ** unobscured windows.  Calls to the general-purpose region code were
- ** replaced with rectangle-to-rectangle clipping comparisions.  This is
- ** possible, since the pixmap is a single rectangle.  In an unobscured
- ** window, the destination clip is also a single rectangle, and region
- ** code can be avoided entirely.  This is a big savings, since the region
- ** code uses XAlloc() and makes many function calls.
- **
- ** In addition, if source is a pixmap, there is no need to call the
- ** expensive miHandleExposures() routine.  Instead, we simply return NULL.
- **
- ** Previously, drawing a pixmap into an unobscured window executed at least
- ** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code.
- **
- ** Now, the same operation requires no XAlloc()'s, no region function calls,
- ** and much less overhead.  Nice for drawing lots of small pixmaps.
- */
- 
-
-void
-mfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc)
-    DrawablePtr	    pSrc, pDst;
-    int		    alu;
-    RegionPtr	    prgnDst;
-    DDXPointPtr	    pptSrc;
-{
-    switch (alu)
-    {
-    case GXcopy:
-	mfbDoBitbltCopy (pSrc, pDst, alu, prgnDst, pptSrc);
-	break;
-    case GXxor:
-	mfbDoBitbltXor (pSrc, pDst, alu, prgnDst, pptSrc);
-	break;
-    case GXcopyInverted:
-	mfbDoBitbltCopyInverted (pSrc, pDst, alu, prgnDst, pptSrc);
-	break;
-    case GXor:
-	mfbDoBitbltOr (pSrc, pDst, alu, prgnDst, pptSrc);
-	break;
-    default:
-	mfbDoBitbltGeneral (pSrc, pDst, alu, prgnDst, pptSrc);
-	break;
-    }
-}
-
-RegionPtr
-mfbCopyArea(pSrcDrawable, pDstDrawable,
-	    pGC, srcx, srcy, width, height, dstx, dsty)
-register DrawablePtr pSrcDrawable;
-register DrawablePtr pDstDrawable;
-register GC *pGC;
-int srcx, srcy;
-int width, height;
-int dstx, dsty;
-{
-    RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
-    Bool freeSrcClip = FALSE;
-
-    RegionPtr prgnExposed;
-    RegionRec rgnDst;
-    DDXPointPtr pptSrc;
-    register DDXPointPtr ppt;
-    register BoxPtr pbox;
-    int i;
-    register int dx;
-    register int dy;
-    xRectangle origSource;
-    DDXPointRec origDest;
-    int numRects;
-    BoxRec fastBox;
-    int fastClip = 0;		/* for fast clipping with pixmap source */
-    int fastExpose = 0;		/* for fast exposures with pixmap source */
-    void (*localDoBitBlt)(
-	DrawablePtr /*pSrc*/,
-	DrawablePtr /*pDst*/,
-	int /*alu*/,
-	RegionPtr /*prgnDst*/,
-	DDXPointPtr /*pptSrc*/);
-
-    origSource.x = srcx;
-    origSource.y = srcy;
-    origSource.width = width;
-    origSource.height = height;
-    origDest.x = dstx;
-    origDest.y = dsty;
-
-    if ((pSrcDrawable != pDstDrawable) &&
-	pSrcDrawable->pScreen->SourceValidate)
-    {
-	(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
-    }
-
-    switch (pGC->alu) {
-    case GXcopy:
-	localDoBitBlt = mfbDoBitbltCopy;
-	break;
-    case GXcopyInverted:
-	localDoBitBlt = mfbDoBitbltCopyInverted;
-	break;
-    case GXxor:
-	localDoBitBlt = mfbDoBitbltXor;
-	break;
-    case GXor:
-	localDoBitBlt = mfbDoBitbltOr;
-	break;
-    default:
-	localDoBitBlt = mfbDoBitbltGeneral;
-	break;
-    }
-
-    srcx += pSrcDrawable->x;
-    srcy += pSrcDrawable->y;
-
-    /* clip the source */
-
-    if (pSrcDrawable->type == DRAWABLE_PIXMAP)
-    {
-	if ((pSrcDrawable == pDstDrawable) &&
-	    (pGC->clientClipType == CT_NONE))
-	{
-	    prgnSrcClip = pGC->pCompositeClip;
-	}
-	else
-	{
-	    fastClip = 1;
-	}
-    }
-    else
-    {
-	if (pGC->subWindowMode == IncludeInferiors)
-	{
-	    if (!((WindowPtr) pSrcDrawable)->parent)
-	    {
-		/*
-		 * special case bitblt from root window in
-		 * IncludeInferiors mode; just like from a pixmap
-		 */
-		fastClip = 1;
-	    }
-	    else if ((pSrcDrawable == pDstDrawable) &&
-		(pGC->clientClipType == CT_NONE))
-	    {
-		prgnSrcClip = pGC->pCompositeClip;
-	    }
-	    else
-	    {
-		prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
-		freeSrcClip = TRUE;
-	    }
-	}
-	else
-	{
-	    prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
-	}
-    }
-
-    fastBox.x1 = srcx;
-    fastBox.y1 = srcy;
-    fastBox.x2 = srcx + width;
-    fastBox.y2 = srcy + height;
-
-    /* Don't create a source region if we are doing a fast clip */
-    if (fastClip)
-    {
-	fastExpose = 1;
-	/*
-	 * clip the source; if regions extend beyond the source size,
- 	 * make sure exposure events get sent
-	 */
-	if (fastBox.x1 < pSrcDrawable->x)
-	{
-	    fastBox.x1 = pSrcDrawable->x;
-	    fastExpose = 0;
-	}
-	if (fastBox.y1 < pSrcDrawable->y)
-	{
-	    fastBox.y1 = pSrcDrawable->y;
-	    fastExpose = 0;
-	}
-	if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
-	{
-	    fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
-	    fastExpose = 0;
-	}
-	if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
-	{
-	    fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
-	    fastExpose = 0;
-	}
-    }
-    else
-    {
-	REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
-    }
-
-    dstx += pDstDrawable->x;
-    dsty += pDstDrawable->y;
-
-    if (pDstDrawable->type == DRAWABLE_WINDOW)
-    {
-	if (!((WindowPtr)pDstDrawable)->realized)
-	{
-	    if (!fastClip)
-		REGION_UNINIT(pGC->pScreen, &rgnDst);
-	    if (freeSrcClip)
-		REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-	    return NULL;
-	}
-    }
-
-    dx = srcx - dstx;
-    dy = srcy - dsty;
-
-    /* Translate and clip the dst to the destination composite clip */
-    if (fastClip)
-    {
-	RegionPtr cclip;
-
-        /* Translate the region directly */
-        fastBox.x1 -= dx;
-        fastBox.x2 -= dx;
-        fastBox.y1 -= dy;
-        fastBox.y2 -= dy;
-
-	/* If the destination composite clip is one rectangle we can
-	   do the clip directly.  Otherwise we have to create a full
-	   blown region and call intersect */
-	cclip = pGC->pCompositeClip;
-        if (REGION_NUM_RECTS(cclip) == 1)
-        {
-	    BoxPtr pBox = REGION_RECTS(cclip);
-
-	    if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
-	    if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
-	    if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
-	    if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
-	    /* Check to see if the region is empty */
-	    if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
-	    {
-		REGION_NULL(pGC->pScreen, &rgnDst);
-	    }
-	    else
-	    {
-		REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	    }
-	}
-        else
-	{
-	    /* We must turn off fastClip now, since we must create
-	       a full blown region.  It is intersected with the
-	       composite clip below. */
-	    fastClip = 0;
-	    REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
-	}
-    }
-    else
-    {
-        REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
-    }
-
-    if (!fastClip)
-    {
-	REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
-    }
-
-    /* Do bit blitting */
-    numRects = REGION_NUM_RECTS(&rgnDst);
-    if (numRects && width && height)
-    {
-	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
-						  sizeof(DDXPointRec))))
-	{
-	    REGION_UNINIT(pGC->pScreen, &rgnDst);
-	    if (freeSrcClip)
-		REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-	    return NULL;
-	}
-	pbox = REGION_RECTS(&rgnDst);
-	ppt = pptSrc;
-	for (i = numRects; --i >= 0; pbox++, ppt++)
-	{
-	    ppt->x = pbox->x1 + dx;
-	    ppt->y = pbox->y1 + dy;
-	}
-    
-	if (pGC->planemask & 1)
-	    (*localDoBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc);
-
-	xfree(pptSrc);
-    }
-
-    prgnExposed = NULL;
-    if (pGC->fExpose) 
-    {
-        /* Pixmap sources generate a NoExposed (we return NULL to do this) */
-        if (!fastExpose)
-	    prgnExposed =
-		miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
-				  origSource.x, origSource.y,
-				  (int)origSource.width,
-				  (int)origSource.height,
-				  origDest.x, origDest.y, (unsigned long)0);
-    }
-    REGION_UNINIT(pGC->pScreen, &rgnDst);
-    if (freeSrcClip)
-	REGION_DESTROY(pGC->pScreen, prgnSrcClip);
-    return prgnExposed;
-}
-
-
-/*
- * Devices which use mfb for 1-bit pixmap support
- * must register a function for n-to-1 copy operations
- */
-
-static DevPrivateKey copyPlaneScreenKey = &copyPlaneScreenKey;
-
-Bool
-mfbRegisterCopyPlaneProc (pScreen, proc)
-    ScreenPtr	pScreen;
-    RegionPtr	(*proc)(
-        DrawablePtr         /* pSrcDrawable */,
-        DrawablePtr         /* pDstDrawable */,
-        GCPtr               /* pGC */,
-        int                 /* srcx */,
-        int                 /* srcy */,
-        int                 /* width */,
-        int                 /* height */,
-        int                 /* dstx */,
-        int                 /* dsty */,
-        unsigned long       /* bitPlane */);
-{
-    dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc);
-    return TRUE;
-}
-
-/*
-    if fg == 1 and bg ==0, we can do an ordinary CopyArea.
-    if fg == bg, we can do a CopyArea with alu = mfbReduceRop(alu, fg)
-    if fg == 0 and bg == 1, we use the same rasterop, with
-	source operand inverted.
-
-    CopyArea deals with all of the graphics exposure events.
-    This code depends on knowing that we can change the
-alu in the GC without having to call ValidateGC() before calling
-CopyArea().
-
-*/
-
-
-RegionPtr
-mfbCopyPlane(pSrcDrawable, pDstDrawable,
-	    pGC, srcx, srcy, width, height, dstx, dsty, plane)
-DrawablePtr pSrcDrawable, pDstDrawable;
-register GC *pGC;
-int srcx, srcy;
-int width, height;
-int dstx, dsty;
-unsigned long plane;
-{
-    int alu;
-    RegionPtr	prgnExposed;
-    RegionPtr	(*copyPlane)(
-        DrawablePtr         /* pSrcDrawable */,
-        DrawablePtr         /* pDstDrawable */,
-        GCPtr               /* pGC */,
-        int                 /* srcx */,
-        int                 /* srcy */,
-        int                 /* width */,
-        int                 /* height */,
-        int                 /* dstx */,
-        int                 /* dsty */,
-        unsigned long       /* bitPlane */);
-
-
-    if (pSrcDrawable->depth != 1)
-    {
-	if ((copyPlane = dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates,
-					  copyPlaneScreenKey)))
-	{
-	    return (*copyPlane) (pSrcDrawable, pDstDrawable,
-			   pGC, srcx, srcy, width, height, dstx, dsty, plane);
-	}  
-	else
-	{
-	    FatalError ("No copyPlane proc registered for depth %d\n",
-			pSrcDrawable->depth);
-	}
-    }
-    if (plane != 1)
-	return NULL;
-
-    if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0)
-    {
-	prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
-			 pGC, srcx, srcy, width, height, dstx, dsty);
-    }
-    else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))
-    {
-	alu = pGC->alu;
-	pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel);
-	prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
-			 pGC, srcx, srcy, width, height, dstx, dsty);
-	pGC->alu = alu;
-    }
-    else /* need to invert the src */
-    {
-	alu = pGC->alu;
-	pGC->alu = InverseAlu[alu];
-	prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
-			 pGC, srcx, srcy, width, height, dstx, dsty);
-	pGC->alu = alu;
-    }
-    return prgnExposed;
-}
-
diff --git a/mfb/mfbblt.c b/mfb/mfbblt.c
deleted file mode 100644
index b87a697..0000000
--- a/mfb/mfbblt.c
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
- * mfb copy area
- */
-
-/*
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Author: Keith Packard
-
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include	<X11/X.h>
-#include	<X11/Xmd.h>
-#include	<X11/Xproto.h>
-#include	"mfb.h"
-#include	"gcstruct.h"
-#include	"windowstr.h"
-#include	"scrnintstr.h"
-#include	"pixmapstr.h"
-#include	"regionstr.h"
-#include	"maskbits.h"
-#include	"fastblt.h"
-#include	"mergerop.h"
-
-void
-MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc)
-    DrawablePtr	    pSrc, pDst;
-    int		    alu;
-    RegionPtr	    prgnDst;
-    DDXPointPtr	    pptSrc;
-{
-    PixelType *psrcBase, *pdstBase;	
-				/* start of src and dst bitmaps */
-    int widthSrc, widthDst;	/* add to get to same position in next line */
-
-    BoxPtr pbox;
-    int nbox;
-
-    BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
-				/* temporaries for shuffling rectangles */
-    DDXPointPtr pptTmp, pptNew1, pptNew2;
-				/* shuffling boxes entails shuffling the
-				   source points too */
-    int w, h;
-    int xdir;			/* 1 = left right, -1 = right left/ */
-    int ydir;			/* 1 = top down, -1 = bottom up */
-
-    PixelType *psrcLine, *pdstLine;	
-				/* pointers to line with current src and dst */
-    register PixelType *psrc;/* pointer to current src longword */
-    register PixelType *pdst;/* pointer to current dst longword */
-
-    MROP_DECLARE_REG()
-
-				/* following used for looping through a line */
-    PixelType startmask, endmask;	/* masks for writing ends of dst */
-    int nlMiddle;		/* whole longwords in dst */
-    int xoffSrc, xoffDst;
-    register int leftShift, rightShift;
-    register PixelType bits;
-    register PixelType bits1;
-    register int nl;		/* temp copy of nlMiddle */
-    int careful;
-
-    MROP_INITIALIZE(alu,0);
-
-    mfbGetPixelWidthAndPointer(pSrc, widthSrc, psrcBase);
-
-    mfbGetPixelWidthAndPointer(pDst, widthDst, pdstBase);
-
-    /* XXX we have to err on the side of safety when both are windows,
-     * because we don't know if IncludeInferiors is being used.
-     */
-    careful = ((pSrc == pDst) ||
-	       ((pSrc->type == DRAWABLE_WINDOW) &&
-		(pDst->type == DRAWABLE_WINDOW)));
-
-    pbox = REGION_RECTS(prgnDst);
-    nbox = REGION_NUM_RECTS(prgnDst);
-
-    pboxNew1 = NULL;
-    pptNew1 = NULL;
-    pboxNew2 = NULL;
-    pptNew2 = NULL;
-    if (careful && (pptSrc->y < pbox->y1))
-    {
-        /* walk source botttom to top */
-	ydir = -1;
-	widthSrc = -widthSrc;
-	widthDst = -widthDst;
-
-	if (nbox > 1)
-	{
-	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
-	    if(!pboxNew1)
-		return;
-	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
-	    if(!pptNew1)
-	    {
-	        xfree(pboxNew1);
-	        return;
-	    }
-	    pboxBase = pboxNext = pbox+nbox-1;
-	    while (pboxBase >= pbox)
-	    {
-	        while ((pboxNext >= pbox) &&
-		       (pboxBase->y1 == pboxNext->y1))
-		    pboxNext--;
-	        pboxTmp = pboxNext+1;
-	        pptTmp = pptSrc + (pboxTmp - pbox);
-	        while (pboxTmp <= pboxBase)
-	        {
-		    *pboxNew1++ = *pboxTmp++;
-		    *pptNew1++ = *pptTmp++;
-	        }
-	        pboxBase = pboxNext;
-	    }
-	    pboxNew1 -= nbox;
-	    pbox = pboxNew1;
-	    pptNew1 -= nbox;
-	    pptSrc = pptNew1;
-        }
-    }
-    else
-    {
-	/* walk source top to bottom */
-	ydir = 1;
-    }
-
-    if (careful && (pptSrc->x < pbox->x1))
-    {
-	/* walk source right to left */
-        xdir = -1;
-
-	if (nbox > 1)
-	{
-	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
-	    if(!pboxNew2 || !pptNew2)
-	    {
-		if (pptNew2) xfree(pptNew2);
-		if (pboxNew2) xfree(pboxNew2);
-		if (pboxNew1)
-		{
-		    xfree(pptNew1);
-		    xfree(pboxNew1);
-		}
-	        return;
-	    }
-	    pboxBase = pboxNext = pbox;
-	    while (pboxBase < pbox+nbox)
-	    {
-	        while ((pboxNext < pbox+nbox) &&
-		       (pboxNext->y1 == pboxBase->y1))
-		    pboxNext++;
-	        pboxTmp = pboxNext;
-	        pptTmp = pptSrc + (pboxTmp - pbox);
-	        while (pboxTmp != pboxBase)
-	        {
-		    *pboxNew2++ = *--pboxTmp;
-		    *pptNew2++ = *--pptTmp;
-	        }
-	        pboxBase = pboxNext;
-	    }
-	    pboxNew2 -= nbox;
-	    pbox = pboxNew2;
-	    pptNew2 -= nbox;
-	    pptSrc = pptNew2;
-	}
-    }
-    else
-    {
-	/* walk source left to right */
-        xdir = 1;
-    }
-
-    while(nbox--)
-    {
-	w = pbox->x2 - pbox->x1;
-	h = pbox->y2 - pbox->y1;
-
-	if (ydir == -1) /* start at last scanline of rectangle */
-	{
-	    psrcLine = mfbScanlineDeltaSrc(psrcBase, -(pptSrc->y+h-1), widthSrc);
-	    pdstLine = mfbScanlineDeltaDst(pdstBase, -(pbox->y2-1), widthDst);
-	}
-	else /* start at first scanline */
-	{
-	    psrcLine = mfbScanlineDeltaSrc(psrcBase, pptSrc->y, widthSrc);
-	    pdstLine = mfbScanlineDeltaDst(pdstBase, pbox->y1, widthDst);
-	}
-	if ((pbox->x1 & PIM) + w <= PPW)
-	{
-	    maskpartialbits (pbox->x1, w, startmask);
-	    endmask = 0;
-	    nlMiddle = 0;
-	}
-	else
-	{
-	    maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
-	}
-	if (xdir == 1)
-	{
-	    xoffSrc = pptSrc->x & PIM;
-	    xoffDst = pbox->x1 & PIM;
-	    pdstLine += (pbox->x1 >> PWSH);
-	    psrcLine += (pptSrc->x >> PWSH);
-#ifdef DO_UNALIGNED_BITBLT
-	    nl = xoffSrc - xoffDst;
-	    psrcLine = (PixelType *)
-			(((unsigned char *) psrcLine) + nl);
-#else
-	    if (xoffSrc == xoffDst)
-#endif
-	    {
-		while (h--)
-		{
-		    psrc = psrcLine;
-		    pdst = pdstLine;
-		    if (startmask)
-		    {
-			*pdst = MROP_MASK(*psrc, *pdst, startmask);
-			psrc++;
-			pdst++;
-		    }
-		    nl = nlMiddle;
-
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
-		    psrc += nl & (UNROLL-1);
-		    pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n)  *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
-#define BodyEven(n) BodyOdd(n)
-
-#define LoopReset   ;
-
-#endif
-		    PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-#ifdef NOTDEF
-		    /* you'd think this would be faster --
-		     * a single instruction instead of 6
-		     * but measurements show it to be ~15% slower
-		     */
-		    while ((nl -= 6) >= 0)
-		    {
-			asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
-			     : "=m" (*(char *)pdst)
-			     : "m" (*(char *)psrc)
-			     : "d0", "d1", "d2", "d3",
-			       "a2", "a3");
-			pdst += 6;
-		    }
-		    nl += 6;
-		    while (nl--)
-			*pdst++ = *psrc++;
-#endif
-		    DuffL(nl, label1,
-			    *pdst = MROP_SOLID (*psrc, *pdst);
-			    pdst++; psrc++;)
-#endif
-
-		    if (endmask)
-			*pdst = MROP_MASK(*psrc, *pdst, endmask);
-		    mfbScanlineIncDst(pdstLine, widthDst);
-		    mfbScanlineIncSrc(psrcLine, widthSrc);
-		}
-	    }
-#ifndef DO_UNALIGNED_BITBLT
-	    else
-	    {
-		if (xoffSrc > xoffDst)
-		{
-		    leftShift = (xoffSrc - xoffDst);
-		    rightShift = PPW - leftShift;
-		}
-		else
-		{
-		    rightShift = (xoffDst - xoffSrc);
-		    leftShift = PPW - rightShift;
-		}
-		while (h--)
-		{
-		    psrc = psrcLine;
-		    pdst = pdstLine;
-		    bits = 0;
-		    if (xoffSrc > xoffDst)
-			bits = *psrc++;
-		    if (startmask)
-		    {
-			bits1 = BitLeft(bits,leftShift);
-			if (BitLeft(startmask, rightShift)) {
-				bits = *psrc++;
-				bits1 |= BitRight(bits,rightShift);
-			}
-			*pdst = MROP_MASK(bits1, *pdst, startmask);
-			pdst++;
-		    }
-		    nl = nlMiddle;
-
-#ifdef LARGE_INSTRUCTION_CACHE
-		    bits1 = bits;
-
-#ifdef FAST_CONSTANT_OFFSET_MODE
-
-		    psrc += nl & (UNROLL-1);
-		    pdst += nl & (UNROLL-1);
-
-#define BodyOdd(n) \
-bits = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
-
-#define BodyEven(n) \
-bits1 = psrc[-n]; \
-pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
-
-#define LoopReset \
-pdst += UNROLL; \
-psrc += UNROLL;
-
-#else
-
-#define BodyOdd(n) \
-bits = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
-pdst++;
-		   
-#define BodyEven(n) \
-bits1 = *psrc++; \
-*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
-pdst++;
-
-#define LoopReset   ;
-
-#endif	/* !FAST_CONSTANT_OFFSET_MODE */
-
-		    PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-		    DuffL (nl,label2,
-			bits1 = BitLeft(bits, leftShift);
-			bits = *psrc++;
-			*pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
-			pdst++;
-		    )
-#endif
-
-		    if (endmask)
-		    {
-			bits1 = BitLeft(bits, leftShift);
-			if (BitLeft(endmask, rightShift))
-			{
-			    bits = *psrc;
-			    bits1 |= BitRight(bits, rightShift);
-			}
-			*pdst = MROP_MASK (bits1, *pdst, endmask);
-		    }
-		    mfbScanlineIncDst(pdstLine, widthDst);
-		    mfbScanlineIncSrc(psrcLine, widthSrc);
-		}
-	    }
-#endif /* DO_UNALIGNED_BITBLT */
-	}
-	else	/* xdir == -1 */
-	{
-	    xoffSrc = (pptSrc->x + w - 1) & PIM;
-	    xoffDst = (pbox->x2 - 1) & PIM;
-	    pdstLine += ((pbox->x2-1) >> PWSH) + 1;
-	    psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
-#ifdef DO_UNALIGNED_BITBLT
-	    nl = xoffSrc - xoffDst;
-	    psrcLine = (PixelType *)
-			(((unsigned char *) psrcLine) + nl);
-#else
-	    if (xoffSrc == xoffDst)
-#endif
-	    {
-		while (h--)
-		{
-		    psrc = psrcLine;
-		    pdst = pdstLine;
-		    if (endmask)
-		    {
-			pdst--;
-			psrc--;
-			*pdst = MROP_MASK (*psrc, *pdst, endmask);
-		    }
-		    nl = nlMiddle;
-
-#ifdef LARGE_INSTRUCTION_CACHE
-#ifdef FAST_CONSTANT_OFFSET_MODE
-		    psrc -= nl & (UNROLL - 1);
-		    pdst -= nl & (UNROLL - 1);
-
-#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
-
-#define BodyEven(n) BodyOdd(n)
-
-#define LoopReset \
-pdst -= UNROLL;\
-psrc -= UNROLL;
-
-#else
-
-#define BodyOdd(n)  --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
-#define BodyEven(n) BodyOdd(n)
-#define LoopReset   ;
-
-#endif
-		    PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-		    DuffL(nl,label3,
-			 --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
-#endif
-
-		    if (startmask)
-		    {
-			--pdst;
-			--psrc;
-			*pdst = MROP_MASK(*psrc, *pdst, startmask);
-		    }
-		    mfbScanlineIncDst(pdstLine, widthDst);
-		    mfbScanlineIncSrc(psrcLine, widthSrc);
-		}
-	    }
-#ifndef DO_UNALIGNED_BITBLT
-	    else
-	    {
-		if (xoffDst > xoffSrc)
-		{
-		    rightShift = (xoffDst - xoffSrc);
-		    leftShift = PPW - rightShift;
-		}
-		else
-		{
-		    leftShift = (xoffSrc - xoffDst);
-		    rightShift = PPW - leftShift;
-		}
-		while (h--)
-		{
-		    psrc = psrcLine;
-		    pdst = pdstLine;
-		    bits = 0;
-		    if (xoffDst > xoffSrc)
-			bits = *--psrc;
-		    if (endmask)
-		    {
-			bits1 = BitRight(bits, rightShift);
-			if (BitRight(endmask, leftShift)) {
-				bits = *--psrc;
-				bits1 |= BitLeft(bits, leftShift);
-			}
-			pdst--;
-			*pdst = MROP_MASK(bits1, *pdst, endmask);
-		    }
-		    nl = nlMiddle;
-
-#ifdef LARGE_INSTRUCTION_CACHE
-		    bits1 = bits;
-#ifdef FAST_CONSTANT_OFFSET_MODE
-		    psrc -= nl & (UNROLL - 1);
-		    pdst -= nl & (UNROLL - 1);
-
-#define BodyOdd(n) \
-bits = psrc[n-1]; \
-pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
-
-#define BodyEven(n) \
-bits1 = psrc[n-1]; \
-pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
-
-#define LoopReset \
-pdst -= UNROLL; \
-psrc -= UNROLL;
-
-#else
-
-#define BodyOdd(n) \
-bits = *--psrc; --pdst; \
-*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
-
-#define BodyEven(n) \
-bits1 = *--psrc; --pdst; \
-*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
-
-#define LoopReset   ;
-
-#endif
-
-		    PackedLoop
-
-#undef BodyOdd
-#undef BodyEven
-#undef LoopReset
-
-#else
-		    DuffL (nl, label4,
-			bits1 = BitRight(bits, rightShift);
-			bits = *--psrc;
-			--pdst;
-			*pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
-		    )
-#endif
-
-		    if (startmask)
-		    {
-			bits1 = BitRight(bits, rightShift);
-			if (BitRight (startmask, leftShift))
-			{
-			    bits = *--psrc;
-			    bits1 |= BitLeft(bits, leftShift);
-			}
-			--pdst;
-			*pdst = MROP_MASK(bits1, *pdst, startmask);
-		    }
-		    mfbScanlineIncDst(pdstLine, widthDst);
-		    mfbScanlineIncSrc(psrcLine, widthSrc);
-		}
-	    }
-#endif
-	}
-	pbox++;
-	pptSrc++;
-    }
-    if (pboxNew2)
-    {
-	xfree(pptNew2);
-	xfree(pboxNew2);
-    }
-    if (pboxNew1)
-    {
-	xfree(pptNew1);
-	xfree(pboxNew1);
-    }
-}
diff --git a/mfb/mfbbres.c b/mfb/mfbbres.c
deleted file mode 100644
index ee2f10f..0000000
--- a/mfb/mfbbres.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "miline.h"
-
-/* Solid bresenham line */
-/* NOTES
-   e2 is used less often than e1, so it's not in a register
-*/
-
-void
-mfbBresS(rop, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
-int rop;		/* a reduced rasterop */
-PixelType *addrlbase;	/* pointer to base of bitmap */
-int nlwidth;		/* width in longwords of bitmap */
-int signdx, signdy;	/* signs of directions */
-int axis;		/* major axis (Y_AXIS or X_AXIS) */
-int x1, y1;		/* initial point */
-register int e;		/* error accumulator */
-register int e1;	/* bresenham increments */
-int e2;
-int len;		/* length of line */
-{
-    register int yinc;	/* increment to next scanline, in bytes */
-    register PixelType *addrl;	/* bitmask 32-bit pointer */
-    register PixelType bit;	/* current bit being set/cleared/etc.  */
-    PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
-    PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
-
-    register int e3 = e2-e1;
-    PixelType	tmp;
-
-    /* point to longword containing first point */
-    addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
-    yinc = signdy * nlwidth;
-    e = e-e1;			/* to make looping easier */
-    bit = mask[x1 & PIM];
-
-    if (!len)
-	return;
-    if (rop == RROP_BLACK)
-    {
-        if (axis == X_AXIS)
-        {
-	    if (signdx > 0)
-	    {
-		tmp = *addrl;
-		for (;;)
-		{ 
-		    tmp &= ~bit;
-		    if (!--len)
-			break;
-		    bit = SCRRIGHT(bit,1);
-		    e += e1;
- 		    if (e >= 0)
-		    {
-			*addrl = tmp;
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-			if (!bit)
-			{
-			    bit = leftbit;
-			    addrl ++;
-			}
-			tmp = *addrl;
-		    }
-		    else if (!bit)
- 		    {
-			*addrl = tmp;
-			bit = leftbit;
-			addrl ++;
-			tmp = *addrl;
-		    }
-		}
-		*addrl = tmp;
-	    }
-	    else
-	    {
-		tmp = *addrl;
-		for (;;)
-		{ 
-		    tmp &= ~bit;
-		    if (!--len)
-			break;
-		    e += e1;
-		    bit = SCRLEFT(bit,1);
-		    if (e >= 0)
-		    {
-			*addrl = tmp;
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-			if (!bit)
-			{
-			    bit = rightbit;
-			    addrl --;
-			}
-			tmp = *addrl;
-		    }
-		    else if (!bit)
- 		    {
-			*addrl = tmp;
-			bit = rightbit;
-			addrl --;
-			tmp = *addrl;
-		    }
-		}
-		*addrl = tmp;
-	    }
-        } /* if X_AXIS */
-        else
-        {
-	    if (signdx > 0)
-	    {
-		while(len--)
-		{
-		    *addrl &= ~bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRRIGHT(bit,1);
-			if (!bit) { bit = leftbit;addrl ++; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-	    else
-	    {
-		while(len--)
-		{
-		    *addrl &= ~bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRLEFT(bit,1);
-			if (!bit) { bit = rightbit;addrl --; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-        } /* else Y_AXIS */
-    } 
-    else if (rop == RROP_WHITE)
-    {
-        if (axis == X_AXIS)
-        {
-	    if (signdx > 0)
-	    {
-		tmp = *addrl;
-		for (;;)
-		{
-		    tmp |= bit;
-		    if (!--len)
-			break;
-		    e += e1;
-		    bit = SCRRIGHT(bit,1);
-		    if (e >= 0)
-		    {
-			*addrl = tmp;
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-			if (!bit)
-			{
-			    bit = leftbit;
-			    addrl ++;
-			}
-			tmp = *addrl;
-		    }
-		    else if (!bit)
- 		    {
-			*addrl = tmp;
-			bit = leftbit;
-			addrl ++;
-			tmp = *addrl;
-		    }
-		}
-		*addrl = tmp;
-	    }
-	    else
-	    {
-		tmp = *addrl;
-		for (;;)
-		{
-		    tmp |= bit;
-		    if (!--len)
-			break;
-		    e += e1;
-		    bit = SCRLEFT(bit,1);
-		    if (e >= 0)
-		    {
-			*addrl = tmp;
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-			if (!bit)
-			{
-			    bit = rightbit;
-			    addrl --;
-			}
-			tmp = *addrl;
-		    }
-		    else if (!bit)
-		    {
-			*addrl = tmp;
-			bit = rightbit;
-			addrl --;
-			tmp = *addrl;
-		    }
-		}
-		*addrl = tmp;
-	    }
-        } /* if X_AXIS */
-        else
-        {
-	    if (signdx > 0)
-	    {
-		while(len--)
-		{
-		    *addrl |= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRRIGHT(bit,1);
-			if (!bit) { bit = leftbit;addrl ++; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-	    else
-	    {
-		while(len--)
-		{
-		    *addrl |= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRLEFT(bit,1);
-			if (!bit) { bit = rightbit;addrl --; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-        } /* else Y_AXIS */
-    }
-    else if (rop == RROP_INVERT)
-    {
-        if (axis == X_AXIS)
-        {
-	    if (signdx > 0)
-	    {
-		while(len--)
-		{
-		    *addrl ^= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-		    }
-		    bit = SCRRIGHT(bit,1);
-		    if (!bit) { bit = leftbit;addrl ++; }
-		}
-	    }
-	    else
-	    {
-		while(len--)
-		{
-		    *addrl ^= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			mfbScanlineInc(addrl, yinc);
-			e += e3;
-		    }
-		    bit = SCRLEFT(bit,1);
-		    if (!bit) { bit = rightbit;addrl --; }
-		}
-	    }
-        } /* if X_AXIS */
-        else
-        {
-	    if (signdx > 0)
-	    {
-		while(len--)
-		{
-		    *addrl ^= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRRIGHT(bit,1);
-			if (!bit) { bit = leftbit;addrl ++; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-	    else
-	    {
-		while(len--)
-		{
-		    *addrl ^= bit;
-		    e += e1;
-		    if (e >= 0)
-		    {
-			bit = SCRLEFT(bit,1);
-			if (!bit) { bit = rightbit; addrl --; }
-			e += e3;
-		    }
-		    mfbScanlineInc(addrl, yinc);
-		}
-	    }
-        } /* else Y_AXIS */
-    }
-} 
diff --git a/mfb/mfbbresd.c b/mfb/mfbbresd.c
deleted file mode 100644
index 3904c0d..0000000
--- a/mfb/mfbbresd.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "miline.h"
-
-/* Dashed bresenham line */
-
-#define StepDash\
-    if (!--dashRemaining) { \
-	if (++ dashIndex == numInDashList) \
-	    dashIndex = 0; \
-	dashRemaining = pDash[dashIndex]; \
-	rop = fgrop; \
-	if (dashIndex & 1) \
-	    rop = bgrop; \
-    }
-
-void
-mfbBresD(fgrop, bgrop,
-	 pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
-	 addrlbase, nlwidth,
-	 signdx, signdy, axis, x1, y1, e, e1, e2, len)
-int fgrop, bgrop;
-int *pdashIndex;	/* current dash */
-unsigned char *pDash;	/* dash list */
-int numInDashList;	/* total length of dash list */
-int *pdashOffset;	/* offset into current dash */
-int isDoubleDash;
-PixelType *addrlbase;	/* pointer to base of bitmap */
-int nlwidth;		/* width in longwords of bitmap */
-int signdx, signdy;	/* signs of directions */
-int axis;		/* major axis (Y_AXIS or X_AXIS) */
-int x1, y1;		/* initial point */
-register int e;		/* error accumulator */
-register int e1;	/* bresenham increments */
-int e2;
-int len;		/* length of line */
-{
-    register int yinc;	/* increment to next scanline, in bytes */
-    register PixelType *addrl;
-    register int e3 = e2-e1;
-    register MfbBits bit;
-    PixelType leftbit = mask[0]; /* leftmost bit to process in new word */
-    PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */
-    int dashIndex;
-    int dashOffset;
-    int dashRemaining;
-    int	rop;
-
-    dashOffset = *pdashOffset;
-    dashIndex = *pdashIndex;
-    dashRemaining = pDash[dashIndex] - dashOffset;
-    rop = fgrop;
-    if (!isDoubleDash)
-	bgrop = -1;
-    if (dashIndex & 1)
-	rop = bgrop;
-
-    /* point to longword containing first point */
-    addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
-    yinc = signdy * nlwidth;
-    e = e-e1;			/* to make looping easier */
-    bit = mask[x1 & PIM];
-    if (axis == X_AXIS)
-    {
-	if (signdx > 0)
-	{
-	    while(len--)
-	    { 
-		if (rop == RROP_BLACK)
-		    *addrl &= ~bit;
-		else if (rop == RROP_WHITE)
-		    *addrl |= bit;
-		else if (rop == RROP_INVERT)
-		    *addrl ^= bit;
-		e += e1;
-		if (e >= 0)
-		{
-		    mfbScanlineInc(addrl, yinc);
-		    e += e3;
-		}
-		bit = SCRRIGHT(bit,1);
-		if (!bit) { bit = leftbit;addrl ++; }
-		StepDash
-	    }
-	}
-	else
-	{
-	    while(len--)
-	    { 
-		if (rop == RROP_BLACK)
-		    *addrl &= ~bit;
-		else if (rop == RROP_WHITE)
-		    *addrl |= bit;
-		else if (rop == RROP_INVERT)
-		    *addrl ^= bit;
-		e += e1;
-		if (e >= 0)
-		{
-		    mfbScanlineInc(addrl, yinc);
-		    e += e3;
-		}
-		bit = SCRLEFT(bit,1);
-		if (!bit) { bit = rightbit;addrl --; }
-		StepDash
-	    }
-	}
-    } /* if X_AXIS */
-    else
-    {
-	if (signdx > 0)
-	{
-	    while(len--)
-	    {
-		if (rop == RROP_BLACK)
-		    *addrl &= ~bit;
-		else if (rop == RROP_WHITE)
-		    *addrl |= bit;
-		else if (rop == RROP_INVERT)
-		    *addrl ^= bit;
-		e += e1;
-		if (e >= 0)
-		{
-		    bit = SCRRIGHT(bit,1);
-		    if (!bit) { bit = leftbit;addrl ++; }
-		    e += e3;
-		}
-		mfbScanlineInc(addrl, yinc);
-		StepDash
-	    }
-	}
-	else
-	{
-	    while(len--)
-	    {
-		if (rop == RROP_BLACK)
-		    *addrl &= ~bit;
-		else if (rop == RROP_WHITE)
-		    *addrl |= bit;
-		else if (rop == RROP_INVERT)
-		    *addrl ^= bit;
-		e += e1;
-		if (e >= 0)
-		{
-		    bit = SCRLEFT(bit,1);
-		    if (!bit) { bit = rightbit;addrl --; }
-		    e += e3;
-		}
-		mfbScanlineInc(addrl, yinc);
-		StepDash
-	    }
-	}
-    } /* else Y_AXIS */
-    *pdashIndex = dashIndex;
-    *pdashOffset = pDash[dashIndex] - dashRemaining;
-} 
diff --git a/mfb/mfbclip.c b/mfb/mfbclip.c
deleted file mode 100644
index 48e532a..0000000
--- a/mfb/mfbclip.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "gc.h"
-#include "maskbits.h"
-#include "mi.h"
-#include "mfb.h"
-
-#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2)			\
-if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&			\
-    (!((reg)->data->numRects &&					\
-       ((r-1)->y1 == (ry1)) &&					\
-       ((r-1)->y2 == (ry2)) &&					\
-       ((r-1)->x1 <= (rx1)) &&					\
-       ((r-1)->x2 >= (rx2)))))					\
-{								\
-    if ((reg)->data->numRects == (reg)->data->size)		\
-    {								\
-	miRectAlloc(reg, 1);					\
-	fr = REGION_BOXPTR(reg);				\
-	r = fr + (reg)->data->numRects;				\
-    }								\
-    r->x1 = (rx1);						\
-    r->y1 = (ry1);						\
-    r->x2 = (rx2);						\
-    r->y2 = (ry2);						\
-    (reg)->data->numRects++;					\
-    if(r->x1 < (reg)->extents.x1)				\
-	(reg)->extents.x1 = r->x1;				\
-    if(r->x2 > (reg)->extents.x2)				\
-	(reg)->extents.x2 = r->x2;				\
-    r++;							\
-}
-
-/* Convert bitmap clip mask into clipping region. 
- * First, goes through each line and makes boxes by noting the transitions
- * from 0 to 1 and 1 to 0.
- * Then it coalesces the current line with the previous if they have boxes
- * at the same X coordinates.
- */
-RegionPtr
-mfbPixmapToRegion(pPix)
-    PixmapPtr	pPix;
-{
-    register RegionPtr	pReg;
-    register PixelType	*pw, w;
-    register int	ib;
-    int			width, h, base, rx1 = 0, crects;
-    PixelType		*pwLineEnd;
-    int			irectPrevStart, irectLineStart;
-    register BoxPtr	prectO, prectN;
-    BoxPtr		FirstRect, rects, prectLineStart;
-    Bool		fInBox, fSame;
-    register PixelType	mask0 = mask[0];
-    PixelType		*pwLine;
-    int			nWidth;
-
-    pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1);
-    if(!pReg)
-	return NullRegion;
-    FirstRect = REGION_BOXPTR(pReg);
-    rects = FirstRect;
-
-    pwLine = (PixelType *) pPix->devPrivate.ptr;
-    nWidth = pPix->devKind / PGSZB;
-
-    width = pPix->drawable.width;
-    pReg->extents.x1 = width - 1;
-    pReg->extents.x2 = 0;
-    irectPrevStart = -1;
-    for(h = 0; h < pPix->drawable.height; h++)
-    {
-	pw = pwLine;
-	pwLine += nWidth;
-	irectLineStart = rects - FirstRect;
-	/* If the Screen left most bit of the word is set, we're starting in
-	 * a box */
-	if(*pw & mask0)
-	{
-	    fInBox = TRUE;
-	    rx1 = 0;
-	}
-	else
-	    fInBox = FALSE;
-	/* Process all words which are fully in the pixmap */
-	pwLineEnd = pw + (width >> PWSH);
-	for (base = 0; pw < pwLineEnd; base += PPW)
-	{
-	    w = *pw++;
-	    if (fInBox)
-	    {
-		if (!~w)
-		    continue;
-	    }
-	    else
-	    {
-		if (!w)
-		    continue;
-	    }
-	    for(ib = 0; ib < PPW; ib++)
-	    {
-	        /* If the Screen left most bit of the word is set, we're
-		 * starting a box */
-		if(w & mask0)
-		{
-		    if(!fInBox)
-		    {
-			rx1 = base + ib;
-			/* start new box */
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			/* end box */
-			ADDRECT(pReg, rects, FirstRect,
-				rx1, h, base + ib, h + 1);
-			fInBox = FALSE;
-		    }
-		}
-		/* Shift the word VISUALLY left one. */
-		w = SCRLEFT(w, 1);
-	    }
-	}
-	if(width & PIM)
-	{
-	    /* Process final partial word on line */
-	    w = *pw++;
-	    for(ib = 0; ib < (width & PIM); ib++)
-	    {
-	        /* If the Screen left most bit of the word is set, we're
-		 * starting a box */
-		if(w & mask0)
-		{
-		    if(!fInBox)
-		    {
-			rx1 = base + ib;
-			/* start new box */
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			/* end box */
-			ADDRECT(pReg, rects, FirstRect,
-				rx1, h, base + ib, h + 1);
-			fInBox = FALSE;
-		    }
-		}
-		/* Shift the word VISUALLY left one. */
-		w = SCRLEFT(w, 1);
-	    }
-	}
-	/* If scanline ended with last bit set, end the box */
-	if(fInBox)
-	{
-	    ADDRECT(pReg, rects, FirstRect,
-		    rx1, h, base + (width & PIM), h + 1);
-	}
-	/* if all rectangles on this line have the same x-coords as
-	 * those on the previous line, then add 1 to all the previous  y2s and 
-	 * throw away all the rectangles from this line 
-	 */
-	fSame = FALSE;
-	if(irectPrevStart != -1)
-	{
-	    crects = irectLineStart - irectPrevStart;
-	    if(crects == ((rects - FirstRect) - irectLineStart))
-	    {
-	        prectO = FirstRect + irectPrevStart;
-	        prectN = prectLineStart = FirstRect + irectLineStart;
-		fSame = TRUE;
-	        while(prectO < prectLineStart)
-		{
-		    if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2))
-		    {
-			  fSame = FALSE;
-			  break;
-		    }
-		    prectO++;
-		    prectN++;
-		}
-		if (fSame)
-		{
-		    prectO = FirstRect + irectPrevStart;
-		    while(prectO < prectLineStart)
-		    {
-			prectO->y2 += 1;
-			prectO++;
-		    }
-		    rects -= crects;
-		    pReg->data->numRects -= crects;
-		}
-	    }
-	}
-	if(!fSame)
-	    irectPrevStart = irectLineStart;
-    }
-    if (!pReg->data->numRects)
-	pReg->extents.x1 = pReg->extents.x2 = 0;
-    else
-    {
-	pReg->extents.y1 = REGION_BOXPTR(pReg)->y1;
-	pReg->extents.y2 = REGION_END(pReg)->y2;
-	if (pReg->data->numRects == 1)
-	{
-	    xfree(pReg->data);
-	    pReg->data = (RegDataPtr)NULL;
-	}
-    }
-#ifdef DEBUG
-    if (!miValidRegion(pReg))
-	FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
-#endif
-    return(pReg);
-}
-
-mfbPixmapToRegionProc *
-mfbPixmapToRegionWeak(void)
-{
-    return mfbPixmapToRegion;
-}
diff --git a/mfb/mfbcmap.c b/mfb/mfbcmap.c
deleted file mode 100644
index 4dabcae..0000000
--- a/mfb/mfbcmap.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "colormapst.h"
-#include "resource.h"
-#include "micmap.h"
-#include "mfb.h"
-
-/* A monochrome frame buffer is a static gray colormap with two entries.
- * We have a "required list" of length 1.  Because we can only support 1
- * colormap, we never have to change it, but we may have to change the 
- * name we call it.  If someone installs a new colormap, we know it must
- * look just like the old one (because we've checked in dispatch that it was
- * a valid colormap identifier, and all the colormap IDs for this device
- * look the same).  Nevertheless, we still have to uninstall the old colormap
- * and install the new one.  Similarly, if someone uninstalls a colormap,
- * we have to install the default map, even though we know those two looked
- * alike.  
- * The required list concept is pretty much irrelevant when you can only
- * have one map installed at a time.  
- */
-
-int
-mfbListInstalledColormaps(pScreen, pmaps)
-    ScreenPtr	pScreen;
-    Colormap	*pmaps;
-{
-    return miListInstalledColormaps(pScreen, pmaps);
-}
-
-
-void
-mfbInstallColormap(pmap)
-    ColormapPtr	pmap;
-{
-    miInstallColormap(pmap);
-}
-
-void
-mfbUninstallColormap(pmap)
-    ColormapPtr	pmap;
-{
-    miUninstallColormap(pmap);
-}
-
-/*ARGSUSED*/
-void
-mfbResolveColor (pred, pgreen, pblue, pVisual)
-    unsigned short	*pred;
-    unsigned short	*pgreen;
-    unsigned short	*pblue;
-    VisualPtr		pVisual;
-{
-    /* 
-     * Gets intensity from RGB.  If intensity is >= half, pick white, else
-     * pick black.  This may well be more trouble than it's worth.
-     */
-    *pred = *pgreen = *pblue = 
-        (((30L * *pred +
-           59L * *pgreen +
-           11L * *pblue) >> 8) >= (((1<<8)-1)*50)) ? ~0 : 0;
-}
-
-Bool
-mfbCreateColormap(pMap)
-    ColormapPtr	pMap;
-{
-    ScreenPtr	pScreen;
-    unsigned short  red0, green0, blue0;
-    unsigned short  red1, green1, blue1;
-    Pixel pix;
-    
-    pScreen = pMap->pScreen;
-    if (pScreen->whitePixel == 0)
-    {
-	red0 = green0 = blue0 = ~0;
-	red1 = green1 = blue1 = 0;
-    }
-    else
-    {
-	red0 = green0 = blue0 = 0;
-	red1 = green1 = blue1 = ~0;
-    }
-
-    /* this is a monochrome colormap, it only has two entries, just fill
-     * them in by hand.  If it were a more complex static map, it would be
-     * worth writing a for loop or three to initialize it */
-
-    /* this will be pixel 0 */
-    pix = 0;
-    if (AllocColor(pMap, &red0, &green0, &blue0, &pix, 0) != Success)
-	return FALSE;
-
-    /* this will be pixel 1 */
-    if (AllocColor(pMap, &red1, &green1, &blue1, &pix, 0) != Success)
-	return FALSE;
-    return TRUE;
-}
-
-/*ARGSUSED*/
-void
-mfbDestroyColormap (pMap)
-    ColormapPtr	pMap;
-{
-    return;
-}
-
-Bool
-mfbCreateDefColormap (pScreen)
-    ScreenPtr	pScreen;
-{
-    return miCreateDefColormap(pScreen);
-}
diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c
deleted file mode 100644
index cbf47a0..0000000
--- a/mfb/mfbfillarc.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/************************************************************
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <limits.h>
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mifillarc.h"
-#include "mi.h"
-
-static void
-mfbFillEllipseSolid(
-    DrawablePtr pDraw,
-    xArc *arc,
-    register int rop)
-{
-    int x, y, e;
-    int yk, xk, ym, xm, dx, dy, xorg, yorg;
-    register int slw;
-    miFillArcRec info;
-    PixelType *addrlt, *addrlb;
-    register PixelType *addrl;
-    register int n;
-    int nlwidth;
-    register int xpos;
-    PixelType startmask, endmask;
-    int nlmiddle;
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt);
-    miFillArcSetup(arc, &info);
-    MIFILLARCSETUP();
-    xorg += pDraw->x;
-    yorg += pDraw->y;
-    addrlb = addrlt;
-    addrlt += nlwidth * (yorg - y);
-    addrlb += nlwidth * (yorg + y + dy);
-    while (y)
-    {
-	addrlt += nlwidth;
-	addrlb -= nlwidth;
-	MIFILLARCSTEP(slw);
-	if (!slw)
-	    continue;
-	xpos = xorg - x;
-	addrl = mfbScanlineOffset(addrlt, (xpos >> PWSH));
-	if (((xpos & PIM) + slw) < PPW)
-	{
-	    maskpartialbits(xpos, slw, startmask);
-	    if (rop == RROP_BLACK)
-		*addrl &= ~startmask;
-	    else if (rop == RROP_WHITE)
-		*addrl |= startmask;
-	    else
-		*addrl ^= startmask;
-	    if (miFillArcLower(slw))
-	    {
-		addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH));
-		if (rop == RROP_BLACK)
-		    *addrl &= ~startmask;
-		else if (rop == RROP_WHITE)
-		    *addrl |= startmask;
-		else
-		    *addrl ^= startmask;
-	    }
-	    continue;
-	}
-	maskbits(xpos, slw, startmask, endmask, nlmiddle);
-	if (startmask)
-	{
-	    if (rop == RROP_BLACK)
-		*addrl++ &= ~startmask;
-	    else if (rop == RROP_WHITE)
-		*addrl++ |= startmask;
-	    else
-		*addrl++ ^= startmask;
-	}
-	n = nlmiddle;
-	if (rop == RROP_BLACK)
-	    while (n--)
-		*addrl++ = 0;
-	else if (rop == RROP_WHITE)
-	    while (n--)
-		*addrl++ = ~0;
-	else
-	    while (n--)
-		*addrl++ ^= ~0;
-	if (endmask)
-	{
-	    if (rop == RROP_BLACK)
-		*addrl &= ~endmask;
-	    else if (rop == RROP_WHITE)
-		*addrl |= endmask;
-	    else
-		*addrl ^= endmask;
-	}
-	if (!miFillArcLower(slw))
-	    continue;
-	addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH));
-	if (startmask)
-	{
-	    if (rop == RROP_BLACK)
-		*addrl++ &= ~startmask;
-	    else if (rop == RROP_WHITE)
-		*addrl++ |= startmask;
-	    else
-		*addrl++ ^= startmask;
-	}
-	n = nlmiddle;
-	if (rop == RROP_BLACK)
-	    while (n--)
-		*addrl++ = 0;
-	else if (rop == RROP_WHITE)
-	    while (n--)
-		*addrl++ = ~0;
-	else
-	    while (n--)
-		*addrl++ ^= ~0;
-	if (endmask)
-	{
-	    if (rop == RROP_BLACK)
-		*addrl &= ~endmask;
-	    else if (rop == RROP_WHITE)
-		*addrl |= endmask;
-	    else
-		*addrl ^= endmask;
-	}
-    }
-}
-
-#define FILLSPAN(xl,xr,addr) \
-    if (xr >= xl) \
-    { \
-	width = xr - xl + 1; \
-	addrl = mfbScanlineOffset(addr, (xl >> PWSH)); \
-	if (((xl & PIM) + width) < PPW) \
-	{ \
-	    maskpartialbits(xl, width, startmask); \
-	    if (rop == RROP_BLACK) \
-		*addrl &= ~startmask; \
-	    else if (rop == RROP_WHITE) \
-		*addrl |= startmask; \
-	    else \
-		*addrl ^= startmask; \
-	} \
-	else \
-	{ \
-	    maskbits(xl, width, startmask, endmask, nlmiddle); \
-	    if (startmask) \
-	    { \
-		if (rop == RROP_BLACK) \
-		    *addrl++ &= ~startmask; \
-		else if (rop == RROP_WHITE) \
-		    *addrl++ |= startmask; \
-		else \
-		    *addrl++ ^= startmask; \
-	    } \
-	    n = nlmiddle; \
-	    if (rop == RROP_BLACK) \
-		while (n--) \
-		    *addrl++ = 0; \
-	    else if (rop == RROP_WHITE) \
-		while (n--) \
-		    *addrl++ = ~0; \
-	    else \
-		while (n--) \
-		    *addrl++ ^= ~0; \
-	    if (endmask) \
-	    { \
-		if (rop == RROP_BLACK) \
-		    *addrl &= ~endmask; \
-		else if (rop == RROP_WHITE) \
-		    *addrl |= endmask; \
-		else \
-		    *addrl ^= endmask; \
-	    } \
-	} \
-    }
-
-#define FILLSLICESPANS(flip,addr) \
-    if (!flip) \
-    { \
-	FILLSPAN(xl, xr, addr); \
-    } \
-    else \
-    { \
-	xc = xorg - x; \
-	FILLSPAN(xc, xr, addr); \
-	xc += slw - 1; \
-	FILLSPAN(xl, xc, addr); \
-    }
-
-static void
-mfbFillArcSliceSolidCopy(
-    DrawablePtr pDraw,
-    GCPtr pGC,
-    xArc *arc,
-    register int rop)
-{
-    register PixelType *addrl;
-    register int n;
-    int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
-    register int x, y, e;
-    miFillArcRec info;
-    miArcSliceRec slice;
-    int xl, xr, xc;
-    PixelType *addrlt, *addrlb;
-    int nlwidth;
-    int width;
-    PixelType startmask, endmask;
-    int nlmiddle;
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt);
-    miFillArcSetup(arc, &info);
-    miFillArcSliceSetup(arc, &slice, pGC);
-    MIFILLARCSETUP();
-    xorg += pDraw->x;
-    yorg += pDraw->y;
-    addrlb = addrlt;
-    addrlt = mfbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth);
-    addrlb = mfbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth);
-    slice.edge1.x += pDraw->x;
-    slice.edge2.x += pDraw->x;
-    while (y > 0)
-    {
-	mfbScanlineIncNoBankSwitch(addrlt, nlwidth);
-	mfbScanlineIncNoBankSwitch(addrlb, -nlwidth);
-	MIFILLARCSTEP(slw);
-	MIARCSLICESTEP(slice.edge1);
-	MIARCSLICESTEP(slice.edge2);
-	if (miFillSliceUpper(slice))
-	{
-	    MIARCSLICEUPPER(xl, xr, slice, slw);
-	    FILLSLICESPANS(slice.flip_top, addrlt);
-	}
-	if (miFillSliceLower(slice))
-	{
-	    MIARCSLICELOWER(xl, xr, slice, slw);
-	    FILLSLICESPANS(slice.flip_bot, addrlb);
-	}
-    }
-}
-
-void
-mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs)
-    register DrawablePtr pDraw;
-    GCPtr	pGC;
-    int		narcs;
-    xArc	*parcs;
-{
-    mfbPrivGC *priv;
-    register xArc *arc;
-    register int i;
-    BoxRec box;
-    int x2, y2;
-    RegionPtr cclip;
-    int rop;
-
-    priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey());
-    rop = priv->rop;
-    if ((rop == RROP_NOP) || !(pGC->planemask & 1))
-	return;
-    cclip = pGC->pCompositeClip;
-    for (arc = parcs, i = narcs; --i >= 0; arc++)
-    {
-	if (miFillArcEmpty(arc))
-	    continue;
-	if (miCanFillArc(arc))
-	{
-	    box.x1 = arc->x + pDraw->x;
-	    box.y1 = arc->y + pDraw->y;
- 	    /*
- 	     * Because box.x2 and box.y2 get truncated to 16 bits, and the
- 	     * RECT_IN_REGION test treats the resulting number as a signed
- 	     * integer, the RECT_IN_REGION test alone can go the wrong way.
- 	     * This can result in a server crash because the rendering
- 	     * routines in this file deal directly with cpu addresses
- 	     * of pixels to be stored, and do not clip or otherwise check
- 	     * that all such addresses are within their respective pixmaps.
- 	     * So we only allow the RECT_IN_REGION test to be used for
- 	     * values that can be expressed correctly in a signed short.
- 	     */
- 	    x2 = box.x1 + (int)arc->width + 1;
- 	    box.x2 = x2;
- 	    y2 = box.y1 + (int)arc->height + 1;
- 	    box.y2 = y2;
- 	    if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- 		    (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
-	    {
-		if ((arc->angle2 >= FULLCIRCLE) ||
-		    (arc->angle2 <= -FULLCIRCLE))
-		    mfbFillEllipseSolid(pDraw, arc, rop);
-		else
-		    mfbFillArcSliceSolidCopy(pDraw, pGC, arc, rop);
-		continue;
-	    }
-	}
-	miPolyFillArc(pDraw, pGC, 1, arc);
-    }
-}
diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c
deleted file mode 100644
index a0b3d67..0000000
--- a/mfb/mfbfillrct.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "miscstruct.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-#define MODEQ(a, b) ((a) %= (b))
-
-/* 
-    filled rectangles.
-    translate the rectangles, clip them, and call the
-helper function in the GC.
-*/
-
-#define NUM_STACK_RECTS	1024
-
-void
-mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		nrectFill; 	/* number of rectangles to fill */
-    xRectangle	*prectInit;  	/* Pointer to first rectangle to fill */
-{
-    xRectangle	    *prect;
-    RegionPtr	    prgnClip;
-    register BoxPtr pbox;
-    register BoxPtr pboxClipped;
-    BoxPtr	    pboxClippedBase;
-    BoxPtr	    pextent;
-    BoxRec	    stackRects[NUM_STACK_RECTS];
-    int		    numRects;
-    int		    n;
-    int		    xorg, yorg;
-    mfbPrivGC	*priv;
-    int alu;
-    mfbFillAreaProcPtr pfn;
-    PixmapPtr ppix;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey());
-    alu = priv->ropFillArea;
-    pfn = priv->FillArea;
-    ppix = pGC->pRotatedPixmap;
-    prgnClip = pGC->pCompositeClip;
-
-    prect = prectInit;
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    if (xorg || yorg)
-    {
-        prect = prectInit;
-	n = nrectFill;
-	Duff (n, prect->x += xorg; prect->y += yorg; prect++);
-    }
-
-
-    prect = prectInit;
-
-    numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
-    if (numRects > NUM_STACK_RECTS)
-    {
-	pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
-	if (!pboxClippedBase)
-	    return;
-    }
-    else
-	pboxClippedBase = stackRects;
-
-    pboxClipped = pboxClippedBase;
-	
-    if (REGION_NUM_RECTS(prgnClip) == 1)
-    {
-	int x1, y1, x2, y2, bx2, by2;
-
-	pextent = REGION_RECTS(prgnClip);
-	x1 = pextent->x1;
-	y1 = pextent->y1;
-	x2 = pextent->x2;
-	y2 = pextent->y2;
-    	while (nrectFill--)
-    	{
-	    if ((pboxClipped->x1 = prect->x) < x1)
-		pboxClipped->x1 = x1;
-    
-	    if ((pboxClipped->y1 = prect->y) < y1)
-		pboxClipped->y1 = y1;
-    
-	    bx2 = (int) prect->x + (int) prect->width;
-	    if (bx2 > x2)
-		bx2 = x2;
-	    pboxClipped->x2 = bx2;
-    
-	    by2 = (int) prect->y + (int) prect->height;
-	    if (by2 > y2)
-		by2 = y2;
-	    pboxClipped->y2 = by2;
-
-	    prect++;
-	    if ((pboxClipped->x1 < pboxClipped->x2) &&
-		(pboxClipped->y1 < pboxClipped->y2))
-	    {
-		pboxClipped++;
-	    }
-    	}
-    }
-    else
-    {
-	int x1, y1, x2, y2, bx2, by2;
-
-	pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
-	x1 = pextent->x1;
-	y1 = pextent->y1;
-	x2 = pextent->x2;
-	y2 = pextent->y2;
-    	while (nrectFill--)
-    	{
-	    BoxRec box;
-    
-	    if ((box.x1 = prect->x) < x1)
-		box.x1 = x1;
-    
-	    if ((box.y1 = prect->y) < y1)
-		box.y1 = y1;
-    
-	    bx2 = (int) prect->x + (int) prect->width;
-	    if (bx2 > x2)
-		bx2 = x2;
-	    box.x2 = bx2;
-    
-	    by2 = (int) prect->y + (int) prect->height;
-	    if (by2 > y2)
-		by2 = y2;
-	    box.y2 = by2;
-    
-	    prect++;
-    
-	    if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
-	    	continue;
-    
-	    n = REGION_NUM_RECTS (prgnClip);
-	    pbox = REGION_RECTS(prgnClip);
-    
-	    /* clip the rectangle to each box in the clip region
-	       this is logically equivalent to calling Intersect()
-	    */
-	    while(n--)
-	    {
-		pboxClipped->x1 = max(box.x1, pbox->x1);
-		pboxClipped->y1 = max(box.y1, pbox->y1);
-		pboxClipped->x2 = min(box.x2, pbox->x2);
-		pboxClipped->y2 = min(box.y2, pbox->y2);
-		pbox++;
-
-		/* see if clipping left anything */
-		if(pboxClipped->x1 < pboxClipped->x2 && 
-		   pboxClipped->y1 < pboxClipped->y2)
-		{
-		    pboxClipped++;
-		}
-	    }
-    	}
-    }
-    if (pboxClipped != pboxClippedBase)
-	(*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, alu, ppix);
-    if (pboxClippedBase != stackRects)
-    	xfree(pboxClippedBase);
-}
diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c
deleted file mode 100644
index c073535..0000000
--- a/mfb/mfbfillsp.c
+++ /dev/null
@@ -1,1029 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "gcstruct.h"
-#include "window.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "mfb.h"
-#include "maskbits.h"
-
-#include "mergerop.h"
-
-#include "servermd.h"
-#include "mi.h"
-#include "mispans.h"
-
-/* scanline filling for monochrome frame buffer
-   written by drewry, oct 1986
-
-   these routines all clip.  they assume that anything that has called
-them has already translated the points (i.e. pGC->miTranslate is
-non-zero, which is howit gets set in mfbCreateGC().)
-
-   the number of new scnalines created by clipping ==
-MaxRectsPerBand * nSpans.
-
-    FillSolid is overloaded to be used for OpaqueStipple as well,
-if fgPixel == bgPixel.  
-
-
-    FillTiled is overloaded to be used for OpaqueStipple, if
-fgPixel != bgPixel.  based on the fill style, it uses
-{RotatedPixmap, gc.alu} or {RotatedPixmap, PrivGC.ropOpStip}
-*/
-
-
-void
-mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		nInit;		/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int		*pwidthInit;	/* pointer to list of n widths */
-    int 	fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;/* pointer to current longword in bitmap */
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-
-	if (*pwidth)
-	{
-	    if ( ((ppt->x & PIM) + *pwidth) < PPW)
-	    {
-		/* all bits inside same longword */
-		maskpartialbits(ppt->x, *pwidth, startmask);
-		    *addrl &= ~startmask;
-	    }
-	    else
-	    {
-		maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-		if (startmask)
-		    *addrl++ &= ~startmask;
-		Duff (nlmiddle, *addrl++ = 0x0);
-		if (endmask)
-		    *addrl &= ~endmask;
-	    }
-	}
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-
-void
-mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		nInit;		/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int		*pwidthInit;	/* pointer to list of n widths */
-    int 	fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;/* pointer to current longword in bitmap */
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-
-	if (*pwidth)
-	{
-	    if ( ((ppt->x & PIM) + *pwidth) < PPW)
-	    {
-		/* all bits inside same longword */
-		maskpartialbits(ppt->x, *pwidth, startmask);
-		*addrl |= startmask;
-	    }
-	    else
-	    {
-		maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-		if (startmask)
-		    *addrl++ |= startmask;
-		Duff (nlmiddle, *addrl++ = ~0);
-		if (endmask)
-		    *addrl |= endmask;
-	    }
-	}
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-
-void
-mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		nInit;		/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int		*pwidthInit;	/* pointer to list of n widths */
-    int 	fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;/* pointer to current longword in bitmap */
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit,
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-
-	if (*pwidth)
-	{
-	    if ( ((ppt->x & PIM) + *pwidth) < PPW)
-	    {
-		/* all bits inside same longword */
-		maskpartialbits(ppt->x, *pwidth, startmask);
-		*addrl ^= startmask;
-	    }
-	    else
-	    {
-		maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-		if (startmask)
-		    *addrl++ ^= startmask;
-		Duff (nlmiddle, *addrl++ ^= ~0);
-		if (endmask)
-		    *addrl ^= endmask;
-	    }
-	}
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-void 
-mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC *pGC;
-    int nInit;			/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;/* pointer to current longword in bitmap */
-    register PixelType src;
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    PixmapPtr pStipple;
-    PixelType *psrc;
-    int tileHeight;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    pStipple = pGC->pRotatedPixmap;
-    tileHeight = pStipple->drawable.height;
-    psrc = (PixelType *)(pStipple->devPrivate.ptr);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-	src = psrc[ppt->y % tileHeight];
-
-        /* all bits inside same longword */
-        if ( ((ppt->x & PIM) + *pwidth) < PPW)
-        {
-	    maskpartialbits(ppt->x, *pwidth, startmask);
-	    *addrl |= (src & startmask);
-        }
-        else
-        {
-	    maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-	    if (startmask)
-		*addrl++ |= (src & startmask);
-	    Duff (nlmiddle, *addrl++ |= src);
-	    if (endmask)
-		*addrl |= (src & endmask);
-        }
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-void 
-mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC *pGC;
-    int nInit;			/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;	/* pointer to current longword in bitmap */
-    register PixelType src;
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    PixmapPtr pStipple;
-    PixelType *psrc;
-    int tileHeight;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    pStipple = pGC->pRotatedPixmap;
-    tileHeight = pStipple->drawable.height;
-    psrc = (PixelType *)(pStipple->devPrivate.ptr);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-	src = psrc[ppt->y % tileHeight];
-
-        /* all bits inside same longword */
-        if ( ((ppt->x & PIM) + *pwidth) < PPW)
-        {
-	    maskpartialbits(ppt->x, *pwidth, startmask);
-	    *addrl &= ~(src & startmask);
-        }
-        else
-        {
-	    maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-	    if (startmask)
-		*addrl++ &= ~(src & startmask);
-	    Duff (nlmiddle, *addrl++ &= ~src);
-	    if (endmask)
-		*addrl &= ~(src & endmask);
-        }
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-void 
-mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC *pGC;
-    int nInit;			/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;	/* pointer to current longword in bitmap */
-    register PixelType src;
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    PixmapPtr pStipple;
-    PixelType *psrc;
-    int tileHeight;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    pStipple = pGC->pRotatedPixmap;
-    tileHeight = pStipple->drawable.height;
-    psrc = (PixelType *)(pStipple->devPrivate.ptr);
-
-    while (n--)
-    {
-        addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-	src = psrc[ppt->y % tileHeight];
-
-        /* all bits inside same longword */
-        if ( ((ppt->x & PIM) + *pwidth) < PPW)
-        {
-	    maskpartialbits(ppt->x, *pwidth, startmask);
-	    *addrl ^= (src & startmask);
-        }
-        else
-        {
-	    maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-	    if (startmask)
-		*addrl++ ^= (src & startmask);
-	    Duff(nlmiddle, *addrl++ ^= src);
-	    if (endmask)
-		*addrl ^= (src & endmask);
-        }
-	pwidth++;
-	ppt++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-/* this works with tiles of width == PPW */
-#define FILLSPANPPW(ROP) \
-    while (n--) \
-    { \
-	if (*pwidth) \
-	{ \
-            addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); \
-	    src = psrc[ppt->y % tileHeight]; \
-            if ( ((ppt->x & PIM) + *pwidth) < PPW) \
-            { \
-	        maskpartialbits(ppt->x, *pwidth, startmask); \
-	        *addrl = (*addrl & ~startmask) | \
-		         (ROP(src, *addrl) & startmask); \
-            } \
-            else \
-            { \
-	        maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); \
-	        if (startmask) \
-	        { \
-	            *addrl = (*addrl & ~startmask) | \
-			     (ROP(src, *addrl) & startmask); \
-		    addrl++; \
-	        } \
-	        while (nlmiddle--) \
-	        { \
-		    *addrl = ROP(src, *addrl); \
-		    addrl++; \
-	        } \
-	        if (endmask) \
-	            *addrl = (*addrl & ~endmask) | \
-			     (ROP(src, *addrl) & endmask); \
-            } \
-	} \
-	pwidth++; \
-	ppt++; \
-    }
-
-
-
-void
-mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC *pGC;
-    int nInit;			/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int nlwidth;		/* width in longwords of bitmap */
-    register PixelType *addrl;	/* pointer to current longword in bitmap */
-    register PixelType src;
-    register int nlmiddle;
-    register PixelType startmask;
-    register PixelType endmask;
-    PixmapPtr pTile;
-    PixelType *psrc;
-    int tileHeight;
-    int rop;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-    MfbBits   flip;
-
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    pTile = pGC->pRotatedPixmap;
-    tileHeight = pTile->drawable.height;
-    psrc = (PixelType *)(pTile->devPrivate.ptr);
-    if (pGC->fillStyle == FillTiled)
-	rop = pGC->alu;
-    else
-	rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					     mfbGetGCPrivateKey()))->ropOpStip;
-
-    flip = 0;
-    switch(rop)
-    {
-      case GXcopyInverted:  /* for opaque stipples */
-	flip = ~0;
-      case GXcopy:
-	{
-
-#define DoMaskCopyRop(src,dst,mask)	(((dst) & ~(mask)) | ((src) & (mask)))
-
-	    while (n--)
-	    {
-	    	if (*pwidth)
-	    	{
-            	    addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-	    	    src = psrc[ppt->y % tileHeight] ^ flip;
-            	    if ( ((ppt->x & PIM) + *pwidth) < PPW)
-            	    {
-	            	maskpartialbits(ppt->x, *pwidth, startmask);
-			*addrl = DoMaskCopyRop (src, *addrl, startmask);
-            	    }
-            	    else
-            	    {
-	            	maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-	            	if (startmask)
-	            	{
-			    *addrl = DoMaskCopyRop (src, *addrl, startmask);
-		    	    addrl++;
-	            	}
-	            	while (nlmiddle--)
-	            	{
-			    *addrl = src;
-		    	    addrl++;
-	            	}
-	            	if (endmask)
-			    *addrl = DoMaskCopyRop (src, *addrl, endmask);
-            	    }
-	    	}
-	    	pwidth++;
-	    	ppt++;
-	    }
-	}
-	break;
-      default:
-	{
-	    register DeclareMergeRop ();
-
-	    InitializeMergeRop(rop,~0);
-	    while (n--)
-	    {
-	    	if (*pwidth)
-	    	{
-            	    addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-	    	    src = psrc[ppt->y % tileHeight];
-            	    if ( ((ppt->x & PIM) + *pwidth) < PPW)
-            	    {
-	            	maskpartialbits(ppt->x, *pwidth, startmask);
-			*addrl = DoMaskMergeRop (src, *addrl, startmask);
-            	    }
-            	    else
-            	    {
-	            	maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle);
-	            	if (startmask)
-	            	{
-			    *addrl = DoMaskMergeRop (src, *addrl, startmask);
-		    	    addrl++;
-	            	}
-	            	while (nlmiddle--)
-	            	{
-			    *addrl = DoMergeRop (src, *addrl);
-		    	    addrl++;
-	            	}
-	            	if (endmask)
-			    *addrl = DoMaskMergeRop (src, *addrl, endmask);
-            	    }
-	    	}
-	    	pwidth++;
-	    	ppt++;
-	    }
-	}
-	break;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-/* Fill spans with tiles that aren't PPW bits wide */
-void
-mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC		*pGC;
-    int		nInit;		/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-    int		iline;		/* first line of tile to use */
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    PixelType *addrlBase;	/* pointer to start of bitmap */
-    int		 nlwidth;	/* width in longwords of bitmap */
-    register PixelType *pdst;/* pointer to current word in bitmap */
-    register PixelType *psrc;/* pointer to current word in tile */
-    register int nlMiddle;
-    register int rop, nstart;
-    PixelType startmask;
-    PixmapPtr	pTile;		/* pointer to tile we want to fill with */
-    int		w, width, x, xSrc, ySrc, srcStartOver, nend;
-    int 	tlwidth, rem, tileWidth, tileHeight, endinc;
-    PixelType      endmask, *psrcT;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    if (pGC->fillStyle == FillTiled)
-    {
-	pTile = pGC->tile.pixmap;
-	tlwidth = pTile->devKind / PGSZB;
-	rop = pGC->alu;
-    }
-    else
-    {
-	pTile = pGC->stipple;
-	tlwidth = pTile->devKind / PGSZB;
-	rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					     mfbGetGCPrivateKey()))->ropOpStip;
-    }
-
-    xSrc = pDrawable->x;
-    ySrc = pDrawable->y;
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    tileWidth = pTile->drawable.width;
-    tileHeight = pTile->drawable.height;
-
-    /* this replaces rotating the tile. Instead we just adjust the offset
-     * at which we start grabbing bits from the tile.
-     * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
-     * so that iline and rem always stay within the tile bounds.
-     */
-    xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
-    ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
-
-    while (n--)
-    {
-	iline = (ppt->y - ySrc) % tileHeight;
-        pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-        psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth);
-	x = ppt->x;
-
-	if (*pwidth)
-	{
-	    width = *pwidth;
-	    while(width > 0)
-	    {
-		psrc = psrcT;
-	        w = min(tileWidth, width);
-		if((rem = (x - xSrc)  % tileWidth) != 0)
-		{
-		    /* if we're in the middle of the tile, get
-		       as many bits as will finish the span, or
-		       as many as will get to the left edge of the tile,
-		       or a longword worth, starting at the appropriate
-		       offset in the tile.
-		    */
-		    w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
-		    endinc = rem / BITMAP_SCANLINE_PAD;
-		    getandputrop((psrc+endinc), (rem&PIM), (x & PIM), w, pdst, rop);
-		    if((x & PIM) + w >= PPW)
-			pdst++;
-		}
-		else if(((x & PIM) + w) < PPW)
-		{
-		    /* doing < PPW bits is easy, and worth special-casing */
-		    putbitsrop(*psrc, x & PIM, w, pdst, rop);
-		}
-		else
-		{
-		    /* start at the left edge of the tile,
-		       and put down as much as we can
-		    */
-		    maskbits(x, w, startmask, endmask, nlMiddle);
-
-	            if (startmask)
-		        nstart = PPW - (x & PIM);
-	            else
-		        nstart = 0;
-	            if (endmask)
-	                nend = (x + w)  & PIM;
-	            else
-		        nend = 0;
-
-	            srcStartOver = nstart > PLST;
-
-		    if(startmask)
-		    {
-			putbitsrop(*psrc, (x & PIM), nstart, pdst, rop);
-			pdst++;
-#if defined(__alpha__) || defined(__alpha)
-			/*
-			 * XXX workaround an egcs 1.1.2 code generation
-			 * bug. This version might actually be faster.
-			 */
-			psrc += srcStartOver;
-#else
-			if(srcStartOver)
-			    psrc++;
-#endif
-		    }
-		     
-		    while(nlMiddle--)
-		    {
-			    getandputrop0(psrc, nstart, PPW, pdst, rop);
-			    pdst++;
-			    psrc++;
-		    }
-		    if(endmask)
-		    {
-			getandputrop0(psrc, nstart, nend, pdst, rop);
-		    }
-		 }
-		 x += w;
-		 width -= w;
-	    }
-	}
-	ppt++;
-	pwidth++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
-
-
-/* Fill spans with stipples that aren't PPW bits wide */
-void
-mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
-    DrawablePtr pDrawable;
-    GC		*pGC;
-    int		nInit;		/* number of spans to fill */
-    DDXPointPtr pptInit;	/* pointer to list of start points */
-    int *pwidthInit;		/* pointer to list of n widths */
-    int fSorted;
-{
-				/* next three parameters are post-clip */
-    int n;			/* number of spans to fill */
-    register DDXPointPtr ppt;	/* pointer to list of start points */
-    register int *pwidth;	/* pointer to list of n widths */
-    int		iline;		/* first line of tile to use */
-    PixelType		*addrlBase;	/* pointer to start of bitmap */
-    int		 nlwidth;	/* width in longwords of bitmap */
-    register PixelType *pdst;		/* pointer to current word in bitmap */
-    register PixelType *psrc;		/* pointer to current word in tile */
-    register int nlMiddle;
-    register int rop, nstart;
-    PixelType startmask;
-    PixmapPtr	pTile;		/* pointer to tile we want to fill with */
-    int		w, width,  x, xSrc, ySrc, srcStartOver, nend;
-    PixelType 	endmask, *psrcT;
-    int 	tlwidth, rem, tileWidth, endinc;
-    int		tileHeight;
-    int *pwidthFree;		/* copies of the pointers to free */
-    DDXPointPtr pptFree;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    n = nInit * miFindMaxBand(pGC->pCompositeClip);
-    pwidthFree = (int *)xalloc(n * sizeof(int));
-    pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec));
-    if(!pptFree || !pwidthFree)
-    {
-	if (pptFree) xfree(pptFree);
-	if (pwidthFree) xfree(pwidthFree);
-	return;
-    }
-    pwidth = pwidthFree;
-    ppt = pptFree;
-    n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, 
-		    ppt, pwidth, fSorted);
-
-    pTile = pGC->stipple;
-    rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey()))->rop;
-    tlwidth = pTile->devKind / PGSZB;
-    xSrc = pDrawable->x;
-    ySrc = pDrawable->y;
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    tileWidth = pTile->drawable.width;
-    tileHeight = pTile->drawable.height;
-
-    /* this replaces rotating the stipple.  Instead, we just adjust the offset
-     * at which we start grabbing bits from the stipple.
-     * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
-     * so that iline and rem always stay within the tile bounds.
-     */
-    xSrc += (pGC->patOrg.x % tileWidth) - tileWidth;
-    ySrc += (pGC->patOrg.y % tileHeight) - tileHeight;
-    while (n--)
-    {
-	iline = (ppt->y - ySrc) % tileHeight;
-        pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth);
-        psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth);
-	x = ppt->x;
-
-	if (*pwidth)
-	{
-	    width = *pwidth;
-	    while(width > 0)
-	    {
-		psrc = psrcT;
-	        w = min(tileWidth, width);
-		if((rem = (x - xSrc) % tileWidth) != 0)
-		{
-		    /* if we're in the middle of the tile, get
-		       as many bits as will finish the span, or
-		       as many as will get to the left edge of the tile,
-		       or a longword worth, starting at the appropriate
-		       offset in the tile.
-		    */
-		    w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD);
-		    endinc = rem / BITMAP_SCANLINE_PAD;
-		    getandputrrop((psrc + endinc), (rem & PIM), (x & PIM),
-				 w, pdst, rop)
-		    if((x & PIM) + w >= PPW)
-			pdst++;
-		}
-
-		else if(((x & PIM) + w) < PPW)
-		{
-		    /* doing < PPW bits is easy, and worth special-casing */
-		    putbitsrrop(*psrc, x & PIM, w, pdst, rop);
-		}
-		else
-		{
-		    /* start at the left edge of the tile,
-		       and put down as much as we can
-		    */
-		    maskbits(x, w, startmask, endmask, nlMiddle);
-
-	            if (startmask)
-		        nstart = PPW - (x & PIM);
-	            else
-		        nstart = 0;
-	            if (endmask)
-	                nend = (x + w)  & PIM;
-	            else
-		        nend = 0;
-
-	            srcStartOver = nstart > PLST;
-
-		    if(startmask)
-		    {
-			putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop);
-			pdst++;
-			if(srcStartOver)
-			    psrc++;
-		    }
-		     
-		    while(nlMiddle--)
-		    {
-			    getandputrrop0(psrc, nstart, PPW, pdst, rop);
-			    pdst++;
-			    psrc++;
-		    }
-		    if(endmask)
-		    {
-			getandputrrop0(psrc, nstart, nend, pdst, rop);
-		    }
-		 }
-		 x += w;
-		 width -= w;
-	    }
-	}
-	ppt++;
-	pwidth++;
-    }
-    xfree(pptFree);
-    xfree(pwidthFree);
-}
diff --git a/mfb/mfbfont.c b/mfb/mfbfont.c
deleted file mode 100644
index 672b5d9..0000000
--- a/mfb/mfbfont.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "mfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "scrnintstr.h"
-
-/*ARGSUSED*/
-Bool
-mfbRealizeFont( pscr, pFont)
-    ScreenPtr	pscr;
-    FontPtr	pFont;
-{
-    return (TRUE);
-}
-
-mfbRealizeFontProc *
-mfbRealizeFontWeak(void)
-{
-    return mfbRealizeFont;
-}
-
-/*ARGSUSED*/
-Bool
-mfbUnrealizeFont( pscr, pFont)
-    ScreenPtr	pscr;
-    FontPtr	pFont;
-{
-    return (TRUE);
-}
-
-mfbUnrealizeFontProc *
-mfbUnrealizeFontWeak(void)
-{
-    return mfbUnrealizeFont;
-}
diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c
deleted file mode 100644
index 7492d7c..0000000
--- a/mfb/mfbgc.c
+++ /dev/null
@@ -1,1120 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "mfb.h"
-#include "dixfontstr.h"
-#include <X11/fonts/fontstruct.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "region.h"
-
-#include "mistruct.h"
-#include "migc.h"
-
-#include "maskbits.h"
-
-static GCFuncs	mfbFuncs = {
-	mfbValidateGC,
-	miChangeGC,
-	miCopyGC,
-	miDestroyGC,
-	miChangeClip,
-	miDestroyClip,
-	miCopyClip
-};
-
-
-static GCOps	whiteTECopyOps = {
-	mfbWhiteSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyWhite,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbTEGlyphBltWhite,
-	mfbPolyGlyphBltWhite,
-	mfbSolidPP
-};
-
-static GCOps	blackTECopyOps = {
-	mfbBlackSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyBlack,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbTEGlyphBltBlack,
-	mfbPolyGlyphBltBlack,
-	mfbSolidPP
-};
-
-static GCOps	whiteTEInvertOps = {
-	mfbInvertSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	miCopyArea,
-	miCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	miZeroPolyArc,
-	mfbFillPolyInvert,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbTEGlyphBltWhite,
-	mfbPolyGlyphBltInvert,
-	mfbSolidPP
-};
-
-static GCOps	blackTEInvertOps = {
-	mfbInvertSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	miZeroPolyArc,
-	mfbFillPolyInvert,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbTEGlyphBltBlack,
-	mfbPolyGlyphBltInvert,
-	mfbSolidPP
-};
-
-static GCOps	whiteCopyOps = {
-	mfbWhiteSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyWhite,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbImageGlyphBltWhite,
-	mfbPolyGlyphBltWhite,
-	mfbSolidPP
-};
-
-static GCOps	blackCopyOps = {
-	mfbBlackSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyBlack,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbImageGlyphBltBlack,
-	mfbPolyGlyphBltBlack,
-	mfbSolidPP
-};
-
-static GCOps	whiteInvertOps = {
-	mfbInvertSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	miZeroPolyArc,
-	mfbFillPolyInvert,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbImageGlyphBltWhite,
-	mfbPolyGlyphBltInvert,
-	mfbSolidPP
-};
-
-static GCOps	blackInvertOps = {
-	mfbInvertSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	miZeroPolyArc,
-	mfbFillPolyInvert,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	mfbImageGlyphBltBlack,
-	mfbPolyGlyphBltInvert,
-	mfbSolidPP
-};
-
-static GCOps	whiteWhiteCopyOps = {
-	mfbWhiteSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyWhite,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	miImageGlyphBlt,
-	mfbPolyGlyphBltWhite,
-	mfbSolidPP
-};
-
-static GCOps	blackBlackCopyOps = {
-	mfbBlackSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	mfbZeroPolyArcSS,
-	mfbFillPolyBlack,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	miImageGlyphBlt,
-	mfbPolyGlyphBltBlack,
-	mfbSolidPP
-};
-
-static GCOps	fgEqBgInvertOps = {
-	mfbInvertSolidFS,
-	mfbSetSpans,
-	mfbPutImage,
-	mfbCopyArea,
-	mfbCopyPlane,
-	mfbPolyPoint,
-	mfbLineSS,
-	mfbSegmentSS,
-	miPolyRectangle,
-	miZeroPolyArc,
-	mfbFillPolyInvert,
-	mfbPolyFillRect,
-	mfbPolyFillArcSolid,
-	miPolyText8,
-	miPolyText16,
-	miImageText8,
-	miImageText16,
-	miImageGlyphBlt,
-	mfbPolyGlyphBltInvert,
-	mfbSolidPP
-};
-
-
-struct commonOps {
-    int		    fg, bg;
-    int		    rrop;
-    int		    terminalFont;
-    GCOps	    *ops;
-    void	    (*fillArea)(
-	DrawablePtr /*pDraw*/,
-    	int /*nbox*/,
-    	BoxPtr /*pbox*/,
-    	int /*alu*/,
-    	PixmapPtr /*nop*/);
-};
-
-static struct commonOps mfbCommonOps[] = {
-    { 1, 0, RROP_WHITE, 1, &whiteTECopyOps, mfbSolidWhiteArea },
-    { 0, 1, RROP_BLACK, 1, &blackTECopyOps, mfbSolidBlackArea },
-    { 1, 0, RROP_INVERT, 1, &whiteTEInvertOps, mfbSolidInvertArea },
-    { 0, 1, RROP_INVERT, 1, &blackTEInvertOps, mfbSolidInvertArea },
-    { 1, 0, RROP_WHITE, 0, &whiteCopyOps, mfbSolidWhiteArea },
-    { 0, 1, RROP_BLACK, 0, &blackCopyOps, mfbSolidBlackArea },
-    { 1, 0, RROP_INVERT, 0, &whiteInvertOps, mfbSolidInvertArea },
-    { 0, 1, RROP_INVERT, 0, &blackInvertOps, mfbSolidInvertArea },
-    { 1, 1, RROP_WHITE, 0, &whiteWhiteCopyOps, mfbSolidWhiteArea },
-    { 0, 0, RROP_BLACK, 0, &blackBlackCopyOps, mfbSolidBlackArea },
-    { 1, 1, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea },
-    { 0, 0, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea },
-};
-
-#define numberCommonOps	(sizeof (mfbCommonOps) / sizeof (mfbCommonOps[0]))
-
-static GCOps *
-matchCommon (
-    GCPtr   pGC)
-{
-    int	i;
-    struct commonOps	*cop;
-    mfbPrivGC		*priv;
-
-    if (pGC->lineWidth != 0)
-	return 0;
-    if (pGC->lineStyle != LineSolid)
-	return 0;
-    if (pGC->fillStyle != FillSolid)
-	return 0;
-    if (!pGC->font ||
-        FONTMAXBOUNDS(pGC->font,rightSideBearing) -
-	FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
-	FONTMINBOUNDS(pGC->font,characterWidth) < 0)
-	return 0;
-    priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey());
-    for (i = 0; i < numberCommonOps; i++) {
-	cop = &mfbCommonOps[i];
-	if ((pGC->fgPixel & 1) != cop->fg)
-	    continue;
-	if ((pGC->bgPixel & 1) != cop->bg)
-	    continue;
-	if (priv->rop != cop->rrop)
-	    continue;
-	if (cop->terminalFont && !TERMINALFONT(pGC->font))
-	    continue;
-	priv->FillArea = cop->fillArea;
-	return cop->ops;
-    }
-    return 0;
-}
-
-
-Bool
-mfbCreateGC(pGC)
-    register GCPtr pGC;
-{
-    mfbPrivGC 	*pPriv;
-
-    pGC->clientClip = NULL;
-    pGC->clientClipType = CT_NONE;
-    
-    /* some of the output primitives aren't really necessary, since
-       they will be filled in ValidateGC because of dix/CreateGC()
-       setting all the change bits.  Others are necessary because although
-       they depend on being a monochrome frame buffer, they don't change 
-    */
-
-    pGC->ops = &whiteCopyOps;
-    pGC->funcs = &mfbFuncs;
-
-    /* mfb wants to translate before scan convesion */
-    pGC->miTranslate = 1;
-
-    pPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					  mfbGetGCPrivateKey());
-    pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel);
-    pGC->fExpose = TRUE;
-    pGC->pRotatedPixmap = NullPixmap;
-    pGC->freeCompClip = FALSE;
-    pPriv->FillArea = mfbSolidInvertArea;
-    return TRUE;
-}
-
-/* some noop functions */
-static void
-mfbPolyGlyphBltNoop(
-    DrawablePtr pDrawable,
-    GCPtr pGC,
-    int x,
-    int y,
-    unsigned int nglyph,
-    CharInfoPtr * ppci,
-    pointer pglyphBase)
-{
-    /* this is a no-op function */
-}
-
-static void
-mfbNoopFS(
-    DrawablePtr pDrawable,
-    GCPtr pGC,
-    int nInit,
-    DDXPointPtr pptInit,
-    int * pwidthInit,
-    int fSorted)
-{
-    /* this is a no-op function */
-}
-
-static void
-mfbFillPolyNoop(
-    DrawablePtr pDrawable,
-    GCPtr pGC,
-    int shape,
-    int mode,
-    int count,
-    DDXPointPtr ptsIn)
-{
-    /* this is a no-op function */
-}
-
-
-/* Clipping conventions
-	if the drawable is a window
-	    CT_REGION ==> pCompositeClip really is the composite
-	    CT_other ==> pCompositeClip is the window clip region
-	if the drawable is a pixmap
-	    CT_REGION ==> pCompositeClip is the translated client region
-		clipped to the pixmap boundary
-	    CT_other ==> pCompositeClip is the pixmap bounding box
-*/
-
-/*ARGSUSED*/
-void
-mfbValidateGC(pGC, changes, pDrawable)
-    register GCPtr 	pGC;
-    unsigned long	changes;
-    DrawablePtr 	pDrawable;
-{
-    register mfbPrivGCPtr	devPriv;
-    int mask;			/* stateChanges */
-    int index;			/* used for stepping through bitfields */
-    int	xrot, yrot;		/* rotations for tile and stipple pattern */
-    int rrop;			/* reduced rasterop */
-				/* flags for changing the proc vector 
-				   and updating things in devPriv
-				*/
-    int new_rotate, new_rrop,  new_line, new_text, new_fill;
-    DDXPointRec	oldOrg;		/* origin of thing GC was last used with */
-
-    oldOrg = pGC->lastWinOrg;
-
-    pGC->lastWinOrg.x = pDrawable->x;
-    pGC->lastWinOrg.y = pDrawable->y;
-
-    /* we need to re-rotate the tile if the previous window/pixmap
-       origin (oldOrg) differs from the new window/pixmap origin
-       (pGC->lastWinOrg)
-    */
-    new_rotate = (oldOrg.x != pGC->lastWinOrg.x) ||
-		 (oldOrg.y != pGC->lastWinOrg.y);
-
-    devPriv = (mfbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
-					     mfbGetGCPrivateKey());
-    /*
-	if the client clip is different or moved OR
-	the subwindowMode has changed OR
-	the window's clip has changed since the last validation
-	we need to recompute the composite clip
-    */
-    if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
-	(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
-       )
-    {
-	miComputeCompositeClip(pGC, pDrawable);
-    }
-
-    new_rrop = FALSE;
-    new_line = FALSE;
-    new_text = FALSE;
-    new_fill = FALSE;
-
-    mask = changes;
-    while (mask)
-    {
-	index = lowbit (mask);
-	mask &= ~index;
-
-	/* this switch acculmulates a list of which procedures
-	   might have to change due to changes in the GC.  in
-	   some cases (e.g. changing one 16 bit tile for another)
-	   we might not really need a change, but the code is
-	   being paranoid.
-	   this sort of batching wins if, for example, the alu
-	   and the font have been changed, or any other pair
-	   of items that both change the same thing.
-	*/
-	switch (index)
-	{
-	  case GCFunction:
-	  case GCForeground:
-	    new_rrop = TRUE;
-	    break;
-	  case GCPlaneMask:
-	    break;
-	  case GCBackground:
-	    new_rrop = TRUE;	/* for opaque stipples */
-	    break;
-	  case GCLineStyle:
-	  case GCLineWidth:
-	  case GCJoinStyle:
-	    new_line = TRUE;
-	    break;
-	  case GCCapStyle:
-	    break;
-	  case GCFillStyle:
-	    new_fill = TRUE;
-	    break;
-	  case GCFillRule:
-	    break;
-	  case GCTile:
-	    if(pGC->tileIsPixel)
-		break;
-	    new_rotate = TRUE;
-	    new_fill = TRUE;
-	    break;
-
-	  case GCStipple:
-	    if(pGC->stipple == (PixmapPtr)NULL)
-		break;
-	    new_rotate = TRUE;
-	    new_fill = TRUE;
-	    break;
-
-	  case GCTileStipXOrigin:
-	    new_rotate = TRUE;
-	    break;
-
-	  case GCTileStipYOrigin:
-	    new_rotate = TRUE;
-	    break;
-
-	  case GCFont:
-	    new_text = TRUE;
-	    break;
-	  case GCSubwindowMode:
-	    break;
-	  case GCGraphicsExposures:
-	    break;
-	  case GCClipXOrigin:
-	    break;
-	  case GCClipYOrigin:
-	    break;
-	  case GCClipMask:
-	    break;
-	  case GCDashOffset:
-	    break;
-	  case GCDashList:
-	    break;
-	  case GCArcMode:
-	    break;
-	  default:
-	    break;
-	}
-    }
-
-    /* deal with the changes we've collected .
-       new_rrop must be done first because subsequent things
-       depend on it.
-    */
-
-    if(new_rotate || new_fill)
-    {
-	Bool new_pix = FALSE;
-
-	/* figure out how much to rotate */
-	xrot = pGC->patOrg.x;
-	yrot = pGC->patOrg.y;
-	xrot += pDrawable->x;
-	yrot += pDrawable->y;
-
-	switch (pGC->fillStyle)
-	{
-	case FillTiled:
-	    /* copy current tile and stipple */
-	    if (!pGC->tileIsPixel && (pGC->tile.pixmap->drawable.width <= PPW) &&
-		!(pGC->tile.pixmap->drawable.width & (pGC->tile.pixmap->drawable.width - 1)))
-	    {
-		mfbCopyRotatePixmap(pGC->tile.pixmap,
-				    &pGC->pRotatedPixmap, xrot, yrot);
-		new_pix = TRUE;
-	    }
-	    break;
-	case FillStippled:
-	case FillOpaqueStippled:
-	    if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) &&
-	    	!(pGC->stipple->drawable.width & (pGC->stipple->drawable.width - 1)))
-	    {
-		mfbCopyRotatePixmap(pGC->stipple,
-				    &pGC->pRotatedPixmap, xrot, yrot);
-		new_pix = TRUE;
-	    }
-	}
-	/* destroy any previously rotated tile or stipple */
-	if (!new_pix && pGC->pRotatedPixmap)
-	{
-	    (*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap);
-	    pGC->pRotatedPixmap = (PixmapPtr)NULL;
-	}
-    }
-
-    /*
-     * duck out here when the GC is unchanged
-     */
-
-    if (!changes)
-	return;
-
-    if (new_rrop || new_fill)
-    {
-	rrop = mfbReduceRop(pGC->alu, pGC->fgPixel);
-	devPriv->rop = rrop;
-	new_fill = TRUE;
-	/* FillArea raster op is GC's for tile filling,
-	   and the reduced rop for solid and stipple
-	*/
-	if (pGC->fillStyle == FillTiled)
-	    devPriv->ropFillArea = pGC->alu;
-	else
-	    devPriv->ropFillArea = rrop;
-
-	/* opaque stipples:
-	   fg	bg	ropOpStip	fill style
-	   1	0	alu		tile
-	   0	1	inverseAlu	tile
-	   1	1	rrop(fg, alu)	solid
-	   0	0	rrop(fg, alu)	solid
-	Note that rrop(fg, alu) == mfbPrivGC.rop, so we don't really need to
-	compute it.
-	*/
-        if (pGC->fillStyle == FillOpaqueStippled)
-        {
-	    if ((pGC->fgPixel & 1) != (pGC->bgPixel & 1))
-	    {
-	        if (pGC->fgPixel & 1)
-		    devPriv->ropOpStip = pGC->alu;
-	        else
-		    devPriv->ropOpStip = InverseAlu[pGC->alu];
-	    }
-	    else
-	        devPriv->ropOpStip = rrop;
-	    devPriv->ropFillArea = devPriv->ropOpStip;
-        }
-    }
-    else
-	rrop = devPriv->rop;
-
-    if (new_line || new_fill || new_text)
-    {
-	GCOps	*newops;
-
-	if ((newops = matchCommon (pGC)))
- 	{
-	    if (pGC->ops->devPrivate.val)
-		miDestroyGCOps (pGC->ops);
-	    pGC->ops = newops;
-	    new_line = new_fill = new_text = 0;
-	}
- 	else
- 	{
-	    if (!pGC->ops->devPrivate.val)
- 	    {
-		pGC->ops = miCreateGCOps (pGC->ops);
-		pGC->ops->devPrivate.val = 1;
-	    }
-	}
-    }
-
-    if (new_line || new_fill)
-    {
-	if (pGC->lineWidth == 0)
-	{
-	    if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)
-		&& ((rrop == RROP_WHITE) || (rrop == RROP_BLACK)))
-		pGC->ops->PolyArc = mfbZeroPolyArcSS;
-	    else
-		pGC->ops->PolyArc = miZeroPolyArc;
-	}
-	else
-	    pGC->ops->PolyArc = miPolyArc;
-	if (pGC->lineStyle == LineSolid)
-	{
-	    if(pGC->lineWidth == 0)
-	    {
-	        if (pGC->fillStyle == FillSolid)
-		{
-		    pGC->ops->PolySegment = mfbSegmentSS;
-		    pGC->ops->Polylines = mfbLineSS;
-	        }
- 		else
-		{
-		    pGC->ops->PolySegment = miPolySegment;
-		    pGC->ops->Polylines = miZeroLine;
-		}
-	    }
-	    else
-	    {
-		pGC->ops->PolySegment = miPolySegment;
-		pGC->ops->Polylines = miWideLine;
-	    }
-	}
-	else
-	{
-	    if(pGC->lineWidth == 0 && pGC->fillStyle == FillSolid)
-	    {
-	        pGC->ops->Polylines = mfbLineSD;
-		pGC->ops->PolySegment = mfbSegmentSD;
-	    }
-	    else
-	    {
-	        pGC->ops->Polylines = miWideDash;
-		pGC->ops->PolySegment = miPolySegment;
-	    }
-	}
-    }
-
-    if (new_text || new_fill)
-    {
-	if ((pGC->font) &&
-	    (FONTMAXBOUNDS(pGC->font,rightSideBearing) -
-	     FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
-	     FONTMINBOUNDS(pGC->font,characterWidth) < 0))
-	{
-	    pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-	    pGC->ops->ImageGlyphBlt = miImageGlyphBlt;
-	}
-	else
-	{
-	    /* special case ImageGlyphBlt for terminal emulator fonts */
-
-
-	    if ((pGC->font) &&
-		TERMINALFONT(pGC->font) &&
-		((pGC->fgPixel & 1) != (pGC->bgPixel & 1)))
-	    {
-		/* pcc bug makes this not compile...
-		pGC->ops->ImageGlyphBlt = (pGC->fgPixel & 1) ? mfbTEGlyphBltWhite :
-						      mfbTEGlyphBltBlack;
-		*/
-		if (pGC->fgPixel & 1)
-		    pGC->ops->ImageGlyphBlt = mfbTEGlyphBltWhite;
-		else
-		    pGC->ops->ImageGlyphBlt = mfbTEGlyphBltBlack;
-	    }
-	    else
-
-
-	    {
-	        if (pGC->fgPixel & 1)
-		    pGC->ops->ImageGlyphBlt = mfbImageGlyphBltWhite;
-	        else
-		    pGC->ops->ImageGlyphBlt = mfbImageGlyphBltBlack;
-	    }
-
-	    /* now do PolyGlyphBlt */
-	    if (pGC->fillStyle == FillSolid ||
-		(pGC->fillStyle == FillOpaqueStippled &&
-		 (pGC->fgPixel & 1) == (pGC->bgPixel & 1)
-		)
-	       )
-	    {
-		if (rrop == RROP_WHITE)
-		    pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltWhite;
-		else if (rrop == RROP_BLACK)
-		    pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltBlack;
-		else if (rrop == RROP_INVERT)
-		    pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltInvert;
-		else
-		    pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltNoop;
-	    }
-	    else
-	    {
-		pGC->ops->PolyGlyphBlt = miPolyGlyphBlt;
-	    }
-	}
-    }
-
-    if (new_fill)
-
-
-    {
-	/* install a suitable fillspans and pushpixels */
-	pGC->ops->PushPixels = mfbPushPixels;
-	pGC->ops->FillPolygon = miFillPolygon;
-	if ((pGC->fillStyle == FillSolid) ||
-	    ((pGC->fillStyle == FillOpaqueStippled) &&
-	     ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))))
-	{
-	    pGC->ops->PushPixels = mfbSolidPP;
-	    switch(devPriv->rop)
-	    {
-	      case RROP_WHITE:
-		pGC->ops->FillSpans = mfbWhiteSolidFS;
-		pGC->ops->FillPolygon = mfbFillPolyWhite;
-		break;
-	      case RROP_BLACK:
-		pGC->ops->FillSpans = mfbBlackSolidFS;
-		pGC->ops->FillPolygon = mfbFillPolyBlack;
-		break;
-	      case RROP_INVERT:
-		pGC->ops->FillSpans = mfbInvertSolidFS;
-		pGC->ops->FillPolygon = mfbFillPolyInvert;
-		break;
-	      case RROP_NOP:
-		pGC->ops->FillSpans = mfbNoopFS;
-		pGC->ops->FillPolygon = mfbFillPolyNoop;
-		break;
-	    }
-	}
-	/* beyond this point, opaqueStippled ==> fg != bg */
-	else if (((pGC->fillStyle == FillTiled) ||
-		  (pGC->fillStyle == FillOpaqueStippled)) &&
-		 !pGC->pRotatedPixmap)
-	{
-	    pGC->ops->FillSpans = mfbUnnaturalTileFS;
-	}
-	else if ((pGC->fillStyle == FillStippled) && !pGC->pRotatedPixmap)
-	{
-	    pGC->ops->FillSpans = mfbUnnaturalStippleFS;
-	}
-	else if (pGC->fillStyle == FillStippled)
-	{
-	    switch(devPriv->rop)
-	    {
-	      case RROP_WHITE:
-		pGC->ops->FillSpans = mfbWhiteStippleFS;
-		break;
-	      case RROP_BLACK:
-		pGC->ops->FillSpans = mfbBlackStippleFS;
-		break;
-	      case RROP_INVERT:
-		pGC->ops->FillSpans = mfbInvertStippleFS;
-		break;
-	      case RROP_NOP:
-		pGC->ops->FillSpans = mfbNoopFS;
-		break;
-	    }
-	}
-	else /* overload tiles to do parti-colored opaque stipples */
-	{
-	    pGC->ops->FillSpans = mfbTileFS;
-	}
-	if (pGC->fillStyle == FillSolid)
-	    pGC->ops->PolyFillArc = mfbPolyFillArcSolid;
-	else
-	    pGC->ops->PolyFillArc = miPolyFillArc;
-	/* the rectangle code doesn't deal with opaque stipples that
-	   are two colors -- we can fool it for fg==bg, though
-	 */
-	if ((((pGC->fillStyle == FillTiled) ||
-	      (pGC->fillStyle == FillStippled)) &&
-	     !pGC->pRotatedPixmap) ||
-	    ((pGC->fillStyle == FillOpaqueStippled) &&
-	     ((pGC->fgPixel & 1) != (pGC->bgPixel & 1)))
-	   )
-	{
-	    pGC->ops->PolyFillRect = miPolyFillRect;
-	}
-	else /* deal with solids and natural stipples and tiles */
-	{
-	    pGC->ops->PolyFillRect = mfbPolyFillRect;
-
-	    if ((pGC->fillStyle == FillSolid) ||
-		((pGC->fillStyle == FillOpaqueStippled) &&
-		 ((pGC->fgPixel & 1) == (pGC->bgPixel & 1))))
-	    {
-		switch(devPriv->rop)
-		{
-		  case RROP_WHITE:
-		    devPriv->FillArea = mfbSolidWhiteArea;
-		    break;
-		  case RROP_BLACK:
-		    devPriv->FillArea = mfbSolidBlackArea;
-		    break;
-		  case RROP_INVERT:
-		    devPriv->FillArea = mfbSolidInvertArea;
-		    break;
-		  case RROP_NOP:
-		    devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
-		    break;
-		}
-	    }
-	    else if (pGC->fillStyle == FillStippled)
-	    {
-		switch(devPriv->rop)
-		{
-		  case RROP_WHITE:
-		    devPriv->FillArea = mfbStippleWhiteArea;
-		    break;
-		  case RROP_BLACK:
-		    devPriv->FillArea = mfbStippleBlackArea;
-		    break;
-		  case RROP_INVERT:
-		    devPriv->FillArea = mfbStippleInvertArea;
-		    break;
-		  case RROP_NOP:
-		    devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA;
-		    break;
-		}
-	    }
-	    else /* deal with tiles */
-	    {
-		switch (pGC->alu)
-		{
-		  case GXcopy:
-		    devPriv->FillArea = mfbTileAreaPPWCopy;
-		    break;
-		  default:
-		    devPriv->FillArea = mfbTileAreaPPWGeneral;
-		    break;
-		}
-	    }
-	} /* end of natural rectangles */
-    } /* end of new_fill */
-
-
-}
-
-/* table to map alu(src, dst) to alu(~src, dst) */
-int InverseAlu[16] = {
-	GXclear,
-	GXandInverted,
-	GXnor,
-	GXcopyInverted,
-	GXand,
-	GXnoop,
-	GXequiv,
-	GXorInverted,
-	GXandReverse,
-	GXxor,
-	GXinvert,
-	GXnand,
-	GXcopy,
-	GXor,
-	GXorReverse,
-	GXset
-};
-
-int mfbGetInverseAlu(i)
-    int i;
-{
-    return InverseAlu[i];
-}
-
-int
-mfbReduceRop(alu, src)
-    register int alu;
-    register Pixel src;
-{
-    int rop = 0;
-    if ((src & 1) == 0)	/* src is black */
-    {
-	switch(alu)
-	{
-	  case GXclear:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXand:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXandReverse:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXcopy:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXandInverted:
-	    rop = RROP_NOP;
-	    break;
-	  case GXnoop:
-	    rop = RROP_NOP;
-	    break;
-	  case GXxor:
-	    rop = RROP_NOP;
-	    break;
-	  case GXor:
-	    rop = RROP_NOP;
-	    break;
-	  case GXnor:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXequiv:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXinvert:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXorReverse:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXcopyInverted:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXorInverted:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXnand:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXset:
-	    rop = RROP_WHITE;
-	    break;
-	}
-    }
-    else /* src is white */
-    {
-	switch(alu)
-	{
-	  case GXclear:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXand:
-	    rop = RROP_NOP;
-	    break;
-	  case GXandReverse:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXcopy:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXandInverted:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXnoop:
-	    rop = RROP_NOP;
-	    break;
-	  case GXxor:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXor:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXnor:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXequiv:
-	    rop = RROP_NOP;
-	    break;
-	  case GXinvert:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXorReverse:
-	    rop = RROP_WHITE;
-	    break;
-	  case GXcopyInverted:
-	    rop = RROP_BLACK;
-	    break;
-	  case GXorInverted:
-	    rop = RROP_NOP;
-	    break;
-	  case GXnand:
-	    rop = RROP_INVERT;
-	    break;
-	  case GXset:
-	    rop = RROP_WHITE;
-	    break;
-	}
-    }
-    return rop;
-}
diff --git a/mfb/mfbgetsp.c b/mfb/mfbgetsp.c
deleted file mode 100644
index befe57a..0000000
--- a/mfb/mfbgetsp.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "misc.h"
-#include "region.h"
-#include "gc.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-#include "servermd.h"
-
-/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
- * and continuing for pwidth[i] bits
- * Each scanline returned will be server scanline padded, i.e., it will come
- * out to an integral number of words.
- */
-/*ARGSUSED*/
-void
-mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart)
-    DrawablePtr		pDrawable;	/* drawable from which to get bits */
-    int			wMax;		/* largest value of all *pwidths */
-    register DDXPointPtr ppt;		/* points to start copying from */
-    int			*pwidth;	/* list of number of bits to copy */
-    int			nspans;		/* number of scanlines to copy */
-    char		*pchardstStart;	/* where to put the bits */
-{
-    PixelType		*pdstStart = (PixelType *)(pointer)pchardstStart;
-    register PixelType	*pdst;	/* where to put the bits */
-    register PixelType	*psrc;	/* where to get the bits */
-    register PixelType	tmpSrc;	/* scratch buffer for bits */
-    PixelType		*psrcBase;	/* start of src bitmap */
-    int			widthSrc;	/* width of pixmap in bytes */
-    register DDXPointPtr pptLast;	/* one past last point to get */
-    int         	xEnd;		/* last pixel to copy from */
-    register int	nstart; 
-    int	 		nend = 0; 
-    int	 		srcStartOver; 
-    PixelType 		startmask, endmask;
-    unsigned int	srcBit;
-    int	 		nlMiddle, nl;
-    int			w;
-  
-    pptLast = ppt + nspans;
-
-    mfbGetPixelWidthAndPointer(pDrawable, widthSrc, psrcBase);
-    pdst = pdstStart;
-
-    while(ppt < pptLast)
-    {
-	/* XXX should this really be << PWSH, or * 8, or * PGSZB? */
-	xEnd = min(ppt->x + *pwidth, widthSrc << PWSH);
-	pwidth++;
-	psrc = mfbScanline(psrcBase, ppt->x, ppt->y, widthSrc);
-	w = xEnd - ppt->x;
-	srcBit = ppt->x & PIM;
-
-	if (srcBit + w <= PPW) 
-	{ 
-	    getandputbits0(psrc, srcBit, w, pdst);
-	    pdst++;
-	} 
-	else 
-	{ 
-
-	    maskbits(ppt->x, w, startmask, endmask, nlMiddle);
-	    if (startmask) 
-		nstart = PPW - srcBit; 
-	    else 
-		nstart = 0; 
-	    if (endmask) 
-		nend = xEnd & PIM; 
-	    srcStartOver = srcBit + nstart > PLST;
-	    if (startmask) 
-	    { 
-		getandputbits0(psrc, srcBit, nstart, pdst);
-		if(srcStartOver)
-		    psrc++;
-	    } 
-	    nl = nlMiddle; 
-#ifdef FASTPUTBITS
-	    Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;);
-#else
-	    while (nl--) 
-	    { 
-		tmpSrc = *psrc;
-		putbits(tmpSrc, nstart, PPW, pdst);
-		psrc++;
-		pdst++;
-	    } 
-#endif
-	    if (endmask) 
-	    { 
-		putbits(*psrc, nstart, nend, pdst);
-		if(nstart + nend > PPW)
-		    pdst++;
-	    } 
-	    if (startmask || endmask)
-		pdst++; 
-	} 
-        ppt++;
-    }
-}
diff --git a/mfb/mfbhrzvert.c b/mfb/mfbhrzvert.c
deleted file mode 100644
index 7616f9b..0000000
--- a/mfb/mfbhrzvert.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "gc.h"
-#include "window.h"
-#include "pixmap.h"
-#include "region.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-/* horizontal solid line
-   abs(len) > 1
-*/
-void
-mfbHorzS(rop, addrl, nlwidth, x1, y1, len)
-int rop;		/* a reduced rasterop */
-register PixelType *addrl;	/* pointer to base of bitmap */
-register int nlwidth;	/* width in longwords of bitmap */
-int x1;			/* initial point */ 
-int y1;
-int len;		/* length of line */
-{
-    register PixelType startmask;
-    register PixelType endmask;
-    register int nlmiddle;
-
-
-    /* force the line to go left to right
-       but don't draw the last point
-    */
-    if (len < 0)
-    {
-	x1 += len;
-	x1 += 1;
-	len = -len;
-    }
-
-    addrl = mfbScanline(addrl, x1, y1, nlwidth);
-
-    /* all bits inside same longword */
-    if ( ((x1 & PIM) + len) < PPW)
-    {
-	maskpartialbits(x1, len, startmask);
-        if (rop == RROP_BLACK)
-        {
-	    *addrl &= ~startmask;
-        }
-        else if (rop == RROP_WHITE)
-        {
-	    *addrl |= startmask;
-        }
-        else if (rop == RROP_INVERT)
-        {
-	    *addrl ^= startmask;
-        }
-    }
-    else
-    {
-	maskbits(x1, len, startmask, endmask, nlmiddle);
-        if (rop == RROP_BLACK)
-        {
-	    if (startmask)
-		*addrl++ &= ~startmask;
-	    Duff (nlmiddle, *addrl++ = 0x0);
-	    if (endmask)
-		*addrl &= ~endmask;
-        }
-        else if (rop == RROP_WHITE)
-        {
-	    if (startmask)
-		*addrl++ |= startmask;
-	    Duff (nlmiddle, *addrl++ = ~0);
-	    if (endmask)
-		*addrl |= endmask;
-        }
-        else if (rop == RROP_INVERT)
-        {
-	    if (startmask)
-		*addrl++ ^= startmask;
-	    Duff (nlmiddle, *addrl++ ^= ~0);
-	    if (endmask)
-		*addrl ^= endmask;
-        }
-    }
-}
-
-/* vertical solid line
-   this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
-   better code.  sigh.  we know that len will never be 0 or 1, so
-   it's OK to use it.
-*/
-
-void
-mfbVertS(rop, addrl, nlwidth, x1, y1, len)
-int rop;		/* a reduced rasterop */
-register PixelType *addrl;	/* pointer to base of bitmap */
-register int nlwidth;	/* width in longwords of bitmap */
-int x1, y1;		/* initial point */
-register int len;	/* length of line */
-{
-    register PixelType bitmask;
-
-    addrl = mfbScanline(addrl, x1, y1, nlwidth);
-
-    if (len < 0)
-    {
-	nlwidth = -nlwidth;
-	len = -len;
-    }
- 
-    if (rop == RROP_BLACK)
-    {
-	bitmask = rmask[x1 & PIM];
-        Duff(len, *addrl &= bitmask; mfbScanlineInc(addrl, nlwidth) );
-    }
-    else if (rop == RROP_WHITE)
-    {
-	bitmask = mask[x1 & PIM];
-        Duff(len, *addrl |= bitmask; mfbScanlineInc(addrl, nlwidth) );
-    }
-    else if (rop == RROP_INVERT)
-    {
-	bitmask = mask[x1 & PIM];
-        Duff(len, *addrl ^= bitmask; mfbScanlineInc(addrl, nlwidth) );
-    }
-}
diff --git a/mfb/mfbimage.c b/mfb/mfbimage.c
deleted file mode 100644
index 8861865..0000000
--- a/mfb/mfbimage.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "gcstruct.h"
-
-#include "mfb.h"
-#include "mi.h"
-#include <X11/Xmd.h>
-
-#include "maskbits.h"
-
-#include "servermd.h"
-
-/* Put and Get images on a monochrome frame buffer
- *
- *   we do this by creating a temporary pixmap and making its
- * pointer to bits point to the buffer read in from the client.
- * this works because of the padding rules specified at startup
- *
- * Note that CopyArea must know how to copy a bitmap into the server-format
- * temporary pixmap.
- *
- * For speed, mfbPutImage should allocate the temporary pixmap on the stack.
- *
- *     even though an XYBitmap and an XYPixmap have the same
- * format (for this device), PutImage has different semantics for the
- * two.  XYPixmap just does the copy; XYBitmap takes gc.fgPixel for
- * a 1 bit, gc.bgPixel for a 0 bit, which we notice is exactly
- * like CopyPlane.
- *
- *   written by drewry, september 1986
- */
-
-
-
-/*ARGSUSED*/
-void
-mfbPutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pImage)
-    DrawablePtr dst;
-    GCPtr	pGC;
-    int		depth, x, y, w, h;
-    int leftPad;
-    int format;
-    char 	*pImage;
-{
-    PixmapPtr	pPixmap;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    /* 0 may confuse CreatePixmap, and will sometimes be
-       passed by the mi text code
-    */
-    if ((w == 0) || (h == 0))
-	return;
-
-    pPixmap = GetScratchPixmapHeader(dst->pScreen, w+leftPad, h, 1, 1,
-				BitmapBytePad(w+leftPad), (pointer)pImage);
-    if (!pPixmap)
-	return;
-
-    pGC->fExpose = FALSE;
-    if (format != XYBitmap)
-	(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
-			      w, h, x, y);
-    else
-	(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0,
-			       w, h, x, y, 1);
-    pGC->fExpose = TRUE;
-    FreeScratchPixmapHeader(pPixmap);
-}
-
-
-/*
- * pdstLine points to space allocated by caller, which he can do since
- * he knows dimensions of the pixmap
- * we can call mfbDoBitblt because the dispatcher has promised not to send us
- * anything that would require going over the edge of the screen.
- *
- *	XYPixmap and ZPixmap are the same for mfb.
- *	For any planemask with bit 0 == 0, just fill the dst with 0.
- */
-/*ARGSUSED*/
-void
-mfbGetImage( pDrawable, sx, sy, w, h, format, planeMask, pdstLine)
-    DrawablePtr pDrawable;
-    int		sx, sy, w, h;
-    unsigned int format;
-    unsigned long planeMask;
-    char	*pdstLine;
-{
-    BoxRec box;
-    DDXPointRec ptSrc;
-    RegionRec rgnDst;
-
-    if (planeMask & 0x1)
-    {
-	ScreenPtr pScreen = pDrawable->pScreen;
-	PixmapPtr pPixmap;
-
-	pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1,
-					 BitmapBytePad(w), (pointer)pdstLine);
-	if (!pPixmap)
-	    return;
-
-        ptSrc.x = sx + pDrawable->x;
-        ptSrc.y = sy + pDrawable->y;
-        box.x1 = 0;
-        box.y1 = 0;
-        box.x2 = w;
-        box.y2 = h;
-        REGION_INIT(pScreen, &rgnDst, &box, 1);
-        mfbDoBitblt(pDrawable, (DrawablePtr)pPixmap,
-		    GXcopy, &rgnDst, &ptSrc);
-        REGION_UNINIT(pScreen, &rgnDst);
-	FreeScratchPixmapHeader(pPixmap);
-    }
-    else
-    {
-	bzero(pdstLine, BitmapBytePad(w) * h);
-    }
-}
diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c
deleted file mode 100644
index cb532cf..0000000
--- a/mfb/mfbimggblt.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include	<X11/X.h>
-#include	<X11/Xmd.h>
-#include	<X11/Xproto.h>
-#include	"mfb.h"
-#include	<X11/fonts/fontstruct.h>
-#include	"dixfontstr.h"
-#include	"gcstruct.h"
-#include	"windowstr.h"
-#include	"scrnintstr.h"
-#include	"pixmapstr.h"
-#include	"regionstr.h"
-#include	"maskbits.h"
-
-/*
-    we should eventually special-case fixed-width fonts for ImageText.
-
-    this works for fonts with glyphs <= 32 bits wide.
-
-    the clipping calculations are done for worst-case fonts.
-we make no assumptions about the heights, widths, or bearings
-of the glyphs.  if we knew that the glyphs are all the same height,
-we could clip the tops and bottoms per clipping box, rather
-than per character per clipping box.  if we knew that the glyphs'
-left and right bearings were wlle-behaved, we could clip a single
-character at the start, output until the last unclipped
-character, and then clip the last one.  this is all straightforward
-to determine based on max-bounds and min-bounds from the font.
-    there is some inefficiency introduced in the per-character
-clipping to make what's going on clearer.
-
-    (it is possible, for example, for a font to be defined in which the
-next-to-last character in a font would be clipped out, but the last
-one wouldn't.  the code below deals with this.)
-
-    Image text looks at the bits in the glyph and the fg and bg in the
-GC.  it paints a rectangle, as defined in the protocol dcoument,
-and the paints the characters.
-
-   to avoid source proliferation, this file is compiled
-three times:
-	MFBIMAGEGLYPHBLT	OPEQ
-	mfbImageGlyphBltWhite	|=
-	mfbImageGlyphBltBlack	&=~
-
-    the register allocations for startmask and endmask may not
-be the right thing.  are there two other deserving candidates?
-xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
-*/
-
-void
-MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
-    DrawablePtr pDrawable;
-    GC 		*pGC;
-    int 	x, y;
-    unsigned int nglyph;
-    CharInfoPtr *ppci;		/* array of character info */
-    pointer	pglyphBase;	/* start of array of glyphs */
-{
-    ExtentInfoRec info;	/* used by QueryGlyphExtents() */
-    BoxRec bbox;	/* string's bounding box */
-    xRectangle backrect;/* backing rectangle to paint.
-			   in the general case, NOT necessarily
-			   the same as the string's bounding box
-			*/
-
-    CharInfoPtr pci;
-    int xorg, yorg;	/* origin of drawable in bitmap */
-    int widthDst;	/* width of dst in longwords */
-
-			/* these keep track of the character origin */
-    PixelType *pdstBase;
-			/* points to longword with character origin */
-    int xchar;		/* xorigin of char (mod 32) */
-
-			/* these are used for placing the glyph */
-    register int xoff;	/* x offset of left edge of glyph (mod 32) */
-    register PixelType *pdst;
-			/* pointer to current longword in dst */
-
-    int w;		/* width of glyph in bits */
-    int h;		/* height of glyph */
-    int widthGlyph;	/* width of glyph, in bytes */
-    register unsigned char *pglyph;
-			/* pointer to current row of glyph */
-
-			/* used for putting down glyph */    
-    register PixelType tmpSrc;
-			/* for getting bits from glyph */
-    register PixelType startmask;
-    register PixelType endmask;
-
-    register int nFirst;/* bits of glyph in current longword */
-    mfbPrivGC *pPrivGC;
-    mfbFillAreaProcPtr oldFillArea;
-			/* we might temporarily usurp this
-			   field in devPriv */
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
-
-    QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
-
-    backrect.x = x;
-    backrect.y = y - FONTASCENT(pGC->font);
-    backrect.width = info.overallWidth;
-    backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
-
-    x += xorg;
-    y += yorg;
-
-    bbox.x1 = x + info.overallLeft;
-    bbox.x2 = x + info.overallRight;
-    bbox.y1 = y - info.overallAscent;
-    bbox.y2 = y + info.overallDescent;
-
-    /* UNCLEAN CODE
-       we know the mfbPolyFillRect uses only two fields in
-       devPrivate[mfbGCPrivateIndex].ptr, one of which (ropFillArea) is
-       irrelevant for solid filling, so we just poke the FillArea
-       field.  the GC is now in an inconsistent state, but we'll fix
-       it as soon as PolyFillRect returns.  fortunately, the server
-       is single threaded.
-
-    NOTE:
-       if you are not using the standard mfbFillRectangle code, you
-       need to poke any fields in the GC the rectangle stuff need
-       (probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGCPrivateIndex].ptr
-       (probably rop or ropFillArea.)  You could just call ValidateGC,
-       but that is usually not a cheap thing to do.
-    */
-
-    pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					    mfbGetGCPrivateKey());
-    oldFillArea = pPrivGC->FillArea;
-
-    if (pGC->bgPixel & 1)
-        pPrivGC->FillArea = mfbSolidWhiteArea;
-    else
-        pPrivGC->FillArea = mfbSolidBlackArea;
-
-    mfbPolyFillRect(pDrawable, pGC, 1, &backrect);
-    pPrivGC->FillArea = oldFillArea;
-
-    /* the faint-hearted can open their eyes now */
-    switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
-    {
-      case rgnOUT:
-	break;
-      case rgnIN:
-	pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
-        xchar = x & PIM;
-
-        while(nglyph--)
-        {
-	    pci = *ppci;
-	    pglyph = FONTGLYPHBITS(pglyphBase, pci);
-	    w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
-	    h = pci->metrics.ascent + pci->metrics.descent;
-	    widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    /* start at top scanline of glyph */
-	    pdst = pdstBase;
-
-	    /* find correct word in scanline and x offset within it
-	       for left edge of glyph
-	    */
-	    xoff = xchar + pci->metrics.leftSideBearing;
-	    if (xoff > PLST)
-	    {
-	        pdst++;
-	        xoff &= PIM;
-	    }
-	    else if (xoff < 0)
-	    {
-	        xoff += PPW;
-	        pdst--;
-	    }
-
-	    pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
-
-	    if ((xoff + w) <= PPW)
-	    {
-	        /* glyph all in one longword */
-	        maskpartialbits(xoff, w, startmask);
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-		    pglyph += widthGlyph;
-		    mfbScanlineInc(pdst, widthDst);
-	        }
-	    }
-	    else
-	    {
-	        /* glyph crosses longword boundary */
-	        maskPPWbits(xoff, w, startmask, endmask);
-	        nFirst = PPW - xoff;
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-		    *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
-		    pglyph += widthGlyph;
-		    mfbScanlineInc(pdst, widthDst);
-	        }
-	    } /* glyph crosses longwords boundary */
-
-	    /* update character origin */
-	    x += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-	        xchar -= PPW;
-	        pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-	        xchar += PPW;
-	        pdstBase--;
-	    }
-	    ppci++;
-        } /* while nglyph-- */
-	break;
-      case rgnPART:
-      {
-	TEXTPOS *ppos;
-	int nbox;
-	BoxPtr pbox;
-	RegionPtr cclip;
-	int xpos;		/* x position of char origin */
-	int i;
-	BoxRec clip;
-	int leftEdge, rightEdge;
-	int topEdge, bottomEdge;
-	int glyphRow;		/* first row of glyph not wholly
-				   clipped out */
-	int glyphCol;		/* leftmost visible column of glyph */
-#if GETLEFTBITS_ALIGNMENT > 1
-	int getWidth;		/* bits to get from glyph */
-#endif
-
-	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
-	    return;
-
-	pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
-        xpos = x;
-	xchar = xpos & PIM;
-
-	for (i=0; i<nglyph; i++)
-	{
-	    pci = ppci[i];
-
-	    ppos[i].xpos = xpos;
-	    ppos[i].xchar = xchar;
-	    ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
-	    ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
-	    ppos[i].topEdge = y - pci->metrics.ascent;
-	    ppos[i].bottomEdge = y + pci->metrics.descent;
-	    ppos[i].pdstBase = pdstBase;
-	    ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    xpos += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-		xchar &= PIM;
-		pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-		xchar += PPW;
-		pdstBase--;
-	    }
-	}
-
-	cclip = pGC->pCompositeClip;
-	pbox = REGION_RECTS(cclip);
-	nbox = REGION_NUM_RECTS(cclip);
-
-	/* HACK ALERT
-	   since we continue out of the loop below so often, it
-	   is easier to increment pbox at the  top than at the end.
-	   don't try this at home.
-	*/
-	pbox--;
-	while(nbox--)
-	{
-	    pbox++;
-	    clip.x1 = max(bbox.x1, pbox->x1);
-	    clip.y1 = max(bbox.y1, pbox->y1);
-	    clip.x2 = min(bbox.x2, pbox->x2);
-	    clip.y2 = min(bbox.y2, pbox->y2);
-	    if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
-		continue;
-
-	    for(i=0; i<nglyph; i++)
-	    {
-		pci = ppci[i];
-		xchar = ppos[i].xchar;
-
-		/* clip the left and right edges */
-		if (ppos[i].leftEdge < clip.x1)
-		    leftEdge = clip.x1;
-		else
-		    leftEdge = ppos[i].leftEdge;
-
-		if (ppos[i].rightEdge > clip.x2)
-		    rightEdge = clip.x2;
-		else
-		    rightEdge = ppos[i].rightEdge;
-
-		w = rightEdge - leftEdge;
-		if (w <= 0)
-		    continue;
-
-		/* clip the top and bottom edges */
-		if (ppos[i].topEdge < clip.y1)
-		    topEdge = clip.y1;
-		else
-		    topEdge = ppos[i].topEdge;
-
-		if (ppos[i].bottomEdge > clip.y2)
-		    bottomEdge = clip.y2;
-		else
-		    bottomEdge = ppos[i].bottomEdge;
-
-		h = bottomEdge - topEdge;
-		if (h <= 0)
-		    continue;
-
-		glyphRow = (topEdge - y) + pci->metrics.ascent;
-		widthGlyph = ppos[i].widthGlyph;
-		pglyph = FONTGLYPHBITS(pglyphBase, pci);
-		pglyph += (glyphRow * widthGlyph);
-
-		pdst = ppos[i].pdstBase;
-
-		glyphCol = (leftEdge - ppos[i].xpos) -
-			   (pci->metrics.leftSideBearing);
-#if GETLEFTBITS_ALIGNMENT > 1
-		getWidth = w + glyphCol;
-#endif
-		xoff = xchar + (leftEdge - ppos[i].xpos);
-		if (xoff > PLST)
-		{
-		    xoff &= PIM;
-		    pdst++;
-		}
-		else if (xoff < 0)
-		{
-		    xoff += PPW;
-		    pdst--;
-		}
-
-		pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
-
-		if ((xoff + w) <= PPW)
-		{
-		    maskpartialbits(xoff, w, startmask);
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-			pglyph += widthGlyph;
-			mfbScanlineInc(pdst, widthDst);
-		    }
-		}
-		else
-		{
-		    maskPPWbits(xoff, w, startmask, endmask);
-		    nFirst = PPW - xoff;
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-			*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
-			pglyph += widthGlyph;
-			mfbScanlineInc(pdst, widthDst);
-		    }
-		}
-	    } /* for each glyph */
-	} /* while nbox-- */
-	xfree(ppos);
-	break;
-      }
-      default:
-	break;
-    }
-}
diff --git a/mfb/mfbline.c b/mfb/mfbline.c
deleted file mode 100644
index 65baa5e..0000000
--- a/mfb/mfbline.c
+++ /dev/null
@@ -1,759 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "mistruct.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-#include "miline.h"
-
-/* single-pixel lines on a color frame buffer
-
-   NON-SLOPED LINES
-   horizontal lines are always drawn left to right; we have to
-move the endpoints right by one after they're swapped.
-   horizontal lines will be confined to a single band of a
-region.  the code finds that band (giving up if the lower
-bound of the band is above the line we're drawing); then it
-finds the first box in that band that contains part of the
-line.  we clip the line to subsequent boxes in that band.
-   vertical lines are always drawn top to bottom (y-increasing.)
-this requires adding one to the y-coordinate of each endpoint
-after swapping.
-
-   SLOPED LINES
-   when clipping a sloped line, we bring the second point inside
-the clipping box, rather than one beyond it, and then add 1 to
-the length of the line before drawing it.  this lets us use
-the same box for finding the outcodes for both endpoints.  since
-the equation for clipping the second endpoint to an edge gives us
-1 beyond the edge, we then have to move the point towards the
-first point by one step on the major axis.
-   eventually, there will be a diagram here to explain what's going
-on.  the method uses Cohen-Sutherland outcodes to determine
-outsideness, and a method similar to Pike's layers for doing the
-actual clipping.
-
-*/
-
-void
-#ifdef POLYSEGMENT
-mfbSegmentSS (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-#else
-mfbLineSS (pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		mode;		/* Origin or Previous */
-    int		npt;		/* number of points */
-    DDXPointPtr pptInit;
-#endif
-{
-    int nboxInit;
-    register int nbox;
-    BoxPtr pboxInit;
-    register BoxPtr pbox;
-#ifndef POLYSEGMENT
-    register DDXPointPtr ppt;	/* pointer to list of translated points */
-#endif
-
-    unsigned int oc1;		/* outcode of point 1 */
-    unsigned int oc2;		/* outcode of point 2 */
-
-    PixelType *addrlBase;	/* pointer to start of drawable */
-#ifndef POLYSEGMENT
-    PixelType *addrl;		/* address of destination pixmap */
-#endif
-    int nlwidth;		/* width in longwords of destination pixmap */
-    int xorg, yorg;		/* origin of window */
-
-    int adx;		/* abs values of dx and dy */
-    int ady;
-    int signdx;		/* sign of dx and dy */
-    int signdy;
-    int e, e1, e2;		/* bresenham error and increments */
-    int len;			/* length of segment */
-    int axis;			/* major axis */
-    int octant;
-    unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-
-				/* a bunch of temporaries */
-    register int y1, y2;
-    register int x1, x2;
-    RegionPtr cclip;
-    int		    alu;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    cclip = pGC->pCompositeClip;
-    alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					 mfbGetGCPrivateKey()))->rop;
-    pboxInit = REGION_RECTS(cclip);
-    nboxInit = REGION_NUM_RECTS(cclip);
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase);
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-#ifdef POLYSEGMENT
-    while (nseg--)
-#else
-    ppt = pptInit;
-    x2 = ppt->x + xorg;
-    y2 = ppt->y + yorg;
-    while(--npt)
-#endif
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-
-#ifdef POLYSEGMENT
-	x1 = pSeg->x1 + xorg;
-	y1 = pSeg->y1 + yorg;
-	x2 = pSeg->x2 + xorg;
-	y2 = pSeg->y2 + yorg;
-	pSeg++;
-#else
-	x1 = x2;
-	y1 = y2;
-	++ppt;
-	if (mode == CoordModePrevious)
-	{
-	    xorg = x1;
-	    yorg = y1;
-	}
-	x2 = ppt->x + xorg;
-	y2 = ppt->y + yorg;
-#endif
-
-	if (x1 == x2) /* vertical line */
-	{
-	    /* make the line go top to bottom of screen, keeping
-	       endpoint semantics
-	    */
-	    if (y1 > y2)
-	    {
-		register int tmp;
-
-		tmp = y2;
-		y2 = y1 + 1;
-		y1 = tmp + 1;
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    y1--;
-#endif
-	    }
-#ifdef POLYSEGMENT
-	    else if (pGC->capStyle != CapNotLast)
-		y2++;
-#endif
-	    /* get to first band that might contain part of line */
-	    while ((nbox) && (pbox->y2 <= y1))
-	    {
-		pbox++;
-		nbox--;
-	    }
-
-	    if (nbox)
-	    {
-		/* stop when lower edge of box is beyond end of line */
-		while((nbox) && (y2 >= pbox->y1))
-		{
-		    if ((x1 >= pbox->x1) && (x1 < pbox->x2))
-		    {
-			int y1t, y2t;
-			/* this box has part of the line in it */
-			y1t = max(y1, pbox->y1);
-			y2t = min(y2, pbox->y2);
-			if (y1t != y2t)
-			{
-			    mfbVertS (alu,
-				      addrlBase, nlwidth, 
-				      x1, y1t, y2t-y1t);
-			}
-		    }
-		    nbox--;
-		    pbox++;
-		}
-	    }
-#ifndef POLYSEGMENT
-	    y2 = ppt->y + yorg;
-#endif
-	}
-	else if (y1 == y2) /* horizontal line */
-	{
-	    /* force line from left to right, keeping
-	       endpoint semantics
-	    */
-	    if (x1 > x2)
-	    {
-		register int tmp;
-
-		tmp = x2;
-		x2 = x1 + 1;
-		x1 = tmp + 1;
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    x1--;
-#endif
-	    }
-#ifdef POLYSEGMENT
-	    else if (pGC->capStyle != CapNotLast)
-		x2++;
-#endif
-
-	    /* find the correct band */
-	    while( (nbox) && (pbox->y2 <= y1))
-	    {
-		pbox++;
-		nbox--;
-	    }
-
-	    /* try to draw the line, if we haven't gone beyond it */
-	    if ((nbox) && (pbox->y1 <= y1))
-	    {
-		int tmp;
-
-		/* when we leave this band, we're done */
-		tmp = pbox->y1;
-		while((nbox) && (pbox->y1 == tmp))
-		{
-		    int	x1t, x2t;
-
-		    if (pbox->x2 <= x1)
-		    {
-			/* skip boxes until one might contain start point */
-			nbox--;
-			pbox++;
-			continue;
-		    }
-
-		    /* stop if left of box is beyond right of line */
-		    if (pbox->x1 >= x2)
-		    {
-			nbox = 0;
-			break;
-		    }
-
-		    x1t = max(x1, pbox->x1);
-		    x2t = min(x2, pbox->x2);
-		    if (x1t != x2t)
-		    {
-			mfbHorzS (alu,
-				  addrlBase, nlwidth, 
-				  x1t, y1, x2t-x1t);
-		    }
-		    nbox--;
-		    pbox++;
-		}
-	    }
-#ifndef POLYSEGMENT
-	    x2 = ppt->x + xorg;
-#endif
-	}
-	else	/* sloped line */
-	{
-	    CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
-			   1, 1, octant);
-
-	    if (adx > ady)
-	    {
-		axis = X_AXIS;
-		e1 = ady << 1;
-		e2 = e1 - (adx << 1);
-		e = e1 - adx;
-	    }
-	    else
-	    {
-		axis = Y_AXIS;
-		e1 = adx << 1;
-		e2 = e1 - (ady << 1);
-		e = e1 - ady;
-		SetYMajorOctant(octant);
-	    }
-
-	    FIXUP_ERROR(e, octant, bias);
-
-	    /* we have bresenham parameters and two points.
-	       all we have to do now is clip and draw.
-	    */
-
-	    while(nbox--)
-	    {
-		oc1 = 0;
-		oc2 = 0;
-		OUTCODES(oc1, x1, y1, pbox);
-		OUTCODES(oc2, x2, y2, pbox);
-		if ((oc1 | oc2) == 0)
-		{
-		    if (axis == X_AXIS)
-			len = adx;
-		    else
-			len = ady;
-#ifdef POLYSEGMENT
-		    if (pGC->capStyle != CapNotLast)
-			len++;
-#endif
-		    mfbBresS (alu,
-			  addrlBase, nlwidth,
-			  signdx, signdy, axis, x1, y1,
-			  e, e1, e2, len);
-		    break;
-		}
-		else if (oc1 & oc2)
-		{
-		    pbox++;
-		}
-		else
-		{
-		    int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
-		    int clip1 = 0, clip2 = 0;
-		    int clipdx, clipdy;
-		    int err;
-		    
-		    if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
-				       pbox->y2-1,
-				       &new_x1, &new_y1, &new_x2, &new_y2,
-				       adx, ady, &clip1, &clip2,
-				       octant, bias, oc1, oc2) == -1)
-		    {
-			pbox++;
-			continue;
-		    }
-
-		    if (axis == X_AXIS)
-			len = abs(new_x2 - new_x1);
-		    else
-			len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
-		    if (clip2 != 0 || pGC->capStyle != CapNotLast)
-			len++;
-#else
-		    len += (clip2 != 0);
-#endif
-		    if (len)
-		    {
-			/* unwind bresenham error term to first point */
-			if (clip1)
-			{
-			    clipdx = abs(new_x1 - x1);
-			    clipdy = abs(new_y1 - y1);
-			    if (axis == X_AXIS)
-				err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
-			    else
-				err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
-			}
-			else
-			    err = e;
-			mfbBresS   
-			    (alu,
-			     addrlBase, nlwidth,
-			     signdx, signdy, axis, new_x1, new_y1,
-			     err, e1, e2, len);
-		    }
-		    pbox++;
-		}
-	    } /* while (nbox--) */
-	} /* sloped line */
-    } /* while (nline--) */
-
-#ifndef POLYSEGMENT
-
-    /* paint the last point if the end style isn't CapNotLast.
-       (Assume that a projecting, butt, or round cap that is one
-        pixel wide is the same as the single pixel of the endpoint.)
-    */
-
-    if ((pGC->capStyle != CapNotLast) &&
-	((ppt->x + xorg != pptInit->x + pDrawable->x) ||
-	 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
-	 (ppt == pptInit + 1)))
-    {
-	PixelType _mask;
-
-	if (alu == RROP_BLACK)
-		_mask = rmask[x2 & PIM];
-	else
-		_mask = mask[x2 & PIM];
-
-	nbox = nboxInit;
-	pbox = pboxInit;
-	while (nbox--)
-	{
-	    if ((x2 >= pbox->x1) &&
-		(y2 >= pbox->y1) &&
-		(x2 <  pbox->x2) &&
-		(y2 <  pbox->y2))
-	    {
-		addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
-		switch(alu)
-		{
-		    case RROP_BLACK:
-		        *addrl &= _mask;
-			break;
-		    case RROP_WHITE:
-		        *addrl |= _mask;
-			break;
-		    case RROP_INVERT:
-		        *addrl ^= _mask;
-			break;
-		}
-		break;
-	    }
-	    else
-		pbox++;
-	}
-    }
-#endif
-}
-
-/*
- * Draw dashed 1-pixel lines.
- */
-
-void
-#ifdef POLYSEGMENT
-mfbSegmentSD (pDrawable, pGC, nseg, pSeg)
-    DrawablePtr	pDrawable;
-    register GCPtr	pGC;
-    int		nseg;
-    register xSegment	*pSeg;
-#else
-mfbLineSD( pDrawable, pGC, mode, npt, pptInit)
-    DrawablePtr pDrawable;
-    register GCPtr pGC;
-    int mode;		/* Origin or Previous */
-    int npt;		/* number of points */
-    DDXPointPtr pptInit;
-#endif
-{
-    int nboxInit;
-    register int nbox;
-    BoxPtr pboxInit;
-    register BoxPtr pbox;
-#ifndef POLYSEGMENT
-    register DDXPointPtr ppt;	/* pointer to list of translated points */
-#endif
-
-    register unsigned int oc1;	/* outcode of point 1 */
-    register unsigned int oc2;	/* outcode of point 2 */
-
-    PixelType *addrl;		/* address of destination pixmap */
-    int nlwidth;		/* width in longwords of destination pixmap */
-    int xorg, yorg;		/* origin of window */
-
-    int adx;		/* abs values of dx and dy */
-    int ady;
-    int signdx;		/* sign of dx and dy */
-    int signdy;
-    int e, e1, e2;		/* bresenham error and increments */
-    int len;			/* length of segment */
-    int axis;			/* major axis */
-    int octant;
-    unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
-    int x1, x2, y1, y2;
-    RegionPtr cclip;
-    int		    fgrop = 0, bgrop = 0;
-    unsigned char   *pDash;
-    int		    dashOffset;
-    int		    numInDashList;
-    int		    dashIndex;
-    int		    isDoubleDash;
-    int		    dashIndexTmp, dashOffsetTmp;
-    int		    unclippedlen;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    cclip = pGC->pCompositeClip;
-    fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					   mfbGetGCPrivateKey()))->rop;
-    pboxInit = REGION_RECTS(cclip);
-    nboxInit = REGION_NUM_RECTS(cclip);
-
-   mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); 
-
-    /* compute initial dash values */
-     
-    pDash = (unsigned char *) pGC->dash;
-    numInDashList = pGC->numInDashList;
-    isDoubleDash = (pGC->lineStyle == LineDoubleDash);
-    dashIndex = 0;
-    dashOffset = 0;
-    miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
-		numInDashList, &dashOffset);
-
-    if (isDoubleDash)
-	bgrop = mfbReduceRop(pGC->alu, pGC->bgPixel);
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-#ifdef POLYSEGMENT
-    while (nseg--)
-#else
-    ppt = pptInit;
-    x2 = ppt->x + xorg;
-    y2 = ppt->y + yorg;
-    while(--npt)
-#endif
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-
-#ifdef POLYSEGMENT
-	x1 = pSeg->x1 + xorg;
-	y1 = pSeg->y1 + yorg;
-	x2 = pSeg->x2 + xorg;
-	y2 = pSeg->y2 + yorg;
-	pSeg++;
-#else
-	x1 = x2;
-	y1 = y2;
-	++ppt;
-	if (mode == CoordModePrevious)
-	{
-	    xorg = x1;
-	    yorg = y1;
-	}
-	x2 = ppt->x + xorg;
-	y2 = ppt->y + yorg;
-#endif
-
-	CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
-
-	if (adx > ady)
-	{
-	    axis = X_AXIS;
-	    e1 = ady << 1;
-	    e2 = e1 - (adx << 1);
-	    e = e1 - adx;
-	    unclippedlen = adx;
-	}
-	else
-	{
-	    axis = Y_AXIS;
-	    e1 = adx << 1;
-	    e2 = e1 - (ady << 1);
-	    e = e1 - ady;
-	    unclippedlen = ady;
-	    SetYMajorOctant(octant);
-	}
-
-	FIXUP_ERROR(e, octant, bias);
-
-	/* we have bresenham parameters and two points.
-	   all we have to do now is clip and draw.
-	*/
-
-	while(nbox--)
-	{
-	    oc1 = 0;
-	    oc2 = 0;
-	    OUTCODES(oc1, x1, y1, pbox);
-	    OUTCODES(oc2, x2, y2, pbox);
-	    if ((oc1 | oc2) == 0)
-	    {
-#ifdef POLYSEGMENT
-		if (pGC->capStyle != CapNotLast)
-		    unclippedlen++;
-		dashIndexTmp = dashIndex;
-		dashOffsetTmp = dashOffset;
-		mfbBresD (fgrop, bgrop,
-		      &dashIndexTmp, pDash, numInDashList,
-		      &dashOffsetTmp, isDoubleDash,
-		      addrl, nlwidth,
-		      signdx, signdy, axis, x1, y1,
-		      e, e1, e2, unclippedlen);
-		break;
-#else
-		mfbBresD (fgrop, bgrop,
-		      &dashIndex, pDash, numInDashList,
-		      &dashOffset, isDoubleDash,
-		      addrl, nlwidth,
-		      signdx, signdy, axis, x1, y1,
-		      e, e1, e2, unclippedlen);
-		goto dontStep;
-#endif
-	    }
-	    else if (oc1 & oc2)
-	    {
-		pbox++;
-	    }
-	    else /* have to clip */
-	    {
-		int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
-		int clip1 = 0, clip2 = 0;
-		int clipdx, clipdy;
-		int err;
-		
-		if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
-				   &new_x1, &new_y1, &new_x2, &new_y2,
-				   adx, ady, &clip1, &clip2,
-				   octant, bias, oc1, oc2) == -1)
-		{
-		    pbox++;
-		    continue;
-		}
-		dashIndexTmp = dashIndex;
-		dashOffsetTmp = dashOffset;
-		if (clip1)
-		{
-		    int dlen;
-		    
-		    if (axis == X_AXIS)
-			dlen = abs(new_x1 - x1);
-		    else
-			dlen = abs(new_y1 - y1);
-		    miStepDash (dlen, &dashIndexTmp, pDash,
-				numInDashList, &dashOffsetTmp);
-		}
-		if (axis == X_AXIS)
-		    len = abs(new_x2 - new_x1);
-		else
-		    len = abs(new_y2 - new_y1);
-#ifdef POLYSEGMENT
-		if (clip2 != 0 || pGC->capStyle != CapNotLast)
-		    len++;
-#else
-		len += (clip2 != 0);
-#endif
-		if (len)
-		{
-		    /* unwind bresenham error term to first point */
-		    if (clip1)
-		    {
-			clipdx = abs(new_x1 - x1);
-			clipdy = abs(new_y1 - y1);
-			if (axis == X_AXIS)
-			    err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
-			else
-			    err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
-		    }
-		    else
-			err = e;
-		    mfbBresD (fgrop, bgrop,
-			      &dashIndexTmp, pDash, numInDashList,
-			      &dashOffsetTmp, isDoubleDash,
-			      addrl, nlwidth,
-			      signdx, signdy, axis, new_x1, new_y1,
-			      err, e1, e2, len);
-		}
-		pbox++;
-	    }
-	} /* while (nbox--) */
-#ifndef POLYSEGMENT
-	/*
-	 * walk the dash list around to the next line
-	 */
-	miStepDash (unclippedlen, &dashIndex, pDash,
-		    numInDashList, &dashOffset);
-dontStep:	;
-#endif
-    } /* while (nline--) */
-
-#ifndef POLYSEGMENT
-    /* paint the last point if the end style isn't CapNotLast.
-       (Assume that a projecting, butt, or round cap that is one
-        pixel wide is the same as the single pixel of the endpoint.)
-    */
-
-    if ((pGC->capStyle != CapNotLast) &&
-        ((dashIndex & 1) == 0 || isDoubleDash) &&
-	((ppt->x + xorg != pptInit->x + pDrawable->x) ||
-	 (ppt->y + yorg != pptInit->y + pDrawable->y) ||
-	 (ppt == pptInit + 1)))
-    {
-	nbox = nboxInit;
-	pbox = pboxInit;
-	while (nbox--)
-	{
-	    if ((x2 >= pbox->x1) &&
-		(y2 >= pbox->y1) &&
-		(x2 <  pbox->x2) &&
-		(y2 <  pbox->y2))
-	    {
-		MfbBits _mask;
-		int rop;
-
-		rop = fgrop;
-		if (dashIndex & 1)
-		    rop = bgrop;
-		if (rop == RROP_BLACK)
-		    _mask = rmask[x2 & PIM];
-		else
-		    _mask = mask[x2 & PIM];
-		addrl = mfbScanline(addrl, x2, y2, nlwidth);
-		if (rop == RROP_BLACK)
-		    *addrl &= _mask;
-		else if (rop == RROP_WHITE)
-		    *addrl |= _mask;
-		else
-		    *addrl ^= _mask;
-		break;
-	    }
-	    else
-		pbox++;
-	}
-    }
-#endif
-}
diff --git a/mfb/mfbmisc.c b/mfb/mfbmisc.c
deleted file mode 100644
index 5154e27..0000000
--- a/mfb/mfbmisc.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "cursor.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-
-/*ARGSUSED*/
-void
-mfbQueryBestSize(class, pwidth, pheight, pScreen)
-int class;
-unsigned short *pwidth;
-unsigned short *pheight;
-ScreenPtr pScreen;
-{
-    unsigned width, test;
-
-    switch(class)
-    {
-      case CursorShape:
-	  if (*pwidth > pScreen->width)
-	     *pwidth = pScreen->width;
-	  if (*pheight > pScreen->height)
-	     *pheight = pScreen->height;
-	  break;
-      case TileShape:
-      case StippleShape:
-	  width = *pwidth;
-	  if (!width) break;
-	  /* Return the closes power of two not less than what they gave me */
-	  test = 0x80000000;
-	  /* Find the highest 1 bit in the width given */
-	  while(!(test & width))
-	     test >>= 1;
-	  /* If their number is greater than that, bump up to the next
-	   *  power of two */
-	  if((test - 1) & width)
-	     test <<= 1;
-	  *pwidth = test;
-	  /* We don't care what height they use */
-	  break;
-    }
-}
-
-mfbQueryBestSizeProc *
-mfbQueryBestSizeWeak(void)
-{
-    return mfbQueryBestSize;
-}
diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c
deleted file mode 100644
index 34bb33d..0000000
--- a/mfb/mfbpixmap.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-/* pixmap management
-   written by drewry, september 1986
-
-   on a monchrome device, a pixmap is a bitmap.
-*/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/Xmd.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "maskbits.h"
-
-#include "mfb.h"
-#include "mi.h"
-
-#include "servermd.h"
-
-
-PixmapPtr
-mfbCreatePixmap (pScreen, width, height, depth, usage_hint)
-    ScreenPtr	pScreen;
-    int		width;
-    int		height;
-    int		depth;
-    unsigned	usage_hint;
-{
-    PixmapPtr pPixmap;
-    size_t datasize;
-    size_t paddedWidth;
-
-    if (depth != 1)
-	return NullPixmap;
-    paddedWidth = BitmapBytePad(width);
-    if (paddedWidth / 4 > 32767 || height > 32767)
-	return NullPixmap;
-    datasize = height * paddedWidth;
-    pPixmap = AllocatePixmap(pScreen, datasize);
-    if (!pPixmap)
-	return NullPixmap;
-    pPixmap->drawable.type = DRAWABLE_PIXMAP;
-    pPixmap->drawable.class = 0;
-    pPixmap->drawable.pScreen = pScreen;
-    pPixmap->drawable.depth = depth;
-    pPixmap->drawable.bitsPerPixel = depth;
-    pPixmap->drawable.id = 0;
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    pPixmap->drawable.x = 0;
-    pPixmap->drawable.y = 0;
-    pPixmap->drawable.width = width;
-    pPixmap->drawable.height = height;
-    pPixmap->devKind = paddedWidth;
-    pPixmap->refcnt = 1;
-    pPixmap->devPrivate.ptr =  datasize ?
-		(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
-    pPixmap->usage_hint = usage_hint;
-    return pPixmap;
-}
-
-
-Bool
-mfbDestroyPixmap(pPixmap)
-    PixmapPtr pPixmap;
-{
-    if(--pPixmap->refcnt)
-	return TRUE;
-    dixFreePrivates(pPixmap->devPrivates);
-    xfree(pPixmap);
-    return TRUE;
-}
-
-
-PixmapPtr
-mfbCopyPixmap(pSrc)
-    register PixmapPtr	pSrc;
-{
-    register PixmapPtr	pDst;
-    int		size;
-    ScreenPtr pScreen;
-
-    size = pSrc->drawable.height * pSrc->devKind;
-    pScreen = pSrc->drawable.pScreen;
-    pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width, 
-				pSrc->drawable.height, pSrc->drawable.depth, 0);
-    if (!pDst)
-	return NullPixmap;
-    memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size);
-    return pDst;
-}
-
-
-/* replicates a pattern to be a full 32 bits wide.
-   relies on the fact that each scnaline is longword padded.
-   doesn't do anything if pixmap is not a factor of 32 wide.
-   changes width field of pixmap if successful, so that the fast
-	XRotatePixmap code gets used if we rotate the pixmap later.
-
-   calculate number of times to repeat
-   for each scanline of pattern
-      zero out area to be filled with replicate
-      left shift and or in original as many times as needed
-*/
-void
-mfbPadPixmap(pPixmap)
-    PixmapPtr pPixmap;
-{
-    register int width = pPixmap->drawable.width;
-    register int h;
-    register PixelType mask;
-    register PixelType *p;
-    register PixelType bits;	/* real pattern bits */
-    register int i;
-    int rep;			/* repeat count for pattern */
-
-    if (width >= PPW)
-	return;
-
-    rep = PPW/width;
-    if (rep*width != PPW)
-	return;
-
-    mask = endtab[width];
-
-    p = (PixelType *)(pPixmap->devPrivate.ptr);
-    for (h=0; h < pPixmap->drawable.height; h++)
-    {
-	*p &= mask;
-	bits = *p;
-	for(i=1; i<rep; i++)
-	{
-	    bits = SCRRIGHT(bits, width);
-	    *p |= bits;
-	}
-	p++;
-    }
-    pPixmap->drawable.width = PPW;
-}
-
-/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that
- * words are PPW bits wide, and that the least significant bit appears on the
- * left.
- */
-void
-mfbXRotatePixmap(pPix, rw)
-    PixmapPtr	pPix;
-    register int rw;
-{
-    register PixelType	*pw, *pwFinal;
-    register PixelType	t;
-
-    if (pPix == NullPixmap)
-        return;
-
-    pw = (PixelType *)pPix->devPrivate.ptr;
-    rw %= (int)pPix->drawable.width;
-    if (rw < 0)
-	rw += (int)pPix->drawable.width;
-    if(pPix->drawable.width == PPW)
-    {
-        pwFinal = pw + pPix->drawable.height;
-	while(pw < pwFinal)
-	{
-	    t = *pw;
-	    *pw++ = SCRRIGHT(t, rw) | 
-		    (SCRLEFT(t, (PPW-rw)) & endtab[rw]);
-	}
-    }
-    else
-    {
-	/* We no longer do this.  Validate doesn't try to rotate odd-size
-	 * tiles or stipples.  mfbUnnatural<tile/stipple>FS works directly off
-	 * the unrotate tile/stipple in the GC
-	 */
-        ErrorF("X internal error: trying to rotate odd-sized pixmap.\n");
-    }
-
-}
-
-/* Rotates pixmap pPix by h lines.  Assumes that h is always less than
-   pPix->height
-   works on any width.
- */
-void
-mfbYRotatePixmap(pPix, rh)
-    register PixmapPtr	pPix;
-    int	rh;
-{
-    int nbyDown;	/* bytes to move down to row 0; also offset of
-			   row rh */
-    int nbyUp;		/* bytes to move up to line rh; also
-			   offset of first line moved down to 0 */
-    char *pbase;
-    char *ptmp;
-    int	height;
-
-    if (pPix == NullPixmap)
-	return;
-    height = (int) pPix->drawable.height;
-    rh %= height;
-    if (rh < 0)
-	rh += height;
-
-    pbase = (char *)pPix->devPrivate.ptr;
-
-    nbyDown = rh * pPix->devKind;
-    nbyUp = (pPix->devKind * height) - nbyDown;
-    if(!(ptmp = (char *)xalloc(nbyUp)))
-	return;
-
-    memmove(ptmp, pbase, nbyUp);		/* save the low rows */
-    memmove(pbase, pbase+nbyUp, nbyDown);	/* slide the top rows down */
-    memmove(pbase+nbyDown, ptmp, nbyUp);	/* move lower rows up to row rh */
-    xfree(ptmp);
-}
-
-void
-mfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot)
-    register PixmapPtr psrcPix, *ppdstPix;
-    int	xrot, yrot;
-{
-    register PixmapPtr pdstPix;
-
-    if ((pdstPix = *ppdstPix) &&
-	(pdstPix->devKind == psrcPix->devKind) &&
-	(pdstPix->drawable.height == psrcPix->drawable.height))
-    {
-	memmove((char *)pdstPix->devPrivate.ptr,
-		(char *)psrcPix->devPrivate.ptr,
-	      psrcPix->drawable.height * psrcPix->devKind);
-	pdstPix->drawable.width = psrcPix->drawable.width;
-	pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    }
-    else
-    {
-	if (pdstPix)
-	    /* FIX XBUG 6168 */
-	    (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix);
-	*ppdstPix = pdstPix = mfbCopyPixmap(psrcPix);
-	if (!pdstPix)
-	    return;
-    }
-    mfbPadPixmap(pdstPix);
-    if (xrot)
-	mfbXRotatePixmap(pdstPix, xrot);
-    if (yrot)
-	mfbYRotatePixmap(pdstPix, yrot);
-}
diff --git a/mfb/mfbply1rct.c b/mfb/mfbply1rct.c
deleted file mode 100644
index 4227e89..0000000
--- a/mfb/mfbply1rct.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- *
-Copyright 1990, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
- *
- * Author:  Keith Packard, MIT X Consortium
- */
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-#include "mistruct.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-#if defined(mips) || defined(sparc)
-#define GetHighWord(x) (((int) (x)) >> 16)
-#else
-#define GetHighWord(x) (((int) (x)) / 65536)
-#endif
-
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define intToCoord(i,x,y)   (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
-#define coordToInt(x,y)	(((x) << 16) | ((y) & 0xffff))
-#define intToX(i)	(GetHighWord(i))
-#define intToY(i)	((int) ((short) i))
-#else
-#define intToCoord(i,x,y)   (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
-#define coordToInt(x,y)	(((y) << 16) | ((x) & 0xffff))
-#define intToX(i)	((int) ((short) (i)))
-#define intToY(i)	(GetHighWord(i))
-#endif
-
-void
-MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn)
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-    int		shape;
-    int		mode;
-    int		count;
-    DDXPointPtr	ptsIn;
-{
-    int		    nlwidth;
-    PixelType	    *addrl, *addr;
-    int		    maxy;
-    int		    origin;
-    register int    vertex1, vertex2;
-    int		    c;
-    BoxPtr	    extents;
-    int		    clip;
-    int		    y;
-    int		    *vertex1p = NULL, *vertex2p;
-    int		    *endp;
-    int		    x1 = 0, x2 = 0;
-    int		    dx1 = 0, dx2 = 0;
-    int		    dy1 = 0, dy2 = 0;
-    int		    e1 = 0, e2 = 0;
-    int		    step1 = 0, step2 = 0;
-    int		    sign1 = 0, sign2 = 0;
-    int		    h;
-    int		    l, r;
-    PixelType	    mask, bits = ~((PixelType)0);
-    int		    nmiddle;
-
-    if (mode == CoordModePrevious || shape != Convex ||
-	REGION_NUM_RECTS(pGC->pCompositeClip) != 1)
-    {
-	miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
-	return;
-    }
-    origin = *((int *) &pDrawable->x);
-    vertex2 = origin - ((origin & 0x8000) << 1);
-    extents = &pGC->pCompositeClip->extents;
-    vertex1 = *((int *) &extents->x1) - vertex2;
-    vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001;
-    clip = 0;
-    y = 32767;
-    maxy = 0;
-    vertex2p = (int *) ptsIn;
-    endp = vertex2p + count;
-    while (count--)
-    {
-	c = *vertex2p;
-	clip |= (c - vertex1) | (vertex2 - c);
-	c = intToY(c);
-	if (c < y) 
-	{
-	    y = c;
-	    vertex1p = vertex2p;
-	}
-	vertex2p++;
-	if (c > maxy)
-	    maxy = c;
-    }
-    if (y == maxy)
-	return;
-
-    if (clip & 0x80008000)
-    {
-	miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn);
-	return;
-    }
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
-    addrl = mfbScanlineDelta(addrl, y + pDrawable->y, nlwidth);
-    origin = intToX(origin);
-    vertex2p = vertex1p;
-    vertex2 = vertex1 = *vertex2p++;
-    if (vertex2p == endp)
-	vertex2p = (int *) ptsIn;
-#define Setup(c,x,vertex,dx,dy,e,sign,step) {\
-    x = intToX(vertex); \
-    if ((dy = intToY(c) - y)) { \
-    	dx = intToX(c) - x; \
-	step = 0; \
-    	if (dx >= 0) \
-    	{ \
-	    e = 0; \
-	    sign = 1; \
-	    if (dx >= dy) {\
-	    	step = dx / dy; \
-	    	dx = dx % dy; \
-	    } \
-    	} \
-    	else \
-    	{ \
-	    e = 1 - dy; \
-	    sign = -1; \
-	    dx = -dx; \
-	    if (dx >= dy) { \
-		step = - (dx / dy); \
-		dx = dx % dy; \
-	    } \
-    	} \
-    } \
-    x += origin; \
-    vertex = c; \
-}
-
-#define Step(x,dx,dy,e,sign,step) {\
-    x += step; \
-    if ((e += dx) > 0) \
-    { \
-	x += sign; \
-	e -= dy; \
-    } \
-}
-    for (;;)
-    {
-	if (y == intToY(vertex1))
-	{
-	    do
-	    {
-	    	if (vertex1p == (int *) ptsIn)
-		    vertex1p = endp;
-	    	c = *--vertex1p;
-	    	Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1)
-	    } while (y >= intToY(vertex1));
-	    h = dy1;
-	}
-	else
-	{
-	    Step(x1,dx1,dy1,e1,sign1,step1)
-	    h = intToY(vertex1) - y;
-	}
-	if (y == intToY(vertex2))
-	{
-	    do
-	    {
-	    	c = *vertex2p++;
-	    	if (vertex2p == endp)
-		    vertex2p = (int *) ptsIn;
-	    	Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2)
-	    } while (y >= intToY(vertex2));
-	    if (dy2 < h)
-		h = dy2;
-	}
-	else
-	{
-	    Step(x2,dx2,dy2,e2,sign2,step2)
-	    if ((c = (intToY(vertex2) - y)) < h)
-		h = c;
-	}
-	/* fill spans for this segment */
-	y += h;
-	for (;;)
-	{
-	    l = x1;
-	    r = x2;
-	    nmiddle = x2 - x1;
-    	    if (nmiddle < 0)
-	    {
-	    	nmiddle = -nmiddle;
-	    	l = x2;
-	    	r = x1;
-    	    }
-	    c = l & PIM;
-	    l -= c;
-	    l = l >> PWSH;
-	    addr = addrl + l;
-	    if (c + nmiddle < PPW)
-	    {
-	    	mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle);
-	    	*addr OPEQ mask;
-	    }
-	    else
-	    {
-	    	if (c)
-	    	{
-	    	    mask = SCRRIGHT(bits, c);
-		    *addr OPEQ mask;
-	    	    nmiddle += c - PPW;
-	    	    addr++;
-	    	}
-	    	nmiddle >>= PWSH;
-		Duff (nmiddle, *addr++ EQWHOLEWORD)
-	    	if ((mask = ~SCRRIGHT(bits, r & PIM)))
-	    	    *addr OPEQ mask;
-	    }
-	    if (!--h)
-		break;
-	    mfbScanlineInc(addrl, nlwidth);
-	    Step(x1,dx1,dy1,e1,sign1,step1)
-	    Step(x2,dx2,dy2,e2,sign2,step2)
-	}
-	if (y == maxy)
-	    break;
-	mfbScanlineInc(addrl, nlwidth);
-    }
-}
diff --git a/mfb/mfbplygblt.c b/mfb/mfbplygblt.c
deleted file mode 100644
index 1bd56e1..0000000
--- a/mfb/mfbplygblt.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "mfb.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "regionstr.h"
-#include "maskbits.h"
-#include "miscstruct.h"
-
-/*
-    we should eventually special-case fixed-width fonts, although
-its more important for ImageText, which is meant for terminal
-emulators.
-
-    this works for fonts with glyphs <= 32 bits wide.
-
-    the clipping calculations are done for worst-case fonts.
-we make no assumptions about the heights, widths, or bearings
-of the glyphs.  if we knew that the glyphs are all the same height,
-we could clip the tops and bottoms per clipping box, rather
-than per character per clipping box.  if we knew that the glyphs'
-left and right bearings were well-behaved, we could clip a single
-character at the start, output until the last unclipped
-character, and then clip the last one.  this is all straightforward
-to determine based on max-bounds and min-bounds from the font.
-    there is some inefficiency introduced in the per-character
-clipping to make what's going on clearer.
-
-    (it is possible, for example, for a font to be defined in which the
-next-to-last character in a font would be clipped out, but the last
-one wouldn't.  the code below deals with this.)
-
-    PolyText looks at the fg color and the rasterop; mfbValidateGC
-swaps in the right routine after looking at the reduced ratserop
-in the private field of the GC.  
-
-   the register allocations are provisional; in particualr startmask and
-endmask might not be the right things.  pglyph, xoff, pdst, and tmpSrc
-are fairly obvious, though.
-
-   to avoid source proliferation, this file is compiled
-three times:
-	MFBPOLYGLYPHBLT		OPEQ
-	mfbPolyGlyphBltWhite	|=
-	mfbPolyGlyphBltBlack	&=~
-	mfbPolyGlyphBltInvert	^=
-*/
-
-void
-MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
-    DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int 	x, y;
-    unsigned int nglyph;
-    CharInfoPtr *ppci;		/* array of character info */
-    pointer	pglyphBase;	/* start of array of glyphs (unused in R5) */
-{
-    ExtentInfoRec info;	/* used by QueryGlyphExtents() */
-    BoxRec bbox;		/* string's bounding box */
-
-    CharInfoPtr pci;
-    int xorg, yorg;	/* origin of drawable in bitmap */
-    int widthDst;	/* width of dst in longwords */
-
-			/* these keep track of the character origin */
-    PixelType *pdstBase;
-			/* points to longword with character origin */
-    int xchar;		/* xorigin of char (mod 32) */
-
-			/* these are used for placing the glyph */
-    register int xoff;	/* x offset of left edge of glyph (mod 32) */
-    register PixelType *pdst;
-			/* pointer to current longword in dst */
-
-    int w;		/* width of glyph in bits */
-    int h;		/* height of glyph */
-    int widthGlyph;	/* width of glyph, in bytes */
-    register unsigned char *pglyph;
-			/* pointer to current row of glyph */
-
-			/* used for putting down glyph */
-    register PixelType tmpSrc;
-			/* for getting bits from glyph */
-    register PixelType startmask;
-    register PixelType endmask;
-    register int nFirst;/* bits of glyph in current longword */
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    xorg = pDrawable->x;
-    yorg = pDrawable->y;
-    mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
-
-    x += xorg;
-    y += yorg;
-
-    QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
-    bbox.x1 = x + info.overallLeft;
-    bbox.x2 = x + info.overallRight;
-    bbox.y1 = y - info.overallAscent;
-    bbox.y2 = y + info.overallDescent;
-
-    switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
-    {
-      case rgnOUT:
-	break;
-      case rgnIN:
-        pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
-        xchar = x & PIM;
-
-        while(nglyph--)
-        {
-	    pci = *ppci;
-	    pglyph = FONTGLYPHBITS(pglyphBase, pci);
-	    w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
-	    h = pci->metrics.ascent + pci->metrics.descent;
-	    widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    /* start at top scanline of glyph */
-	    pdst = pdstBase;
-
-	    /* find correct word in scanline and x offset within it
-	       for left edge of glyph
-	    */
-	    xoff = xchar + pci->metrics.leftSideBearing;
-	    if (xoff > PLST)
-	    {
-	        pdst++;
-	        xoff &= PIM;
-	    }
-	    else if (xoff < 0)
-	    {
-	        xoff += PPW;
-	        pdst--;
-	    }
-
-	    pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst);
-
-	    if ((xoff + w) <= PPW)
-	    {
-	        /* glyph all in one longword */
-	        maskpartialbits(xoff, w, startmask);
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-		    pglyph += widthGlyph;
-		    mfbScanlineInc(pdst, widthDst);
-	        }
-	    }
-	    else
-	    {
-	        /* glyph crosses longword boundary */
-	        maskPPWbits(xoff, w, startmask, endmask);
-	        nFirst = PPW - xoff;
-	        while (h--)
-	        {
-		    getleftbits(pglyph, w, tmpSrc);
-		    *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-		    *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
-		    pglyph += widthGlyph;
-		    mfbScanlineInc(pdst, widthDst);
-	        }
-	    } /* glyph crosses longwords boundary */
-
-	    /* update character origin */
-	    x += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-	        xchar -= PPW;
-	        pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-	        xchar += PPW;
-	        pdstBase--;
-	    }
-	    ppci++;
-        } /* while nglyph-- */
-	break;
-      case rgnPART:
-      {
-	TEXTPOS *ppos;
-	RegionPtr cclip;
-	int nbox;
-	BoxPtr pbox;
-	int xpos;		/* x position of char origin */
-	int i;
-	BoxRec clip;
-	int leftEdge, rightEdge;
-	int topEdge, bottomEdge;
-	int glyphRow;		/* first row of glyph not wholly
-				   clipped out */
-	int glyphCol;		/* leftmost visible column of glyph */
-#if GETLEFTBITS_ALIGNMENT > 1
-	int getWidth;		/* bits to get from glyph */
-#endif
-
-	if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
-	    return;
-
-        pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst);
-        xpos = x;
-	xchar = xpos & PIM;
-
-	for (i=0; i<nglyph; i++)
-	{
-	    pci = ppci[i];
-
-	    ppos[i].xpos = xpos;
-	    ppos[i].xchar = xchar;
-	    ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
-	    ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
-	    ppos[i].topEdge = y - pci->metrics.ascent;
-	    ppos[i].bottomEdge = y + pci->metrics.descent;
-	    ppos[i].pdstBase = pdstBase;
-	    ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
-
-	    xpos += pci->metrics.characterWidth;
-	    xchar += pci->metrics.characterWidth;
-	    if (xchar > PLST)
-	    {
-		xchar &= PIM;
-		pdstBase++;
-	    }
-	    else if (xchar < 0)
-	    {
-		xchar += PPW;
-		pdstBase--;
-	    }
-	}
-
-	cclip = pGC->pCompositeClip;
-	pbox = REGION_RECTS(cclip);
-	nbox = REGION_NUM_RECTS(cclip);
-
-	for (; --nbox >= 0; pbox++)
-	{
-	    clip.x1 = max(bbox.x1, pbox->x1);
-	    clip.y1 = max(bbox.y1, pbox->y1);
-	    clip.x2 = min(bbox.x2, pbox->x2);
-	    clip.y2 = min(bbox.y2, pbox->y2);
-	    if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
-		continue;
-
-	    for(i=0; i<nglyph; i++)
-	    {
-		pci = ppci[i];
-		xchar = ppos[i].xchar;
-
-		/* clip the left and right edges */
-		if (ppos[i].leftEdge < clip.x1)
-		    leftEdge = clip.x1;
-		else
-		    leftEdge = ppos[i].leftEdge;
-
-		if (ppos[i].rightEdge > clip.x2)
-		    rightEdge = clip.x2;
-		else
-		    rightEdge = ppos[i].rightEdge;
-
-		w = rightEdge - leftEdge;
-		if (w <= 0)
-		    continue;
-
-		/* clip the top and bottom edges */
-		if (ppos[i].topEdge < clip.y1)
-		    topEdge = clip.y1;
-		else
-		    topEdge = ppos[i].topEdge;
-
-		if (ppos[i].bottomEdge > clip.y2)
-		    bottomEdge = clip.y2;
-		else
-		    bottomEdge = ppos[i].bottomEdge;
-
-		h = bottomEdge - topEdge;
-		if (h <= 0)
-		    continue;
-
-		glyphRow = (topEdge - y) + pci->metrics.ascent;
-		widthGlyph = ppos[i].widthGlyph;
-		pglyph = FONTGLYPHBITS(pglyphBase, pci);
-		pglyph += (glyphRow * widthGlyph);
-
-		pdst = ppos[i].pdstBase;
-
-		glyphCol = (leftEdge - ppos[i].xpos) -
-			   (pci->metrics.leftSideBearing);
-#if GETLEFTBITS_ALIGNMENT > 1
-		getWidth = w + glyphCol;
-#endif
-		xoff = xchar + (leftEdge - ppos[i].xpos);
-		if (xoff > PLST)
-		{
-		    xoff &= PIM;
-		    pdst++;
-		}
-		else if (xoff < 0)
-		{
-		    xoff += PPW;
-		    pdst--;
-		}
-
-		pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst);
-
-		if ((xoff + w) <= PPW)
-		{
-		    maskpartialbits(xoff, w, startmask);
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-			pglyph += widthGlyph;
-			mfbScanlineInc(pdst, widthDst);
-		    }
-		}
-		else
-		{
-		    maskPPWbits(xoff, w, startmask, endmask);
-		    nFirst = PPW - xoff;
-		    while (h--)
-		    {
-			getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
-			*pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask);
-			*(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask);
-			pglyph += widthGlyph;
-			mfbScanlineInc(pdst, widthDst);
-		    }
-		}
-	    } /* for each glyph */
-	} /* while nbox-- */
-	xfree(ppos);
-	break;
-      }
-      default:
-	break;
-    }
-}
diff --git a/mfb/mfbpntarea.c b/mfb/mfbpntarea.c
deleted file mode 100644
index 2906e66..0000000
--- a/mfb/mfbpntarea.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "windowstr.h"
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-/* 
-   the solid fillers are called for rectangles and window backgrounds.
-   the boxes are already translated.
-   maybe this should always take a pixmap instead of a drawable?
-
-   NOTE:
-   iy = ++iy < tileHeight ? iy : 0
-is equivalent to iy%= tileheight, and saves a division.
-*/
-
-/*
-	MFBSOLIDFILLAREA	OPEQ	EQWHOLEOWRD
-	mfbSolidWhiteArea	|=	= ~0
-	mfbSolidBlackArea	&=~	= 0
-	mfbSolidInvertArea	^=	^= ~0
-
-EQWHOLEWORD is used to write whole longwords.  it could use OPEQ,
-but *p++ |= ~0 on at least two compilers generates much
-worse code than *p++ = ~0.  similarly for *p++ &= ~~0
-and *p++ = 0.
-
-*/
-
-/*ARGSUSED*/
-void
-MFBSOLIDFILLAREA(pDraw, nbox, pbox, alu, nop)
-    DrawablePtr pDraw;
-    int nbox;
-    BoxPtr pbox;
-    int alu;
-    PixmapPtr nop;
-{
-    int nlwidth;	/* width in longwords of the drawable */
-    int w;		/* width of current box */
-    register int h;	/* height of current box */
-    register PixelType *p;	/* pointer to bits we're writing */
-    register int nlw;	/* loop version of nlwMiddle */
-    register PixelType startmask;
-    register PixelType endmask;/* masks for reggedy bits at either end of line */
-    register int nlwExtra;	
-		        /* to get from right of box to left of next span */
-    int nlwMiddle;	/* number of longwords between sides of boxes */
-    PixelType *pbits;	/* pointer to start of drawable */
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
-
-    while (nbox--)
-    {
-	w = pbox->x2 - pbox->x1;
-	h = pbox->y2 - pbox->y1;
-	p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
-
-	if ( ((pbox->x1 & PIM) + w) < PPW)
-	{
-	    maskpartialbits(pbox->x1, w, startmask);
-	    nlwExtra = nlwidth;
-	    Duff(h, *p OPEQ startmask; mfbScanlineInc(p, nlwExtra));
-	}
-	else
-	{
-	    maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
-	    nlwExtra = nlwidth - nlwMiddle;
-
-	    if (startmask && endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    nlw = nlwMiddle;
-		    *p OPEQ startmask;
-		    p++;
-		    Duff(nlw, *p++ EQWHOLEWORD);
-		    *p OPEQ endmask;
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (startmask && !endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    nlw = nlwMiddle;
-		    *p OPEQ startmask;
-		    p++;
-		    Duff(nlw, *p++ EQWHOLEWORD);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (!startmask && endmask)
-	    {
-		while (h--)
-		{
-		    nlw = nlwMiddle;
-		    Duff(nlw, *p++ EQWHOLEWORD);
-		    *p OPEQ endmask;
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else /* no ragged bits at either end */
-	    {
-		while (h--)
-		{
-		    nlw = nlwMiddle;
-		    Duff(nlw, *p++ EQWHOLEWORD);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	}
-        pbox++;
-    }
-}
-
-
-
-/* stipple a list of boxes
-
-you can use the reduced rasterop for stipples.  if rrop is
-black, AND the destination with (not stipple pattern).  if rrop is
-white OR the destination with the stipple pattern.  if rrop is invert,
-XOR the destination with the stipple pattern.
-
-	MFBSTIPPLEFILLAREA	OPEQ
-	mfbStippleWhiteArea	|=
-	mfbStippleBlackArea	&=~
-	mfbStippleInveryArea	^=
-*/
-
-/*ARGSUSED*/
-void
-MFBSTIPPLEFILLAREA(pDraw, nbox, pbox, alu, pstipple)
-    DrawablePtr pDraw;
-    int nbox;
-    BoxPtr pbox;
-    int alu;
-    PixmapPtr pstipple;
-{
-    register PixelType *psrc;
-			/* pointer to bits in tile, if needed */
-    int tileHeight;	/* height of the tile */
-    register PixelType srcpix;	
-
-    int nlwidth;	/* width in longwords of the drawable */
-    int w;		/* width of current box */
-    register int nlw;	/* loop version of nlwMiddle */
-    register PixelType *p;	/* pointer to bits we're writing */
-    register int h;	/* height of current box */
-    PixelType startmask;
-    PixelType endmask;	/* masks for reggedy bits at either end of line */
-    int nlwMiddle;	/* number of longwords between sides of boxes */
-    int nlwExtra;	/* to get from right of box to left of next span */
-    register int iy;	/* index of current scanline in tile */
-    PixelType *pbits;	/* pointer to start of drawable */
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
-
-    tileHeight = pstipple->drawable.height;
-    psrc = (PixelType *)(pstipple->devPrivate.ptr);
-
-    while (nbox--)
-    {
-	w = pbox->x2 - pbox->x1;
-	h = pbox->y2 - pbox->y1;
-	iy = pbox->y1 % tileHeight;
-	p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
-
-	if ( ((pbox->x1 & PIM) + w) < PPW)
-	{
-	    maskpartialbits(pbox->x1, w, startmask);
-	    nlwExtra = nlwidth;
-	    while (h--)
-	    {
-		srcpix = psrc[iy];
-		iy = ++iy < tileHeight ? iy : 0;
-		*p OPEQ (srcpix & startmask);
-		mfbScanlineInc(p, nlwExtra);
-	    }
-	}
-	else
-	{
-	    maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
-	    nlwExtra = nlwidth - nlwMiddle;
-
-	    if (startmask && endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy = ++iy < tileHeight ? iy : 0;
-		    nlw = nlwMiddle;
-		    *p OPEQ (srcpix & startmask);
-		    p++;
-		    Duff (nlw, *p++ OPEQ srcpix);
-		    *p OPEQ (srcpix & endmask);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (startmask && !endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy = ++iy < tileHeight ? iy : 0;
-		    nlw = nlwMiddle;
-		    *p OPEQ (srcpix & startmask);
-		    p++;
-		    Duff(nlw, *p++ OPEQ srcpix);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (!startmask && endmask)
-	    {
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy = ++iy < tileHeight ? iy : 0;
-		    nlw = nlwMiddle;
-		    Duff(nlw, *p++ OPEQ srcpix);
-		    *p OPEQ (srcpix & endmask);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else /* no ragged bits at either end */
-	    {
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy = ++iy < tileHeight ? iy : 0;
-		    nlw = nlwMiddle;
-		    Duff(nlw, *p++ OPEQ srcpix);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	}
-        pbox++;
-    }
-}
diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c
deleted file mode 100644
index 146cfdc..0000000
--- a/mfb/mfbpolypnt.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "miscstruct.h"
-#include "regionstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-void
-mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
-    register DrawablePtr pDrawable;
-    GCPtr	pGC;
-    int		mode;		/* Origin or Previous */
-    int		npt;
-    xPoint 	*pptInit;
-{
-
-    register BoxPtr pbox;
-    register int nbox;
-
-    register PixelType *addrl;
-    int nlwidth;
-
-    int nptTmp;
-    register xPoint *ppt;
-
-    register int x;
-    register int y;
-    register int rop;
-    mfbPrivGC	*pGCPriv;
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-					    mfbGetGCPrivateKey());
-    rop = pGCPriv->rop;
-
-    mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl);
-
-    if ((mode == CoordModePrevious) && (npt > 1))
-    {
-	for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++)
-	{
-	    ppt->x += (ppt-1)->x;
-	    ppt->y += (ppt-1)->y;
-	}
-    }
-
-    nbox = REGION_NUM_RECTS(pGC->pCompositeClip);
-    pbox = REGION_RECTS(pGC->pCompositeClip);
-    for (; --nbox >= 0; pbox++)
-    {
-	if (rop == RROP_BLACK)
-	{
-	    for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
-	    {
-		x = ppt->x + pDrawable->x;
-		y = ppt->y + pDrawable->y;
-		if ((x >= pbox->x1) && (x < pbox->x2) &&
-		    (y >= pbox->y1) && (y < pbox->y2))
-		    *mfbScanline(addrl, x, y, nlwidth) &= rmask[x & PIM];
-	    }
-	}
-	else if (rop == RROP_WHITE)
-	{
-	    for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
-	    {
-		x = ppt->x + pDrawable->x;
-		y = ppt->y + pDrawable->y;
-		if ((x >= pbox->x1) && (x < pbox->x2) &&
-		    (y >= pbox->y1) && (y < pbox->y2))
-		    *mfbScanline(addrl, x, y, nlwidth) |= mask[x & PIM];
-	    }
-	}
-	else if (rop == RROP_INVERT)
-	{
-	    for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++)
-	    {
-		x = ppt->x + pDrawable->x;
-		y = ppt->y + pDrawable->y;
-		if ((x >= pbox->x1) && (x < pbox->x2) &&
-		    (y >= pbox->y1) && (y < pbox->y2))
-		    *mfbScanline(addrl, x, y, nlwidth) ^= mask[x & PIM];
-	    }
-	}
-    }
-}
diff --git a/mfb/mfbpushpxl.c b/mfb/mfbpushpxl.c
deleted file mode 100644
index de96992..0000000
--- a/mfb/mfbpushpxl.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "miscstruct.h"
-#include "maskbits.h"
-#include "regionstr.h"
-#include "mfb.h"
-
-/*  mfbSolidPP is courtesy of xhacks at csri.toronto.edu
-
-    For fillStyle==FillSolid, a monochrome PushPixels can be reduced to
-    a ROP in the following way:  (Note that the ROP is the same as the
-    result of ROP(src=0x3,dst=0x5))
-
-			src=0011 0000 0011
-			dst=0101 0101 0101
-			rop      fg=0 fg=1
-	GXclear         0x0 0000 0100 0100 0
-	GXand           0x1 0001 0100 0101  s&d
-	GXandReverse    0x2 0010 0100 0110 s&~d
-	GXcopy          0x3 0011 0100 0111 s
-	GXandInverted   0x4 0100 0101 0100 ~s&d
-	GXnoop          0x5 0101 0101 0101 d
-	GXxor           0x6 0110 0101 0110 s^d
-	GXor            0x7 0111 0101 0111 s|d
-	GXnor           0x8 1000 0110 0100 ~s&~d
-	GXequiv         0x9 1001 0110 0101 ~s^d
-	GXinvert        0xa 1010 0110 0110 ~d
-	GXorReverse     0xb 1011 0110 0111 s|~d
-	GXcopyInverted  0xc 1100 0111 0100 ~s
-	GXorInverted    0xd 1101 0111 0101 ~s|d
-	GXnand          0xe 1110 0111 0110 ~s|~d
-	GXset           0xf 1111 0111 0111 1
-
-For src=0: newRop = 0x4|(rop>>2)
-For src=1: newRop = 0x4|(rop&3)
-*/
-
-/* mfbSolidPP -- squeegees the forground color of pGC through pBitMap
- * into pDrawable.  pBitMap is a stencil (dx by dy of it is used, it may
- * be bigger) which is placed on the drawable at xOrg, yOrg.  Where a 1 bit
- * is set in the bitmap, the fill style is put onto the drawable using
- * the GC's logical function. The drawable is not changed where the bitmap
- * has a zero bit or outside the area covered by the stencil.
- */
-void
-mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
-    GCPtr	pGC;
-    PixmapPtr	pBitMap;
-    DrawablePtr pDrawable;
-    int		dx, dy, xOrg, yOrg;
-{
-    unsigned char alu;
-    RegionRec rgnDst;
-    DDXPointPtr pptSrc;
-    BoxRec srcBox;
-    register DDXPointPtr ppt;
-    register BoxPtr pbox;
-    int i;
-
-    if (!(pGC->planemask & 1)) return;
-
-    /* compute the reduced rop function */
-    alu = pGC->alu;
-    if (!(pGC->fgPixel&1)) alu >>= 2;
-    alu = (alu & 0x3) | 0x4;
-    if (alu == GXnoop) return;
-
-    srcBox.x1 = xOrg;
-    srcBox.y1 = yOrg;
-    srcBox.x2 = xOrg + dx;
-    srcBox.y2 = yOrg + dy;
-    REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1);
-
-    /* clip the shape of the dst to the destination composite clip */
-    REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
-
-    if (!REGION_NIL(&rgnDst))
-    {
-	i = REGION_NUM_RECTS(&rgnDst);
-	pptSrc = (DDXPointPtr)xalloc(i * sizeof(DDXPointRec));
-        if(pptSrc)
-        {
-	    for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc;
-		 --i >= 0;
-		 pbox++, ppt++)
-	    {
-		ppt->x = pbox->x1 - xOrg;
-		ppt->y = pbox->y1 - yOrg;
-	    }
-	    mfbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc);
-	    xfree(pptSrc);
-	}
-    }
-    REGION_UNINIT(pGC->pScreen, &rgnDst);
-}
-
-#define NPT 128
-
-/* mfbPushPixels -- squeegees the forground color of pGC through pBitMap
- * into pDrawable.  pBitMap is a stencil (dx by dy of it is used, it may
- * be bigger) which is placed on the drawable at xOrg, yOrg.  Where a 1 bit
- * is set in the bitmap, the fill style is put onto the drawable using
- * the GC's logical function. The drawable is not changed where the bitmap
- * has a zero bit or outside the area covered by the stencil.
- */
-void
-mfbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
-    GCPtr	pGC;
-    PixmapPtr	pBitMap;
-    DrawablePtr pDrawable;
-    int		dx, dy, xOrg, yOrg;
-{
-    int		h, dxDivPPW, ibEnd;
-    PixelType *pwLineStart;
-    register PixelType	*pw, *pwEnd;
-    register PixelType mask;
-    register int ib;
-    register PixelType w;
-    register int ipt;		/* index into above arrays */
-    Bool 	fInBox;
-    DDXPointRec	pt[NPT];
-    int		width[NPT];
-
-    /* Now scan convert the pixmap and use the result to call fillspans in
-     * in the drawable with the original GC */
-    ipt = 0;
-    dxDivPPW = dx/PPW;
-    for(h = 0; h < dy; h++)
-    {
-
-	pw = (PixelType *)(pointer)
-	     (((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind));
-	pwLineStart = pw;
-	/* Process all words which are fully in the pixmap */
-	
-	fInBox = FALSE;
-	pwEnd = pwLineStart + dxDivPPW;
-	while(pw  < pwEnd)
-	{
-	    w = *pw;
-	    mask = endtab[1];
-	    for(ib = 0; ib < PPW; ib++)
-	    {
-		if(w & mask)
-		{
-		    if(!fInBox)
-		    {
-			pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
-			pt[ipt].y = h + yOrg;
-			/* start new box */
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			width[ipt] = ((pw - pwLineStart) << PWSH) + 
-				     ib + xOrg - pt[ipt].x;
-			if (++ipt >= NPT)
-			{
-			    (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
-			                      width, TRUE);
-			    ipt = 0;
-			}
-			/* end box */
-			fInBox = FALSE;
-		    }
-		}
-		mask = SCRRIGHT(mask, 1);
-	    }
-	    pw++;
-	}
-	ibEnd = dx & PIM;
-	if(ibEnd)
-	{
-	    /* Process final partial word on line */
-	    w = *pw;
-	    mask = endtab[1];
-	    for(ib = 0; ib < ibEnd; ib++)
-	    {
-		if(w & mask)
-		{
-		    if(!fInBox)
-		    {
-			/* start new box */
-			pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg;
-			pt[ipt].y = h + yOrg;
-			fInBox = TRUE;
-		    }
-		}
-		else
-		{
-		    if(fInBox)
-		    {
-			/* end box */
-			width[ipt] = ((pw - pwLineStart) << PWSH) + 
-				     ib + xOrg - pt[ipt].x;
-			if (++ipt >= NPT)
-			{
-			    (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt,
-			                      width, TRUE);
-			    ipt = 0;
-			}
-			fInBox = FALSE;
-		    }
-		}
-		mask = SCRRIGHT(mask, 1);
-	    }
-	}
-	/* If scanline ended with last bit set, end the box */
-	if(fInBox)
-	{
-	    width[ipt] = dx + xOrg - pt[ipt].x;
-	    if (++ipt >= NPT)
-	    {
-		(*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE);
-		ipt = 0;
-	    }
-	}
-    }
-    /* Flush any remaining spans */
-    if (ipt)
-    {
-	(*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE);
-    }
-}
-
-mfbPushPixelsProc *mfbPushPixelsWeak(void)
-{
-   return mfbPushPixels;
-}
diff --git a/mfb/mfbscrclse.c b/mfb/mfbscrclse.c
deleted file mode 100644
index 97ca729..0000000
--- a/mfb/mfbscrclse.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "mfb.h"
-#include "scrnintstr.h"
-
-/*ARGSUSED*/
-Bool
-mfbCloseScreen(index, pScreen)
-    int	index;
-    register ScreenPtr pScreen;
-{
-    xfree(pScreen->devPrivate);
-    return TRUE;
-}
-
diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c
deleted file mode 100644
index 8873a1b..0000000
--- a/mfb/mfbscrinit.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include <X11/X.h>
-#include <X11/Xproto.h>	/* for xColorItem */
-#include <X11/Xmd.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "resource.h"
-#include "colormap.h"
-#include "mfb.h"
-#include "mistruct.h"
-#include "dix.h"
-#include "mi.h"
-#include "mibstore.h"
-#include "migc.h"
-#include "servermd.h"
-
-#ifdef PIXMAP_PER_WINDOW
-static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey;
-DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; }
-#endif
-static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey;
-DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; }
-static unsigned long mfbGeneration = 0;
-
-static VisualRec visual = {
-/* vid  class       bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
-   0,   StaticGray, 1,    2,   1,    0,    0,    0,    0,   0,     0
-};
-
-static VisualID VID;
-
-static DepthRec depth = {
-/* depth	numVid		vids */
-    1,		1,		&VID
-};
-
-Bool
-mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
-{
-    if (mfbGeneration != serverGeneration)
-    {
-	visual.vid = FakeClientID(0);
-	VID = visual.vid;
-	mfbGeneration = serverGeneration;
-    }
-    if (pGCKey)
-	*pGCKey = mfbGCPrivateKey;
-    pScreen->GetWindowPixmap = mfbGetWindowPixmap;
-    pScreen->SetWindowPixmap = mfbSetWindowPixmap;
-    return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC));
-}
-
-
-/* dts * (inch/dot) * (25.4 mm / inch) = mm */
-Bool
-mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
-    register ScreenPtr pScreen;
-    pointer pbits;		/* pointer to screen bitmap */
-    int xsize, ysize;		/* in pixels */
-    int dpix, dpiy;		/* dots per inch */
-    int width;			/* pixel width of frame buffer */
-{
-    if (!mfbAllocatePrivates(pScreen, NULL))
-	return FALSE;
-    pScreen->defColormap = (Colormap) FakeClientID(0);
-    /* whitePixel, blackPixel */
-    pScreen->QueryBestSize = mfbQueryBestSize;
-    /* SaveScreen */
-    pScreen->GetImage = mfbGetImage;
-    pScreen->GetSpans = mfbGetSpans;
-    pScreen->CreateWindow = mfbCreateWindow;
-    pScreen->PositionWindow = mfbPositionWindow;
-    pScreen->RealizeWindow = mfbMapWindow;
-    pScreen->UnrealizeWindow = mfbUnmapWindow;
-    pScreen->CopyWindow = mfbCopyWindow;
-    pScreen->CreatePixmap = mfbCreatePixmap;
-    pScreen->DestroyPixmap = mfbDestroyPixmap;
-    pScreen->RealizeFont = mfbRealizeFont;
-    pScreen->UnrealizeFont = mfbUnrealizeFont;
-    pScreen->CreateGC = mfbCreateGC;
-    pScreen->CreateColormap = mfbCreateColormap;
-    pScreen->DestroyColormap = mfbDestroyColormap;
-    pScreen->InstallColormap = mfbInstallColormap;
-    pScreen->UninstallColormap = mfbUninstallColormap;
-    pScreen->ListInstalledColormaps = mfbListInstalledColormaps;
-    pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA;
-    pScreen->ResolveColor = mfbResolveColor;
-    pScreen->BitmapToRegion = mfbPixmapToRegion;
-    if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
-			1, 1, &depth, VID, 1, &visual))
-	return FALSE;
-    return TRUE;
-}
-
-PixmapPtr
-mfbGetWindowPixmap(pWin)
-    WindowPtr pWin;
-{
-#ifdef PIXMAP_PER_WINDOW
-    return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates,
-				       frameWindowPrivateKey);
-#else
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    return (* pScreen->GetScreenPixmap)(pScreen);
-#endif
-}
-
-void
-mfbSetWindowPixmap(pWin, pPix)
-    WindowPtr pWin;
-    PixmapPtr pPix;
-{
-#ifdef PIXMAP_PER_WINDOW
-    dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix);
-#else
-    (* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
-#endif
-}
-
-void mfbFillInScreen(ScreenPtr pScreen)
-{
-    pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes;
-    pScreen->RealizeWindow = mfbMapWindow;
-    pScreen->UnrealizeWindow = mfbUnmapWindow;
-    pScreen->DestroyPixmap = mfbDestroyPixmap;
-    pScreen->RealizeFont = mfbRealizeFont;
-    pScreen->UnrealizeFont = mfbUnrealizeFont;
-    pScreen->BitmapToRegion = mfbPixmapToRegion;
-}
diff --git a/mfb/mfbsetsp.c b/mfb/mfbsetsp.c
deleted file mode 100644
index 24add83..0000000
--- a/mfb/mfbsetsp.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "misc.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-#include "servermd.h"
-
-
-/* mfbSetScanline -- copies the bits from psrc to the drawable starting at
- * (xStart, y) and continuing to (xEnd, y).  xOrigin tells us where psrc 
- * starts on the scanline. (I.e., if this scanline passes through multiple
- * boxes, we may not want to start grabbing bits at psrc but at some offset
- * further on.) 
- */
-void
-mfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst)
-    int			y;
-    int			xOrigin;	/* where this scanline starts */
-    int			xStart;		/* first bit to use from scanline */
-    int			xEnd;		/* last bit to use from scanline + 1 */
-    register PixelType	*psrc;
-    register int	alu;		/* raster op */
-    PixelType		*pdstBase;	/* start of the drawable */
-    int			widthDst;	/* width of drawable in words */
-{
-    int			w;		/* width of scanline in bits */
-    register PixelType	*pdst;		/* where to put the bits */
-    register PixelType	tmpSrc;		/* scratch buffer to collect bits in */
-    int			dstBit;		/* offset in bits from beginning of 
-					 * word */
-    register int	nstart; 	/* number of bits from first partial */
-    register int	nend; 		/* " " last partial word */
-    int		offSrc;
-    PixelType	startmask, endmask;
-    int		nlMiddle, nl;
-
-    pdst = mfbScanline(pdstBase, xStart, y, widthDst);
-    psrc += (xStart - xOrigin) >> PWSH;
-    offSrc = (xStart - xOrigin) & PIM;
-    w = xEnd - xStart;
-    dstBit = xStart & PIM;
-
-    if (dstBit + w <= PPW) 
-    { 
-	getandputrop(psrc, offSrc, dstBit, w, pdst, alu)
-    } 
-    else 
-    { 
-
-	maskbits(xStart, w, startmask, endmask, nlMiddle);
-	if (startmask) 
-	    nstart = PPW - dstBit; 
-	else 
-	    nstart = 0; 
-	if (endmask) 
-	    nend = xEnd & PIM; 
-	else 
-	    nend = 0; 
-	if (startmask) 
-	{ 
-	    getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu)
-	    pdst++; 
-	    offSrc += nstart;
-	    if (offSrc > PLST)
-	    {
-		psrc++;
-		offSrc -= PPW;
-	    }
-	} 
-	nl = nlMiddle; 
-	while (nl--) 
-	{ 
-	    getbits(psrc, offSrc, PPW, tmpSrc);
-	    DoRop(*pdst, alu, tmpSrc, *pdst); 
-	    pdst++; 
-	    psrc++; 
-	} 
-	if (endmask) 
-	{ 
-	    getandputrop0(psrc, offSrc, nend, pdst, alu);
-	} 
-	 
-    } 
-}
-
-
-
-/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
- * ppt[i] using the raster op from the GC.  If fSorted is TRUE, the scanlines
- * are in increasing Y order.
- * Source bit lines are server scanline padded so that they always begin
- * on a word boundary.
- */ 
-void
-mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)
-    DrawablePtr		pDrawable;
-    GCPtr		pGC;
-    char		*pcharsrc;
-    register DDXPointPtr ppt;
-    int			*pwidth;
-    int			nspans;
-    int			fSorted;
-{
-    PixelType		*psrc = (PixelType *)(pointer)pcharsrc;
-    PixelType 		*pdstBase;	/* start of dst bitmap */
-    int 		widthDst;	/* width of bitmap in words */
-    register BoxPtr 	pbox, pboxLast, pboxTest;
-    register DDXPointPtr pptLast;
-    int 		alu;
-    RegionPtr 		prgnDst;
-    int			xStart, xEnd;
-    int			yMax;
-
-    alu = pGC->alu;
-    prgnDst = pGC->pCompositeClip;
-
-    pptLast = ppt + nspans;
-
-    yMax = pDrawable->y + (int) pDrawable->height;
-    mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
-
-    pbox =  REGION_RECTS(prgnDst);
-    pboxLast = pbox + REGION_NUM_RECTS(prgnDst);
-
-    if(fSorted)
-    {
-    /* scan lines sorted in ascending order. Because they are sorted, we
-     * don't have to check each scanline against each clip box.  We can be
-     * sure that this scanline only has to be clipped to boxes at or after the
-     * beginning of this y-band 
-     */
-	pboxTest = pbox;
-	while(ppt < pptLast)
-	{
-	    pbox = pboxTest;
-	    if(ppt->y >= yMax)
-		break;
-	    while(pbox < pboxLast)
-	    {
-		if(pbox->y1 > ppt->y)
-		{
-		    /* scanline is before clip box */
-		    break;
-		}
-		else if(pbox->y2 <= ppt->y)
-		{
-		    /* clip box is before scanline */
-		    pboxTest = ++pbox;
-		    continue;
-		}
-		else if(pbox->x1 > ppt->x + *pwidth) 
-		{
-		    /* clip box is to right of scanline */
-		    break;
-		}
-		else if(pbox->x2 <= ppt->x)
-		{
-		    /* scanline is to right of clip box */
-		    pbox++;
-		    continue;
-		}
-
-		/* at least some of the scanline is in the current clip box */
-		xStart = max(pbox->x1, ppt->x);
-		xEnd = min(ppt->x + *pwidth, pbox->x2);
-		mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu,
-			       pdstBase, widthDst);
-		if(ppt->x + *pwidth <= pbox->x2)
-		{
-		    /* End of the line, as it were */
-		    break;
-		}
-		else
-		    pbox++;
-	    }
-	    /* We've tried this line against every box; it must be outside them
-	     * all.  move on to the next point */
-	    ppt++;
-	    psrc += PixmapWidthInPadUnits(*pwidth, 1);
-	    pwidth++;
-	}
-    }
-    else
-    {
-    /* scan lines not sorted. We must clip each line against all the boxes */
-	while(ppt < pptLast)
-	{
-	    if(ppt->y >= 0 && ppt->y < yMax)
-	    {
-		
-		for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++)
-		{
-		    if(pbox->y1 > ppt->y)
-		    {
-			/* rest of clip region is above this scanline,
-			 * skip it */
-			break;
-		    }
-		    if(pbox->y2 <= ppt->y)
-		    {
-			/* clip box is below scanline */
-			pbox++;
-			break;
-		    }
-		    if(pbox->x1 <= ppt->x + *pwidth &&
-		       pbox->x2 > ppt->x)
-		    {
-			xStart = max(pbox->x1, ppt->x);
-			xEnd = min(pbox->x2, ppt->x + *pwidth);
-			mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, 
-				       psrc, alu, pdstBase, widthDst);
-		    }
-
-		}
-	    }
-	psrc += PixmapWidthInPadUnits(*pwidth, 1);
-	ppt++;
-	pwidth++;
-	}
-    }
-}
diff --git a/mfb/mfbtegblt.c b/mfb/mfbtegblt.c
deleted file mode 100644
index ff52d8c..0000000
--- a/mfb/mfbtegblt.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include	<X11/X.h>
-#include	<X11/Xmd.h>
-#include	<X11/Xproto.h>
-#include	"mfb.h"
-#include	<X11/fonts/fontstruct.h>
-#include	"dixfontstr.h"
-#include	"gcstruct.h"
-#include	"windowstr.h"
-#include	"scrnintstr.h"
-#include	"pixmapstr.h"
-#include	"regionstr.h"
-#include	"maskbits.h"
-
-/*
-    this works for fonts with glyphs <= PPW bits wide.
-
-    This should be called only with a terminal-emulator font;
-this means that the FIXED_METRICS flag is set, and that
-glyphbounds == charbounds.
-
-    in theory, this goes faster; even if it doesn't, it reduces the
-flicker caused by writing a string over itself with image text (since
-the background gets repainted per character instead of per string.)
-this seems to be important for some converted X10 applications.
-
-    Image text looks at the bits in the glyph and the fg and bg in the
-GC.  it paints a rectangle, as defined in the protocol dcoument,
-and the paints the characters.
-
-   to avoid source proliferation, this file is compiled
-two times:
-	MFBTEGLYPHBLT		OP
-	mfbTEGlyphBltWhite		(white text, black bg )
-	mfbTEGlyphBltBlack	~	(black text, white bg )
-
-*/
-
-#if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS)
-#define FASTCHARS
-#endif
-
-/*
- * this macro "knows" that only characters <= 8 bits wide will
- * fit this case (which is why it is independent of GLYPHPADBYTES)
- */
-
-#if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4)
-#if GLYPHPADBYTES == 1
-#define ShiftAmnt   24
-#else
-#define ShiftAmnt   16
-#endif
-
-/*
- * XXX XXX XXX There is something horribly, massively wrong here. There are
- * hardcoded shifts by 64 below; these cannot work on any present-day
- * architecture.
- */
-
-/*
- * Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its
- * first argument more than once.  Thus the imbedded char++ have to be moved.
- * (DHD)
- */
-#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#define GetBits4    c = (*char1++ << ShiftAmnt) | \
-			SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
-			SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
-			SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
-#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#define GetBits4    c = (*char1++ << ShiftAmnt) | \
-			SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
-			SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
-			SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
-			char2++; char3++; char4++;
-#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
-
-#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
-
-#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#define GetBits4    c = *char1++ | \
-			SCRRIGHT (*char2++, xoff2) | \
-			SCRRIGHT (*char3++, xoff3) | \
-			SCRRIGHT (*char4++, xoff4);
-#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#define GetBits4    c = *char1++ | \
-			SCRRIGHT (*char2, xoff2) | \
-			SCRRIGHT (*char3, xoff3) | \
-			SCRRIGHT (*char4, xoff4); \
-			char2++; char3++; char4++;
-#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
-
-#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
-
-
-#if GLYPHPADBYTES == 1
-typedef	unsigned char	*glyphPointer;
-#define USE_LEFTBITS
-#endif
-
-#if GLYPHPADBYTES == 2
-typedef unsigned short	*glyphPointer;
-#define USE_LEFTBITS
-#endif
-
-#if GLYPHPADBYTES == 4
-typedef unsigned int	*glyphPointer;
-#endif
-
-#ifdef USE_LEFTBITS
-#define GetBits1    getleftbits (char1, widthGlyph, c); \
-		    c &= glyphMask; \
-		    char1 = (glyphPointer) (((char *) char1) + glyphBytes);
-#else
-#define GetBits1    c = *char1++;
-#endif
-
-void
-MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
-    DrawablePtr pDrawable;
-    GC 		*pGC;
-    int 	x, y;
-    unsigned int nglyph;
-    CharInfoPtr *ppci;		/* array of character info */
-    pointer	pglyphBase;	/* start of array of glyphs */
-{
-    FontPtr	pfont = pGC->font;
-    int widthDst;
-    PixelType *pdstBase;	/* pointer to longword with top row 
-				   of current glyph */
-
-    int h;			/* height of glyph and char */
-    register int xpos;		/* current x  */
-    int ypos;			/* current y */
-    int widthGlyph;
-
-    int hTmp;			/* counter for height */
-    register PixelType startmask, endmask;
-    int nfirst;			/* used if glyphs spans a longword boundary */
-    BoxRec bbox;		/* for clipping */
-    int	widthGlyphs;
-    register PixelType  *dst;
-    register PixelType  c;
-    register int	    xoff1, xoff2, xoff3, xoff4;
-    register glyphPointer   char1, char2, char3, char4;
-
-#ifdef USE_LEFTBITS
-    register PixelType  glyphMask;
-    register PixelType  tmpSrc;
-    register int	    glyphBytes;
-#endif
-
-    if (!(pGC->planemask & 1))
-	return;
-
-    mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase);
-
-    xpos = x + pDrawable->x;
-    ypos = y + pDrawable->y;
-
-    widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
-    h = FONTASCENT(pfont) + FONTDESCENT(pfont);
-
-    xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
-    ypos -= FONTASCENT(pfont);
-
-    bbox.x1 = xpos;
-    bbox.x2 = xpos + (widthGlyph * nglyph);
-    bbox.y1 = ypos;
-    bbox.y2 = ypos + h;
-
-    switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
-    {
-      case rgnPART:
-	/* this is the WRONG thing to do, but it works.
-	   calling the non-terminal text is easy, but slow, given
-	   what we know about the font.
-
-	   the right thing to do is something like:
-	    for each clip rectangle
-		compute at which row the glyph starts to be in it,
-		   and at which row the glyph ceases to be in it
-		compute which is the first glyph inside the left
-		    edge, and the last one inside the right edge
-		draw a fractional first glyph, using only
-		    the rows we know are in
-		draw all the whole glyphs, using the appropriate rows
-		draw any pieces of the last glyph, using the right rows
-
-	   this way, the code would take advantage of knowing that
-	   all glyphs are the same height and don't overlap.
-
-	   one day...
-	*/
-	CLIPTETEXT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-      case rgnOUT:
-	return;
-    }
-    pdstBase = mfbScanlineDeltaNoBankSwitch(pdstBase, ypos, widthDst);
-    widthGlyphs = widthGlyph * PGSZB;
-
-#ifdef USE_LEFTBITS
-    glyphMask = endtab[widthGlyph];
-    glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci);
-#endif
-
-    if (nglyph >= PGSZB && widthGlyphs <= PPW)
-    {
-	while (nglyph >= PGSZB)
-	{
-	    nglyph -= PGSZB;
-	    xoff1 = xpos & PIM;
-	    xoff2 = widthGlyph;
-	    xoff3 = xoff2 + widthGlyph;
-	    xoff4 = xoff3 + widthGlyph;
-	    char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-
-	    hTmp = h;
-	    dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
-
-#ifndef FASTCHARS
-	    if (xoff1 + widthGlyphs <= PPW)
-	    {
-		maskpartialbits (xoff1, widthGlyphs, startmask);
-#endif
-		while (hTmp--)
-		{
-		    GetBits4
-#ifdef FASTCHARS
-# if BITMAP_BIT_ORDER == MSBFirst
-		    c >>= PPW - widthGlyphs;
-# endif
-		    FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst);
-#else
-		    *(dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
-#endif
-		    mfbScanlineInc(dst, widthDst);
-		}
-#ifndef FASTCHARS
-	    }
-	    else
-	    {
-		maskPPWbits (xoff1, widthGlyphs, startmask, endmask);
-		nfirst = PPW - xoff1;
-		while (hTmp--)
-		{
-		    GetBits4
-		    dst[0] = (dst[0] & ~startmask) |
-			     (OP(SCRRIGHT(c,xoff1)) & startmask);
-		    dst[1] = (dst[1] & ~endmask) |
-			     (OP(SCRLEFT(c,nfirst)) & endmask);
-		    mfbScanlineInc(dst, widthDst);
-		}
-	    }
-#endif
-	    xpos += widthGlyphs;
-	}
-    }
-
-    while(nglyph--)
-    {
-	xoff1 = xpos & PIM;
-	char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	hTmp = h;
-	dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH));
-
-#ifndef FASTCHARS
-	if (xoff1 + widthGlyph <= PPW)
-	{
-	    maskpartialbits (xoff1, widthGlyph, startmask);
-#endif
-	    while (hTmp--)
-	    {
-#ifdef FASTCHARS
-#ifdef USE_LEFTBITS
-		FASTGETBITS (char1,0,widthGlyph,c);
-		char1 = (glyphPointer) (((char *) char1) + glyphBytes);
-#else
-		c = *char1++;
-#if BITMAP_BIT_ORDER == MSBFirst
-		c >>= PPW - widthGlyph;
-#endif
-#endif
-		FASTPUTBITS (OP(c),xoff1,widthGlyph,dst);
-#else
-		GetBits1
-		(*dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
-#endif
-		mfbScanlineInc(dst, widthDst);
-	    }
-#ifndef FASTCHARS
-	}
-	else
-	{
-	    maskPPWbits (xoff1, widthGlyph, startmask, endmask);
-	    nfirst = PPW - xoff1;
-	    while (hTmp--)
-	    {
-		GetBits1
-		dst[0] = (dst[0] & ~startmask) |
-			 (OP(SCRRIGHT(c,xoff1)) & startmask);
-		dst[1] = (dst[1] & ~endmask) |
-			 (OP(SCRLEFT(c,nfirst)) & endmask);
-		mfbScanlineInc(dst, widthDst);
-	    }
-	}
-#endif
-	xpos += widthGlyph;
-    }
-}
diff --git a/mfb/mfbtile.c b/mfb/mfbtile.c
deleted file mode 100644
index 73015f5..0000000
--- a/mfb/mfbtile.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "windowstr.h"
-#include "regionstr.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-
-#include "mfb.h"
-#include "maskbits.h"
-
-#include "mergerop.h"
-/* 
-
-   the boxes are already translated.
-
-   NOTE:
-   iy = ++iy < tileHeight ? iy : 0
-is equivalent to iy%= tileheight, and saves a division.
-*/
-
-/* 
-    tile area with a PPW bit wide pixmap 
-*/
-void
-MROP_NAME(mfbTileAreaPPW)(pDraw, nbox, pbox, alu, ptile)
-    DrawablePtr pDraw;
-    int nbox;
-    BoxPtr pbox;
-    int alu;
-    PixmapPtr ptile;
-{
-    register PixelType *psrc;
-			/* pointer to bits in tile, if needed */
-    int tileHeight;	/* height of the tile */
-    register PixelType srcpix;	
-    int nlwidth;	/* width in longwords of the drawable */
-    int w;		/* width of current box */
-    MROP_DECLARE_REG ()
-    register int h;	/* height of current box */
-    register int nlw;	/* loop version of nlwMiddle */
-    register PixelType *p;	/* pointer to bits we're writing */
-    PixelType startmask;
-    PixelType endmask;	/* masks for reggedy bits at either end of line */
-    int nlwMiddle;	/* number of longwords between sides of boxes */
-    int nlwExtra;	/* to get from right of box to left of next span */
-    register int iy;	/* index of current scanline in tile */
-    PixelType *pbits;	/* pointer to start of drawable */
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits);
-
-    MROP_INITIALIZE(alu,~0)
-
-    tileHeight = ptile->drawable.height;
-    psrc = (PixelType *)(ptile->devPrivate.ptr);
-
-    while (nbox--)
-    {
-	w = pbox->x2 - pbox->x1;
-	h = pbox->y2 - pbox->y1;
-	iy = pbox->y1 % tileHeight;
-	p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth);
-
-	if ( ((pbox->x1 & PIM) + w) < PPW)
-	{
-	    maskpartialbits(pbox->x1, w, startmask);
-	    nlwExtra = nlwidth;
-	    while (h--)
-	    {
-		srcpix = psrc[iy];
-		iy++;
-		if (iy == tileHeight)
-		    iy = 0;
-		*p = MROP_MASK(srcpix,*p,startmask);
-		mfbScanlineInc(p, nlwExtra);
-	    }
-	}
-	else
-	{
-	    maskbits(pbox->x1, w, startmask, endmask, nlwMiddle);
-	    nlwExtra = nlwidth - nlwMiddle;
-
-	    if (startmask && endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy++;
-		    if (iy == tileHeight)
-			iy = 0;
-		    nlw = nlwMiddle;
-		    *p = MROP_MASK (srcpix,*p,startmask);
-		    p++;
-		    while (nlw--)
-		    {
-			*p = MROP_SOLID(srcpix,*p);
-			p++;
-		    }
-
-		    *p = MROP_MASK(srcpix,*p,endmask);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (startmask && !endmask)
-	    {
-		nlwExtra -= 1;
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy++;
-		    if (iy == tileHeight)
-			iy = 0;
-		    nlw = nlwMiddle;
-		    *p = MROP_MASK(srcpix,*p,startmask);
-		    p++;
-		    while (nlw--)
-		    {
-			*p = MROP_SOLID(srcpix,*p);
-			p++;
-		    }
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else if (!startmask && endmask)
-	    {
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy++;
-		    if (iy == tileHeight)
-			iy = 0;
-		    nlw = nlwMiddle;
-		    while (nlw--)
-		    {
-			*p = MROP_SOLID(srcpix,*p);
-			p++;
-		    }
-
-		    *p = MROP_MASK(srcpix,*p,endmask);
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	    else /* no ragged bits at either end */
-	    {
-		while (h--)
-		{
-		    srcpix = psrc[iy];
-		    iy++;
-		    if (iy == tileHeight)
-			iy = 0;
-		    nlw = nlwMiddle;
-		    while (nlw--)
-		    {
-			*p = MROP_SOLID (srcpix,*p);
-			p++;
-		    }
-		    mfbScanlineInc(p, nlwExtra);
-		}
-	    }
-	}
-        pbox++;
-    }
-}
-
-#if (MROP) == 0
-void
-mfbTileAreaPPW (pDraw, nbox, pbox, alu, ptile)
-    DrawablePtr pDraw;
-    int nbox;
-    BoxPtr pbox;
-    int alu;
-    PixmapPtr ptile;
-{
-    void (*f)(
-	DrawablePtr /*pDraw*/,
-	int /*nbox*/,
-    	BoxPtr /*pbox*/,
-    	int /*alu*/,
-    	PixmapPtr /*ptile*/);
-    
-    if (alu == GXcopy)
-	f = mfbTileAreaPPWCopy;
-    else
-	f = mfbTileAreaPPWGeneral;
-    (*f) (pDraw, nbox, pbox, alu, ptile);
-}
-#endif
diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c
deleted file mode 100644
index 37125da..0000000
--- a/mfb/mfbwindow.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "privates.h"
-#include "mfb.h"
-#include "mistruct.h"
-#include "regionstr.h"
-#include "maskbits.h"
-
-Bool
-mfbCreateWindow(pWin)
-    register WindowPtr pWin;
-{
-    return (TRUE);
-}
-
-/* This always returns true, because Xfree can't fail.  It might be possible
- * on some devices for Destroy to fail */
-Bool 
-mfbDestroyWindow(WindowPtr pWin)
-{
-    return (TRUE);
-}
-
-/*ARGSUSED*/
-Bool mfbMapWindow(pWindow)
-    WindowPtr pWindow;
-{
-    return (TRUE);
-}
-
-/* (x, y) is the upper left corner of the window on the screen 
-   do we really need to pass this?  (is it a;ready in pWin->absCorner?)
-   we only do the rotation for pixmaps that are 32 bits wide (padded
-or otherwise.)
-   mfbChangeWindowAttributes() has already put a copy of the pixmap
-in pPrivWin->pRotated*
-*/
-
-/*ARGSUSED*/
-Bool 
-mfbPositionWindow(pWin, x, y)
-    register WindowPtr pWin;
-    int x, y;
-{
-    /* This is the "wrong" fix to the right problem, but it doesn't really
-     * cost very much.  When the window is moved, we need to invalidate any
-     * RotatedPixmap that exists in any GC currently validated against this
-     * window.
-     */
-    pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
-    /* Again, we have no failure modes indicated by any of the routines
-     * we've called, so we have to assume it worked */
-    return (TRUE);
-}
-
-/*ARGSUSED*/
-Bool 
-mfbUnmapWindow(pWindow)
-    WindowPtr pWindow;
-{
-    return (TRUE);
-}
-
-/* UNCLEAN!
-   this code calls the bitblt helper code directly.
-
-   mfbCopyWindow copies only the parts of the destination that are
-visible in the source.
-*/
-
-
-void 
-mfbCopyWindow(pWin, ptOldOrg, prgnSrc)
-    WindowPtr pWin;
-    DDXPointRec ptOldOrg;
-    RegionPtr prgnSrc;
-{
-    DDXPointPtr pptSrc;
-    register DDXPointPtr ppt;
-    RegionPtr prgnDst;
-    register BoxPtr pbox;
-    register int dx, dy;
-    register int i, nbox;
-    WindowPtr pwinRoot;
-
-    pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
-
-    prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
-
-    dx = ptOldOrg.x - pWin->drawable.x;
-    dy = ptOldOrg.y - pWin->drawable.y;
-    REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-    REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip,
-		     prgnSrc);
-
-    pbox = REGION_RECTS(prgnDst);
-    nbox = REGION_NUM_RECTS(prgnDst);
-    if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
-	return;
-    ppt = pptSrc;
-
-    for (i=nbox; --i >= 0; ppt++, pbox++)
-    {
-	ppt->x = pbox->x1 + dx;
-	ppt->y = pbox->y1 + dy;
-    }
-
-    mfbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
-		GXcopy, prgnDst, pptSrc);
-    xfree(pptSrc);
-    REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
-}
diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c
deleted file mode 100644
index 624e45f..0000000
--- a/mfb/mfbzerarc.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/************************************************************
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-********************************************************/
-
-
-/* Derived from:
- * "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
- * by M. L. V. Pitteway
- * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <limits.h>
-
-#include <X11/X.h>
-#include <X11/Xprotostr.h>
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "scrnintstr.h"
-#include "mfb.h"
-#include "maskbits.h"
-#include "mizerarc.h"
-#include "mi.h"
-
-/*
- * Note: LEFTMOST must be the bit leftmost in the actual screen
- * representation.  This depends also on the IMAGE_BYTE_ORDER.
- * LONG2CHARS() takes care of the re-ordering as required. (DHD)
- */
-#if (BITMAP_BIT_ORDER == MSBFirst)
-#define LEFTMOST	((PixelType) LONG2CHARS(((MfbBits)1 << PLST)))
-#else
-#define LEFTMOST	((PixelType) LONG2CHARS(1))
-#endif
-
-#define PixelateWhite(addr,yoff,xoff) \
-    *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) |= \
-	SCRRIGHT (LEFTMOST, ((xoff) & PIM))
-#define PixelateBlack(addr,yoff,xoff) \
-    *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) &= \
-	~(SCRRIGHT (LEFTMOST, ((xoff) & PIM)))
-
-#define Pixelate(base,yoff,xoff) \
-{ \
-    paddr = mfbScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \
-    pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \
-    *paddr = (*paddr & ~pmask) | (pixel & pmask); \
-}
-
-#define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff);
-
-static void
-mfbZeroArcSS(
-    DrawablePtr pDraw,
-    GCPtr pGC,
-    xArc *arc)
-{
-    miZeroArcRec info;
-    Bool do360;
-    register int x, y, a, b, d, mask;
-    register int k1, k3, dx, dy;
-    PixelType *addrl;
-    PixelType *yorgl, *yorgol;
-    PixelType pixel;
-    int nlwidth, yoffset, dyoffset;
-    PixelType pmask;
-    register PixelType *paddr;
-
-    if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
-				       mfbGetGCPrivateKey()))->rop ==
-	RROP_BLACK)
-	pixel = 0;
-    else
-	pixel = ~0;
-
-    mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrl);
-    do360 = miZeroArcSetup(arc, &info, TRUE);
-    yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
-    yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
-    info.xorg += pDraw->x;
-    info.xorgo += pDraw->x;
-    MIARCSETUP();
-    yoffset = y ? nlwidth : 0;
-    dyoffset = 0;
-    mask = info.initialMask;
-    if (!(arc->width & 1))
-    {
-	DoPix(2, yorgl, 0, info.xorgo);
-	DoPix(8, yorgol, 0, info.xorgo);
-    }
-    if (!info.end.x || !info.end.y)
-    {
-	mask = info.end.mask;
-	info.end = info.altend;
-    }
-    if (do360 && (arc->width == arc->height) && !(arc->width & 1))
-    {
-	int xoffset = nlwidth;
-	PixelType *yorghl = mfbScanlineDeltaNoBankSwitch(yorgl, info.h, nlwidth);
-	int xorghp = info.xorg + info.h;
-	int xorghn = info.xorg - info.h;
-
-	if (pixel)
-	{
-	    while (1)
-	    {
-		PixelateWhite(yorgl, yoffset, info.xorg + x);
-		PixelateWhite(yorgl, yoffset, info.xorg - x);
-		PixelateWhite(yorgol, -yoffset, info.xorg - x);
-		PixelateWhite(yorgol, -yoffset, info.xorg + x);
-		if (a < 0)
-		    break;
-		PixelateWhite(yorghl, -xoffset, xorghp - y);
-		PixelateWhite(yorghl, -xoffset, xorghn + y);
-		PixelateWhite(yorghl, xoffset, xorghn + y);
-		PixelateWhite(yorghl, xoffset, xorghp - y);
-		xoffset += nlwidth;
-		MIARCCIRCLESTEP(yoffset += nlwidth;);
-	    }
-	}
-	else
-	{
-	    while (1)
-	    {
-		PixelateBlack(yorgl, yoffset, info.xorg + x);
-		PixelateBlack(yorgl, yoffset, info.xorg - x);
-		PixelateBlack(yorgol, -yoffset, info.xorg - x);
-		PixelateBlack(yorgol, -yoffset, info.xorg + x);
-		if (a < 0)
-		    break;
-		PixelateBlack(yorghl, -xoffset, xorghp - y);
-		PixelateBlack(yorghl, -xoffset, xorghn + y);
-		PixelateBlack(yorghl, xoffset, xorghn + y);
-		PixelateBlack(yorghl, xoffset, xorghp - y);
-		xoffset += nlwidth;
-		MIARCCIRCLESTEP(yoffset += nlwidth;);
-	    }
-	}
-	x = info.w;
-	yoffset = info.h * nlwidth;
-    }
-    else if (do360)
-    {
-	while (y < info.h || x < info.w)
-	{
-	    MIARCOCTANTSHIFT(dyoffset = nlwidth;);
-	    Pixelate(yorgl, yoffset, info.xorg + x);
-	    Pixelate(yorgl, yoffset, info.xorgo - x);
-	    Pixelate(yorgol, -yoffset, info.xorgo - x);
-	    Pixelate(yorgol, -yoffset, info.xorg + x);
-	    MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
-	}
-    }
-    else
-    {
-	while (y < info.h || x < info.w)
-	{
-	    MIARCOCTANTSHIFT(dyoffset = nlwidth;);
-	    if ((x == info.start.x) || (y == info.start.y))
-	    {
-		mask = info.start.mask;
-		info.start = info.altstart;
-	    }
-	    DoPix(1, yorgl, yoffset, info.xorg + x);
-	    DoPix(2, yorgl, yoffset, info.xorgo - x);
-	    DoPix(4, yorgol, -yoffset, info.xorgo - x);
-	    DoPix(8, yorgol, -yoffset, info.xorg + x);
-	    if ((x == info.end.x) || (y == info.end.y))
-	    {
-		mask = info.end.mask;
-		info.end = info.altend;
-	    }
-	    MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
-	}
-    }
-    if ((x == info.start.x) || (y == info.start.y))
-	mask = info.start.mask;
-    DoPix(1, yorgl, yoffset, info.xorg + x);
-    DoPix(4, yorgol, -yoffset, info.xorgo - x);
-    if (arc->height & 1)
-    {
-	DoPix(2, yorgl, yoffset, info.xorgo - x);
-	DoPix(8, yorgol, -yoffset, info.xorg + x);
-    }
-}
-
-void
-mfbZeroPolyArcSS(pDraw, pGC, narcs, parcs)
-    DrawablePtr	pDraw;
-    GCPtr	pGC;
-    int		narcs;
-    xArc	*parcs;
-{
-    register xArc *arc;
-    register int i;
-    BoxRec box;
-    int x2, y2;
-    RegionPtr cclip;
-
-    if (!(pGC->planemask & 1))
-	return;
-    cclip = pGC->pCompositeClip;
-    for (arc = parcs, i = narcs; --i >= 0; arc++)
-    {
-	if (miCanZeroArc(arc))
-	{
-	    box.x1 = arc->x + pDraw->x;
-	    box.y1 = arc->y + pDraw->y;
- 	    /*
- 	     * Because box.x2 and box.y2 get truncated to 16 bits, and the
- 	     * RECT_IN_REGION test treats the resulting number as a signed
- 	     * integer, the RECT_IN_REGION test alone can go the wrong way.
- 	     * This can result in a server crash because the rendering
- 	     * routines in this file deal directly with cpu addresses
- 	     * of pixels to be stored, and do not clip or otherwise check
- 	     * that all such addresses are within their respective pixmaps.
- 	     * So we only allow the RECT_IN_REGION test to be used for
- 	     * values that can be expressed correctly in a signed short.
- 	     */
- 	    x2 = box.x1 + (int)arc->width + 1;
- 	    box.x2 = x2;
- 	    y2 = box.y1 + (int)arc->height + 1;
- 	    box.y2 = y2;
- 	    if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) &&
- 		    (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) )
-		mfbZeroArcSS(pDraw, pGC, arc);
-	    else
-		miZeroPolyArc(pDraw, pGC, 1, arc);
-	}
-	else
-	    miPolyArc(pDraw, pGC, 1, arc);
-    }
-}
commit af86c3b7ce705c1711c8cf8bf05a7a02b8afccf6
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Sat May 24 21:16:34 2008 +0300

    clean .gitignore

diff --git a/.gitignore b/.gitignore
index d2699db..e4ab6da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,61 +37,6 @@ xorg-server.pc
 stamp-h?
 do-not-use-config.h
 do-not-use-config.h.in
-cfb/cfb8lineCO.c
-cfb/cfb8lineCP.c
-cfb/cfb8lineG.c
-cfb/cfb8lineX.c
-cfb/cfb8segC.c
-cfb/cfb8segCS.c
-cfb/cfb8segX.c
-cfb/cfb8setG.c
-cfb/cfbbltC.c
-cfb/cfbbltG.c
-cfb/cfbbltO.c
-cfb/cfbbltX.c
-cfb/cfbfillarcC.c
-cfb/cfbfillarcG.c
-cfb/cfbglrop8.c
-cfb/cfbply1rctC.c
-cfb/cfbply1rctG.c
-cfb/cfbseg.c
-cfb/cfbsolidC.c
-cfb/cfbsolidG.c
-cfb/cfbsolidX.c
-cfb/cfbtile32C.c
-cfb/cfbtile32G.c
-cfb/cfbtileoddC.c
-cfb/cfbtileoddG.c
-cfb/cfbzerarcC.c
-cfb/cfbzerarcG.c
-cfb/cfbzerarcX.c
-cfb32/cfb8lineCO.c
-cfb32/cfb8lineCP.c
-cfb32/cfb8lineG.c
-cfb32/cfb8lineX.c
-cfb32/cfb8segC.c
-cfb32/cfb8segCS.c
-cfb32/cfb8segX.c
-cfb32/cfb8setG.c
-cfb32/cfbbltC.c
-cfb32/cfbbltG.c
-cfb32/cfbbltO.c
-cfb32/cfbbltX.c
-cfb32/cfbfillarcC.c
-cfb32/cfbfillarcG.c
-cfb32/cfbply1rctC.c
-cfb32/cfbply1rctG.c
-cfb32/cfbseg.c
-cfb32/cfbsolidC.c
-cfb32/cfbsolidG.c
-cfb32/cfbsolidX.c
-cfb32/cfbtile32C.c
-cfb32/cfbtile32G.c
-cfb32/cfbtileoddC.c
-cfb32/cfbtileoddG.c
-cfb32/cfbzerarcC.c
-cfb32/cfbzerarcG.c
-cfb32/cfbzerarcX.c
 doc/Xserver.1x
 doc/Xserver.man
 hw/dmx/Xdmx
@@ -120,24 +65,11 @@ hw/dmx/examples/xdmx
 hw/dmx/examples/xinput
 hw/dmx/examples/xled
 hw/dmx/examples/xtest
-hw/kdrive/ati/Xati
-hw/kdrive/chips/Xchips
 hw/kdrive/ephyr/Xephyr
-hw/kdrive/epson/Xepson
 hw/kdrive/fake/Xfake
 hw/kdrive/fbdev/Xfbdev
-hw/kdrive/i810/Xi810
-hw/kdrive/mach64/Xmach64
-hw/kdrive/mga/Xmga
-hw/kdrive/neomagic/Xneomagic
-hw/kdrive/nvidia/Xnvidia
-hw/kdrive/pm2/Xpm2
-hw/kdrive/r128/Xr128
 hw/kdrive/sdl/Xsdl
-hw/kdrive/sis300/Xsis
-hw/kdrive/smi/Xsmi
 hw/kdrive/vesa/Xvesa
-hw/kdrive/via/Xvia
 hw/vfb/Xvfb
 hw/vfb/Xvfb.1x
 hw/vfb/Xvfb.man
@@ -153,15 +85,9 @@ hw/xfree86/exa/exa.4x
 hw/xfree86/exa/exa.man
 hw/xfree86/fbdevhw/fbdevhw.4x
 hw/xfree86/fbdevhw/fbdevhw.man
-hw/xfree86/getconfig/cfg.man
-hw/xfree86/getconfig/getconfig.1x
-hw/xfree86/getconfig/getconfig.5x
-hw/xfree86/getconfig/getconfig.man
 hw/xfree86/os-support/xorgos.c
 hw/xfree86/osandcommon.c
 hw/xfree86/ramdac/xf86BitOrder.c
-hw/xfree86/scanpci/xf86PciData.c
-hw/xfree86/scanpci/xf86PciIds.h
 hw/xfree86/utils/cvt/cvt
 hw/xfree86/utils/cvt/cvt.man
 hw/xfree86/utils/gtf/gtf
@@ -174,12 +100,6 @@ hw/xfree86/utils/ioport/ioport
 hw/xfree86/utils/ioport/outb
 hw/xfree86/utils/ioport/outl
 hw/xfree86/utils/ioport/outw
-hw/xfree86/utils/pcitweak/pcitweak
-hw/xfree86/utils/pcitweak/pcitweak.1x
-hw/xfree86/utils/pcitweak/pcitweak.man
-hw/xfree86/utils/scanpci/scanpci
-hw/xfree86/utils/scanpci/scanpci.1x
-hw/xfree86/utils/scanpci/scanpci.man
 hw/xfree86/utils/xorgcfg/XOrgCfg
 hw/xfree86/utils/xorgcfg/xorgcfg
 hw/xfree86/utils/xorgcfg/xorgcfg.1x
@@ -256,20 +176,12 @@ hw/xfree86/xf1bpp/mfbtileG.c
 hw/xfree86/xf1bpp/mfbwindow.c
 hw/xfree86/xf1bpp/mfbzerarc.c
 hw/xfree86/xf4bpp/mfbseg.c
-hw/xfree86/xf8_32bpp/cfbgc32.c
-hw/xfree86/xf8_32bpp/cfbgc8.c
 hw/xfree86/xorg.c
 hw/xfree86/xorg.conf.example
 hw/xfree86/xorg.conf.example.pre
 hw/xnest/Xnest
 hw/xnest/Xnest.1x
 hw/xnest/Xnest.man
-hw/xprint/Xprt
-hw/xprint/config/C/print/Xprinters.ghostscript
-hw/xprint/doc/Xprt.1x
-hw/xprint/doc/Xprt.man
-hw/xprint/dpmsstubs-wrapper.c
-hw/xprint/miinitext-wrapper.c
 hw/xquartz/mach-startup/mach_startup.h
 hw/xquartz/mach-startup/mach_startupServer.c
 hw/xquartz/mach-startup/mach_startupServer.h
commit 3108980f5e78c129b23ff32f72564cf9a746c693
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Fri Jun 13 15:58:56 2008 +0300

    glx: drop unused cleargc

diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 9d987c2..cf4827e 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -81,7 +81,6 @@ struct __GLXDRIdrawable {
     __GLXDRIscreen	*screen;
 
     GCPtr gc;		/* scratch GC for span drawing */
-    GCPtr cleargc;	/* GC for clearing the color buffer */
     GCPtr swapgc;	/* GC for swapping the color buffers */
 };
 
@@ -94,7 +93,6 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
     (*core->destroyDrawable)(private->driDrawable);
 
     FreeScratchGC(private->gc);
-    FreeScratchGC(private->cleargc);
     FreeScratchGC(private->swapgc);
 
     xfree(private);
@@ -335,11 +333,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
     private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
 
     private->gc = CreateScratchGC(pScreen, pDraw->depth);
-    private->cleargc = CreateScratchGC(pScreen, pDraw->depth);
     private->swapgc = CreateScratchGC(pScreen, pDraw->depth);
 
     glxChangeGC(private->gc, GCFunction, GXcopy);
-    glxChangeGC(private->cleargc, GCFunction, GXcopy);
     glxChangeGC(private->swapgc, GCFunction, GXcopy);
     glxChangeGC(private->swapgc, GCGraphicsExposures, FALSE);
 
@@ -378,9 +374,6 @@ swrastPutImage(__DRIdrawable *draw, int op,
     case __DRI_SWRAST_IMAGE_OP_DRAW:
 	gc = drawable->gc;
 	break;
-    case __DRI_SWRAST_IMAGE_OP_CLEAR:
-	gc = drawable->cleargc;
-	break;
     case __DRI_SWRAST_IMAGE_OP_SWAP:
 	gc = drawable->swapgc;
 	break;
commit 23b55a61f89f69454a3b0e3413b1f07d5fdf43aa
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Fri Jun 13 11:13:56 2008 +0200

    AIGLX/DRI1: Switch to server context for calling pScreen->GetImage.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=16292 .

diff --git a/glx/glxdri.c b/glx/glxdri.c
index 43b0523..a87ff13 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -485,9 +485,11 @@ nooverride:
 
 	    data = xalloc(pitch * pixmap->drawable.height);
 
+	    __glXenterServer(GL_FALSE);
 	    pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
 			      0 /*pixmap->drawable.y*/, pixmap->drawable.width,
 			      pixmap->drawable.height, ZPixmap, ~0, data);
+	    __glXleaveServer(GL_FALSE);
 
 	    if (pixmap->drawable.depth == 24)
 		glxFillAlphaChannel(data,
@@ -529,9 +531,11 @@ nooverride:
 					   pixmap->drawable.depth);
 	    void *data = xalloc(pitch * (p[i].y2 - p[i].y1));
 
+	    __glXenterServer(GL_FALSE);
 	    pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
 			      /*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1,
 			      p[i].y2 - p[i].y1, ZPixmap, ~0, data);
+	    __glXleaveServer(GL_FALSE);
 
 	    if (pixmap->drawable.depth == 24)
 		glxFillAlphaChannel(data,
commit d15b3790307053587df8daed1936ff6923881b63
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jun 12 16:00:50 2008 -0400

    Remove xgl.
    
    This code hasn't been updated with anything even resembling what anyone is
    shipping in nearly thirty months.  It hasn't built out of the box since
    7.1.  Most of its features over AIGLX are accomplished with DRI2 and
    friends.

diff --git a/configure.ac b/configure.ac
index ccb7c29..4d654da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,8 +40,6 @@ AC_CONFIG_HEADERS(include/xorg-server.h)
 dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
 dnl dix/).
 AC_CONFIG_HEADERS(include/dix-config.h)
-dnl xgl-config.h covers the Xgl DDX.
-AC_CONFIG_HEADERS(include/xgl-config.h)
 dnl xorg-config.h covers the Xorg DDX.
 AC_CONFIG_HEADERS(include/xorg-config.h)
 dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
@@ -567,9 +565,6 @@ AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
 AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
 AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
-AC_ARG_ENABLE(xgl,            AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
-AC_ARG_ENABLE(xglx,           AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
-AC_ARG_ENABLE(xegl,           AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
 dnl legacy fb support
 AC_ARG_ENABLE(mfb,            AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
 dnl kdrive and its subsystems
@@ -1252,62 +1247,6 @@ if test "x$XORG" = xauto; then
 fi
 AC_MSG_RESULT([$XORG])
 
-dnl Xgl DDX
-
-AC_MSG_CHECKING([whether to build Xgl DDX])
-if test "x$XGL" != xno; then
-  PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XGL=yes], [XGL=no])
-  AC_SUBST(XGLMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XGL])
-AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
-
-if test "x$XGL" = xyes; then
-	XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
-	XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
-	AC_SUBST([XGL_LIBS])
-	AC_SUBST([XGL_SYS_LIBS])
-	AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
-
-	xglmoduledir="$moduledir/xgl"
-	AC_SUBST([xglmoduledir])
-	AC_DEFINE_DIR(XGL_MODULE_PATH, xglmoduledir, [Default XGL module search path])
-fi
-
-dnl Xegl DDX
-
-AC_MSG_CHECKING([whether to build Xegl DDX])
-if test "x$XEGL" != xno; then
-  PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XEGL=yes], [XEGL=no])
-  AC_SUBST(XEGLMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XEGL])
-AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
-
-if test "x$XEGL" = xyes; then
-	XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
-	XEGL_SYS_LIBS = "$XEGL_SYS_LIBS $XEGLMODULES_LIBS $GLX_SYS_LIBS"
-	AC_SUBST([XEGL_LIBS])
-	AC_SUBST([XEGL_SYS_LIBS])
-fi
-
-dnl Xglx DDX
-
-AC_MSG_CHECKING([whether to build Xglx DDX])
-if test "x$XGLX" != xno; then
-  PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= 0.4.3 xrender], [XGLX=yes], [XGLX=no])
-  AC_SUBST(XGLXMODULES_CFLAGS)
-fi
-AC_MSG_RESULT([$XGLX])
-AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
-
-if test "x$XGLX" = xyes; then
-	XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
-	XGLX_SYS_LIBS="$XGLX_SYS_LIBS $XGLXMODULES_LIBS $GLX_SYS_LIBS"
-	AC_SUBST([XGLX_LIBS])
-	AC_SUBST([XGLX_SYS_LIBS])
-fi
-
 xorg_bus_linuxpci=no
 xorg_bus_bsdpci=no
 xorg_bus_ix86pci=no
@@ -1315,7 +1254,7 @@ xorg_bus_ppcpci=no
 xorg_bus_sparcpci=no
 xorg_bus_sparc=no
 
-if test "x$XORG" = xyes -o "x$XGL" = xyes; then
+if test "x$XORG" = xyes; then
 	XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
 	XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
 	XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
@@ -2054,13 +1993,6 @@ hw/dmx/input/Makefile
 hw/dmx/glxProxy/Makefile
 hw/dmx/Makefile
 hw/vfb/Makefile
-hw/xgl/Makefile
-hw/xgl/egl/Makefile
-hw/xgl/egl/module/Makefile
-hw/xgl/glx/Makefile
-hw/xgl/glx/module/Makefile
-hw/xgl/glxext/Makefile
-hw/xgl/glxext/module/Makefile
 hw/xnest/Makefile
 hw/xwin/Makefile
 hw/xquartz/Makefile
diff --git a/hw/Makefile.am b/hw/Makefile.am
index 4589b7e..7409906 100644
--- a/hw/Makefile.am
+++ b/hw/Makefile.am
@@ -18,10 +18,6 @@ if XWIN
 XWIN_SUBDIRS = xwin
 endif
 
-if XGL
-XGL_SUBDIRS = xgl
-endif
-
 if KDRIVE
 KDRIVE_SUBDIRS = kdrive
 endif
@@ -32,7 +28,6 @@ endif
 
 SUBDIRS =			\
 	$(XORG_SUBDIRS)		\
-	$(XGL_SUBDIRS)		\
 	$(XWIN_SUBDIRS)		\
 	$(XVFB_SUBDIRS)		\
 	$(XNEST_SUBDIRS)	\
@@ -40,7 +35,7 @@ SUBDIRS =			\
 	$(KDRIVE_SUBDIRS)	\
 	$(XQUARTZ_SUBDIRS)
 
-DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
 
 relink:
 	for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done
diff --git a/hw/xgl/Makefile.am b/hw/xgl/Makefile.am
deleted file mode 100644
index 8df8ae9..0000000
--- a/hw/xgl/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-if GLX
-GLX_SUBDIRS = glxext
-endif
-
-if XGLX
-XGLX_SUBDIRS = glx
-endif
-
-if XEGL
-XEGL_SUBDIRS = egl
-endif
-
-DIST_SUBDIRS = glxext glx egl
-
-SUBDIRS = 		\
-	.		\
-	$(GLX_SUBDIRS)  \
-	$(XGLX_SUBDIRS) \
-	$(XEGL_SUBDIRS)
-
-AM_CFLAGS = \
-	 $(DIX_CFLAGS) \
-	-DHAVE_XGL_CONFIG_H \
-	-DHAVE_DIX_CONFIG_H \
-	-I$(top_srcdir)/glx			\
-	-I$(top_srcdir)/GL/include		\
-	-I at MESA_SOURCE@/include \
-	-I at MESA_SOURCE@/src/mesa/glapi \
-	$(XGLMODULES_CFLAGS)
-
-noinst_LIBRARIES = libxgl.a
-
-libxgl_a_SOURCES =     \
-	xgl.h	       \
-	xglmodule.h    \
-	xglglx.h       \
-	xglinput.c     \
-	xgloutput.c    \
-	xglcmap.c      \
-	xglparse.c     \
-	xglscreen.c    \
-	xglarea.c      \
-	xglgeometry.c  \
-	xglpixmap.c    \
-	xglsync.c      \
-	xglsolid.c     \
-	xgltile.c      \
-	xglcopy.c      \
-	xglfill.c      \
-	xglwindow.c    \
-	xglget.c       \
-	xglgc.c	       \
-	xglshm.c       \
-	xglcompose.c   \
-	xglpict.c      \
-	xglglyph.c     \
-	xgltrap.c      \
-	xglloader.c     \
-	xglhash.c      \
-	xglglx.c       \
-	xglxv.c
-
-EXTRA_DIST = \
-	xglmodule.h
-
-Xgl_LDFLAGS = -export-dynamic
-Xgl_SOURCES = \
-	xglinit.c \
-	$(top_srcdir)/mi/miinitext.c \
-	$(top_srcdir)/Xext/dpmsstubs.c \
-	$(top_srcdir)/Xi/stubs.c \
-	$(top_srcdir)/fb/fbcmap.c
-
-XGL_LIBS = \
-	libxgl.a \
-	@XGL_LIBS@ \
-	$(XSERVER_LIBS)
-
-Xgl_DEPENDENCIES = $(XGL_LIBS)
-Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS)
-Xgl_programs = Xgl
-
-bin_PROGRAMS = $(Xgl_programs)
diff --git a/hw/xgl/egl/Makefile.am b/hw/xgl/egl/Makefile.am
deleted file mode 100644
index 8c4e9af..0000000
--- a/hw/xgl/egl/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-if XGL
-XGL_MODULE_DIRS = module
-endif
-
-DIST_SUBDIRS = module
-
-SUBDIRS =		  \
-	.		  \
-	$(XGL_MODULE_DIRS)
-
-AM_CFLAGS = \
-	$(DIX_CFLAGS) \
-	-DHAVE_XGL_CONFIG_H \
-	-DHAVE_DIX_CONFIG_H \
-	$(XEGLMODULES_CFLAGS)
-
-noinst_LTLIBRARIES = libxegl.la
-
-libxegl_la_SOURCES = \
-	xegl.h	     \
-	xegl.c	     \
-	xeglinput.c  \
-	kkeymap.h    \
-	kinput.c     \
-	evdev.c
-
-XEGL_LIBS = \
-	@XEGL_LIBS@ \
-	libxegl.la \
-	../libxgl.a \
-	$XSERVER_LIBS
-
-Xegl_LDFLAGS	  = -export-dynamic
-Xegl_SOURCES	  = \
-	xeglinit.c \
-	$(top_srcdir)/mi/miinitext.c \
-	$(top_srcdir)/Xext/dpmsstubs.c \
-	$(top_srcdir)/Xi/stubs.c \
-	$(top_srcdir)/fb/fbcmap.c
-
-Xegl_DEPENDENCIES = $(XEGL_LIBS)
-Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS)
-
-bin_PROGRAMS = Xegl
diff --git a/hw/xgl/egl/evdev.c b/hw/xgl/egl/evdev.c
deleted file mode 100644
index fff4524..0000000
--- a/hw/xgl/egl/evdev.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Copyright © 2004 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <xgl-config.h>
-#define NEED_EVENTS
-#include <errno.h>
-#include <linux/input.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xpoll.h>
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "kkeymap.h"
-#include "scrnintstr.h"
-#include "xegl.h"
-
-#define NUM_EVENTS  128
-#define ABS_UNSET   -65535
-
-#define BITS_PER_LONG (sizeof(long) * 8)
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
-#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
-#define OFF(x)   ((x)%BITS_PER_LONG)
-#define LONG(x)  ((x)/BITS_PER_LONG)
-#define BIT(x)	 (1 << OFF(x))
-#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
-#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
-#define ASSIGNBIT(x,y,z)    ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
-
-typedef struct _kevdevMouse {
-    /* current device state */
-    int			    rel[REL_MAX + 1];
-    int			    abs[ABS_MAX + 1];
-    int			    prevabs[ABS_MAX + 1];
-    long		    key[NBITS(KEY_MAX + 1)];
-
-    /* supported device info */
-    long		    relbits[NBITS(REL_MAX + 1)];
-    long		    absbits[NBITS(ABS_MAX + 1)];
-    long		    keybits[NBITS(KEY_MAX + 1)];
-    struct input_absinfo    absinfo[ABS_MAX + 1];
-    int			    max_rel;
-    int			    max_abs;
-} Kevdev;
-
-static int flags = 0;
-
-static void
-EvdevMotion (KdMouseInfo    *mi)
-{
-    Kevdev		*ke = mi->driver;
-    int			i;
-
-    for (i = 0; i <= ke->max_rel; i++)
-	if (ke->rel[i])
-	{
-            KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]);
-	    int a;
-//	    ErrorF ("rel");
-	    for (a = 0; a <= ke->max_rel; a++)
-	    {
-//		if (ISBITSET (ke->relbits, a))
-//		    ErrorF (" %d=%d", a, ke->rel[a]);
-		ke->rel[a] = 0;
-	    }
-//	    ErrorF ("\n");
-	    break;
-	}
-    for (i = 0; i < ke->max_abs; i++)
-	if (ke->abs[i] != ke->prevabs[i])
-	{
-            KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]);
-	    int a;
-//	    ErrorF ("abs");
-	    for (a = 0; a <= ke->max_abs; a++)
-	    {
-//		if (ISBITSET (ke->absbits, a))
-//		    ErrorF (" %d=%d", a, ke->abs[a]);
-		ke->prevabs[a] = ke->abs[a];
-	    }
-//	    ErrorF ("\n");
-	    break;
-	}
-}
-
-static void
-EvdevRead (int evdevPort, void *closure)
-{
-    KdMouseInfo		*mi = closure;
-    Kevdev		*ke = mi->driver;
-    int			i, n;
-    struct input_event	events[NUM_EVENTS];
-
-    n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
-    if (n <= 0)
-	return;
-    n /= sizeof (struct input_event);
-    for (i = 0; i < n; i++)
-    {
-	switch (events[i].type) {
-	case EV_SYN:
-	    break;
-	case EV_KEY:
-	    EvdevMotion (mi);
-	    ASSIGNBIT(ke->key,events[i].code, events[i].value);
-	    if (events[i].code < 0x100)
-		ErrorF ("key %d %d\n", events[i].code, events[i].value);
-	    else
-		ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
-	    
-	    if (events[i].value==1) {
-	      switch (events[i].code) {
-	      case BTN_LEFT:
-                flags |= KD_BUTTON_1;
-                break;
-	      case BTN_RIGHT:
-		flags |= KD_BUTTON_3;
-                break;
-	      case BTN_MIDDLE:
-                flags |= KD_BUTTON_2;
-                break;
-	      case BTN_FORWARD:
-                flags |= KD_BUTTON_4;
-                break;
-	      case BTN_BACK:
-                flags |= KD_BUTTON_5;
-                break;
-	      }
-	    }
-	    else if (events[i].value==0) {
-	      switch (events[i].code) {
-	      case BTN_LEFT:
-                flags &= ~KD_BUTTON_1;
-                break;
-	      case BTN_RIGHT:
-		flags &= ~KD_BUTTON_3;
-                break;
-	      case BTN_MIDDLE:
-                flags &= ~KD_BUTTON_2;
-                break;
-	      case BTN_FORWARD:
-                flags &= ~KD_BUTTON_4;
-                break;
-	      case BTN_BACK:
-                flags &= ~KD_BUTTON_5;
-                break;
-	      }
-	    }
-	    KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0);
-	    break;
-	case EV_REL:
-	    ke->rel[events[i].code] += events[i].value;
-	    break;
-	case EV_ABS:
-	    ke->abs[events[i].code] = events[i].value;
-	    break;
-	}
-    }
-    EvdevMotion (mi);
-}
-
-int EvdevInputType;
-
-char *kdefaultEvdev[] =  {
-  //    "/dev/input/event0",
-    "/dev/input/event1",
-    //   "/dev/input/event2",
-    // "/dev/input/event3",
-    //    "/dev/input/event4",
-    //   "/dev/input/event5",
-};
-
-#define NUM_DEFAULT_EVDEV    (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
-
-static Bool
-EvdevInit (void)
-{
-    int		i;
-    int		fd;
-    KdMouseInfo	*mi, *next;
-    int		n = 0;
-    char	*prot;
-    char        name[100];
-
-    if (!EvdevInputType)
-	EvdevInputType = KdAllocInputType ();
-
-    for (mi = kdMouseInfo; mi; mi = next)
-    {
-	next = mi->next;
-	prot = mi->prot;
-	if (mi->inputType)
-	    continue;
-	if (!mi->name)
-	{
-	    for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
-	    {
-		fd = open (kdefaultEvdev[i], 2);
-		if (fd >= 0)
-		{
-                    ioctl(fd, EVIOCGRAB, 1);
-
-                    ioctl(fd, EVIOCGNAME(sizeof(name)), name);
-                    ErrorF("Name is %s\n", name);
-                    ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
-                    ErrorF("Phys Loc is %s\n", name);
-                    ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
-                    ErrorF("Unique is %s\n", name);
-
-		    mi->name = KdSaveString (kdefaultEvdev[i]);
-		    break;
-		}
-	    }
-	}
-	else
-	    fd = open (mi->name, 2);
-
-	if (fd >= 0)
-	{
-	    unsigned long   ev[NBITS(EV_MAX)];
-	    Kevdev	    *ke;
-
- 	    if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
-	    {
-		perror ("EVIOCGBIT 0");
-		close (fd);
-		continue;
-	    }
-	    ke = xalloc (sizeof (Kevdev));
-	    if (!ke)
-	    {
-		close (fd);
-		continue;
-	    }
-	    memset (ke, '\0', sizeof (Kevdev));
-	    if (ISBITSET (ev, EV_KEY))
-	    {
-		if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
-			   ke->keybits) < 0)
-		{
-		    perror ("EVIOCGBIT EV_KEY");
-		    xfree (ke);
-		    close (fd);
-		    continue;
-		}
-	    }
-	    if (ISBITSET (ev, EV_REL))
-	    {
-		if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
-			   ke->relbits) < 0)
-		{
-		    perror ("EVIOCGBIT EV_REL");
-		    xfree (ke);
-		    close (fd);
-		    continue;
-		}
-		for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
-		    if (ISBITSET(ke->relbits, ke->max_rel))
-			break;
-	    }
-	    if (ISBITSET (ev, EV_ABS))
-	    {
-		int i;
-
-		if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
-			   ke->absbits) < 0)
-		{
-		    perror ("EVIOCGBIT EV_ABS");
-		    xfree (ke);
-		    close (fd);
-		    continue;
-		}
-		for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
-		    if (ISBITSET(ke->absbits, ke->max_abs))
-			break;
-		for (i = 0; i <= ke->max_abs; i++)
-		{
-		    if (ISBITSET (ke->absbits, i))
-			if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
-			{
-			    perror ("EVIOCGABS");
-			    break;
-			}
-		    ke->prevabs[i] = ABS_UNSET;
-		}
-		if (i <= ke->max_abs)
-		{
-		    xfree (ke);
-		    close (fd);
-		    continue;
-		}
-	    }
-	    mi->driver = ke;
-	    mi->inputType = EvdevInputType;
-	    if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
-		n++;
-	}
-    }
-    return TRUE;
-}
-
-static void
-EvdevFini (void)
-{
-    KdMouseInfo	*mi;
-
-    KdUnregisterFds (EvdevInputType, TRUE);
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-    {
-	if (mi->inputType == EvdevInputType)
-	{
-	    xfree (mi->driver);
-	    mi->driver = 0;
-	    mi->inputType = 0;
-	}
-    }
-}
-
-KdMouseFuncs LinuxEvdevMouseFuncs = {
-    EvdevInit,
-    EvdevFini,
-};
-
-
-KeySym evdevKeymap[(112 - 1 + 1) * 2] = {
-/* These are directly mapped from DOS scanset 0 */
-/*      1     8 */       XK_Escape, NoSymbol,
-/*      2     9 */       XK_1,  XK_exclam,
-/*      3    10 */       XK_2,  XK_at,
-/*      4    11 */       XK_3,  XK_numbersign,
-/*      5    12 */       XK_4,  XK_dollar,
-/*      6    13 */       XK_5,  XK_percent,
-/*      7    14 */       XK_6,  XK_asciicircum,
-/*      8    15 */       XK_7,  XK_ampersand,
-/*      9    16 */       XK_8,  XK_asterisk,
-/*     10    17 */       XK_9,  XK_parenleft,
-/*     11    18 */       XK_0,  XK_parenright,
-/*     12    19 */       XK_minus,      XK_underscore,
-/*     13    20 */       XK_equal,      XK_plus,
-/*     14    21 */       XK_BackSpace,  NoSymbol,
-/*     15    22 */       XK_Tab,        NoSymbol,
-/*     16    23 */       XK_Q,  NoSymbol,
-/*     17    24 */       XK_W,  NoSymbol,
-/*     18    25 */       XK_E,  NoSymbol,
-/*     19    26 */       XK_R,  NoSymbol,
-/*     20    27 */       XK_T,  NoSymbol,
-/*     21    28 */       XK_Y,  NoSymbol,
-/*     22    29 */       XK_U,  NoSymbol,
-/*     23    30 */       XK_I,  NoSymbol,
-/*     24    31 */       XK_O,  NoSymbol,
-/*     25    32 */       XK_P,  NoSymbol,
-/*     26    33 */       XK_bracketleft,        XK_braceleft,
-/*     27    34 */       XK_bracketright,       XK_braceright,
-/*     28    35 */       XK_Return,     NoSymbol,
-/*     29    36 */       XK_Control_L,  NoSymbol,
-/*     30    37 */       XK_A,  NoSymbol,
-/*     31    38 */       XK_S,  NoSymbol,
-/*     32    39 */       XK_D,  NoSymbol,
-/*     33    40 */       XK_F,  NoSymbol,
-/*     34    41 */       XK_G,  NoSymbol,
-/*     35    42 */       XK_H,  NoSymbol,
-/*     36    43 */       XK_J,  NoSymbol,
-/*     37    44 */       XK_K,  NoSymbol,
-/*     38    45 */       XK_L,  NoSymbol,
-/*     39    46 */       XK_semicolon,  XK_colon,
-/*     40    47 */       XK_apostrophe, XK_quotedbl,
-/*     41    48 */       XK_grave,      XK_asciitilde,
-/*     42    49 */       XK_Shift_L,    NoSymbol,
-/*     43    50 */       XK_backslash,  XK_bar,
-/*     44    51 */       XK_Z,  NoSymbol,
-/*     45    52 */       XK_X,  NoSymbol,
-/*     46    53 */       XK_C,  NoSymbol,
-/*     47    54 */       XK_V,  NoSymbol,
-/*     48    55 */       XK_B,  NoSymbol,
-/*     49    56 */       XK_N,  NoSymbol,
-/*     50    57 */       XK_M,  NoSymbol,
-/*     51    58 */       XK_comma,      XK_less,
-/*     52    59 */       XK_period,     XK_greater,
-/*     53    60 */       XK_slash,      XK_question,
-/*     54    61 */       XK_Shift_R,    NoSymbol,
-/*     55    62 */       XK_KP_Multiply,        NoSymbol,
-/*     56    63 */       XK_Alt_L,      XK_Meta_L,
-/*     57    64 */       XK_space,      NoSymbol,
-/*     58    65 */       XK_Caps_Lock,  NoSymbol,
-/*     59    66 */       XK_F1, NoSymbol,
-/*     60    67 */       XK_F2, NoSymbol,
-/*     61    68 */       XK_F3, NoSymbol,
-/*     62    69 */       XK_F4, NoSymbol,
-/*     63    70 */       XK_F5, NoSymbol,
-/*     64    71 */       XK_F6, NoSymbol,
-/*     65    72 */       XK_F7, NoSymbol,
-/*     66    73 */       XK_F8, NoSymbol,
-/*     67    74 */       XK_F9, NoSymbol,
-/*     68    75 */       XK_F10,        NoSymbol,
-/*     69    76 */       XK_Break,      XK_Pause,
-/*     70    77 */       XK_Scroll_Lock,        NoSymbol,
-/*     71    78 */       XK_KP_Home,    XK_KP_7,
-/*     72    79 */       XK_KP_Up,      XK_KP_8,
-/*     73    80 */       XK_KP_Page_Up, XK_KP_9,
-/*     74    81 */       XK_KP_Subtract,        NoSymbol,
-/*     75    82 */       XK_KP_Left,    XK_KP_4,
-/*     76    83 */       XK_KP_5,       NoSymbol,
-/*     77    84 */       XK_KP_Right,   XK_KP_6,
-/*     78    85 */       XK_KP_Add,     NoSymbol,
-/*     79    86 */       XK_KP_End,     XK_KP_1,
-/*     80    87 */       XK_KP_Down,    XK_KP_2,
-/*     81    88 */       XK_KP_Page_Down,       XK_KP_3,
-/*     82    89 */       XK_KP_Insert,  XK_KP_0,
-/*     83    90 */       XK_KP_Delete,  XK_KP_Decimal,
-/*     84    91 */     NoSymbol,        NoSymbol,
-/*     85    92 */     NoSymbol,        NoSymbol,
-/*     86    93 */     NoSymbol,        NoSymbol,
-/*     87    94 */       XK_F11,        NoSymbol,
-/*     88    95 */       XK_F12,        NoSymbol,
-
-/* These are remapped from the extended set (using ExtendMap) */
-
-/*     89    96 */       XK_Control_R,  NoSymbol,
-/*     90    97 */       XK_KP_Enter,   NoSymbol,
-/*     91    98 */       XK_KP_Divide,  NoSymbol,
-/*     92    99 */       XK_Sys_Req,    XK_Print,
-/*     93   100 */       XK_Alt_R,      XK_Meta_R,
-/*     94   101 */       XK_Num_Lock,   NoSymbol,
-/*     95   102 */       XK_Home,       NoSymbol,
-/*     96   103 */       XK_Up,         NoSymbol,
-/*     97   104 */       XK_Page_Up,    NoSymbol,
-/*     98   105 */       XK_Left,       NoSymbol,
-/*     99   106 */       XK_Right,      NoSymbol,
-/*    100   107 */       XK_End,        NoSymbol,
-/*    101   108 */       XK_Down,       NoSymbol,
-/*    102   109 */       XK_Page_Down,  NoSymbol,
-/*    103   110 */       XK_Insert,     NoSymbol,
-/*    104   111 */       XK_Delete,     NoSymbol,
-/*    105   112 */       XK_Super_L,    NoSymbol,
-/*    106   113 */       XK_Super_R,    NoSymbol,
-/*    107   114 */       XK_Menu,       NoSymbol,
-/*    108   115 */       NoSymbol,      NoSymbol,
-/*    109   116 */       NoSymbol,      NoSymbol,
-/*    110   117 */       NoSymbol,      NoSymbol,
-/*    111   118 */       NoSymbol,      NoSymbol,
-/*    112   119 */       NoSymbol,      NoSymbol,
-};
-
-static void
-EvdevRead1 (int evdevPort, void *closure)
-{
-    int i, n, xk;
-    struct input_event  events[NUM_EVENTS];
-
-    n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
-    if (n <= 0)
-        return;
-    n /= sizeof (struct input_event);
-    for (i = 0; i < n; i++)
-    {
-        switch (events[i].type) {
-        case EV_SYN:
-            break;
-        case EV_KEY:
-            xk = events[i].code;
-            if (events[i].code < 0x100)
-                ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk);
-            else
-                ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk);
-            if (events[i].value == 2) {
-                //KdEnqueueKeyboardEvent (xk, 0);
-                KdEnqueueKeyboardEvent (xk, 0);
-            } else
-                KdEnqueueKeyboardEvent (xk, !events[i].value);
-            break;
-        }
-    }
-}
-
-char *kdefaultEvdev1[] =  {
-    "/dev/input/event0",
-    //    "/dev/input/event1",
-    //    "/dev/input/event2",
-    //    "/dev/input/event3",
-    //    "/dev/input/event4",
-    //    "/dev/input/event5",
-};
-
-#define NUM_DEFAULT_EVDEV1    (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0]))
-
-static Bool
-EvdevKbdInit (void)
-{
-    int         i;
-    int         fd;
-    int         n = 0;
-    char        name[100];
-
-    if (!EvdevInputType)
-        EvdevInputType = KdAllocInputType ();
-
-    for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
-    {
-        fd = open (kdefaultEvdev1[i], 2);
-        if (fd >= 0)
-        {
-            ioctl(fd, EVIOCGRAB, 1);
-
-            ioctl(fd, EVIOCGNAME(sizeof(name)), name);
-            ErrorF("Name is %s\n", name);
-            ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
-            ErrorF("Phys Loc is %s\n", name);
-            ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
-            ErrorF("Unique is %s\n", name);
-
-        }
-
-        if (fd >= 0)
-        {
-            unsigned long   ev[NBITS(EV_MAX)];
-            Kevdev          *ke;
-
-            if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
-            {
-                perror ("EVIOCGBIT 0");
-                close (fd);
-                continue;
-            }
-            ke = xalloc (sizeof (Kevdev));
-            if (!ke)
-            {
-                close (fd);
-                continue;
-            }
-            memset (ke, '\0', sizeof (Kevdev));
-            if (ISBITSET (ev, EV_KEY))
-            {
-                if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
-                           ke->keybits) < 0)
-                {
-                    perror ("EVIOCGBIT EV_KEY");
-                    xfree (ke);
-                    close (fd);
-                    continue;
-                }
-            }
-            if (ISBITSET (ev, EV_REL))
-            {
-                if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
-                           ke->relbits) < 0)
-                {
-                    perror ("EVIOCGBIT EV_REL");
-                    xfree (ke);
-                    close (fd);
-                    continue;
-                }
-                for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
-                    if (ISBITSET(ke->relbits, ke->max_rel))
-                        break;
-            }
-            if (ISBITSET (ev, EV_ABS))
-            {
-                int i;
-
-                if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
-                           ke->absbits) < 0)
-                {
-                    perror ("EVIOCGBIT EV_ABS");
-                    xfree (ke);
-                    close (fd);
-                    continue;
-                }
-                for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
-                    if (ISBITSET(ke->absbits, ke->max_abs))
-                        break;
-                for (i = 0; i <= ke->max_abs; i++)
-                {
-                    if (ISBITSET (ke->absbits, i))
-                        if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
-                        {
-                            perror ("EVIOCGABS");
-                            break;
-                        }
-                    ke->prevabs[i] = ABS_UNSET;
-                }
-                if (i <= ke->max_abs)
-                {
-                    xfree (ke);
-                    close (fd);
-                    continue;
-                }
-            }
-            if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL))
-                n++;
-        }
-    }
-    return TRUE;
-}
-
-static void EvdevKbdLoad(void)
-{
-    kdMinScanCode = 1;
-    kdMaxScanCode = 112;
-    kdKeymapWidth = 2;
-    memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap));
-}
-
-static void
-EvdevKbdFini (void)
-{
-}
-
-static void
-EvdevKbdLeds (int leds)
-{
-}
-
-
-static void EvdevKbdBell(int volume, int pitch, int duration)
-{
-}
-
-
-KdKeyboardFuncs LinuxEvdevKeyboardFuncs = {
-    EvdevKbdLoad,
-    EvdevKbdInit,
-    EvdevKbdLeds,
-    EvdevKbdBell,
-    EvdevKbdFini,
-    0,
-};
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
deleted file mode 100644
index 6c1018c..0000000
--- a/hw/xgl/egl/kinput.c
+++ /dev/null
@@ -1,1670 +0,0 @@
-/*
- * Copyright  1999 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <xgl-config.h>
-
-#include <signal.h>
-#include <stdio.h>
-
-#include "xegl.h"
-#include "mipointer.h"
-#include "inputstr.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-#include "kkeymap.h"
-
-#ifdef XKB
-#define XKB_IN_SERVER
-#include <xkbsrv.h>
-#endif
-
-static DeviceIntPtr	pKdKeyboard, pKdPointer;
-
-#define MAX_MOUSE_DRIVERS   6
-
-static KdMouseFuncs	*kdMouseFuncs[MAX_MOUSE_DRIVERS];
-static int		kdNMouseFuncs;
-static KdKeyboardFuncs	*kdKeyboardFuncs;
-static int		kdBellPitch;
-static int		kdBellDuration;
-static int		kdLeds;
-static Bool		kdInputEnabled;
-static Bool		kdOffScreen;
-static unsigned long	kdOffScreenTime;
-static KdMouseMatrix	kdMouseMatrix = {
-   { { 1, 0, 0 },
-     { 0, 1, 0 } }
-};
-
-int		kdMouseButtonCount;
-int		kdMinScanCode;
-int		kdMaxScanCode;
-int		kdMinKeyCode;
-int		kdMaxKeyCode;
-int		kdKeymapWidth = KD_MAX_WIDTH;
-KeySym		kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-CARD8		kdModMap[MAP_LENGTH];
-KeySymsRec	kdKeySyms;
-
-
-void
-KdResetInputMachine (void);
-
-#define KD_KEY_COUNT		248
-
-CARD8		kdKeyState[KD_KEY_COUNT/8];
-
-#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
-
-#define KD_MAX_INPUT_FDS    8
-
-typedef struct _kdInputFd {
-    int	    type;
-    int	    fd;
-    void    (*read) (int fd, void *closure);
-    int	    (*enable) (int fd, void *closure);
-    void    (*disable) (int fd, void *closure);
-    void    *closure;
-} KdInputFd;
-
-KdInputFd    	kdInputFds[KD_MAX_INPUT_FDS];
-int		kdNumInputFds;
-int		kdInputTypeSequence;
-
-static void
-KdSigio (int sig)
-{
-    int	i;
-
-    for (i = 0; i < kdNumInputFds; i++)
-	(*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
-}
-
-static void
-KdBlockSigio (void)
-{
-    sigset_t	set;
-
-    sigemptyset (&set);
-    sigaddset (&set, SIGIO);
-    sigprocmask (SIG_BLOCK, &set, 0);
-}
-
-static void
-KdUnblockSigio (void)
-{
-    sigset_t	set;
-
-    sigemptyset (&set);
-    sigaddset (&set, SIGIO);
-    sigprocmask (SIG_UNBLOCK, &set, 0);
-}
-
-#undef VERIFY_SIGIO
-#ifdef VERIFY_SIGIO
-
-void
-KdAssertSigioBlocked (char *where)
-{
-    sigset_t	set, old;
-
-    sigemptyset (&set);
-    sigprocmask (SIG_BLOCK, &set, &old);
-    if (!sigismember (&old, SIGIO))
-	ErrorF ("SIGIO not blocked at %s\n", where);
-}
-
-#else
-
-#define KdAssertSigioBlocked(s)
-
-#endif
-
-static int  kdnFds;
-
-#ifdef FNONBLOCK
-#define NOBLOCK FNONBLOCK
-#else
-#define NOBLOCK FNDELAY
-#endif
-
-static void
-KdNonBlockFd (int fd)
-{
-    int	flags;
-    flags = fcntl (fd, F_GETFL);
-    flags |= FASYNC|NOBLOCK;
-    fcntl (fd, F_SETFL, flags);
-}
-
-static void
-KdAddFd (int fd)
-{
-    struct sigaction	act;
-    sigset_t		set;
-
-    kdnFds++;
-    fcntl (fd, F_SETOWN, getpid());
-    KdNonBlockFd (fd);
-    AddEnabledDevice (fd);
-    memset (&act, '\0', sizeof act);
-    act.sa_handler = KdSigio;
-    sigemptyset (&act.sa_mask);
-    sigaddset (&act.sa_mask, SIGIO);
-    sigaddset (&act.sa_mask, SIGALRM);
-    sigaddset (&act.sa_mask, SIGVTALRM);
-    sigaction (SIGIO, &act, 0);
-    sigemptyset (&set);
-    sigprocmask (SIG_SETMASK, &set, 0);
-}
-
-static void
-KdRemoveFd (int fd)
-{
-    struct sigaction	act;
-    int			flags;
-
-    kdnFds--;
-    RemoveEnabledDevice (fd);
-    flags = fcntl (fd, F_GETFL);
-    flags &= ~(FASYNC|NOBLOCK);
-    fcntl (fd, F_SETFL, flags);
-    if (kdnFds == 0)
-    {
-	memset (&act, '\0', sizeof act);
-	act.sa_handler = SIG_IGN;
-	sigemptyset (&act.sa_mask);
-	sigaction (SIGIO, &act, 0);
-    }
-}
-
-int
-KdAllocInputType (void)
-{
-    return ++kdInputTypeSequence;
-}
-
-Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
-{
-    if (kdNumInputFds == KD_MAX_INPUT_FDS)
-	return FALSE;
-    kdInputFds[kdNumInputFds].type = type;
-    kdInputFds[kdNumInputFds].fd = fd;
-    kdInputFds[kdNumInputFds].read = read;
-    kdInputFds[kdNumInputFds].enable = 0;
-    kdInputFds[kdNumInputFds].disable = 0;
-    kdInputFds[kdNumInputFds].closure = closure;
-    ++kdNumInputFds;
-    if (kdInputEnabled)
-	KdAddFd (fd);
-    return TRUE;
-}
-
-void
-KdRegisterFdEnableDisable (int fd,
-			   int (*enable) (int fd, void *closure),
-			   void (*disable) (int fd, void *closure))
-{
-    int	i;
-
-    for (i = 0; i < kdNumInputFds; i++)
-	if (kdInputFds[i].fd == fd)
-	{
-	    kdInputFds[i].enable = enable;
-	    kdInputFds[i].disable = disable;
-	    break;
-	}
-}
-
-void
-KdUnregisterFds (int type, Bool do_close)
-{
-    int	i, j;
-
-    for (i = 0; i < kdNumInputFds;)
-    {
-	if (kdInputFds[i].type == type)
-	{
-	    if (kdInputEnabled)
-		KdRemoveFd (kdInputFds[i].fd);
-	    if (do_close)
-		close (kdInputFds[i].fd);
-	    --kdNumInputFds;
-	    for (j = i; j < kdNumInputFds; j++)
-		kdInputFds[j] = kdInputFds[j+1];
-	}
-	else
-	    i++;
-    }
-}
-
-static void
-KdDisableInput (void)
-{
-    int	i;
-
-    KdBlockSigio ();
-
-    for (i = 0; i < kdNumInputFds; i++)
-    {
-	KdRemoveFd (kdInputFds[i].fd);
-	if (kdInputFds[i].disable)
-	    (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
-    }
-    kdInputEnabled = FALSE;
-}
-
-static void
-KdEnableInput (void)
-{
-    xEvent	xE;
-    int	i;
-
-    kdInputEnabled = TRUE;
-    for (i = 0; i < kdNumInputFds; i++)
-    {
-	KdNonBlockFd (kdInputFds[i].fd);
-	if (kdInputFds[i].enable)
-	    kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
-	KdAddFd (kdInputFds[i].fd);
-    }
-
-    /* reset screen saver */
-    xE.u.keyButtonPointer.time = GetTimeInMillis ();
-    NoticeEventTime (&xE);
-
-    KdUnblockSigio ();
-}
-
-static int
-KdMouseProc(DeviceIntPtr pDevice, int onoff)
-{
-    BYTE	map[KD_MAX_BUTTON];
-    DevicePtr	pDev = (DevicePtr)pDevice;
-    int		i;
-
-    if (!pDev)
-	return BadImplementation;
-
-    switch (onoff)
-    {
-    case DEVICE_INIT:
-	for (i = 1; i <= kdMouseButtonCount; i++)
-	    map[i] = i;
-	InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
-	    miPointerGetMotionEvents,
-	    (PtrCtrlProcPtr)NoopDDA,
-	    miPointerGetMotionBufferSize());
-	break;
-
-    case DEVICE_ON:
-	pDev->on = TRUE;
-	pKdPointer = pDevice;
-	for (i = 0; i < kdNMouseFuncs; i++)
-	    (*kdMouseFuncs[i]->Init)();
-	break;
-    case DEVICE_OFF:
-    case DEVICE_CLOSE:
-	if (pDev->on)
-	{
-	    pDev->on = FALSE;
-	    pKdPointer = 0;
-	    for (i = 0; i < kdNMouseFuncs; i++)
-		(*kdMouseFuncs[i]->Fini) ();
-	}
-	break;
-    }
-    return Success;
-}
-
-Bool
-KdLegalModifier(unsigned int key, DevicePtr pDev)
-{
-    return TRUE;
-}
-
-static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
-{
-    if (kdInputEnabled)
-	(*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
-}
-
-
-static void
-KdSetLeds (void)
-{
-    if (kdInputEnabled)
-	(*kdKeyboardFuncs->Leds) (kdLeds);
-}
-
-static void
-KdSetLed (int led, Bool on)
-{
-    NoteLedState (pKdKeyboard, led, on);
-    kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
-    KdSetLeds ();
-}
-
-static void
-KdSetMouseMatrix (KdMouseMatrix *matrix)
-{
-    kdMouseMatrix = *matrix;
-}
-
-static void
-KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
-{
-    int		    x_dir = 1, y_dir = 1;
-    int		    i, j;
-    int		    size[2];
-
-    size[0] = width; size[1] = height;
-    if (randr & RR_Reflect_X)
-	x_dir = -1;
-    if (randr & RR_Reflect_Y)
-	y_dir = -1;
-    switch (randr & (RR_Rotate_All)) {
-    case RR_Rotate_0:
-	m->matrix[0][0] = x_dir; m->matrix[0][1] = 0;
-	m->matrix[1][0] = 0; m->matrix[1][1] = y_dir;
-	break;
-    case RR_Rotate_90:
-	m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir;
-	m->matrix[1][0] = y_dir; m->matrix[1][1] = 0;
-	break;
-    case RR_Rotate_180:
-	m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0;
-	m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir;
-	break;
-    case RR_Rotate_270:
-	m->matrix[0][0] = 0; m->matrix[0][1] = x_dir;
-	m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0;
-	break;
-    }
-    for (i = 0; i < 2; i++)
-    {
-	m->matrix[i][2] = 0;
-	for (j = 0 ; j < 2; j++)
-	    if (m->matrix[i][j] < 0)
-		m->matrix[i][2] = size[j] - 1;
-    }
-}
-
-static void
-KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
-{
-    kdLeds = ctrl->leds;
-    kdBellPitch = ctrl->bell_pitch;
-    kdBellDuration = ctrl->bell_duration;
-    KdSetLeds ();
-}
-
-static int
-KdKeybdProc(DeviceIntPtr pDevice, int onoff)
-{
-    Bool        ret;
-    DevicePtr   pDev = (DevicePtr)pDevice;
-#ifdef XKB
-    XkbComponentNamesRec names;
-#endif
-
-    if (!pDev)
-	return BadImplementation;
-
-    switch (onoff)
-    {
-    case DEVICE_INIT:
-	if (pDev != (DevicePtr)inputInfo.keyboard)
-	{
-	    return !Success;
-	}
-#ifndef XKB
-	ret = InitKeyboardDeviceStruct(pDev,
-				       &kdKeySyms,
-				       kdModMap,
-				       KdBell, KdKbdCtrl);
-#else
-	memset(&names, 0, sizeof(XkbComponentNamesRec));
-
-	XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL);
-	ret = XkbInitKeyboardDeviceStruct (pDev,
-					   &names,
-					   &kdKeySyms,
-					   kdModMap,
-					   KdBell, KdKbdCtrl);
-#endif
-	if (!ret)
-	    return BadImplementation;
-	break;
-    case DEVICE_ON:
-	pDev->on = TRUE;
-	pKdKeyboard = pDevice;
-	if (kdKeyboardFuncs)
-	    (*kdKeyboardFuncs->Init) ();
-	break;
-    case DEVICE_OFF:
-    case DEVICE_CLOSE:
-	pKdKeyboard = 0;
-	if (pDev->on)
-	{
-	    pDev->on = FALSE;
-	    if (kdKeyboardFuncs)
-		(*kdKeyboardFuncs->Fini) ();
-	}
-	break;
-    }
-    return Success;
-}
-
-extern KeybdCtrl defaultKeyboardControl;
-
-static void
-KdInitAutoRepeats (void)
-{
-    int		    key_code;
-    unsigned char   mask;
-    int		    i;
-    unsigned char   *repeats;
-
-    repeats = defaultKeyboardControl.autoRepeats;
-    memset (repeats, '\0', 32);
-    for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
-    {
-	if (!kdModMap[key_code])
-	{
-	    i = key_code >> 3;
-	    mask = 1 << (key_code & 7);
-	    repeats[i] |= mask;
-	}
-    }
-}
-
-const KdKeySymModsRec kdKeySymMods[] = {
-  {  XK_Control_L,	ControlMask },
-  {  XK_Control_R, ControlMask },
-  {  XK_Shift_L,	ShiftMask },
-  {  XK_Shift_R,	ShiftMask },
-  {  XK_Caps_Lock,	LockMask },
-  {  XK_Shift_Lock, LockMask },
-  {  XK_Alt_L,	Mod1Mask },
-  {  XK_Alt_R,	Mod1Mask },
-  {  XK_Meta_L,	Mod1Mask },
-  {  XK_Meta_R,	Mod1Mask },
-  {  XK_Num_Lock,	Mod2Mask },
-  {  XK_Super_L,	Mod3Mask },
-  {  XK_Super_R,	Mod3Mask },
-  {  XK_Hyper_L,	Mod3Mask },
-  {  XK_Hyper_R,	Mod3Mask },
-  {  XK_Mode_switch, Mod4Mask },
-#ifdef TOUCHSCREEN
-  /* PDA specific hacks */
-#ifdef XF86XK_Start
-  {  XF86XK_Start, ControlMask },
-#endif
-  {  XK_Menu, ShiftMask },
-  {  XK_telephone, Mod1Mask },
-#ifdef XF86XK_AudioRecord
-  {  XF86XK_AudioRecord, Mod2Mask },
-#endif
-#ifdef XF86XK_Calendar
-  {  XF86XK_Calendar, Mod3Mask }
-#endif
-#endif
-};
-
-#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
-
-static void
-KdInitModMap (void)
-{
-    int	    key_code;
-    int	    row;
-    int	    width;
-    KeySym  *syms;
-    int	    i;
-
-    width = kdKeySyms.mapWidth;
-    for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
-    {
-	kdModMap[key_code] = 0;
-	syms = kdKeymap + (key_code - kdMinKeyCode) * width;
-	for (row = 0; row < width; row++, syms++)
-	{
-	    for (i = 0; i < NUM_SYM_MODS; i++)
-	    {
-		if (*syms == kdKeySymMods[i].modsym)
-		    kdModMap[key_code] |= kdKeySymMods[i].modbit;
-	    }
-	}
-    }
-}
-
-static void
-KdAddMouseDriver(KdMouseFuncs *pMouseFuncs)
-{
-    if (kdNMouseFuncs < MAX_MOUSE_DRIVERS)
-	kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs;
-}
-
-void
-eglInitInput(KdMouseFuncs    *pMouseFuncs,
-	    KdKeyboardFuncs *pKeyboardFuncs)
-{
-    DeviceIntPtr	pKeyboard, pPointer;
-    KdMouseInfo		*mi;
-
-    if (!kdMouseInfo)
-	KdParseMouse (0);
-    kdMouseButtonCount = 0;
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-    {
-	if (mi->nbutton > kdMouseButtonCount)
-	    kdMouseButtonCount = mi->nbutton;
-    }
-
-    kdNMouseFuncs = 0;
-    KdAddMouseDriver (pMouseFuncs);
-    kdKeyboardFuncs = pKeyboardFuncs;
-    memset (kdKeyState, '\0', sizeof (kdKeyState));
-    if (kdKeyboardFuncs)
-	(*kdKeyboardFuncs->Load) ();
-    kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
-    kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
-    kdKeySyms.map = kdKeymap;
-    kdKeySyms.minKeyCode = kdMinKeyCode;
-    kdKeySyms.maxKeyCode = kdMaxKeyCode;
-    kdKeySyms.mapWidth = kdKeymapWidth;
-    kdLeds = 0;
-    kdBellPitch = 1000;
-    kdBellDuration = 200;
-    kdInputEnabled = TRUE;
-    KdInitModMap ();
-    KdInitAutoRepeats ();
-    KdResetInputMachine ();
-    pPointer  = AddInputDevice(KdMouseProc, TRUE);
-    pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
-    RegisterPointerDevice(pPointer);
-    RegisterKeyboardDevice(pKeyboard);
-    miRegisterPointerDevice(screenInfo.screens[0], pPointer);
-    mieqInit(&pKeyboard->public, &pPointer->public);
-    {
-	static long zero1, zero2;
-
-	//SetExtInputCheck (&zero1, &zero2);
-	ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
-	       __LINE__, __FILE__);
-    }
-}
-
-/*
- * Middle button emulation state machine
- *
- *  Possible transitions:
- *	Button 1 press	    v1
- *	Button 1 release    ^1
- *	Button 2 press	    v2
- *	Button 2 release    ^2
- *	Button 3 press	    v3
- *	Button 3 release    ^3
- *	Button other press  vo
- *	Button other release ^o
- *	Mouse motion	    <>
- *	Keyboard event	    k
- *	timeout		    ...
- *	outside box	    <->
- *
- *  States:
- *	start
- *	button_1_pend
- *	button_1_down
- *	button_2_down
- *	button_3_pend
- *	button_3_down
- *	synthetic_2_down_13
- *	synthetic_2_down_3
- *	synthetic_2_down_1
- *
- *  Transition diagram
- *
- *  start
- *	v1  -> (hold) (settimeout) button_1_pend
- *	^1  -> (deliver) start
- *	v2  -> (deliver) button_2_down
- *	^2  -> (deliever) start
- *	v3  -> (hold) (settimeout) button_3_pend
- *	^3  -> (deliver) start
- *	vo  -> (deliver) start
- *	^o  -> (deliver) start
- *	<>  -> (deliver) start
- *	k   -> (deliver) start
- *
- *  button_1_pend	(button 1 is down, timeout pending)
- *	^1  -> (release) (deliver) start
- *	v2  -> (release) (deliver) button_1_down
- *	^2  -> (release) (deliver) button_1_down
- *	v3  -> (cleartimeout) (generate v2) synthetic_2_down_13
- *	^3  -> (release) (deliver) button_1_down
- *	vo  -> (release) (deliver) button_1_down
- *	^o  -> (release) (deliver) button_1_down
- *	<-> -> (release) (deliver) button_1_down
- *	<>  -> (deliver) button_1_pend
- *	k   -> (release) (deliver) button_1_down
- *	... -> (release) button_1_down
- *
- *  button_1_down	(button 1 is down)
- *	^1  -> (deliver) start
- *	v2  -> (deliver) button_1_down
- *	^2  -> (deliver) button_1_down
- *	v3  -> (deliver) button_1_down
- *	^3  -> (deliver) button_1_down
- *	vo  -> (deliver) button_1_down
- *	^o  -> (deliver) button_1_down
- *	<>  -> (deliver) button_1_down
- *	k   -> (deliver) button_1_down
- *
- *  button_2_down	(button 2 is down)
- *	v1  -> (deliver) button_2_down
- *	^1  -> (deliver) button_2_down
- *	^2  -> (deliver) start
- *	v3  -> (deliver) button_2_down
- *	^3  -> (deliver) button_2_down
- *	vo  -> (deliver) button_2_down
- *	^o  -> (deliver) button_2_down
- *	<>  -> (deliver) button_2_down
- *	k   -> (deliver) button_2_down
- *
- *  button_3_pend	(button 3 is down, timeout pending)
- *	v1  -> (generate v2) synthetic_2_down
- *	^1  -> (release) (deliver) button_3_down
- *	v2  -> (release) (deliver) button_3_down
- *	^2  -> (release) (deliver) button_3_down
- *	^3  -> (release) (deliver) start
- *	vo  -> (release) (deliver) button_3_down
- *	^o  -> (release) (deliver) button_3_down
- *	<-> -> (release) (deliver) button_3_down
- *	<>  -> (deliver) button_3_pend
- *	k   -> (release) (deliver) button_3_down
- *	... -> (release) button_3_down
- *
- *  button_3_down	(button 3 is down)
- *	v1  -> (deliver) button_3_down
- *	^1  -> (deliver) button_3_down
- *	v2  -> (deliver) button_3_down
- *	^2  -> (deliver) button_3_down
- *	^3  -> (deliver) start
- *	vo  -> (deliver) button_3_down
- *	^o  -> (deliver) button_3_down
- *	<>  -> (deliver) button_3_down
- *	k   -> (deliver) button_3_down
- *
- *  synthetic_2_down_13	(button 1 and 3 are down)
- *	^1  -> (generate ^2) synthetic_2_down_3
- *	v2  -> synthetic_2_down_13
- *	^2  -> synthetic_2_down_13
- *	^3  -> (generate ^2) synthetic_2_down_1
- *	vo  -> (deliver) synthetic_2_down_13
- *	^o  -> (deliver) synthetic_2_down_13
- *	<>  -> (deliver) synthetic_2_down_13
- *	k   -> (deliver) synthetic_2_down_13
- *
- *  synthetic_2_down_3 (button 3 is down)
- *	v1  -> (deliver) synthetic_2_down_3
- *	^1  -> (deliver) synthetic_2_down_3
- *	v2  -> synthetic_2_down_3
- *	^2  -> synthetic_2_down_3
- *	^3  -> start
- *	vo  -> (deliver) synthetic_2_down_3
- *	^o  -> (deliver) synthetic_2_down_3
- *	<>  -> (deliver) synthetic_2_down_3
- *	k   -> (deliver) synthetic_2_down_3
- *
- *  synthetic_2_down_1 (button 1 is down)
- *	^1  -> start
- *	v2  -> synthetic_2_down_1
- *	^2  -> synthetic_2_down_1
- *	v3  -> (deliver) synthetic_2_down_1
- *	^3  -> (deliver) synthetic_2_down_1
- *	vo  -> (deliver) synthetic_2_down_1
- *	^o  -> (deliver) synthetic_2_down_1
- *	<>  -> (deliver) synthetic_2_down_1
- *	k   -> (deliver) synthetic_2_down_1
- */
-
-typedef enum _inputClass {
-    down_1, up_1,
-    down_2, up_2,
-    down_3, up_3,
-    down_o, up_o,
-    motion, outside_box,
-    keyboard, timeout,
-    num_input_class
-} KdInputClass;
-
-typedef enum _inputAction {
-    noop,
-    hold,
-    setto,
-    deliver,
-    release,
-    clearto,
-    gen_down_2,
-    gen_up_2
-} KdInputAction;
-
-#define MAX_ACTIONS 2
-
-typedef struct _inputTransition {
-    KdInputAction  actions[MAX_ACTIONS];
-    KdMouseState   nextState;
-} KdInputTransition;
-
-KdInputTransition  kdInputMachine[num_input_states][num_input_class] = {
-    /* start */
-    {
-	{ { hold, setto },	    button_1_pend },	/* v1 */
-	{ { deliver, noop },	    start },		/* ^1 */
-	{ { deliver, noop },	    button_2_down },	/* v2 */
-	{ { deliver, noop },	    start },		/* ^2 */
-	{ { hold, setto },	    button_3_pend },	/* v3 */
-	{ { deliver, noop },	    start },		/* ^3 */
-	{ { deliver, noop },	    start },		/* vo */
-	{ { deliver, noop },	    start },		/* ^o */
-	{ { deliver, noop },	    start },		/* <> */
-	{ { deliver, noop },	    start },		/* <-> */
-	{ { noop, noop },	    start },		/* k */
-	{ { noop, noop },	    start },		/* ... */
-    },
-    /* button_1_pend */
-    {
-	{ { noop, noop },	    button_1_pend },	/* v1 */
-	{ { release, deliver },	    start },		/* ^1 */
-	{ { release, deliver },	    button_1_down },	/* v2 */
-	{ { release, deliver },	    button_1_down },	/* ^2 */
-	{ { clearto, gen_down_2 },  synth_2_down_13 },	/* v3 */
-	{ { release, deliver },	    button_1_down },	/* ^3 */
-	{ { release, deliver },	    button_1_down },	/* vo */
-	{ { release, deliver },	    button_1_down },	/* ^o */
-	{ { deliver, noop },	    button_1_pend },	/* <> */
-	{ { release, deliver },	    button_1_down },	/* <-> */
-	{ { noop, noop },	    button_1_down },	/* k */
-	{ { release, noop },	    button_1_down },	/* ... */
-    },
-    /* button_1_down */
-    {
-	{ { noop, noop },	    button_1_down },	/* v1 */
-	{ { deliver, noop },	    start },		/* ^1 */
-	{ { deliver, noop },	    button_1_down },	/* v2 */
-	{ { deliver, noop },	    button_1_down },	/* ^2 */
-	{ { deliver, noop },	    button_1_down },	/* v3 */
-	{ { deliver, noop },	    button_1_down },	/* ^3 */
-	{ { deliver, noop },	    button_1_down },	/* vo */
-	{ { deliver, noop },	    button_1_down },	/* ^o */
-	{ { deliver, noop },	    button_1_down },	/* <> */
-	{ { deliver, noop },	    button_1_down },	/* <-> */
-	{ { noop, noop },	    button_1_down },	/* k */
-	{ { noop, noop },	    button_1_down },	/* ... */
-    },
-    /* button_2_down */
-    {
-	{ { deliver, noop },	    button_2_down },	/* v1 */
-	{ { deliver, noop },	    button_2_down },	/* ^1 */
-	{ { noop, noop },	    button_2_down },	/* v2 */
-	{ { deliver, noop },	    start },		/* ^2 */
-	{ { deliver, noop },	    button_2_down },	/* v3 */
-	{ { deliver, noop },	    button_2_down },	/* ^3 */
-	{ { deliver, noop },	    button_2_down },	/* vo */
-	{ { deliver, noop },	    button_2_down },	/* ^o */
-	{ { deliver, noop },	    button_2_down },	/* <> */
-	{ { deliver, noop },	    button_2_down },	/* <-> */
-	{ { noop, noop },	    button_2_down },	/* k */
-	{ { noop, noop },	    button_2_down },	/* ... */
-    },
-    /* button_3_pend */
-    {
-	{ { clearto, gen_down_2 },  synth_2_down_13 },	/* v1 */
-	{ { release, deliver },	    button_3_down },	/* ^1 */
-	{ { release, deliver },	    button_3_down },	/* v2 */
-	{ { release, deliver },	    button_3_down },	/* ^2 */
-	{ { release, deliver },	    button_3_down },	/* v3 */
-	{ { release, deliver },	    start },		/* ^3 */
-	{ { release, deliver },	    button_3_down },	/* vo */
-	{ { release, deliver },	    button_3_down },	/* ^o */
-	{ { deliver, noop },	    button_3_pend },	/* <> */
-	{ { release, deliver },	    button_3_down },	/* <-> */
-	{ { release, noop },	    button_3_down },	/* k */
-	{ { release, noop },	    button_3_down },	/* ... */
-    },
-    /* button_3_down */
-    {
-	{ { deliver, noop },	    button_3_down },	/* v1 */
-	{ { deliver, noop },	    button_3_down },	/* ^1 */
-	{ { deliver, noop },	    button_3_down },	/* v2 */
-	{ { deliver, noop },	    button_3_down },	/* ^2 */
-	{ { noop, noop },	    button_3_down },	/* v3 */
-	{ { deliver, noop },	    start },		/* ^3 */
-	{ { deliver, noop },	    button_3_down },	/* vo */
-	{ { deliver, noop },	    button_3_down },	/* ^o */
-	{ { deliver, noop },	    button_3_down },	/* <> */
-	{ { deliver, noop },	    button_3_down },	/* <-> */
-	{ { noop, noop },	    button_3_down },	/* k */
-	{ { noop, noop },	    button_3_down },	/* ... */
-    },
-    /* synthetic_2_down_13 */
-    {
-	{ { noop, noop },	    synth_2_down_13 },	/* v1 */
-	{ { gen_up_2, noop },	    synth_2_down_3 },	/* ^1 */
-	{ { noop, noop },	    synth_2_down_13 },	/* v2 */
-	{ { noop, noop },	    synth_2_down_13 },	/* ^2 */
-	{ { noop, noop },	    synth_2_down_13 },	/* v3 */
-	{ { gen_up_2, noop },	    synth_2_down_1 },	/* ^3 */
-	{ { deliver, noop },	    synth_2_down_13 },	/* vo */
-	{ { deliver, noop },	    synth_2_down_13 },	/* ^o */
-	{ { deliver, noop },	    synth_2_down_13 },	/* <> */
-	{ { deliver, noop },	    synth_2_down_13 },	/* <-> */
-	{ { noop, noop },	    synth_2_down_13 },	/* k */
-	{ { noop, noop },	    synth_2_down_13 },	/* ... */
-    },
-    /* synthetic_2_down_3 */
-    {
-	{ { deliver, noop },	    synth_2_down_3 },	/* v1 */
-	{ { deliver, noop },	    synth_2_down_3 },	/* ^1 */
-	{ { deliver, noop },	    synth_2_down_3 },	/* v2 */
-	{ { deliver, noop },	    synth_2_down_3 },	/* ^2 */
-	{ { noop, noop },	    synth_2_down_3 },	/* v3 */
-	{ { noop, noop },	    start },		/* ^3 */
-	{ { deliver, noop },	    synth_2_down_3 },	/* vo */
-	{ { deliver, noop },	    synth_2_down_3 },	/* ^o */
-	{ { deliver, noop },	    synth_2_down_3 },	/* <> */
-	{ { deliver, noop },	    synth_2_down_3 },	/* <-> */
-	{ { noop, noop },	    synth_2_down_3 },	/* k */
-	{ { noop, noop },	    synth_2_down_3 },	/* ... */
-    },
-    /* synthetic_2_down_1 */
-    {
-	{ { noop, noop },	    synth_2_down_1 },	/* v1 */
-	{ { noop, noop },	    start },		/* ^1 */
-	{ { deliver, noop },	    synth_2_down_1 },	/* v2 */
-	{ { deliver, noop },	    synth_2_down_1 },	/* ^2 */
-	{ { deliver, noop },	    synth_2_down_1 },	/* v3 */
-	{ { deliver, noop },	    synth_2_down_1 },	/* ^3 */
-	{ { deliver, noop },	    synth_2_down_1 },	/* vo */
-	{ { deliver, noop },	    synth_2_down_1 },	/* ^o */
-	{ { deliver, noop },	    synth_2_down_1 },	/* <> */
-	{ { deliver, noop },	    synth_2_down_1 },	/* <-> */
-	{ { noop, noop },	    synth_2_down_1 },	/* k */
-	{ { noop, noop },	    synth_2_down_1 },	/* ... */
-    },
-};
-
-#define EMULATION_WINDOW    10
-#define EMULATION_TIMEOUT   100
-
-#define EventX(e)   ((e)->u.keyButtonPointer.rootX)
-#define EventY(e)   ((e)->u.keyButtonPointer.rootY)
-
-static int
-KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
-{
-    if (ev->u.keyButtonPointer.pad1)
-    {
-	mi->emulationDx += EventX(ev);
-	mi->emulationDy += EventY(ev);
-    }
-    else
-    {
-	mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
-	mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
-    }
-    return (abs (mi->emulationDx) < EMULATION_WINDOW &&
-	    abs (mi->emulationDy) < EMULATION_WINDOW);
-}
-
-static KdInputClass
-KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
-{
-    switch (ev->u.u.type) {
-    case ButtonPress:
-	switch (ev->u.u.detail) {
-	case 1: return down_1;
-	case 2: return down_2;
-	case 3: return down_3;
-	default: return down_o;
-	}
-	break;
-    case ButtonRelease:
-	switch (ev->u.u.detail) {
-	case 1: return up_1;
-	case 2: return up_2;
-	case 3: return up_3;
-	default: return up_o;
-	}
-	break;
-    case MotionNotify:
-	if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
-	    return outside_box;
-	else
-	    return motion;
-    default:
-	return keyboard;
-    }
-    return keyboard;
-}
-
-#ifdef DEBUG
-char	*kdStateNames[] = {
-    "start",
-    "button_1_pend",
-    "button_1_down",
-    "button_2_down",
-    "button_3_pend",
-    "button_3_down",
-    "synth_2_down_13",
-    "synth_2_down_3",
-    "synthetic_2_down_1",
-    "num_input_states"
-};
-
-char	*kdClassNames[] = {
-    "down_1", "up_1",
-    "down_2", "up_2",
-    "down_3", "up_3",
-    "motion", "ouside_box",
-    "keyboard", "timeout",
-    "num_input_class"
-};
-
-char *kdActionNames[] = {
-    "noop",
-    "hold",
-    "setto",
-    "deliver",
-    "release",
-    "clearto",
-    "gen_down_2",
-    "gen_up_2",
-};
-#endif /* DEBUG */
-
-static void
-KdQueueEvent (xEvent *ev)
-{
-    KdAssertSigioBlocked ("KdQueueEvent");
-    if (ev->u.u.type == MotionNotify)
-    {
-	if (ev->u.keyButtonPointer.pad1)
-	{
-	    ev->u.keyButtonPointer.pad1 = 0;
-	    miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
-				  ev->u.keyButtonPointer.rootY,
-				  ev->u.keyButtonPointer.time);
-	}
-	else
-	{
-	    miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
-				    ev->u.keyButtonPointer.rootY,
-				    ev->u.keyButtonPointer.time);
-	}
-    }
-    else
-    {
-	mieqEnqueue (ev);
-    }
-}
-
-static void
-KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
-{
-    KdInputTransition	*t;
-    int			a;
-
-    t = &kdInputMachine[mi->mouseState][c];
-    for (a = 0; a < MAX_ACTIONS; a++)
-    {
-	switch (t->actions[a]) {
-	case noop:
-	    break;
-	case hold:
-	    mi->eventHeld = TRUE;
-	    mi->emulationDx = 0;
-	    mi->emulationDy = 0;
-	    mi->heldEvent = *ev;
-	    break;
-	case setto:
-	    mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
-	    mi->timeoutPending = TRUE;
-	    break;
-	case deliver:
-	    KdQueueEvent (ev);
-	    break;
-	case release:
-	    mi->eventHeld = FALSE;
-	    mi->timeoutPending = FALSE;
-	    KdQueueEvent (&mi->heldEvent);
-	    break;
-	case clearto:
-	    mi->timeoutPending = FALSE;
-	    break;
-	case gen_down_2:
-	    ev->u.u.detail = 2;
-	    mi->eventHeld = FALSE;
-	    KdQueueEvent (ev);
-	    break;
-	case gen_up_2:
-	    ev->u.u.detail = 2;
-	    KdQueueEvent (ev);
-	    break;
-	}
-    }
-    mi->mouseState = t->nextState;
-}
-
-void
-KdResetInputMachine (void)
-{
-    KdMouseInfo	*mi;
-
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-    {
-	mi->mouseState = start;
-	mi->eventHeld = FALSE;
-    }
-}
-
-static void
-KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
-{
-    if (mi->emulateMiddleButton)
-	KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
-    else
-	KdQueueEvent (ev);
-}
-
-static void
-KdReceiveTimeout (KdMouseInfo *mi)
-{
-    KdRunMouseMachine (mi, timeout, 0);
-}
-
-#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
-#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
-#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
-#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
-#define KEYMAP	    (pKdKeyboard->key->curKeySyms)
-#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
-
-CARD32	KdSpecialKeys = 0;
-
-extern char dispatchException;
-
-/*
- * kdCheckTermination
- *
- * This function checks for the key sequence that terminates the server.  When
- * detected, it sets the dispatchException flag and returns.  The key sequence
- * is:
- *	Control-Alt
- * It's assumed that the server will be waken up by the caller when this
- * function returns.
- */
-
-extern int nClients;
-
-static void
-KdCheckSpecialKeys(xEvent *xE)
-{
-    KeySym	sym = KEYCOL1(xE->u.u.detail);
-
-    if (!pKdKeyboard) return;
-
-    /*
-     * Ignore key releases
-     */
-
-    if (xE->u.u.type == KeyRelease) return;
-
-#ifdef XIPAQ
-    /*
-     * Check for buttons 1, 2 and 3 on the iPAQ
-     */
-    if (sym == XK_Pointer_Button1 && kdMouseInfo) {
-	KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
-	return;
-    }
-    if (sym == XK_Pointer_Button2 && kdMouseInfo) {
-	KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
-	return;
-    }
-    if (sym == XK_Pointer_Button3 && kdMouseInfo) {
-	KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
-	return;
-    }
-#endif
-
-    /*
-     * Check for control/alt pressed
-     */
-    if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
-	(ControlMask|Mod1Mask))
-	return;
-
-
-    /*
-     * Let OS function see keysym first
-     */
-
-    if (kdOsFuncs->SpecialKey)
-	if ((*kdOsFuncs->SpecialKey) (sym))
-	    return;
-
-    /*
-     * Now check for backspace or delete; these signal the
-     * X server to terminate
-     */
-    switch (sym) {
-    case XK_BackSpace:
-    case XK_Delete:
-    case XK_KP_Delete:
-	/*
-	 * Set the dispatch exception flag so the server will terminate the
-	 * next time through the dispatch loop.
-	 */
-	if (kdDontZap == FALSE)
-	    dispatchException |= DE_TERMINATE;
-	break;
-    }
-}
-
-/*
- * kdEnqueueKeyboardEvent
- *
- * This function converts hardware keyboard event information into an X event
- * and enqueues it using MI.  It wakes up the server before returning so that
- * the event will be processed normally.
- *
- */
-
-static void
-KdHandleKeyboardEvent (xEvent *ev)
-{
-    int		key = ev->u.u.detail;
-    int		byte;
-    CARD8	bit;
-    KdMouseInfo	*mi;
-
-    byte = key >> 3;
-    bit = 1 << (key & 7);
-    switch (ev->u.u.type) {
-    case KeyPress:
-	kdKeyState[byte] |= bit;
-	break;
-    case KeyRelease:
-	kdKeyState[byte] &= ~bit;
-	break;
-    }
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-	KdRunMouseMachine (mi, keyboard, 0);
-    KdQueueEvent (ev);
-}
-
-static void
-KdReleaseAllKeys (void)
-{
-    xEvent  xE;
-    int	    key;
-
-    KdBlockSigio ();
-    for (key = 0; key < KD_KEY_COUNT; key++)
-	if (IsKeyDown(key))
-	{
-	    xE.u.keyButtonPointer.time = GetTimeInMillis();
-	    xE.u.u.type = KeyRelease;
-	    xE.u.u.detail = key;
-	    KdHandleKeyboardEvent (&xE);
-	}
-    KdUnblockSigio ();
-}
-
-static void
-KdCheckLock (void)
-{
-    KeyClassPtr	    keyc = pKdKeyboard->key;
-    Bool	    isSet, shouldBeSet;
-
-    if (kdKeyboardFuncs->LockLed)
-    {
-	isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
-	shouldBeSet = (keyc->state & LockMask) != 0;
-	if (isSet != shouldBeSet)
-	{
-	    KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
-	}
-    }
-}
-
-void
-KdEnqueueKeyboardEvent(unsigned char	scan_code,
-		       unsigned char	is_up)
-{
-    unsigned char   key_code;
-    xEvent	    xE;
-    KeyClassPtr	    keyc;
-
-    if (!pKdKeyboard)
-	return;
-    keyc = pKdKeyboard->key;
-
-    xE.u.keyButtonPointer.time = GetTimeInMillis();
-
-    if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
-    {
-	key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
-
-	/*
-	 * Set up this event -- the type may be modified below
-	 */
-	if (is_up)
-	    xE.u.u.type = KeyRelease;
-	else
-	    xE.u.u.type = KeyPress;
-	xE.u.u.detail = key_code;
-
-	switch (KEYCOL1(key_code))
-	{
-	case XK_Num_Lock:
-	case XK_Scroll_Lock:
-	case XK_Shift_Lock:
-	case XK_Caps_Lock:
-	    if (xE.u.u.type == KeyRelease)
-		return;
-	    if (IsKeyDown (key_code))
-		xE.u.u.type = KeyRelease;
-	    else
-		xE.u.u.type = KeyPress;
-	}
-
-	/*
-	 * Check pressed keys which are already down
-	 */
-	if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
-	{
-	    KeybdCtrl	*ctrl = &pKdKeyboard->kbdfeed->ctrl;
-
-	    /*
-	     * Check auto repeat
-	     */
-	    if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
-		!(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
-	    {
-		return;
-	    }
-	    /*
-	     * X delivers press/release even for autorepeat
-	     */
-	    xE.u.u.type = KeyRelease;
-	    KdHandleKeyboardEvent (&xE);
-	    xE.u.u.type = KeyPress;
-	}
-	/*
-	 * Check released keys which are already up
-	 */
-	else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
-	{
-	    return;
-	}
-	KdCheckSpecialKeys (&xE);
-	KdHandleKeyboardEvent (&xE);
-    }
-}
-
-#define SetButton(mi, b, v, s) \
-{\
-    xE.u.u.detail = mi->map[b]; \
-    xE.u.u.type = v; \
-    KdHandleMouseEvent (mi, &xE); \
-}
-
-#define Press(mi, b)         SetButton(mi, b, ButtonPress, "Down")
-#define Release(mi, b)       SetButton(mi, b, ButtonRelease, "Up")
-
-/*
- * kdEnqueueMouseEvent
- *
- * This function converts hardware mouse event information into X event
- * information.  A mouse movement event is passed off to MI to generate
- * a MotionNotify event, if appropriate.  Button events are created and
- * passed off to MI for enqueueing.
- */
-
-static void
-KdMouseAccelerate (DeviceIntPtr	device, int *dx, int *dy)
-{
-    PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
-    double  speed = sqrt (*dx * *dx + *dy * *dy);
-    double  accel;
-    double  m;
-
-    /*
-     * Ok, so we want it moving num/den times faster at threshold*2
-     *
-     * accel = m *threshold + b
-     * 1 = m * 0 + b	-> b = 1
-     *
-     * num/den = m * (threshold * 2) + 1
-     *
-     * num / den - 1 = m * threshold * 2
-     * (num / den - 1) / threshold * 2 = m
-     */
-    m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
-	 ((double) pCtrl->threshold * 2.0));
-    accel = m * speed + 1;
-    *dx = accel * *dx;
-    *dy = accel * *dy;
-}
-
-void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
-{
-    CARD32	    ms;
-    xEvent	    xE;
-    unsigned char   buttons;
-    int		    x, y;
-    int		    (*matrix)[3] = kdMouseMatrix.matrix;
-    unsigned long   button;
-    int		    n;
-
-    if (!pKdPointer)
-	return;
-
-    ms = GetTimeInMillis();
-
-    if (flags & KD_MOUSE_DELTA)
-    {
-	if (mi->transformCoordinates)
-	{
-	    x = matrix[0][0] * rx + matrix[0][1] * ry;
-	    y = matrix[1][0] * rx + matrix[1][1] * ry;
-	}
-	else
-	{
-	    x = rx;
-	    y = ry;
-	}
-	KdMouseAccelerate (pKdPointer, &x, &y);
-	xE.u.keyButtonPointer.pad1 = 1;
-    }
-    else
-    {
-	if (mi->transformCoordinates)
-	{
-	    x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
-	    y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
-	}
-	else
-	{
-	    x = rx;
-	    y = ry;
-	}
-	xE.u.keyButtonPointer.pad1 = 0;
-    }
-    xE.u.keyButtonPointer.time = ms;
-    xE.u.keyButtonPointer.rootX = x;
-    xE.u.keyButtonPointer.rootY = y;
-
-    xE.u.u.type = MotionNotify;
-    xE.u.u.detail = 0;
-    KdHandleMouseEvent (mi, &xE);
-
-    buttons = flags;
-
-    for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
-    {
-	if ((mi->buttonState & button) ^ (buttons & button))
-	{
-	    if (buttons & button)
-	    {
-		Press(mi, n);
-	    }
-	    else
-	    {
-		Release(mi, n);
-	    }
-	}
-    }
-    mi->buttonState = buttons;
-}
-
-static void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
-{
-    xEvent  xE;
-    CARD32  ms;
-
-    ms = GetTimeInMillis();
-
-    xE.u.u.type = MotionNotify;
-    xE.u.keyButtonPointer.time = ms;
-    xE.u.keyButtonPointer.rootX = x;
-    xE.u.keyButtonPointer.rootY = y;
-
-    KdHandleMouseEvent (mi, &xE);
-}
-
-static void
-KdBlockHandler (int		screen,
-		pointer		blockData,
-		pointer		timeout,
-		pointer		readmask)
-{
-    KdMouseInfo		    *mi;
-    int myTimeout=0;
-
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-    {
-	if (mi->timeoutPending)
-	{
-	    int	ms;
-
-	    ms = mi->emulationTimeout - GetTimeInMillis ();
-	    if (ms < 1)
-		ms = 1;
-	    if(ms<myTimeout || myTimeout==0)
-		    myTimeout=ms;
-	}
-    }
-    /* if we need to poll for events, do that */
-    if(kdOsFuncs->pollEvents)
-    {
-	    (*kdOsFuncs->pollEvents)();
-	    myTimeout=20;
-    }
-    if(myTimeout>0)
-    	AdjustWaitForDelay (timeout, myTimeout);
-}
-
-void
-KdWakeupHandler (pointer data,
-		 int	 result,
-		 pointer readmask)
-{
-    fd_set	*pReadmask = (fd_set *) readmask;
-    int		i;
-    KdMouseInfo	*mi;
-
-    if (kdInputEnabled && result > 0)
-    {
-	for (i = 0; i < kdNumInputFds; i++)
-	    if (FD_ISSET (kdInputFds[i].fd, pReadmask))
-	    {
-		KdBlockSigio ();
-		(*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure);
-		KdUnblockSigio ();
-	    }
-    }
-    for (mi = kdMouseInfo; mi; mi = mi->next)
-    {
-	if (mi->timeoutPending)
-	{
-	    if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
-	    {
-		mi->timeoutPending = FALSE;
-		KdBlockSigio ();
-		KdReceiveTimeout (mi);
-		KdUnblockSigio ();
-	    }
-	}
-    }
-//  if (kdSwitchPending)
-//      kdProcessSwitch ();
-}
-
-#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin))
-
-static Bool
-KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
-    ScreenPtr	pScreen  = *ppScreen;
-    ScreenPtr	pNewScreen;
-    int		n;
-    int		dx, dy;
-    int		best_x, best_y;
-    int		n_best_x, n_best_y;
-    CARD32	ms;
-
-    if (kdDisableZaphod || screenInfo.numScreens <= 1)
-	return FALSE;
-
-    if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
-	return FALSE;
-
-    ms = GetTimeInMillis ();
-    if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
-	return FALSE;
-    kdOffScreen = TRUE;
-    kdOffScreenTime = ms;
-    n_best_x = -1;
-    best_x = 32767;
-    n_best_y = -1;
-    best_y = 32767;
-    for (n = 0; n < screenInfo.numScreens; n++)
-    {
-	pNewScreen = screenInfo.screens[n];
-	if (pNewScreen == pScreen)
-	    continue;
-	dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
-	dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
-	if (*x < 0)
-	{
-	    if (dx <= 0 && -dx < best_x)
-	    {
-		best_x = -dx;
-		n_best_x = n;
-	    }
-	}
-	else if (*x >= pScreen->width)
-	{
-	    if (dx >= 0 && dx < best_x)
-	    {
-		best_x = dx;
-		n_best_x = n;
-	    }
-	}
-	if (*y < 0)
-	{
-	    if (dy <= 0 && -dy < best_y)
-	    {
-		best_y = -dy;
-		n_best_y = n;
-	    }
-	}
-	else if (*y >= pScreen->height)
-	{
-	    if (dy >= 0 && dy < best_y)
-	    {
-		best_y = dy;
-		n_best_y = n;
-	    }
-	}
-    }
-    if (best_y < best_x)
-	n_best_x = n_best_y;
-    if (n_best_x == -1)
-	return FALSE;
-    pNewScreen = screenInfo.screens[n_best_x];
-
-    if (*x < 0)
-	*x += pNewScreen->width;
-    if (*y < 0)
-	*y += pNewScreen->height;
-
-    if (*x >= pScreen->width)
-	*x -= pScreen->width;
-    if (*y >= pScreen->height)
-	*y -= pScreen->height;
-
-    *ppScreen = pNewScreen;
-    return TRUE;
-}
-
-static void
-KdCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-#ifndef XIPAQ
-//  if (entering)
-//      KdEnableScreen (pScreen);
-//  else
-//      KdDisableScreen (pScreen);
-#endif
-}
-
-int KdCurScreen;	/* current event screen */
-
-static void
-KdWarpCursor (ScreenPtr pScreen, int x, int y)
-{
-    KdBlockSigio ();
-    KdCurScreen = pScreen->myNum;
-    miPointerWarpCursor (pScreen, x, y);
-    KdUnblockSigio ();
-}
-
-miPointerScreenFuncRec kdPointerScreenFuncs =
-{
-    KdCursorOffScreen,
-    KdCrossScreen,
-    KdWarpCursor
-};
-
-void
-KdProcessInputEvents (void)
-{
-    mieqProcessInputEvents();
-    miPointerUpdate();
-//  if (kdSwitchPending)
-//      KdProcessSwitch ();
-    KdCheckLock ();
-}
diff --git a/hw/xgl/egl/kkeymap.h b/hw/xgl/egl/kkeymap.h
deleted file mode 100644
index 920e807..0000000
--- a/hw/xgl/egl/kkeymap.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright  1999 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- *  All global variables and functions pertaining to keyboard key mapping
- *  live in this header file.
- */
-
-#ifndef _KKEYMAP_H
-#define _KKEYMAP_H
-
-/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
-#define KD_KEY_OFFSET	(8 - kdMinScanCode)
-
-#define KD_MIN_KEYCODE	8
-#define KD_MAX_KEYCODE	254
-#define KD_MAX_WIDTH	4
-#define KD_MAX_LENGTH	(KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
-
-extern int		kdMinScanCode;
-extern int		kdMaxScanCode;
-extern int		kdMinKeyCode;
-extern int		kdMaxKeyCode;
-extern int		kdKeymapWidth;
-
-extern KeySym		kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-
-extern CARD8		kdModMap[MAP_LENGTH];
-
-extern KeySymsRec	kdKeySyms;
-
-typedef struct {
-    KeySym  modsym;
-    int	    modbit;
-} KdKeySymModsRec;
-
-#endif /* _KKEYMAP_H */
diff --git a/hw/xgl/egl/module/Makefile.am b/hw/xgl/egl/module/Makefile.am
deleted file mode 100644
index c84f85c..0000000
--- a/hw/xgl/egl/module/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-AM_CFLAGS = \
-        $(DIX_CFLAGS) \
-	-I$(srcdir)/.. \
-	-I$(srcdir)/../.. \
-	$(XEGLMODULES_CFLAGS)
-
-libxegl_la_LDFLAGS = -avoid-version
-libxegl_la_SOURCES = xeglmodule.c
-libxegl_la_LIBADD   =	  \
-	$(top_builddir)/hw/xgl/glx/libxegl.la \
-	$(XEGLMODULES_LIBS)
-
-moduledir = @xglmoduledir@
-
-module_LTLIBRARIES = libxegl.la
diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c
deleted file mode 100644
index abd0d0d..0000000
--- a/hw/xgl/egl/module/xeglmodule.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglmodule.h"
-#include "xegl.h"
-
-#include <glitz-egl.h>
-
-char *
-moduleVersion (void)
-{
-    return VERSION;
-}
-
-Bool
-moduleInit (const char *module)
-{
-    glitz_egl_init (module);
-
-    return TRUE;
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
-{
-    xeglInitOutput (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
-	       DeviceIntPtr    pDev)
-{
-    return xeglLegalModifier (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
-    xeglProcessInputEvents ();
-}
-
-void
-InitInput (int  argc,
-	   char **argv)
-{
-    xeglInitInput (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
-    ErrorF ("\nXegl usage:\n");
-    xeglUseMsg ();
-}
-
-int
-ddxProcessArgument (int  argc,
-		    char **argv,
-		    int  i)
-{
-    return xeglProcessArgument (argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
-    xeglAbort ();
-}
-
-void
-ddxGiveUp (void)
-{
-    xeglGiveUp ();
-}
-
-void
-OsVendorInit (void)
-{
-    xeglOsVendorInit ();
-}
diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c
deleted file mode 100644
index 1cf615b..0000000
--- a/hw/xgl/egl/xegl.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <math.h>
-
-#include <glitz-egl.h>
-
-#include "inputstr.h"
-#include "cursorstr.h"
-#include "mipointer.h"
-
-#include "xegl.h"
-
-#define XEGL_DEFAULT_SCREEN_WIDTH  800
-#define XEGL_DEFAULT_SCREEN_HEIGHT 600
-
-DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey;
-
-#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
-
-#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
-    dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v)
-
-#define XEGL_SCREEN_PRIV(pScreen)			       \
-    xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
-
-static EGLDisplay    eDisplay;
-static EGLScreenMESA eScreen;
-static ScreenPtr     currentScreen = 0;
-static Bool	     softCursor = TRUE;
-
-extern miPointerScreenFuncRec kdPointerScreenFuncs;
-
-static Bool
-xeglAllocatePrivates (ScreenPtr pScreen)
-{
-    xeglScreenPtr pScreenPriv;
-
-    pScreenPriv = xalloc (sizeof (xeglScreenRec));
-    if (!pScreenPriv)
-	return FALSE;
-
-    XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
-    return TRUE;
-}
-
-static Bool
-xeglCloseScreen (int	   index,
-		 ScreenPtr pScreen)
-{
-    glitz_drawable_t *drawable;
-
-    XEGL_SCREEN_PRIV (pScreen);
-
-    drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
-    if (drawable)
-	glitz_drawable_destroy (drawable);
-
-    xglClearVisualTypes ();
-
-    XGL_SCREEN_UNWRAP (CloseScreen);
-    xfree (pScreenPriv);
-
-    return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-static Bool
-xeglScreenInit (int	  index,
-		ScreenPtr pScreen,
-		int	  argc,
-		char	  **argv)
-{
-    EGLSurface		    eSurface;
-    EGLModeMESA		    mode;
-    int			    count;
-    xeglScreenPtr	    pScreenPriv;
-    glitz_drawable_format_t *format;
-    glitz_drawable_t	    *drawable;
-    EGLint screenAttribs[] = {
-	EGL_WIDTH, 1024,
-	EGL_HEIGHT, 768,
-	EGL_NONE
-    };
-
-    if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
-    {
-      xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
-      xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
-
-    }
-    
-    screenAttribs[1] = xglScreenInfo.width;
-    screenAttribs[3] = xglScreenInfo.height;
-
-    format = xglVisuals[0].format;
-
-    if (!xeglAllocatePrivates (pScreen))
-	return FALSE;
-
-    currentScreen = pScreen;
-
-    pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);
-
-    if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
-    {
-	xglScreenInfo.width  = XEGL_DEFAULT_SCREEN_WIDTH;
-	xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
-    }
-
-    eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);
-
-    eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
-    if (eSurface == EGL_NO_SURFACE)
-    {
-	ErrorF ("failed to create screen surface\n");
-	return FALSE;
-    }
-
-    eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode);
-
-    drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
-					 xglScreenInfo.width,
-					 xglScreenInfo.height);
-    if (!drawable)
-    {
-	ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
-	return FALSE;
-    }
-
-    xglScreenInfo.drawable = drawable;
-
-    if (!xglScreenInit (pScreen))
-	return FALSE;
-
-#ifdef GLXEXT
-    if (!xglInitVisualConfigs (pScreen))
-	return FALSE;
-#endif
-
-    XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
-
-    miDCInitialize (pScreen, &kdPointerScreenFuncs);
-    miCreateDefColormap(pScreen);
-
-    if (!xglFinishScreenInit (pScreen))
-	return FALSE;
-
-    return TRUE;
-}
-
-void
-xeglInitOutput (ScreenInfo *pScreenInfo,
-		int	   argc,
-		char       **argv)
-{
-    glitz_drawable_format_t *format, templ;
-    int			    i, maj, min, count;
-    unsigned long	    mask;
-    
-    xglSetPixmapFormats (pScreenInfo);
-
-    if (!eDisplay)
-    {
-	eDisplay = eglGetDisplay (":0");
-
-	if (!eglInitialize (eDisplay, &maj, &min))
-	    FatalError ("can't open display");
-
-	eglGetScreensMESA (eDisplay, &eScreen, 1, &count);
-    }
-
-    templ.samples          = 1;
-    templ.doublebuffer     = 1;
-    templ.color.alpha_size = 8;
-
-    mask = GLITZ_FORMAT_SAMPLES_MASK;
-
-    format = glitz_egl_find_window_config (eDisplay, eScreen,
-				    mask, &templ, 0);
-
-    if (!format)
-	FatalError ("no visual format found");
-
-    xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor));
-
-    xglInitVisuals (pScreenInfo);
-
-    AddScreen (xeglScreenInit, argc, argv);
-}
-
-static void
-xeglBlockHandler (pointer   blockData,
-		  OSTimePtr pTimeout,
-		  pointer   pReadMask)
-{
-    XGL_SCREEN_PRIV (currentScreen);
-
-    if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    glitz_surface_flush (pScreenPriv->surface);
-    glitz_drawable_finish (pScreenPriv->drawable);
-}
-
-void
-xeglInitInput (int  argc,
-	       char **argv)
-{
-    eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
-    RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
-}
-
-Bool
-xeglLegalModifier (unsigned int key,
-		   DeviceIntPtr pDev)
-{
-    return KdLegalModifier (key, pDev);
-}
-
-void
-xeglProcessInputEvents (void)
-{
-    KdProcessInputEvents ();
-}
-
-void
-xeglUseMsg (void)
-{
-    ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
-	    "specify screen characteristics\n");
-    ErrorF ("-softcursor            force software cursor\n");
-}
-
-int
-xeglProcessArgument (int  argc,
-		     char **argv,
-		     int  i)
-{
-    if (!strcmp (argv[i], "-screen"))
-    {
-	if ((i + 1) < argc)
-	{
-	    xglParseScreen (argv[i + 1]);
-	}
-	else
-	    return 1;
-
-	return 2;
-    }
-    else if (!strcmp (argv[i], "-softcursor"))
-    {
-	softCursor = TRUE;
-	return 1;
-    }
-
-    return 0;
-}
-
-void
-xeglAbort (void)
-{
-}
-
-void
-xeglGiveUp (void)
-{
-    AbortDDX ();
-}
-
-void
-xeglOsVendorInit (void)
-{
-}
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
deleted file mode 100644
index 0a07397..0000000
--- a/hw/xgl/egl/xegl.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#ifndef _XEGL_H_
-#define _XEGL_H_
-
-#include "xgl.h"
-
-#include "randrstr.h"
-
-#define KD_BUTTON_1     0x01
-#define KD_BUTTON_2     0x02
-#define KD_BUTTON_3     0x04
-#define KD_BUTTON_4     0x08
-#define KD_BUTTON_5     0x10
-#define KD_MOUSE_DELTA  0x80000000
-
-typedef struct _KdMouseFuncs {
-    Bool (*Init) (void);
-    void (*Fini) (void);
-} KdMouseFuncs;
-
-typedef struct _KdKeyboardFuncs {
-    void (*Load) (void);
-    int  (*Init) (void);
-    void (*Leds) (int);
-    void (*Bell) (int, int, int);
-    void (*Fini) (void);
-    int  LockLed;
-} KdKeyboardFuncs;
-
-typedef struct _KdOsFuncs {
-    int  (*Init)       (void);
-    void (*Enable)     (void);
-    Bool (*SpecialKey) (KeySym);
-    void (*Disable)    (void);
-    void (*Fini)       (void);
-    void (*pollEvents) (void);
-} KdOsFuncs;
-
-typedef struct _KdMouseMatrix {
-    int matrix[2][3];
-} KdMouseMatrix;
-
-typedef enum _KdMouseState {
-    start,
-    button_1_pend,
-    button_1_down,
-    button_2_down,
-    button_3_pend,
-    button_3_down,
-    synth_2_down_13,
-    synth_2_down_3,
-    synth_2_down_1,
-    num_input_states
-} KdMouseState;
-
-#define KD_MAX_BUTTON  7
-
-typedef struct _KdMouseInfo {
-    struct _KdMouseInfo *next;
-    void		*driver;
-    void		*closure;
-    char		*name;
-    char		*prot;
-    char		map[KD_MAX_BUTTON];
-    int			nbutton;
-    Bool		emulateMiddleButton;
-    unsigned long	emulationTimeout;
-    Bool		timeoutPending;
-    KdMouseState	mouseState;
-    Bool		eventHeld;
-    xEvent		heldEvent;
-    unsigned char	buttonState;
-    int			emulationDx, emulationDy;
-    int			inputType;
-    Bool		transformCoordinates;
-} KdMouseInfo;
-
-typedef struct _xeglScreen {
-    CloseScreenProcPtr CloseScreen;
-    ScreenPtr	       pScreen;
-    DDXPointRec	       origin;
-} xeglScreenRec, *xeglScreenPtr;
-
-extern KdMouseInfo     *kdMouseInfo;
-extern KdOsFuncs       *kdOsFuncs;
-extern Bool	       kdDontZap;
-extern Bool	       kdDisableZaphod;
-extern DevPrivateKey   xeglScreenPrivateKey;
-extern KdMouseFuncs    LinuxEvdevMouseFuncs;
-extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
-
-#define RR_Rotate_All						 \
-    (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
-#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y)
-
-#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
-#define KdScreenPriv(pScreen)				  \
-    xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
-
-void
-eglInitInput (KdMouseFuncs    *pMouseFuncs,
-	      KdKeyboardFuncs *pKeyboardFuncs);
-
-void
-KdParseMouse (char *arg);
-
-KdMouseInfo *
-KdMouseInfoAdd (void);
-
-void
-KdMouseInfoDispose (KdMouseInfo *mi);
-
-int
-KdAllocInputType (void);
-
-char *
-KdSaveString (char *str);
-
-Bool
-KdRegisterFd (int  type,
-	      int  fd,
-	      void (*read) (int fd, void *closure),
-	      void *closure);
-
-void
-KdUnregisterFds (int  type,
-		 Bool do_close);
-
-void
-KdEnqueueKeyboardEvent (unsigned char scan_code,
-			unsigned char is_up);
-
-void
-KdEnqueueMouseEvent (KdMouseInfo   *mi,
-		     unsigned long flags,
-		     int	   rx,
-		     int	   ry);
-
-void
-KdRegisterFdEnableDisable (int  fd,
-			   int  (*enable)  (int fd, void *closure),
-			   void (*disable) (int fd, void *closure));
-
-void
-KdWakeupHandler (pointer data,
-		 int	 result,
-		 pointer readmask);
-
-Bool
-KdLegalModifier (unsigned int key, 
-		 DeviceIntPtr pDev);
-
-void
-KdProcessInputEvents (void);
-
-void
-xeglInitOutput (ScreenInfo *pScreenInfo,
-		int	   argc,
-		char       **argv);
-
-Bool
-xeglLegalModifier (unsigned int key,
-		   DevicePtr    pDev);
-
-void
-xeglProcessInputEvents (void);
-
-void
-xeglInitInput (int  argc,
-	       char **argv);
-
-void
-xeglUseMsg (void);
-
-int
-xeglProcessArgument (int  argc,
-		     char **argv,
-		     int  i);
-
-void
-xeglAbort (void);
-
-void
-xeglGiveUp (void);
-
-void
-xeglOsVendorInit (void);
-
-#endif /* _XEGL_H_ */
diff --git a/hw/xgl/egl/xeglinit.c b/hw/xgl/egl/xeglinit.c
deleted file mode 100644
index c28d946..0000000
--- a/hw/xgl/egl/xeglinit.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xegl.h"
-
-static xglScreenInfoRec xglScreenInfo = {
-    NULL, 0, 0, 0, 0,
-    DEFAULT_GEOMETRY_DATA_TYPE,
-    DEFAULT_GEOMETRY_USAGE,
-    FALSE,
-    XGL_DEFAULT_PBO_MASK,
-    FALSE,
-    FALSE
-};
-
-#ifdef GLXEXT
-static Bool loadGlx = TRUE;
-#endif
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
-{
-
-#ifdef GLXEXT
-    if (loadGlx)
-    {
-	if (!xglLoadGLXModules ())
-	    FatalError ("No GLX modules loaded");
-    }
-#endif
-
-    xeglInitOutput (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
-	       DeviceIntPtr pDev)
-{
-    return xeglLegalModifier (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
-    xeglProcessInputEvents ();
-}
-
-void
-InitInput (int  argc,
-	   char **argv)
-{
-    xeglInitInput (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
-    ErrorF ("\nXgl usage:\n");
-
-#ifdef GLXEXT
-    ErrorF ("-noglx                 don't load glx extension\n");
-#endif
-
-    xglUseMsg ();
-    ErrorF ("\nXegl usage:\n");
-    xeglUseMsg ();
-}
-
-int
-ddxProcessArgument (int  argc,
-		    char **argv,
-		    int  i)
-{
-    int skip;
-
-#ifdef GLXEXT
-    if (!strcmp (argv[i], "-noglx"))
-    {
-	loadGlx = FALSE;
-	return 1;
-    }
-#endif
-
-    skip = xglProcessArgument (argc, argv, i);
-    if (skip)
-	return skip;
-
-    return xeglProcessArgument (argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
-    xeglAbort ();
-}
-
-void
-ddxGiveUp (void)
-{
-    xeglGiveUp ();
-}
-
-void
-OsVendorInit (void)
-{
-    xeglOsVendorInit ();
-}
diff --git a/hw/xgl/egl/xeglinput.c b/hw/xgl/egl/xeglinput.c
deleted file mode 100644
index 8c50b78..0000000
--- a/hw/xgl/egl/xeglinput.c
+++ /dev/null
@@ -1,168 +0,0 @@
-#include "xgl.h"
-#include "xegl.h"
-
-KdOsFuncs *kdOsFuncs;
-Bool kdEmulateMiddleButton;
-Bool kdRawPointerCoordinates;
-Bool kdDontZap;
-Bool kdDisableZaphod;
-int kdScreenPrivateIndex;
-
-static char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
-{
-    while (*cur && !strchr (delim, *cur))
-    {
-        *save++ = *cur++;
-    }
-    *save = 0;
-    *last = *cur;
-    if (*cur)
-        cur++;
-    return cur;
-}
-
-/*
- * Mouse argument syntax:
- *
- *  device,protocol,options...
- *
- *  Options are any of:
- *      1-5         n button mouse
- *      2button     emulate middle button
- *      {NMO}       Reorder buttons
- */
-char *
-KdSaveString (char *str)
-{
-    char    *n = (char *) xalloc (strlen (str) + 1);
-
-    if (!n)
-        return 0;
-    strcpy (n, str);
-    return n;
-}
-
-/*
- * Parse mouse information.  Syntax:
- *
- *  <device>,<nbutton>,<protocol>{,<option>}...
- *
- * options: {nmo}   pointer mapping (e.g. {321})
- *          2button emulate middle button
- *          3button dont emulate middle button
- */
-void
-KdParseMouse (char *arg)
-{
-    char        save[1024];
-    char        delim;
-    KdMouseInfo *mi;
-    int         i;
-
-    mi = KdMouseInfoAdd ();
-    if (!mi)
-        return;
-    mi->name = 0;
-    mi->prot = 0;
-    mi->emulateMiddleButton = kdEmulateMiddleButton;
-    mi->transformCoordinates = !kdRawPointerCoordinates;
-    mi->nbutton = 3;
-    for (i = 0; i < KD_MAX_BUTTON; i++)
-        mi->map[i] = i + 1;
-
-    if (!arg)
-        return;
-    if (strlen (arg) >= sizeof (save))
-        return;
-    arg = KdParseFindNext (arg, ",", save, &delim);
-    if (!save[0])
-        return;
-    mi->name = KdSaveString (save);
-    if (delim != ',')
-        return;
-
-    arg = KdParseFindNext (arg, ",", save, &delim);
-    if (!save[0])
-        return;
-
-    if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
-    {
-        mi->nbutton = save[0] - '0';
-        if (mi->nbutton > KD_MAX_BUTTON)
-        {
-            UseMsg ();
-            return;
-        }
-    }
-
-    if (!delim != ',')
-        return;
-
-    arg = KdParseFindNext (arg, ",", save, &delim);
-
-    if (save[0])
-        mi->prot = KdSaveString (save);
-
-    while (delim == ',')
-    {
-        arg = KdParseFindNext (arg, ",", save, &delim);
-        if (save[0] == '{')
-        {
-            char        *s = save + 1;
-            i = 0;
-            while (*s && *s != '}')
-            {
-                if ('1' <= *s && *s <= '0' + mi->nbutton)
-                    mi->map[i] = *s - '0';
-                else
-                    UseMsg ();
-                s++;
-            }
-        }
-        else if (!strcmp (save, "2button"))
-            mi->emulateMiddleButton = TRUE;
-        else if (!strcmp (save, "3button"))
-            mi->emulateMiddleButton = FALSE;
-        else if (!strcmp (save, "rawcoord"))
-            mi->transformCoordinates = FALSE;
-        else if (!strcmp (save, "transform"))
-            mi->transformCoordinates = TRUE;
-        else
-            UseMsg ();
-    }
-}
-
-KdMouseInfo *kdMouseInfo;
-
-KdMouseInfo *
-KdMouseInfoAdd (void)
-{
-    KdMouseInfo *mi, **prev;
-
-    mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
-    if (!mi)
-        return 0;
-    bzero (mi, sizeof (KdMouseInfo));
-    for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
-    *prev = mi;
-    return mi;
-}
-
-void
-KdMouseInfoDispose (KdMouseInfo *mi)
-{
-    KdMouseInfo **prev;
-
-    for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
-        if (*prev == mi)
-        {
-            *prev = mi->next;
-            if (mi->name)
-                xfree (mi->name);
-            if (mi->prot)
-                xfree (mi->prot);
-            xfree (mi);
-            break;
-        }
-}
diff --git a/hw/xgl/glx/Makefile.am b/hw/xgl/glx/Makefile.am
deleted file mode 100644
index ea34ea4..0000000
--- a/hw/xgl/glx/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-if XGL
-XGL_MODULE_DIRS = module
-endif
-
-DIST_SUBDIRS = module
-
-SUBDIRS =		  \
-	.		  \
-	$(XGL_MODULE_DIRS)
-
-AM_CFLAGS = \
-	-I$(srcdir)/.. \
-	-I$(srcdir)/../glxext \
-	-I$(top_srcdir)/glx \
-	-I$(top_srcdir)/GL/include \
-	-I at MESA_SOURCE@/include \
-	-I at MESA_SOURCE@/src/mesa/glapi \
-	 $(DIX_CFLAGS) \
-	-DHAVE_XGL_CONFIG_H \
-	-DHAVE_DIX_CONFIG_H \
-	$(XGLXMODULES_CFLAGS)
-
-noinst_LTLIBRARIES = libxglx.la
-
-libxglx_la_SOURCES = \
-	xglx.h	     \
-	xglx.c	     \
-	xglxorg.c
-
-# Xglx_DEPENDENCIES = @XGLX_LIBS@
-# Xglx_LDFLAGS	  = -export-dynamic
-# Xglx_SOURCES	  = \
-#	xglxinit.c \
-#	$(top_srcdir)/mi/miinitext.c \
-#	$(top_srcdir)/Xext/dpmsstubs.c \
-#	$(top_srcdir)/Xi/stubs.c \
-#	$(top_srcdir)/fb/fbcmap.c
-#Xglx_LDADD = \
-#	libxglx.la \
-#	../libxgl.a \
-#	$(XORG_CORE_LIBS) \
-#	$(XGLX_LIBS) \
-#	$(EXTENSION_LIBS) \
-#	$(XGLXMODULES_LIBS) \
-#	-lXrandr
-#Xglx_programs	  = Xglx
-#
-#bin_PROGRAMS = $(Xglx_programs)
diff --git a/hw/xgl/glx/module/Makefile.am b/hw/xgl/glx/module/Makefile.am
deleted file mode 100644
index bd1c4b0..0000000
--- a/hw/xgl/glx/module/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-if GLX
-GLX_LIB = $(top_builddir)/hw/xgl/glxext/libxglglxext.la
-endif
-
-AM_CFLAGS = $(DIX_CFLAGS) \
-	-I$(srcdir)/.. \
-	-I$(srcdir)/../.. \
-	$(XGLXMODULES_CFLAGS)
-
-libxglx_la_DEPENDENCIES = $(GLX_LIB)
-libxglx_la_LDFLAGS = -avoid-version
-libxglx_la_SOURCES = xglxmodule.c
-libxglx_la_LIBADD = \
-	$(top_builddir)/hw/xgl/glx/libxglx.la \
-	$(GLX_LIB) \
-	$(XGLXMODULES_LIBS) \
-	-lXrandr
-
-moduledir = @xglmoduledir@
-
-module_LTLIBRARIES = libxglx.la
diff --git a/hw/xgl/glx/module/xglxmodule.c b/hw/xgl/glx/module/xglxmodule.c
deleted file mode 100644
index 40af890..0000000
--- a/hw/xgl/glx/module/xglxmodule.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglx.h"
-#include "xglmodule.h"
-
-#include <glitz-glx.h>
-
-char *
-moduleVersion (void)
-{
-    return VERSION;
-}
-
-Bool
-moduleInit (const char *module)
-{
-    glitz_glx_init (module);
-
-    return TRUE;
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
-{
-    xglxInitOutput (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
-	       DeviceIntPtr pDev)
-{
-    return xglxLegalModifier (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
-    xglxProcessInputEvents ();
-}
-
-void
-InitInput (int	argc,
-	   char	**argv)
-{
-    xglxInitInput (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
-    ErrorF ("\nXglx usage:\n");
-    xglxUseMsg ();
-}
-
-int
-ddxProcessArgument (int	 argc,
-		    char **argv,
-		    int	 i)
-{
-    return xglxProcessArgument (argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
-    xglxAbort ();
-}
-
-void
-ddxGiveUp (void)
-{
-    xglxGiveUp ();
-}
-
-void
-OsVendorInit (void)
-{
-    xglxOsVendorInit ();
-}
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
deleted file mode 100644
index 33b276b..0000000
--- a/hw/xgl/glx/xglx.c
+++ /dev/null
@@ -1,1444 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglx.h"
-
-#include <X11/extensions/Xrandr.h>
-#include <X11/cursorfont.h>
-
-#include <glitz-glx.h>
-
-#ifdef GLXEXT
-#include "xglglxext.h"
-#endif
-
-#include "inputstr.h"
-#include "cursorstr.h"
-#include "mipointer.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <math.h>
-
-#ifdef XKB
-#include <X11/extensions/XKB.h>
-#include <xkbsrv.h>
-#include <X11/extensions/XKBconfig.h>
-
-extern Bool
-XkbQueryExtension (Display *dpy,
-		   int     *opcodeReturn,
-		   int     *eventBaseReturn,
-		   int     *errorBaseReturn,
-		   int     *majorRtrn,
-		   int     *minorRtrn);
-
-extern XkbDescPtr
-XkbGetKeyboard (Display      *dpy,
-		unsigned int which,
-		unsigned int deviceSpec);
-
-extern Status
-XkbGetControls (Display	    *dpy,
-		unsigned long which,
-		XkbDescPtr    desc);
-
-#ifndef XKB_BASE_DIRECTORY
-#define	XKB_BASE_DIRECTORY	"/usr/lib/X11/xkb/"
-#endif
-#ifndef XKB_CONFIG_FILE
-#define	XKB_CONFIG_FILE		"X0-config.keyboard"
-#endif
-#ifndef XKB_DFLT_RULES_FILE
-#define	XKB_DFLT_RULES_FILE	"xorg"
-#endif
-#ifndef XKB_DFLT_KB_LAYOUT
-#define	XKB_DFLT_KB_LAYOUT	"us"
-#endif
-#ifndef XKB_DFLT_KB_MODEL
-#define	XKB_DFLT_KB_MODEL	"pc101"
-#endif
-#ifndef XKB_DFLT_KB_VARIANT
-#define	XKB_DFLT_KB_VARIANT	NULL
-#endif
-#ifndef XKB_DFLT_KB_OPTIONS
-#define	XKB_DFLT_KB_OPTIONS	NULL
-#endif
-
-#endif
-
-#define XGLX_DEFAULT_SCREEN_WIDTH  800
-#define XGLX_DEFAULT_SCREEN_HEIGHT 600
-
-typedef struct _xglxScreen {
-    Window	       win, root;
-    Colormap	       colormap;
-    Bool	       fullscreen;
-    CloseScreenProcPtr CloseScreen;
-} xglxScreenRec, *xglxScreenPtr;
-
-DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey;
-
-#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey))
-
-#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
-    dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v)
-
-#define XGLX_SCREEN_PRIV(pScreen)			       \
-    xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen)
-
-typedef struct _xglxCursor {
-    Cursor cursor;
-} xglxCursorRec, *xglxCursorPtr;
-
-#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen)		   \
-    ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
-
-#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v)	 \
-    dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
-
-#define XGLX_CURSOR_PRIV(pCursor, pScreen)			        \
-    xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
-
-static char	 *xDisplayName = 0;
-static Display	 *xdisplay     = 0;
-static int	 xscreen;
-static CARD32	 lastEventTime = 0;
-static ScreenPtr currentScreen = 0;
-static Bool	 softCursor    = FALSE;
-static Bool	 fullscreen    = TRUE;
-
-static Bool randrExtension = FALSE;
-static int  randrEvent, randrError;
-
-static glitz_drawable_format_t *xglxScreenFormat = 0;
-
-static Bool
-xglxAllocatePrivates (ScreenPtr pScreen)
-{
-    xglxScreenPtr pScreenPriv;
-
-    pScreenPriv = xalloc (sizeof (xglxScreenRec));
-    if (!pScreenPriv)
-	return FALSE;
-
-    XGLX_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
-    return TRUE;
-}
-
-#ifdef RANDR
-
-#define DEFAULT_REFRESH_RATE 50
-
-static Bool
-xglxRandRGetInfo (ScreenPtr pScreen,
-		  Rotation  *rotations)
-{
-    RRScreenSizePtr pSize;
-
-    *rotations = RR_Rotate_0;
-
-    if (randrExtension)
-    {
-	XRRScreenConfiguration *xconfig;
-	XRRScreenSize	       *sizes;
-	int		       nSizes, currentSize = 0;
-	short		       *rates, currentRate;
-	int		       nRates, i, j;
-
-	XGLX_SCREEN_PRIV (pScreen);
-
-	xconfig	    = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
-	sizes	    = XRRConfigSizes (xconfig, &nSizes);
-	currentRate = XRRConfigCurrentRate (xconfig);
-
-	if (pScreenPriv->fullscreen)
-	{
-	    Rotation rotation;
-
-	    currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
-
-	    for (i = 0; i < nSizes; i++)
-	    {
-		pSize = RRRegisterSize (pScreen,
-					sizes[i].width,
-					sizes[i].height,
-					sizes[i].mwidth,
-					sizes[i].mheight);
-
-		rates = XRRConfigRates (xconfig, i, &nRates);
-
-		for (j = 0; j < nRates; j++)
-		{
-		    RRRegisterRate (pScreen, pSize, rates[j]);
-
-		    if (i == currentSize && rates[j] == currentRate)
-			RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
-					    pSize);
-		}
-	    }
-	}
-	else
-	{
-	    pSize = RRRegisterSize (pScreen,
-				    pScreen->width,
-				    pScreen->height,
-				    pScreen->mmWidth,
-				    pScreen->mmHeight);
-
-	    for (i = 0; i < nSizes; i++)
-	    {
-		rates = XRRConfigRates (xconfig, i, &nRates);
-
-		for (j = 0; j < nRates; j++)
-		{
-		    RRRegisterRate (pScreen, pSize, rates[j]);
-
-		    if (rates[j] == currentRate)
-			RRSetCurrentConfig (pScreen, RR_Rotate_0, currentRate,
-					    pSize);
-		}
-	    }
-	}
-
-	XRRFreeScreenConfigInfo (xconfig);
-    }
-    else
-    {
-	pSize = RRRegisterSize (pScreen,
-				pScreen->width,
-				pScreen->height,
-				pScreen->mmWidth,
-				pScreen->mmHeight);
-
-	RRRegisterRate (pScreen, pSize, DEFAULT_REFRESH_RATE);
-	RRSetCurrentConfig (pScreen, RR_Rotate_0, DEFAULT_REFRESH_RATE, pSize);
-    }
-
-    return TRUE;
-}
-
-static Bool
-xglxRandRSetConfig (ScreenPtr	    pScreen,
-		    Rotation	    rotations,
-		    int		    rate,
-		    RRScreenSizePtr pSize)
-{
-    if (randrExtension)
-    {
-	XRRScreenConfiguration *xconfig;
-	XRRScreenSize	       *sizes;
-	int		       nSizes, currentSize;
-	int		       i, size = -1;
-	int		       status = RRSetConfigFailed;
-	Rotation	       rotation;
-
-	XGLX_SCREEN_PRIV (pScreen);
-
-	xconfig	    = XRRGetScreenInfo (xdisplay, pScreenPriv->root);
-	sizes	    = XRRConfigSizes (xconfig, &nSizes);
-	currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
-
-	for (i = 0; i < nSizes; i++)
-	{
-	    if (pScreenPriv->fullscreen)
-	    {
-		if (sizes[i].width   == pSize->width   &&
-		    sizes[i].height  == pSize->height  &&
-		    sizes[i].mwidth  == pSize->mmWidth &&
-		    sizes[i].mheight == pSize->mmHeight)
-		{
-		    size = i;
-		    break;
-		}
-	    }
-	    else
-	    {
-		short *rates;
-		int   nRates, j;
-
-		rates = XRRConfigRates (xconfig, i, &nRates);
-
-		for (j = 0; j < nRates; j++)
-		{
-		    if (rates[j] == rate)
-		    {
-			size = i;
-			if (i >= currentSize)
-			    break;
-		    }
-		}
-	    }
-	}
-
-	if (size >= 0)
-	    status = XRRSetScreenConfigAndRate (xdisplay,
-						xconfig,
-						pScreenPriv->root,
-						size,
-						RR_Rotate_0,
-						rate,
-						CurrentTime);
-
-	XRRFreeScreenConfigInfo (xconfig);
-
-	if (status == RRSetConfigSuccess)
-	{
-	    PixmapPtr pPixmap;
-
-	    pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
-	    if (pScreenPriv->fullscreen)
-	    {
-		XGL_PIXMAP_PRIV (pPixmap);
-
-		xglSetRootClip (pScreen, FALSE);
-
-		XResizeWindow (xdisplay, pScreenPriv->win,
-			       pSize->width, pSize->height);
-
-		glitz_drawable_update_size (pPixmapPriv->drawable,
-					    pSize->width, pSize->height);
-
-		pScreen->width    = pSize->width;
-		pScreen->height   = pSize->height;
-		pScreen->mmWidth  = pSize->mmWidth;
-		pScreen->mmHeight = pSize->mmHeight;
-
-		(*pScreen->ModifyPixmapHeader) (pPixmap,
-						pScreen->width,
-						pScreen->height,
-						pPixmap->drawable.depth,
-						pPixmap->drawable.bitsPerPixel,
-						0, 0);
-
-		xglSetRootClip (pScreen, TRUE);
-	    }
-
-	    return TRUE;
-	}
-    }
-
-    return FALSE;
-}
-
-static Bool
-xglxRandRInit (ScreenPtr pScreen)
-{
-    rrScrPrivPtr pScrPriv;
-
-    if (!RRScreenInit (pScreen))
-	return FALSE;
-
-    pScrPriv = rrGetScrPriv (pScreen);
-    pScrPriv->rrGetInfo   = xglxRandRGetInfo;
-    pScrPriv->rrSetConfig = xglxRandRSetConfig;
-
-    return TRUE;
-}
-
-#endif
-
-static void
-xglxConstrainCursor (ScreenPtr pScreen,
-		     BoxPtr    pBox)
-{
-}
-
-static void
-xglxCursorLimits (ScreenPtr pScreen,
-		  CursorPtr pCursor,
-		  BoxPtr    pHotBox,
-		  BoxPtr    pTopLeftBox)
-{
-    *pTopLeftBox = *pHotBox;
-}
-
-static Bool
-xglxDisplayCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor)
-{
-    XGLX_SCREEN_PRIV (pScreen);
-    XGLX_CURSOR_PRIV (pCursor, pScreen);
-
-    XDefineCursor (xdisplay, pScreenPriv->win, pCursorPriv->cursor);
-
-    return TRUE;
-}
-
-#ifdef ARGB_CURSOR
-
-static Bool
-xglxARGBCursorSupport (void);
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
-		      CursorPtr pCursor);
-
-#endif
-
-static Bool
-xglxRealizeCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor)
-{
-    xglxCursorPtr pCursorPriv;
-    XImage	  *ximage;
-    Pixmap	  source, mask;
-    XColor	  fgColor, bgColor;
-    XlibGC	  xgc;
-    unsigned long valuemask;
-    XGCValues	  values;
-
-    XGLX_SCREEN_PRIV (pScreen);
-
-    valuemask = GCForeground | GCBackground;
-
-    values.foreground = 1L;
-    values.background = 0L;
-
-    pCursorPriv = xalloc (sizeof (xglxCursorRec));
-    if (!pCursorPriv)
-	return FALSE;
-
-    XGLX_SET_CURSOR_PRIV (pCursor, pScreen, pCursorPriv);
-
-#ifdef ARGB_CURSOR
-    if (pCursor->bits->argb)
-    {
-	pCursorPriv->cursor = xglxCreateARGBCursor (pScreen, pCursor);
-	if (pCursorPriv->cursor)
-	    return TRUE;
-    }
-#endif
-
-    source = XCreatePixmap (xdisplay,
-			    pScreenPriv->win,
-			    pCursor->bits->width,
-			    pCursor->bits->height,
-			    1);
-
-    mask = XCreatePixmap (xdisplay,
-			  pScreenPriv->win,
-			  pCursor->bits->width,
-			  pCursor->bits->height,
-			  1);
-
-    xgc = XCreateGC (xdisplay, source, valuemask, &values);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   1, XYBitmap, 0,
-			   (char *) pCursor->bits->source,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   BitmapPad (xdisplay), 0);
-
-    XPutImage (xdisplay, source, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   1, XYBitmap, 0,
-			   (char *) pCursor->bits->mask,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   BitmapPad (xdisplay), 0);
-
-    XPutImage (xdisplay, mask, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-    XFreeGC (xdisplay, xgc);
-
-    fgColor.red   = pCursor->foreRed;
-    fgColor.green = pCursor->foreGreen;
-    fgColor.blue  = pCursor->foreBlue;
-
-    bgColor.red   = pCursor->backRed;
-    bgColor.green = pCursor->backGreen;
-    bgColor.blue  = pCursor->backBlue;
-
-    pCursorPriv->cursor =
-	XCreatePixmapCursor (xdisplay, source, mask, &fgColor, &bgColor,
-			     pCursor->bits->xhot, pCursor->bits->yhot);
-
-    XFreePixmap (xdisplay, mask);
-    XFreePixmap (xdisplay, source);
-
-    return TRUE;
-}
-
-static Bool
-xglxUnrealizeCursor (ScreenPtr pScreen,
-		     CursorPtr pCursor)
-{
-    XGLX_CURSOR_PRIV (pCursor, pScreen);
-
-    XFreeCursor (xdisplay, pCursorPriv->cursor);
-    xfree (pCursorPriv);
-
-    return TRUE;
-}
-
-static void
-xglxRecolorCursor (ScreenPtr pScreen,
-		   CursorPtr pCursor,
-		   Bool	     displayed)
-{
-    XColor fgColor, bgColor;
-
-    XGLX_CURSOR_PRIV (pCursor, pScreen);
-
-    fgColor.red   = pCursor->foreRed;
-    fgColor.green = pCursor->foreGreen;
-    fgColor.blue  = pCursor->foreBlue;
-
-    bgColor.red   = pCursor->backRed;
-    bgColor.green = pCursor->backGreen;
-    bgColor.blue  = pCursor->backBlue;
-
-    XRecolorCursor (xdisplay, pCursorPriv->cursor, &fgColor, &bgColor);
-}
-
-static Bool
-xglxSetCursorPosition (ScreenPtr pScreen,
-		       int	 x,
-		       int	 y,
-		       Bool	 generateEvent)
-{
-    XGLX_SCREEN_PRIV (pScreen);
-
-    XWarpPointer (xdisplay, pScreenPriv->win, pScreenPriv->win,
-		  0, 0, 0, 0, x, y);
-
-    return TRUE;
-}
-
-static Bool
-xglxCloseScreen (int	   index,
-		 ScreenPtr pScreen)
-{
-    glitz_drawable_t *drawable;
-
-    XGLX_SCREEN_PRIV (pScreen);
-
-    drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
-    if (drawable)
-	glitz_drawable_destroy (drawable);
-
-    xglClearVisualTypes ();
-
-    if (pScreenPriv->win)
-	XDestroyWindow (xdisplay, pScreenPriv->win);
-
-    if (pScreenPriv->colormap)
-	XFreeColormap (xdisplay, pScreenPriv->colormap);
-
-    XGL_SCREEN_UNWRAP (CloseScreen);
-    xfree (pScreenPriv);
-
-    return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-static Bool
-xglxCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y)
-{
-    return FALSE;
-}
-
-static void
-xglxCrossScreen (ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void
-xglxWarpCursor (ScreenPtr pScreen, int x, int y)
-{
-    miPointerWarpCursor (pScreen, x, y);
-}
-
-miPointerScreenFuncRec xglxPointerScreenFuncs = {
-    xglxCursorOffScreen,
-    xglxCrossScreen,
-    xglxWarpCursor
-};
-
-static Bool
-xglxScreenInit (int	  index,
-		ScreenPtr pScreen,
-		int	  argc,
-		char	  **argv)
-{
-    XSetWindowAttributes    xswa;
-    XWMHints		    *wmHints;
-    XSizeHints		    *normalHints;
-    XClassHint		    *classHint;
-    xglxScreenPtr	    pScreenPriv;
-    XVisualInfo		    *vinfo;
-    XEvent		    xevent;
-    glitz_drawable_format_t *format;
-    glitz_drawable_t	    *drawable;
-
-    format = xglxScreenFormat;
-
-    if (!xglxAllocatePrivates (pScreen))
-	return FALSE;
-
-    currentScreen = pScreen;
-
-    pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen);
-
-    pScreenPriv->root	    = RootWindow (xdisplay, xscreen);
-    pScreenPriv->fullscreen = fullscreen;
-
-    vinfo = glitz_glx_get_visual_info_from_format (xdisplay, xscreen, format);
-    if (!vinfo)
-    {
-	ErrorF ("[%d] no visual info from format\n", index);
-	return FALSE;
-    }
-
-    pScreenPriv->colormap =
-	XCreateColormap (xdisplay, pScreenPriv->root, vinfo->visual,
-			 AllocNone);
-
-    if (XRRQueryExtension (xdisplay, &randrEvent, &randrError))
-	randrExtension = TRUE;
-
-    if (fullscreen)
-    {
-	xglScreenInfo.width    = DisplayWidth (xdisplay, xscreen);
-	xglScreenInfo.height   = DisplayHeight (xdisplay, xscreen);
-	xglScreenInfo.widthMm  = DisplayWidthMM (xdisplay, xscreen);
-	xglScreenInfo.heightMm = DisplayHeightMM (xdisplay, xscreen);
-
-	if (randrExtension)
-	{
-	    XRRScreenConfiguration *xconfig;
-	    Rotation		   rotation;
-	    XRRScreenSize	   *sizes;
-	    int			   nSizes, currentSize;
-
-	    xconfig	= XRRGetScreenInfo (xdisplay, pScreenPriv->root);
-	    currentSize = XRRConfigCurrentConfiguration (xconfig, &rotation);
-	    sizes	= XRRConfigSizes (xconfig, &nSizes);
-
-	    xglScreenInfo.width    = sizes[currentSize].width;
-	    xglScreenInfo.height   = sizes[currentSize].height;
-	    xglScreenInfo.widthMm  = sizes[currentSize].mwidth;
-	    xglScreenInfo.heightMm = sizes[currentSize].mheight;
-
-	    XRRFreeScreenConfigInfo (xconfig);
-	}
-    }
-    else if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
-    {
-	xglScreenInfo.width  = XGLX_DEFAULT_SCREEN_WIDTH;
-	xglScreenInfo.height = XGLX_DEFAULT_SCREEN_HEIGHT;
-    }
-
-    xswa.colormap = pScreenPriv->colormap;
-
-    pScreenPriv->win =
-	XCreateWindow (xdisplay, pScreenPriv->root, 0, 0,
-		       xglScreenInfo.width, xglScreenInfo.height, 0,
-		       vinfo->depth, InputOutput, vinfo->visual,
-		       CWColormap, &xswa);
-
-    XFree (vinfo);
-
-    normalHints = XAllocSizeHints ();
-    normalHints->flags      = PMinSize | PMaxSize | PSize;
-    normalHints->min_width  = xglScreenInfo.width;
-    normalHints->min_height = xglScreenInfo.height;
-    normalHints->max_width  = xglScreenInfo.width;
-    normalHints->max_height = xglScreenInfo.height;
-
-    if (fullscreen)
-    {
-	normalHints->x = 0;
-	normalHints->y = 0;
-	normalHints->flags |= PPosition;
-    }
-
-    classHint = XAllocClassHint ();
-    classHint->res_name = "xglx";
-    classHint->res_class = "Xglx";
-
-    wmHints = XAllocWMHints ();
-    wmHints->flags = InputHint;
-    wmHints->input = TRUE;
-
-    Xutf8SetWMProperties (xdisplay, pScreenPriv->win, "Xglx", "Xglx", 0, 0,
-			  normalHints, wmHints, classHint);
-
-    XFree (wmHints);
-    XFree (classHint);
-    XFree (normalHints);
-
-    drawable = glitz_glx_create_drawable_for_window (xdisplay, xscreen,
-						     format, pScreenPriv->win,
-						     xglScreenInfo.width,
-						     xglScreenInfo.height);
-    if (!drawable)
-    {
-	ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
-	return FALSE;
-    }
-
-    XSelectInput (xdisplay, pScreenPriv->win,
-		  ButtonPressMask | ButtonReleaseMask |
-		  KeyPressMask | KeyReleaseMask | EnterWindowMask |
-		  PointerMotionMask | ExposureMask);
-
-    XMapWindow (xdisplay, pScreenPriv->win);
-
-    if (fullscreen)
-    {
-	XClientMessageEvent xev;
-
-	memset (&xev, 0, sizeof (xev));
-
-	xev.type = ClientMessage;
-	xev.message_type = XInternAtom (xdisplay, "_NET_WM_STATE", FALSE);
-	xev.display = xdisplay;
-	xev.window = pScreenPriv->win;
-	xev.format = 32;
-	xev.data.l[0] = 1;
-	xev.data.l[1] =
-	    XInternAtom (xdisplay, "_NET_WM_STATE_FULLSCREEN", FALSE);
-
-	XSendEvent (xdisplay, pScreenPriv->root, FALSE,
-		    SubstructureRedirectMask, (XEvent *) &xev);
-    }
-
-    xglScreenInfo.drawable = drawable;
-
-    if (!xglScreenInit (pScreen))
-	return FALSE;
-
-#ifdef GLXEXT
-    if (!xglInitVisualConfigs (pScreen))
-	return FALSE;
-#endif
-
-    XGL_SCREEN_WRAP (CloseScreen, xglxCloseScreen);
-
-#ifdef ARGB_CURSOR
-    if (!xglxARGBCursorSupport ())
-	softCursor = TRUE;
-#endif
-
-    if (softCursor)
-    {
-	static char data = 0;
-	XColor	    black, dummy;
-	Pixmap	    bitmap;
-	Cursor	    cursor;
-
-	if (!XAllocNamedColor (xdisplay, pScreenPriv->colormap,
-			       "black", &black, &dummy))
-	    return FALSE;
-
-	bitmap = XCreateBitmapFromData (xdisplay, pScreenPriv->win, &data,
-					1, 1);
-	if (!bitmap)
-	    return FALSE;
-
-	cursor = XCreatePixmapCursor (xdisplay, bitmap, bitmap, &black, &black,
-				      0, 0);
-	if (!cursor)
-	    return FALSE;
-
-	XDefineCursor (xdisplay, pScreenPriv->win, cursor);
-
-	XFreeCursor (xdisplay, cursor);
-	XFreePixmap (xdisplay, bitmap);
-	XFreeColors (xdisplay, pScreenPriv->colormap, &black.pixel, 1, 0);
-
-	miDCInitialize (pScreen, &xglxPointerScreenFuncs);
-    }
-    else
-    {
-	pScreen->ConstrainCursor   = xglxConstrainCursor;
-	pScreen->CursorLimits      = xglxCursorLimits;
-	pScreen->DisplayCursor     = xglxDisplayCursor;
-	pScreen->RealizeCursor     = xglxRealizeCursor;
-	pScreen->UnrealizeCursor   = xglxUnrealizeCursor;
-	pScreen->RecolorCursor     = xglxRecolorCursor;
-	pScreen->SetCursorPosition = xglxSetCursorPosition;
-    }
-
-    if (!xglFinishScreenInit (pScreen))
-	return FALSE;
-
-#ifdef RANDR
-    if (!xglxRandRInit (pScreen))
-	return FALSE;
-#endif
-
-    while (XNextEvent (xdisplay, &xevent))
-	if (xevent.type == Expose)
-	    break;
-
-    return TRUE;
-}
-
-void
-xglxInitOutput (ScreenInfo *pScreenInfo,
-		int	   argc,
-		char	   **argv)
-{
-    glitz_drawable_format_t *format, templ;
-    int			    i;
-    unsigned long	    mask;
-    unsigned long	    extraMask[] = {
-	GLITZ_FORMAT_DOUBLEBUFFER_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK,
-	GLITZ_FORMAT_DOUBLEBUFFER_MASK,
-	GLITZ_FORMAT_ALPHA_SIZE_MASK,
-	0
-    };
-
-    xglClearVisualTypes ();
-
-    xglSetPixmapFormats (pScreenInfo);
-
-    if (!xdisplay)
-    {
-	char *name = xDisplayName;
-
-	if (!name)
-	    name = xglxInitXorg ();
-
-	xdisplay = XOpenDisplay (name);
-	if (!xdisplay)
-	    FatalError ("can't open display: %s\n", name ? name : "NULL");
-
-	xscreen = DefaultScreen (xdisplay);
-
-	if (!xDisplayName)
-	    XDefineCursor (xdisplay, RootWindow (xdisplay, xscreen),
-			   XCreateFontCursor (xdisplay, XC_watch));
-    }
-
-    templ.samples          = 1;
-    templ.doublebuffer     = 1;
-    templ.color.fourcc     = GLITZ_FOURCC_RGB;
-    templ.color.alpha_size = 8;
-
-    mask = GLITZ_FORMAT_SAMPLES_MASK | GLITZ_FORMAT_FOURCC_MASK;
-
-    for (i = 0; i < sizeof (extraMask) / sizeof (extraMask[0]); i++)
-    {
-	format = glitz_glx_find_window_format (xdisplay, xscreen,
-					       mask | extraMask[i],
-					       &templ, 0);
-	if (format)
-	    break;
-    }
-
-    if (!format)
-	FatalError ("no visual format found");
-
-    xglScreenInfo.depth =
-	format->color.red_size   +
-	format->color.green_size +
-	format->color.blue_size;
-
-    xglSetVisualTypes (xglScreenInfo.depth,
-		       (1 << TrueColor),
-		       format->color.red_size,
-		       format->color.green_size,
-		       format->color.blue_size);
-
-    xglxScreenFormat = format;
-
-    AddScreen (xglxScreenInit, argc, argv);
-}
-
-static Bool
-xglxExposurePredicate (Display *xdisplay,
-		       XEvent  *xevent,
-		       char    *args)
-{
-    return (xevent->type == Expose);
-}
-
-static Bool
-xglxNotExposurePredicate (Display *xdisplay,
-			  XEvent  *xevent,
-			  char	  *args)
-{
-    return (xevent->type != Expose);
-}
-
-static int
-xglxWindowExposures (WindowPtr pWin,
-		     pointer   pReg)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    RegionRec ClipList;
-
-    if (HasBorder (pWin))
-    {
-	REGION_INIT (pScreen, &ClipList, NullBox, 0);
-	REGION_SUBTRACT (pScreen, &ClipList, &pWin->borderClip,
-			 &pWin->winSize);
-	REGION_INTERSECT (pScreen, &ClipList, &ClipList, (RegionPtr) pReg);
-	miPaintWindow(pWin, &ClipList, PW_BORDER);
-	REGION_UNINIT (pScreen, &ClipList);
-    }
-
-    REGION_INIT (pScreen, &ClipList, NullBox, 0);
-    REGION_INTERSECT (pScreen, &ClipList, &pWin->clipList, (RegionPtr) pReg);
-    (*pScreen->WindowExposures) (pWin, &ClipList, NullRegion);
-    REGION_UNINIT (pScreen, &ClipList);
-
-    return WT_WALKCHILDREN;
-}
-
-static void
-xglxBlockHandler (pointer   blockData,
-		  OSTimePtr pTimeout,
-		  pointer   pReadMask)
-{
-    XEvent    X;
-    RegionRec region;
-    BoxRec    box;
-
-    XGL_SCREEN_PRIV (currentScreen);
-
-    while (XCheckIfEvent (xdisplay, &X, xglxExposurePredicate, NULL))
-    {
-	ScreenPtr pScreen = currentScreen;
-
-	box.x1 = X.xexpose.x;
-	box.y1 = X.xexpose.y;
-	box.x2 = box.x1 + X.xexpose.width;
-	box.y2 = box.y1 + X.xexpose.height;
-
-	REGION_INIT (currentScreen, &region, &box, 1);
-
-	WalkTree (pScreen, xglxWindowExposures, &region);
-
-	REGION_UNINIT (pScreen, &region);
-    }
-
-    if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    glitz_surface_flush (pScreenPriv->surface);
-    glitz_drawable_flush (pScreenPriv->drawable);
-
-    XFlush (xdisplay);
-}
-
-static void
-xglxWakeupHandler (pointer blockData,
-		   int     result,
-		   pointer pReadMask)
-{
-    ScreenPtr pScreen = currentScreen;
-    XEvent    X;
-    xEvent    x;
-
-    while (XCheckIfEvent (xdisplay, &X, xglxNotExposurePredicate, NULL))
-    {
-	switch (X.type) {
-	case KeyPress:
-	    x.u.u.type = KeyPress;
-	    x.u.u.detail = X.xkey.keycode;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case KeyRelease:
-	    x.u.u.type = KeyRelease;
-	    x.u.u.detail = X.xkey.keycode;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case ButtonPress:
-	    x.u.u.type = ButtonPress;
-	    x.u.u.detail = X.xbutton.button;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case ButtonRelease:
-	    x.u.u.type = ButtonRelease;
-	    x.u.u.detail = X.xbutton.button;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    mieqEnqueue (&x);
-	    break;
-	case MotionNotify:
-	    x.u.u.type = MotionNotify;
-	    x.u.u.detail = 0;
-	    x.u.keyButtonPointer.rootX = X.xmotion.x;
-	    x.u.keyButtonPointer.rootY = X.xmotion.y;
-	    x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis ();
-	    miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, lastEventTime);
-	    mieqEnqueue (&x);
-	    break;
-	case EnterNotify:
-	    if (X.xcrossing.detail != NotifyInferior) {
-		if (pScreen) {
-		    NewCurrentScreen (pScreen, X.xcrossing.x, X.xcrossing.y);
-		    x.u.u.type = MotionNotify;
-		    x.u.u.detail = 0;
-		    x.u.keyButtonPointer.rootX = X.xcrossing.x;
-		    x.u.keyButtonPointer.rootY = X.xcrossing.y;
-		    x.u.keyButtonPointer.time = lastEventTime =
-			GetTimeInMillis ();
-		    mieqEnqueue (&x);
-		}
-	    }
-	    break;
-	default:
-	    break;
-	}
-    }
-}
-
-static void
-xglxBell (int	       volume,
-	  DeviceIntPtr pDev,
-	  pointer      ctrl,
-	  int	       cls)
-{
-  XBell (xdisplay, volume);
-}
-
-static void
-xglxKbdCtrl (DeviceIntPtr pDev,
-	     KeybdCtrl    *ctrl)
-{
-    unsigned long    valueMask;
-    XKeyboardControl values;
-    int		     i;
-
-    valueMask = KBKeyClickPercent | KBBellPercent | KBBellPitch |
-	KBBellDuration | KBAutoRepeatMode;
-
-    values.key_click_percent = ctrl->click;
-    values.bell_percent	     = ctrl->bell;
-    values.bell_pitch	     = ctrl->bell_pitch;
-    values.bell_duration     = ctrl->bell_duration;
-    values.auto_repeat_mode  = (ctrl->autoRepeat) ? AutoRepeatModeOn :
-	AutoRepeatModeOff;
-
-    XChangeKeyboardControl (xdisplay, valueMask, &values);
-
-    valueMask = KBLed | KBLedMode;
-
-    for (i = 1; i <= 32; i++)
-    {
-	values.led = i;
-	values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn :
-	    LedModeOff;
-
-	XChangeKeyboardControl (xdisplay, valueMask, &values);
-    }
-}
-
-static int
-xglxKeybdProc (DeviceIntPtr pDevice,
-	       int	    onoff)
-{
-    Bool      ret = FALSE;
-    DevicePtr pDev = (DevicePtr) pDevice;
-
-    if (!pDev)
-	return BadImplementation;
-
-    switch (onoff) {
-    case DEVICE_INIT: {
-      XModifierKeymap *xmodMap;
-      KeySym	      *xkeyMap;
-      int	      minKeyCode, maxKeyCode, mapWidth, i, j;
-      KeySymsRec      xglxKeySyms;
-      CARD8	      xglxModMap[256];
-      XKeyboardState  values;
-
-#ifdef _XSERVER64
-      KeySym64	      *xkeyMap64;
-      int	      len;
-#endif
-
-#ifdef XKB
-      Bool	      xkbExtension = FALSE;
-      int	      xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor;
-#endif
-
-      if (pDev != (DevicePtr)inputInfo.keyboard)
-	  return !Success;
-
-      xmodMap = XGetModifierMapping (xdisplay);
-
-      XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode);
-
-#ifdef _XSERVER64
-      xkeyMap64 = XGetKeyboardMapping (xdisplay,
-				       minKeyCode,
-				       maxKeyCode - minKeyCode + 1,
-				       &mapWidth);
-
-      len = (maxKeyCode - minKeyCode + 1) * mapWidth;
-      xkeyMap = (KeySym *) xalloc (len * sizeof (KeySym));
-      for (i = 0; i < len; ++i)
-	  xkeyMap[i] = xkeyMap64[i];
-
-      XFree (xkeyMap64);
-#else
-      xkeyMap = XGetKeyboardMapping (xdisplay,
-				     minKeyCode,
-				     maxKeyCode - minKeyCode + 1,
-				     &mapWidth);
-#endif
-
-      memset (xglxModMap, 0, 256);
-
-      for (j = 0; j < 8; j++)
-      {
-	  for (i = 0; i < xmodMap->max_keypermod; i++)
-	  {
-	      CARD8 keyCode;
-
-	      keyCode = xmodMap->modifiermap[j * xmodMap->max_keypermod + i];
-	      if (keyCode)
-		  xglxModMap[keyCode] |= 1 << j;
-	  }
-      }
-
-      XFreeModifiermap (xmodMap);
-
-      xglxKeySyms.minKeyCode = minKeyCode;
-      xglxKeySyms.maxKeyCode = maxKeyCode;
-      xglxKeySyms.mapWidth   = mapWidth;
-      xglxKeySyms.map	     = xkeyMap;
-
-#ifdef XKB
-      if (!noXkbExtension)
-	  xkbExtension = XkbQueryExtension (xdisplay,
-					    &xkbOp, &xkbEvent, &xkbError,
-					    &xkbMajor, &xkbMinor);
-
-      if (xkbExtension)
-      {
-	  XkbDescPtr desc;
-	  char	     *rules, *model, *layout, *variants, *options;
-
-	  desc = XkbGetKeyboard (xdisplay,
-				 XkbGBN_AllComponentsMask,
-				 XkbUseCoreKbd);
-
-	  if (desc && desc->geom)
-	  {
-	      XkbComponentNamesRec names;
-	      FILE		   *file;
-
-	      rules    = XKB_DFLT_RULES_FILE;
-	      model    = XKB_DFLT_KB_MODEL;
-	      layout   = XKB_DFLT_KB_LAYOUT;
-	      variants = XKB_DFLT_KB_VARIANT;
-	      options  = XKB_DFLT_KB_OPTIONS;
-
-	      XkbGetControls (xdisplay, XkbAllControlsMask, desc);
-
-	      memset (&names, 0, sizeof (XkbComponentNamesRec));
-
-	      XkbSetRulesDflts (rules, model, layout, variants, options);
-
-	      ret = XkbInitKeyboardDeviceStruct ((pointer) pDev,
-						 &names,
-						 &xglxKeySyms,
-						 xglxModMap,
-						 xglxBell,
-						 xglxKbdCtrl);
-
-	      if (ret)
-		  XkbDDXChangeControls ((pointer) pDev, desc->ctrls,
-					desc->ctrls);
-
-	      XkbFreeKeyboard (desc, 0, False);
-	  }
-      }
-#endif
-
-      if (!ret)
-      {
-	  XGetKeyboardControl (xdisplay, &values);
-
-	  memmove (defaultKeyboardControl.autoRepeats,
-		   values.auto_repeats, sizeof (values.auto_repeats));
-
-	  ret = InitKeyboardDeviceStruct (pDev,
-					  &xglxKeySyms,
-					  xglxModMap,
-					  xglxBell,
-					  xglxKbdCtrl);
-      }
-
-#ifdef _XSERVER64
-      xfree (xkeyMap);
-#else
-      XFree (xkeyMap);
-#endif
-
-      if (!ret)
-	  return BadImplementation;
-
-    } break;
-    case DEVICE_ON:
-	pDev->on = TRUE;
-	break;
-    case DEVICE_OFF:
-    case DEVICE_CLOSE:
-	pDev->on = FALSE;
-	break;
-    }
-
-    return Success;
-}
-
-Bool
-xglxLegalModifier (unsigned int key,
-		   DeviceIntPtr pDev)
-{
-    return TRUE;
-}
-
-void
-xglxProcessInputEvents (void)
-{
-    mieqProcessInputEvents ();
-    miPointerUpdate ();
-}
-
-void
-xglxInitInput (int  argc,
-	       char **argv)
-{
-    DeviceIntPtr pKeyboard, pPointer;
-
-    pPointer  = AddInputDevice (xglMouseProc, TRUE);
-    pKeyboard = AddInputDevice (xglxKeybdProc, TRUE);
-
-    RegisterPointerDevice (pPointer);
-    RegisterKeyboardDevice (pKeyboard);
-
-    miRegisterPointerDevice (screenInfo.screens[0], pPointer);
-    mieqInit (&pKeyboard->public, &pPointer->public);
-
-    AddEnabledDevice (XConnectionNumber (xdisplay));
-
-    RegisterBlockAndWakeupHandlers (xglxBlockHandler,
-				    xglxWakeupHandler,
-				    NULL);
-}
-
-void
-xglxUseMsg (void)
-{
-    ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
-	    "specify screen characteristics\n");
-    ErrorF ("-fullscreen            run fullscreen\n");
-    ErrorF ("-display string        display name of the real server\n");
-    ErrorF ("-softcursor            force software cursor\n");
-
-    if (!xDisplayName)
-	xglxUseXorgMsg ();
-}
-
-int
-xglxProcessArgument (int  argc,
-		     char **argv,
-		     int  i)
-{
-    static Bool checkDisplayName = FALSE;
-
-    if (!checkDisplayName)
-    {
-	char *display = ":0";
-	int  j;
-
-	for (j = i; j < argc; j++)
-	{
-	    if (!strcmp (argv[j], "-display"))
-	    {
-		if (++j < argc)
-		    xDisplayName = argv[j];
-
-		break;
-	    }
-	    else if (argv[j][0] == ':')
-	    {
-		display = argv[j];
-	    }
-	}
-
-	if (!xDisplayName)
-	    xDisplayName = getenv ("DISPLAY");
-
-	if (xDisplayName)
-	{
-	    int n;
-
-	    n = strspn (xDisplayName, ":0123456789");
-	    if (strncmp (xDisplayName, display, n) == 0)
-		xDisplayName = 0;
-	}
-
-	if (xDisplayName)
-	    fullscreen = FALSE;
-
-	checkDisplayName = TRUE;
-    }
-
-    if (!strcmp (argv[i], "-screen"))
-    {
-	if ((i + 1) < argc)
-	{
-	    xglParseScreen (argv[i + 1]);
-	}
-	else
-	    return 1;
-
-	return 2;
-    }
-    else if (!strcmp (argv[i], "-fullscreen"))
-    {
-	fullscreen = TRUE;
-	return 1;
-    }
-    else if (!strcmp (argv[i], "-display"))
-    {
-	if (++i < argc)
-	    return 2;
-
-	return 0;
-    }
-    else if (!strcmp (argv[i], "-softcursor"))
-    {
-	softCursor = TRUE;
-	return 1;
-    }
-    else if (!xDisplayName)
-    {
-	return xglxProcessXorgArgument (argc, argv, i);
-    }
-
-    return 0;
-}
-
-void
-xglxAbort (void)
-{
-    xglxAbortXorg ();
-}
-
-void
-xglxGiveUp (void)
-{
-    AbortDDX ();
-}
-
-void
-xglxOsVendorInit (void)
-{
-}
-
-#ifdef ARGB_CURSOR
-
-#include <X11/extensions/Xrender.h>
-
-static Bool
-xglxARGBCursorSupport (void)
-{
-    int renderMajor, renderMinor;
-
-    if (!XRenderQueryVersion (xdisplay, &renderMajor, &renderMinor))
-	renderMajor = renderMinor = -1;
-
-    return (renderMajor > 0 || renderMinor > 4);
-}
-
-static Cursor
-xglxCreateARGBCursor (ScreenPtr pScreen,
-		      CursorPtr pCursor)
-{
-    Pixmap	      xpixmap;
-    XlibGC	      xgc;
-    XImage	      *ximage;
-    XRenderPictFormat *xformat;
-    Picture	      xpicture;
-    Cursor	      cursor;
-
-    XGLX_SCREEN_PRIV (pScreen);
-
-    xpixmap = XCreatePixmap (xdisplay,
-			     pScreenPriv->win,
-			     pCursor->bits->width,
-			     pCursor->bits->height,
-			     32);
-
-    xgc = XCreateGC (xdisplay, xpixmap, 0, NULL);
-
-    ximage = XCreateImage (xdisplay,
-			   DefaultVisual (xdisplay, xscreen),
-			   32, ZPixmap, 0,
-			   (char *) pCursor->bits->argb,
-			   pCursor->bits->width,
-			   pCursor->bits->height,
-			   32, pCursor->bits->width * 4);
-
-    XPutImage (xdisplay, xpixmap, xgc, ximage,
-	       0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height);
-
-    XFree (ximage);
-    XFreeGC (xdisplay, xgc);
-
-    xformat = XRenderFindStandardFormat (xdisplay, PictStandardARGB32);
-    xpicture = XRenderCreatePicture (xdisplay, xpixmap, xformat, 0, 0);
-
-    cursor = XRenderCreateCursor (xdisplay, xpicture,
-				  pCursor->bits->xhot,
-				  pCursor->bits->yhot);
-
-    XRenderFreePicture (xdisplay, xpicture);
-    XFreePixmap (xdisplay, xpixmap);
-
-    return cursor;
-}
-
-#endif
diff --git a/hw/xgl/glx/xglx.h b/hw/xgl/glx/xglx.h
deleted file mode 100644
index a8c8946..0000000
--- a/hw/xgl/glx/xglx.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#ifndef _XGLX_H_
-#define _XGLX_H_
-
-#include "xgl.h"
-
-#ifdef _XSERVER64
-#define _XSERVER64_tmp
-#undef _XSERVER64
-typedef unsigned long XID64;
-typedef unsigned long Mask64;
-typedef unsigned long Atom64;
-typedef unsigned long VisualID64;
-typedef unsigned long Time64;
-#define XID      XID64
-#define Mask     Mask64
-#define Atom     Atom64
-#define VisualID VisualID64
-#define Time     Time64
-typedef XID Window64;
-typedef XID Drawable64;
-typedef XID Font64;
-typedef XID Pixmap64;
-typedef XID Cursor64;
-typedef XID Colormap64;
-typedef XID GContext64;
-typedef XID KeySym64;
-#define Window   Window64
-#define Drawable Drawable64
-#define Font     Font64
-#define Pixmap   Pixmap64
-#define Cursor   Cursor64
-#define Colormap Colormap64
-#define GContext GContext64
-#define KeySym   KeySym64
-#endif
-
-#define GC XlibGC
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#undef GC
-
-#ifdef _XSERVER64_tmp
-#ifndef _XSERVER64
-#define _XSERVER64
-#endif
-#undef _XSERVER64_tmp
-#undef XID
-#undef Mask
-#undef Atom
-#undef VisualID
-#undef Time
-#undef Window
-#undef Drawable
-#undef Font
-#undef Pixmap
-#undef Cursor
-#undef Colormap
-#undef GContext
-#undef KeySym
-#endif
-
-void
-xglxInitOutput (ScreenInfo *pScreenInfo,
-		int	   argc,
-		char	   **argv);
-
-Bool
-xglxLegalModifier (unsigned int key,
-		   DeviceIntPtr pDev);
-
-void
-xglxProcessInputEvents (void);
-
-void
-xglxInitInput (int  argc,
-	       char **argv);
-
-void
-xglxUseMsg (void);
-
-int
-xglxProcessArgument (int  argc,
-		     char **argv,
-		     int  i);
-
-void
-xglxAbort (void);
-
-void
-xglxGiveUp (void);
-
-void
-xglxOsVendorInit (void);
-
-#ifndef NXGLXORG
-
-void
-xglxUseXorgMsg (void);
-
-int
-xglxProcessXorgArgument (int  argc,
-			 char **argv,
-			 int  i);
-
-void
-xglxAbortXorg (void);
-
-char *
-xglxInitXorg (void);
-
-#endif
-
-#endif /* _XGLX_H_ */
diff --git a/hw/xgl/glx/xglxinit.c b/hw/xgl/glx/xglxinit.c
deleted file mode 100644
index 0348d1f..0000000
--- a/hw/xgl/glx/xglxinit.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglx.h"
-#include "xglglx.h"
-
-xglScreenInfoRec xglScreenInfo = {
-    NULL, 0, 0, 0, 0, 0,
-    DEFAULT_GEOMETRY_DATA_TYPE,
-    DEFAULT_GEOMETRY_USAGE,
-    FALSE,
-    XGL_DEFAULT_PBO_MASK,
-    FALSE,
-    {
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } }
-    }
-};
-
-#ifdef GLXEXT
-static Bool loadGlx = TRUE;
-
-#ifndef NGLXEXTLOG
-static char *glxExtLogFile = 0;
-#endif
-
-#endif
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
-{
-
-#ifdef GLXEXT
-    if (loadGlx)
-    {
-	if (!xglLoadGLXModules ())
-	    FatalError ("No GLX modules loaded");
-
-#ifndef NGLXEXTLOG
-	if (glxExtLogFile)
-	{
-	    __xglGLXLogFp = fopen (glxExtLogFile, "w");
-	    if (!__xglGLXLogFp)
-		perror ("InitOutput");
-	}
-	else
-	    __xglGLXLogFp = 0;
-#endif
-
-    }
-#endif
-
-    xglxInitOutput (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
-	       DeviceIntPtr pDev)
-{
-    return xglxLegalModifier (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
-    xglxProcessInputEvents ();
-}
-
-void
-InitInput (int  argc,
-	   char **argv)
-{
-    xglxInitInput (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
-    ErrorF ("\nXgl usage:\n");
-
-#ifdef GLXEXT
-    ErrorF ("-noglx                 don't load glx extension\n");
-
-#ifndef NGLXEXTLOG
-    ErrorF ("-glxlog file           glx extension log file\n");
-#endif
-
-#endif
-
-    xglUseMsg ();
-    ErrorF ("\nXglx usage:\n");
-    xglxUseMsg ();
-}
-
-int
-ddxProcessArgument (int  argc,
-		    char **argv,
-		    int  i)
-{
-    int skip;
-
-#ifdef GLXEXT
-    if (!strcmp (argv[i], "-noglx"))
-    {
-	loadGlx = FALSE;
-	return 1;
-    }
-
-#ifndef NGLXEXTLOG
-    else if (!strcmp (argv[i], "-glxlog"))
-    {
-	if (++i < argc)
-	    glxExtLogFile = argv[i];
-    }
-#endif
-
-#endif
-
-    skip = xglProcessArgument (argc, argv, i);
-    if (skip)
-	return skip;
-
-    return xglxProcessArgument (argc, argv, i);
-}
-
-void
-AbortDDX (void)
-{
-    xglxAbort ();
-}
-
-void
-ddxGiveUp (void)
-{
-    xglxGiveUp ();
-}
-
-void
-OsVendorInit (void)
-{
-    xglxOsVendorInit ();
-}
diff --git a/hw/xgl/glx/xglxorg.c b/hw/xgl/glx/xglxorg.c
deleted file mode 100644
index 1d6fc9a..0000000
--- a/hw/xgl/glx/xglxorg.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: David Reveman <davidr at novell.com>
- *          Matthias Hopf <mhopf at suse.de>
- */
-
-#include "xglx.h"
-
-#ifndef NXGLXORG
-
-#include <X11/Xauth.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <ctype.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <libgen.h>
-
-typedef void (*sighandler_t) (int);
-
-#define XORG_DIE_TIMEOUT 3
-#define XORG_DEV_RANDOM  "/dev/urandom"
-
-static char xorgAuthBuf[256];
-static char *xorgAuthTempl = "/tmp/.Xgl-auth-XXXXXX";
-static char *xorgAuth      = NULL;
-
-static char *xorgProgs[] = { "/usr/bin/Xorg", "/usr/X11R6/bin/Xorg" };
-static char *xorgProg    = NULL;
-
-static char *xorgDisplay   = ":93";
-static char *xorgTerminate = "-terminate";
-
-static pid_t   xorgPid = 0;
-static int     receivedUsr1 = 0;
-static jmp_buf jumpbuf;
-
-static Bool waitAndExit = FALSE;
-
-static char **xorgArgv = 0;
-static int  nXorgArgv  = 0;
-
-typedef struct _xglxArg *xglxArgPtr;
-
-typedef int (*xglxProcessArgumentProc) (xglxArgPtr, int, char **, int);
-
-typedef struct _xglxArg {
-    xglxProcessArgumentProc processArgument;
-    const char		    *name;
-    const char		    *usage;
-} xglxArgRec;
-
-static int
-xglxAddXorgArguments (char **argv,
-		      int  n)
-{
-    char **newArgv;
-    int  i;
-
-    newArgv = xrealloc (xorgArgv, sizeof (char *) * (nXorgArgv + n));
-    if (!newArgv)
-	return 0;
-
-    for (i = 0; i < n; i++)
-	newArgv[nXorgArgv + i] = argv[i];
-
-    xorgArgv   = newArgv;
-    nXorgArgv += n;
-
-    return n;
-}
-
-static int
-xglxProcessCommonXorgArgument (xglxArgPtr pArg,
-			       int	  n,
-			       int	  argc,
-			       char	  **argv,
-			       int	  i)
-{
-    if (strcmp (argv[i], pArg->name) == 0)
-    {
-	if (i + n - 1 < argc)
-	    return xglxAddXorgArguments (&argv[i], n);
-    }
-
-    return 0;
-}
-
-#define PROCESS_COMMON_XORG_ARGUMENT_IMP(args)				  \
-    static int								  \
-    xglxProcess ## args ## CommonXorgArgument (xglxArgPtr pArg,		  \
-					       int	  argc,		  \
-					       char	  **argv,	  \
-					       int	  i)		  \
-    {									  \
-	return xglxProcessCommonXorgArgument (pArg, args, argc, argv, i); \
-    }
-
-PROCESS_COMMON_XORG_ARGUMENT_IMP (1)
-PROCESS_COMMON_XORG_ARGUMENT_IMP (2)
-
-static int
-xglxProcessXorgVTArgument (xglxArgPtr pArg,
-			   int	      argc,
-			   char	      **argv,
-			   int	      i)
-{
-    if (argv[i][0] == 'v' && argv[i][1] == 't' &&
-	strspn (&argv[i][2], "0123456789") == strlen (&argv[i][2]))
-	return xglxAddXorgArguments (&argv[i], 1);
-
-    return 0;
-}
-
-static int
-xglxProcessXorgAcArgument (xglxArgPtr pArg,
-			   int	      argc,
-			   char	      **argv,
-			   int	      i)
-{
-    static char *ac = "-ac";
-
-    if (strcmp (argv[i], pArg->name) == 0)
-    {
-	if (xglxAddXorgArguments (&ac, 1))
-	    return 1;
-    }
-
-    return 0;
-}
-
-static int
-xglxProcessXorgVersionArgument (xglxArgPtr pArg,
-				int	   argc,
-				char	   **argv,
-				int	   i)
-{
-    static char *version = "-version";
-
-    if (strcmp (argv[i], pArg->name) == 0)
-    {
-	if (xglxAddXorgArguments (&version, 1))
-	{
-	    waitAndExit = TRUE;
-	    return 1;
-	}
-    }
-
-    return 0;
-}
-
-static int
-xglxProcessXorgProgArgument (xglxArgPtr pArg,
-			     int	argc,
-			     char	**argv,
-			     int	i)
-{
-    if (strcmp (argv[i], pArg->name) == 0)
-    {
-	if (i + 1 < argc)
-	{
-	    xorgProg = argv[i + 1];
-	    return 2;
-	}
-    }
-
-    return 0;
-}
-
-static int
-xglxProcessXorgDisplayArgument (xglxArgPtr pArg,
-				int	   argc,
-				char	   **argv,
-				int	   i)
-{
-    if (strcmp (argv[i], pArg->name) == 0)
-    {
-	if (i + 1 < argc)
-	{
-	    xorgDisplay = argv[i + 1];
-	    return 2;
-	}
-    }
-
-    return 0;
-}
-
-static int
-xglxProcessXorgWaitExitArgument (xglxArgPtr pArg,
-				 int	    argc,
-				 char	    **argv,
-				 int	    i)
-{
-    if (xglxProcessCommonXorgArgument (pArg, 1, argc, argv, i))
-    {
-	waitAndExit = TRUE;
-	return 1;
-    }
-
-    return 0;
-}
-
-#define ARG(processArgument, name, usage) \
-    { processArgument, name, usage }
-
-#define XORG_ARG(name, args)				     \
-    ARG (xglxProcess ## args ## CommonXorgArgument, name, 0)
-
-#define XORG_UARG(name, usage, args)				 \
-    ARG (xglxProcess ## args ## CommonXorgArgument, name, usage)
-
-xglxArgRec xorgUid0Args[] = {
-    XORG_UARG ("-modulepath", " paths      specify the module search path", 2),
-    XORG_UARG ("-logfile", " file          specify a log file name", 2),
-    ARG (xglxProcessXorgWaitExitArgument, "-configure",
-	 "             probe for devices and write an Xorg config")
-};
-
-xglxArgRec xorgUidArgs[] = {
-    XORG_UARG ("-config",
-	       " file           specify configuration file, relative to the\n"
-	       "                       Xorg config search path, "
-	       "only root can use absolute", 2)
-};
-
-xglxArgRec xorgArgs[] = {
-    ARG (xglxProcessXorgWaitExitArgument, "-probeonly",
-	 "             probe for devices, then exit"),
-    XORG_UARG ("-verbose", " [n]           verbose startup messages", 2),
-    XORG_UARG ("-logverbose", " [n]        verbose log messages", 2),
-    XORG_UARG ("-quiet", "                 minimal startup messages", 1),
-    XORG_UARG ("-depth", " n               set colour depth. Default: 8", 2),
-    XORG_UARG ("-gamma",
-	       " f               set gamma value (0.1 < f < 10.0) "
-	       "Default: 1.0", 2),
-    XORG_UARG ("-rgamma", " f              set gamma value for red phase", 2),
-    XORG_UARG ("-ggamma", " f              set gamma value for green phase",
-	       2),
-    XORG_UARG ("-bgamma", " f              set gamma value for blue phase", 2),
-    XORG_UARG ("-layout",
-	       " name           specify the ServerLayout section name", 2),
-    XORG_UARG ("-screen",
-	       " name           specify the Screen section name", 2),
-    XORG_UARG ("-keyboard",
-	       " name         specify the core keyboard InputDevice name", 2),
-    XORG_UARG ("-pointer",
-	       " name          specify the core pointer InputDevice name", 2),
-    XORG_UARG ("-nosilk", "                disable Silken Mouse", 1),
-    XORG_UARG ("-disableModInDev",
-	       "       disable dynamic modification of input device settings",
-	       1),
-    XORG_UARG ("-allowMouseOpenFail",
-	       "    start server even if the mouse can't be initialized", 1),
-    XORG_UARG ("-bestRefresh",
-	       "           choose modes with the best refresh rate", 1),
-    XORG_UARG ("-ignoreABI",
-	       "             make module ABI mismatches non-fatal", 1),
-    XORG_UARG ("-isolateDevice",
-	       " bus_id  restrict device resets to bus_id (PCI only)", 2),
-    ARG (xglxProcessXorgVTArgument, "vtXX",
-	 "                   use the specified VT number"),
-    XORG_UARG ("-keeptty",
-	       "               don't detach controlling tty "
-	       "(for debugging only)", 1),
-    XORG_UARG ("-novtswitch", "            don't immediately switch to new VT",
-	       1),
-    XORG_UARG ("-sharevts", "              share VTs with another X server",
-	       1),
-    ARG (xglxProcessXorgAcArgument, "-xorgAc",
-	 "                disable access control restrictions"),
-    ARG (xglxProcessXorgProgArgument, "-xorgProgram",
-	 "           server program"),
-    ARG (xglxProcessXorgDisplayArgument, "-xorgDisplay",
-	 "           server display"),
-    ARG (xglxProcessXorgVersionArgument, "-xorgVersion",
-	 "           show the server version")
-};
-
-xglxArgRec sharedArgs[] = {
-    XORG_ARG ("-br", 1)
-};
-
-void
-xglxUseXorgMsg (void)
-{
-    int i;
-
-    ErrorF ("\nXorg usage:\n");
-
-    if (getuid () == 0)
-    {
-	for (i = 0; i < sizeof (xorgUid0Args) / sizeof (xglxArgRec); i++)
-	    ErrorF ("%s%s\n", xorgUid0Args[i].name, xorgUid0Args[i].usage);
-    }
-    else
-    {
-	for (i = 0; i < sizeof (xorgUidArgs) / sizeof (xglxArgRec); i++)
-	    ErrorF ("%s%s\n", xorgUidArgs[i].name, xorgUidArgs[i].usage);
-    }
-
-    for (i = 0; i < sizeof (xorgArgs) / sizeof (xglxArgRec); i++)
-	ErrorF ("%s%s\n", xorgArgs[i].name, xorgArgs[i].usage);
-}
-
-int
-xglxProcessXorgArgument (int  argc,
-			 char **argv,
-			 int  i)
-{
-    int skip, j;
-
-    if (nXorgArgv == 0)
-    {
-	if (!xglxAddXorgArguments (&xorgProg, 1))
-	    return 0;
-    }
-
-    if (getuid () == 0)
-    {
-	for (j = 0; j < sizeof (xorgUid0Args) / sizeof (xglxArgRec); j++)
-	{
-	    skip = (*xorgUid0Args[j].processArgument) (&xorgUid0Args[j],
-						       argc, argv, i);
-	    if (skip)
-		return skip;
-	}
-    }
-    else
-    {
-	for (j = 0; j < sizeof (xorgUidArgs) / sizeof (xglxArgRec); j++)
-	{
-	    skip = (*xorgUidArgs[j].processArgument) (&xorgUidArgs[j],
-						      argc, argv, i);
-	    if (skip)
-		return skip;
-	}
-    }
-
-    for (j = 0; j < sizeof (xorgArgs) / sizeof (xorgArgs[0]); j++)
-    {
-	skip = (*xorgArgs[j].processArgument) (&xorgArgs[j], argc, argv, i);
-	if (skip)
-	    return skip;
-    }
-
-    for (j = 0; j < sizeof (sharedArgs) / sizeof (sharedArgs[0]); j++)
-    {
-	skip = (*sharedArgs[j].processArgument) (&sharedArgs[j], argc, argv, i);
-	if (skip)
-	    return 0;
-    }
-
-    return 0;
-}
-
-static void
-sigAlarm (int sig)
-{
-    ErrorF ("%s won't die, killing it\n", basename (xorgProg));
-
-    kill (xorgPid, SIGKILL);
-    if (xorgPid)
-	while (waitpid (xorgPid, NULL, 0) == -1 && errno == EINTR);
-}
-
-void
-xglxAbortXorg (void)
-{
-    sighandler_t oldSigAlarm;
-    unsigned int oldAlarm;
-    int          status = 0;
-    char	 *name;
-
-    if (!xorgPid)
-	return;
-
-    name = basename (xorgProg);
-
-    oldAlarm    = alarm (0);
-    oldSigAlarm = signal (SIGALRM, sigAlarm);
-
-    kill (xorgPid, SIGTERM);
-
-    alarm (XORG_DIE_TIMEOUT);
-    while (waitpid (xorgPid, &status, 0) == -1 && errno == EINTR);
-    alarm (0);
-
-    signal (SIGALRM, oldSigAlarm);
-    alarm (oldAlarm);
-
-    if (WIFEXITED (status))
-    {
-	if (WEXITSTATUS (status))
-	    ErrorF ("%s died, exit status %d\n", name, WEXITSTATUS (status));
-    }
-    else if (WIFSIGNALED (status))
-	ErrorF ("%s died, signal %d\n", name, WTERMSIG (status));
-    else
-	ErrorF ("%s died, dubious exit\n", name);
-
-    if (xorgAuth)
-	unlink (xorgAuth);
-}
-
-static void
-sigUsr1Waiting (int sig)
-{
-    signal (sig, sigUsr1Waiting);
-    receivedUsr1++;
-}
-
-static void
-sigUsr1Jump (int sig)
-{
-
-#ifdef HAVE_SIGPROCMASK
-    sigset_t set;
-#endif
-
-    signal (sig, sigUsr1Waiting);
-
-#ifdef HAVE_SIGPROCMASK
-    sigemptyset (&set);
-    sigaddset (&set, SIGUSR1);
-    sigprocmask (SIG_UNBLOCK, &set, NULL);
-#endif
-
-    longjmp (jumpbuf, 1);
-}
-
-#define AUTH_DATA_LEN 16 /* bytes of authorization data */
-
-static Bool
-xglxSetupAuth (char *name, int authFd)
-{
-    Xauth   auth;
-    int	    randomFd;
-    ssize_t bytes, size;
-    char    authHost[256];
-    char    authData[AUTH_DATA_LEN];
-    FILE    *file;
-
-    auth.family = FamilyLocal;
-
-    gethostname (authHost, sizeof (authHost));
-
-    auth.address	= authHost;
-    auth.address_length = strlen (authHost);
-
-    auth.number	= strrchr (xorgDisplay, ':');
-    if (!auth.number)
-    {
-	ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
-	return FALSE;
-    }
-
-    auth.number++;
-
-    auth.number_length = strlen (auth.number);
-    if (!auth.number_length)
-    {
-	ErrorF ("Bad Xorg display name: %s\n", xorgDisplay);
-	return FALSE;
-    }
-
-    auth.name	     = "MIT-MAGIC-COOKIE-1";
-    auth.name_length = strlen (auth.name);
-
-    randomFd = open (XORG_DEV_RANDOM, O_RDONLY);
-    if (randomFd == -1)
-    {
-	ErrorF ("Failed to open " XORG_DEV_RANDOM "\n");
-	return FALSE;
-    }
-
-    bytes = 0;
-    do {
-	size = read (randomFd, authData + bytes, AUTH_DATA_LEN - bytes);
-	if (size <= 0)
-	    break;
-
-	bytes += size;
-    } while (bytes != AUTH_DATA_LEN);
-
-    close (randomFd);
-
-    if (bytes != AUTH_DATA_LEN)
-    {
-	ErrorF ("Failed to read %d random bytes from " XORG_DEV_RANDOM "\n",
-		AUTH_DATA_LEN);
-	return FALSE;
-    }
-
-    auth.data	     = authData;
-    auth.data_length = AUTH_DATA_LEN;
-
-    file = fdopen (authFd, "w");
-    if (!file)
-    {
-	ErrorF ("Failed to open authorization file: %s\n", name);
-	close (authFd);
-	return FALSE;
-    }
-
-    XauWriteAuth (file, &auth);
-    fclose (file);
-
-    return TRUE;
-}
-
-char *
-xglxInitXorg (void)
-{
-    sighandler_t oldSigUsr1;
-    pid_t	 pid;
-    char	 *name;
-    char	 *auth[] = { "-auth", xorgAuthBuf, "-nolisten", "tcp" };
-    char	 *saver[] = { "-dpms", "-v", "-s", "0" };
-    char	 *endArg = NULL;
-    int		 authFd;
-    int		 mask;
-
-    if (xorgPid)
-	return xorgDisplay;
-
-    if (!xorgProg)
-    {
-	struct stat buf;
-	int i;
-
-	for (i = 0; i < sizeof (xorgProgs) / sizeof (char *); i++)
-	{
-	    if (stat (xorgProgs[i], &buf) == 0)
-	    {
-		xorgProg = xorgProgs[i];
-		break;
-	    }
-	}
-
-	if (!xorgProg)
-	    FatalError ("Can't find Xorg executable\n");
-    }
-
-    strcpy (xorgAuthBuf, xorgAuthTempl);
-    mask = umask (0077);
-    authFd = mkstemp (xorgAuthBuf);
-    umask (mask);
-    if (authFd == -1)
-	FatalError ("Failed to generate unique authorization file\n");
-
-    xorgAuth = xorgAuthBuf;
-
-    if (nXorgArgv == 0)
-    {
-	if (!xglxAddXorgArguments (&xorgProg, 1))
-	    return 0;
-    }
-    else
-    {
-	xorgArgv[0] = xorgProg;
-    }
-
-    if (!xglxAddXorgArguments (auth, sizeof (auth) / sizeof (char *)))
-	return 0;
-
-    if (!xglxAddXorgArguments (saver, sizeof (saver) / sizeof (char *)))
-	return 0;
-
-    if (!xglxAddXorgArguments (&xorgDisplay, 1))
-	return 0;
-
-    if (!xglxAddXorgArguments (&xorgTerminate, 1))
-	return 0;
-
-    if (!xglxAddXorgArguments (&endArg, 1))
-	return 0;
-
-    name = basename (xorgProg);
-
-    if (!xglxSetupAuth (xorgAuth, authFd))
-	FatalError ("Failed to set up authorization: %s\n", xorgAuth);
-
-    oldSigUsr1 = signal (SIGUSR1, sigUsr1Waiting);
-
-    pid = fork ();
-
-    switch (pid) {
-    case -1:
-	perror ("fork");
-	FatalError ("fork");
-	break;
-    case 0:
-	signal (SIGUSR1, SIG_IGN);
-	execv (xorgArgv[0], xorgArgv);
-	perror (xorgArgv[0]);
-	exit (2);
-	break;
-    default:
-	xorgPid = pid;
-	break;
-    }
-
-    for (;;)
-    {
-	int status;
-
-	signal (SIGUSR1, sigUsr1Waiting);
-	if (setjmp (jumpbuf) && !waitAndExit)
-	    break;
-
-	signal (SIGUSR1, sigUsr1Jump);
-	if (receivedUsr1 && !waitAndExit)
-	    break;
-
-	if (waitpid (xorgPid, &status, 0) != -1)
-	{
-	    if (WIFEXITED (status))
-	    {
-		if (waitAndExit)
-		{
-		    if (WEXITSTATUS (status))
-			FatalError ("%s died, exit status %d\n", name,
-				    WEXITSTATUS (status));
-
-		    exit (WEXITSTATUS (status));
-		}
-		else
-		{
-		    FatalError ("%s died, exit status %d\n", name,
-				WEXITSTATUS (status));
-		}
-	    }
-	    else if (WIFSIGNALED (status))
-		FatalError ("%s died, signal %d\n", name, WTERMSIG (status));
-	    else
-		FatalError ("%s died, dubious exit\n", name);
-	}
-    }
-
-    signal (SIGUSR1, oldSigUsr1);
-
-    setenv ("XAUTHORITY", xorgAuth, 1);
-
-    return xorgDisplay;
-}
-
-#endif
diff --git a/hw/xgl/glxext/Makefile.am b/hw/xgl/glxext/Makefile.am
deleted file mode 100644
index f79b855..0000000
--- a/hw/xgl/glxext/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-SUBDIRS = module
-
-AM_CFLAGS =		 \
-	 $(DIX_CFLAGS) \
-	-DHAVE_XGL_CONFIG_H \
-	-DHAVE_DIX_CONFIG_H \
-	$(XGLMODULES_CFLAGS) \
-	-I$(top_srcdir)/glx \
-	-I$(top_srcdir)/GL/include \
-	-I$(top_srcdir)/hw/xgl \
-	-I at MESA_SOURCE@/include \
-	-I at MESA_SOURCE@/src/mesa/glapi
-
-libxglglxext_libraries = libxglglxext.la
-libxglglxext_la_SOURCES = \
-	xglglxext.h	  \
-	xglglxext.c       \
-	xglglxlog.c
-
-noinst_LTLIBRARIES = $(libxglglxext_libraries)
-
diff --git a/hw/xgl/glxext/module/Makefile.am b/hw/xgl/glxext/module/Makefile.am
deleted file mode 100644
index 67653cd..0000000
--- a/hw/xgl/glxext/module/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-AM_CFLAGS = \
-	$(DIX_CFLAGS) \
-	-DHAVE_XGL_CONFIG_H \
-	-DHAVE_DIX_CONFIG_H \
-	$(XGLMODULES_CFLAGS) \
-	-I$(top_srcdir)/hw/xgl 
-
-libglx_la_LDFLAGS = -avoid-version
-libglx_la_SOURCES = glxmodule.c
-libglx_la_LIBADD  = $(top_builddir)/glx/libglx.la
-libglx_modules    = libglx.la
-
-libglcore_la_LDFLAGS = -avoid-version
-libglcore_la_SOURCES = glcoremodule.c
-libglcore_la_LIBADD  = $(top_builddir)/GL/mesa/libGLcore.la
-libglcore_modules    = libglcore.la
-
-moduledir = @XGL_MODULE_PATH@
-
-module_LTLIBRARIES =	     \
-	$(libglcore_modules) \
-	$(libglx_modules)
diff --git a/hw/xgl/glxext/module/glcoremodule.c b/hw/xgl/glxext/module/glcoremodule.c
deleted file mode 100644
index 37aa9c6..0000000
--- a/hw/xgl/glxext/module/glcoremodule.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglmodule.h"
-
-char *
-moduleVersion (void)
-{
-    return VERSION;
-}
-
-Bool
-moduleInit (const char *module)
-{
-    return TRUE;
-}
diff --git a/hw/xgl/glxext/module/glxmodule.c b/hw/xgl/glxext/module/glxmodule.c
deleted file mode 100644
index 37aa9c6..0000000
--- a/hw/xgl/glxext/module/glxmodule.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglmodule.h"
-
-char *
-moduleVersion (void)
-{
-    return VERSION;
-}
-
-Bool
-moduleInit (const char *module)
-{
-    return TRUE;
-}
diff --git a/hw/xgl/glxext/xglglxext.c b/hw/xgl/glxext/xglglxext.c
deleted file mode 100644
index c260d8e..0000000
--- a/hw/xgl/glxext/xglglxext.c
+++ /dev/null
@@ -1,5772 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "xglglx.h"
-#include "xglglxext.h"
-
-#include <GL/gl.h>
-#include <GL/glext.h>
-#include <GL/internal/glcore.h>
-
-#include "glxserver.h"
-#include "glxdrawable.h"
-#include "glxscreens.h"
-#include "glxutil.h"
-#include "unpack.h"
-#include "g_disptab.h"
-#include "glapitable.h"
-#include "glxext.h"
-#include "micmap.h"
-
-#define XGL_MAX_TEXTURE_UNITS      8
-#define XGL_MAX_ATTRIB_STACK_DEPTH 16
-
-#define XGL_TEXTURE_1D_BIT	  (1 << 0)
-#define XGL_TEXTURE_2D_BIT	  (1 << 1)
-#define XGL_TEXTURE_3D_BIT	  (1 << 2)
-#define XGL_TEXTURE_RECTANGLE_BIT (1 << 3)
-#define XGL_TEXTURE_CUBE_MAP_BIT  (1 << 4)
-
-typedef Bool	      (*GLXScreenProbeProc)    (int screen);
-typedef __GLinterface *(*GLXCreateContextProc) (__GLimports      *imports,
-						__GLcontextModes *modes,
-						__GLinterface    *shareGC);
-typedef void	      (*GLXCreateBufferProc)   (__GLXdrawablePrivate *glxPriv);
-typedef GLboolean     (*GLXSwapBuffersProc)    (__GLXdrawablePrivate *glxPriv);
-typedef int	      (*GLXBindBuffersProc)    (__GLXdrawablePrivate *glxPriv,
-						int		     buffer);
-typedef int	      (*GLXReleaseBuffersProc) (__GLXdrawablePrivate *glxPriv,
-						int		     buffer);
-
-typedef struct _xglGLXScreenInfo {
-    GLXScreenProbeProc   screenProbe;
-    GLXCreateContextProc createContext;
-    GLXCreateBufferProc  createBuffer;
-} xglGLXScreenInfoRec, *xglGLXScreenInfoPtr;
-
-extern __GLXscreenInfo *__xglScreenInfoPtr;
-
-static xglGLXScreenInfoRec screenInfoPriv;
-
-//extern __GLXscreenInfo __glDDXScreenInfo;
-
-typedef GLboolean (*GLResizeBuffersProc) (__GLdrawableBuffer   *buffer,
-					  GLint		       x,
-					  GLint		       y,
-					  GLuint	       width,
-					  GLuint	       height,
-					  __GLdrawablePrivate  *glPriv,
-					  GLuint	       bufferMask);
-typedef void	  (*GLFreeBuffersProc)   (__GLdrawablePrivate  *glPriv);
-
-typedef struct _xglGLBuffer {
-    GLXSwapBuffersProc    swapBuffers;
-    GLXBindBuffersProc    bindBuffers;
-    GLXReleaseBuffersProc releaseBuffers;
-    GLResizeBuffersProc   resizeBuffers;
-    GLFreeBuffersProc     freeBuffers;
-    ScreenPtr		  pScreen;
-    DrawablePtr		  pDrawable;
-    xglVisualPtr	  pVisual;
-    glitz_drawable_t	  *drawable;
-    glitz_surface_t	  *backSurface;
-    PixmapPtr		  pPixmap;
-    GCPtr		  pGC;
-    RegionRec		  damage;
-    void	          *private;
-    int			  screenX, screenY;
-    int			  xOff, yOff;
-    int			  yFlip;
-} xglGLBufferRec, *xglGLBufferPtr;
-
-typedef int xglGLXVisualConfigRec, *xglGLXVisualConfigPtr;
-typedef struct _xglDisplayList *xglDisplayListPtr;
-
-#define XGL_LIST_OP_CALLS 0
-#define XGL_LIST_OP_DRAW  1
-#define XGL_LIST_OP_GL    2
-#define XGL_LIST_OP_LIST  3
-
-typedef struct _xglGLOp {
-    void (*glProc) (struct _xglGLOp *pOp);
-    union {
-	GLenum     enumeration;
-	GLbitfield bitfield;
-	GLsizei    size;
-	struct {
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	} rect;
-	struct {
-	    GLenum target;
-	    GLuint texture;
-	} bind_texture;
-	struct {
-	    GLenum  target;
-	    GLenum  pname;
-	    GLfloat params[4];
-	} tex_parameter_fv;
-	struct {
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	    GLenum  type;
-	} copy_pixels;
-	struct {
-	    GLenum  target;
-	    GLint   level;
-	    GLenum  internalformat;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLint   border;
-	} copy_tex_image_1d;
-	struct {
-	    GLenum  target;
-	    GLint   level;
-	    GLenum  internalformat;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	    GLint   border;
-	} copy_tex_image_2d;
-	struct {
-	    GLenum  target;
-	    GLint   level;
-	    GLint   xoffset;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	} copy_tex_sub_image_1d;
-	struct {
-	    GLenum  target;
-	    GLint   level;
-	    GLint   xoffset;
-	    GLint   yoffset;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	} copy_tex_sub_image_2d;
-	struct {
-	    GLenum  target;
-	    GLenum  internalformat;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	} copy_color_table;
-	struct {
-	    GLenum  target;
-	    GLsizei start;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	} copy_color_sub_table;
-	struct {
-	    GLenum  target;
-	    GLenum  internalformat;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	} copy_convolution_filter_1d;
-	struct {
-	    GLenum  target;
-	    GLenum  internalformat;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	} copy_convolution_filter_2d;
-	struct {
-	    GLenum  target;
-	    GLint   level;
-	    GLint   xoffset;
-	    GLint   yoffset;
-	    GLint   zoffset;
-	    GLint   x;
-	    GLint   y;
-	    GLsizei width;
-	    GLsizei height;
-	} copy_tex_sub_image_3d;
-	struct {
-	    GLfloat x;
-	    GLfloat y;
-	    GLfloat z;
-	} window_pos_3f;
-    } u;
-} xglGLOpRec, *xglGLOpPtr;
-
-typedef struct _xglListOp {
-    int type;
-    union {
-	GLuint	   list;
-	xglGLOpPtr gl;
-    } u;
-} xglListOpRec, *xglListOpPtr;
-
-typedef struct _xglDisplayList {
-    xglListOpPtr pOp;
-    int		 nOp;
-    int		 size;
-} xglDisplayListRec;
-
-typedef struct _xglTexObj {
-    GLuint		   key;
-    GLuint		   name;
-    PixmapPtr		   pPixmap;
-    glitz_texture_object_t *object;
-    int			   refcnt;
-} xglTexObjRec, *xglTexObjPtr;
-
-typedef struct _xglTexUnit {
-    GLbitfield   enabled;
-    xglTexObjPtr p1D;
-    xglTexObjPtr p2D;
-    xglTexObjPtr p3D;
-    xglTexObjPtr pRect;
-    xglTexObjPtr pCubeMap;
-} xglTexUnitRec, *xglTexUnitPtr;
-
-typedef struct _xglGLAttributes {
-    GLbitfield	  mask;
-    GLenum	  drawBuffer;
-    GLenum	  readBuffer;
-    xRectangle	  viewport;
-    xRectangle	  scissor;
-    GLboolean	  scissorTest;
-    xglTexUnitRec texUnits[XGL_MAX_TEXTURE_UNITS];
-} xglGLAttributesRec, *xglGLAttributesPtr;
-
-typedef struct _xglGLContext {
-    __GLinterface	      iface;
-    __GLinterface	      *mIface;
-    int			      refcnt;
-    struct _xglGLContext      *shared;
-    glitz_context_t	      *context;
-    struct _glapi_table	      glRenderTable;
-    PFNGLACTIVETEXTUREARBPROC ActiveTextureARB;
-    PFNGLWINDOWPOS3FMESAPROC  WindowPos3fMESA;
-    Bool		      needInit;
-    xglGLBufferPtr	      pDrawBuffer;
-    xglGLBufferPtr	      pReadBuffer;
-    int			      drawXoff, drawYoff;
-    __GLdrawablePrivate	      *readPriv;
-    __GLdrawablePrivate	      *drawPriv;
-    char		      *versionString;
-    GLenum		      errorValue;
-    GLboolean		      doubleBuffer;
-    GLint		      depthBits;
-    GLint		      stencilBits;
-    xglHashTablePtr	      texObjects;
-    xglHashTablePtr	      displayLists;
-    GLuint		      list;
-    GLenum		      listMode;
-    GLuint		      beginCnt;
-    xglDisplayListPtr	      pList;
-    GLuint		      groupList;
-    xglGLAttributesRec	      attrib;
-    xglGLAttributesRec	      attribStack[XGL_MAX_ATTRIB_STACK_DEPTH];
-    int			      nAttribStack;
-    int			      activeTexUnit;
-    GLint		      maxTexUnits;
-    GLint		      maxListNesting;
-    GLint		      maxAttribStackDepth;
-} xglGLContextRec, *xglGLContextPtr;
-
-static xglGLContextPtr cctx = NULL;
-
-static void
-xglSetCurrentContext (xglGLContextPtr pContext);
-
-#define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox)	  \
-    (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip);	  \
-    (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip);	  \
-    (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \
-    (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width;	  \
-    (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \
-    (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2;	  \
-    (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height
-
-#define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox)		      \
-    XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \
-    xglSetupTextures ()
-
-#define XGL_GLX_DRAW_BOX(pBox1, pBox2)			    \
-    (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \
-    (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \
-    (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \
-    (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2
-
-#define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \
-    {					    \
-	if ((pBox1)->x1 < (pBox2)->x1)	    \
-	    (pBox1)->x1 = (pBox2)->x1;	    \
-	if ((pBox1)->y1 < (pBox2)->y1)	    \
-	    (pBox1)->y1 = (pBox2)->y1;	    \
-	if ((pBox1)->x2 > (pBox2)->x2)	    \
-	    (pBox1)->x2 = (pBox2)->x2;	    \
-	if ((pBox1)->y2 > (pBox2)->y2)	    \
-	    (pBox1)->y2 = (pBox2)->y2;	    \
-    }
-
-#define XGL_GLX_SET_SCISSOR_BOX(pBox)		      \
-    glScissor ((pBox)->x1,			      \
-	       cctx->pDrawBuffer->yFlip - (pBox)->y2, \
-	       (pBox)->x2 - (pBox)->x1,		      \
-	       (pBox)->y2 - (pBox)->y1)
-
-#define XGL_GLX_DRAW_DAMAGE(pBox, pRegion)				 \
-    if (cctx->attrib.drawBuffer != GL_BACK)				 \
-    {									 \
-	(pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \
-	(pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \
-	(pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \
-	(pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \
-	(pRegion)->data = (RegDataPtr) NULL;				 \
-	REGION_UNION (cctx->pDrawBuffer->pGC->pScreen,			 \
-		      &cctx->pDrawBuffer->damage,			 \
-		      &cctx->pDrawBuffer->damage,			 \
-		      pRegion);						 \
-	xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion);	 \
-    }
-
-static void
-xglRecordError (GLenum error)
-{
-    if (cctx->errorValue == GL_NO_ERROR)
-	cctx->errorValue = error;
-}
-
-static xglDisplayListPtr
-xglCreateList (void)
-{
-    xglDisplayListPtr pDisplayList;
-
-    pDisplayList = xalloc (sizeof (xglDisplayListRec));
-    if (!pDisplayList)
-	return NULL;
-
-    pDisplayList->pOp  = NULL;
-    pDisplayList->nOp  = 0;
-    pDisplayList->size = 0;
-
-    return pDisplayList;
-}
-
-static void
-xglDestroyList (xglDisplayListPtr pDisplayList)
-{
-    xglListOpPtr pOp = pDisplayList->pOp;
-    int		 nOp = pDisplayList->nOp;
-
-    while (nOp--)
-    {
-	switch (pOp->type) {
-	case XGL_LIST_OP_CALLS:
-	case XGL_LIST_OP_DRAW:
-	    glDeleteLists (pOp->u.list, 1);
-	    break;
-	case XGL_LIST_OP_GL:
-	    xfree (pOp->u.gl);
-	    break;
-	case XGL_LIST_OP_LIST:
-	    break;
-	}
-
-	pOp++;
-    }
-
-    if (pDisplayList->pOp)
-	xfree (pDisplayList->pOp);
-
-    xfree (pDisplayList);
-}
-
-static Bool
-xglResizeList (xglDisplayListPtr pDisplayList,
-	       int		 nOp)
-{
-    if (pDisplayList->size < nOp)
-    {
-	int size = pDisplayList->nOp ? pDisplayList->nOp : 4;
-
-	while (size < nOp)
-	    size <<= 1;
-
-	pDisplayList->pOp = xrealloc (pDisplayList->pOp,
-				      sizeof (xglListOpRec) * size);
-	if (!pDisplayList->pOp)
-	    return FALSE;
-
-	pDisplayList->size = size;
-    }
-
-    return TRUE;
-}
-
-static void
-xglStartList (int    type,
-	      GLenum mode)
-{
-    if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
-    {
-	xglRecordError (GL_OUT_OF_MEMORY);
-	return;
-    }
-
-    cctx->pList->pOp[cctx->pList->nOp].type   = type;
-    cctx->pList->pOp[cctx->pList->nOp].u.list = glGenLists (1);
-
-    glNewList (cctx->pList->pOp[cctx->pList->nOp].u.list, mode);
-
-    cctx->pList->nOp++;
-}
-
-static void
-xglGLOp (xglGLOpPtr pOp)
-{
-    if (cctx->list)
-    {
-	xglGLOpPtr pGLOp;
-
-	pGLOp = xalloc (sizeof (xglGLOpRec));
-	if (!pGLOp)
-	{
-	    xglRecordError (GL_OUT_OF_MEMORY);
-	    return;
-	}
-
-	if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
-	{
-	    xfree (pGLOp);
-	    xglRecordError (GL_OUT_OF_MEMORY);
-	    return;
-	}
-
-	glEndList ();
-
-	*pGLOp = *pOp;
-
-	cctx->pList->pOp[cctx->pList->nOp].type = XGL_LIST_OP_GL;
-	cctx->pList->pOp[cctx->pList->nOp].u.gl = pGLOp;
-	cctx->pList->nOp++;
-
-	if (cctx->listMode == GL_COMPILE_AND_EXECUTE)
-	    (*pOp->glProc) (pOp);
-
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-    }
-    else
-	(*pOp->glProc) (pOp);
-}
-
-static void
-xglViewportProc (xglGLOpPtr pOp)
-{
-    cctx->attrib.viewport.x	 = pOp->u.rect.x;
-    cctx->attrib.viewport.y	 = pOp->u.rect.y;
-    cctx->attrib.viewport.width  = pOp->u.rect.width;
-    cctx->attrib.viewport.height = pOp->u.rect.height;
-
-    glViewport (pOp->u.rect.x + cctx->pDrawBuffer->xOff,
-		pOp->u.rect.y + cctx->pDrawBuffer->yOff,
-		pOp->u.rect.width,
-		pOp->u.rect.height);
-}
-
-static void
-xglViewport (GLint   x,
-	     GLint   y,
-	     GLsizei width,
-	     GLsizei height)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglViewportProc;
-
-    gl.u.rect.x	     = x;
-    gl.u.rect.y	     = y;
-    gl.u.rect.width  = width;
-    gl.u.rect.height = height;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglScissorProc (xglGLOpPtr pOp)
-{
-    cctx->attrib.scissor.x	= pOp->u.rect.x;
-    cctx->attrib.scissor.y	= pOp->u.rect.y;
-    cctx->attrib.scissor.width  = pOp->u.rect.width;
-    cctx->attrib.scissor.height = pOp->u.rect.height;
-}
-
-static void
-xglScissor (GLint   x,
-	    GLint   y,
-	    GLsizei width,
-	    GLsizei height)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglScissorProc;
-
-    gl.u.rect.x	     = x;
-    gl.u.rect.y	     = y;
-    gl.u.rect.width  = width;
-    gl.u.rect.height = height;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglDrawBufferProc (xglGLOpPtr pOp)
-{
-    glitz_drawable_buffer_t buffers[2];
-
-    switch (pOp->u.enumeration) {
-    case GL_FRONT:
-	buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
-	glitz_context_draw_buffers (cctx->context, buffers, 1);
-	break;
-    case GL_FRONT_AND_BACK:
-	buffers[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR;
-	if (cctx->doubleBuffer)
-	{
-	    buffers[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
-	    glitz_context_draw_buffers (cctx->context, buffers, 2);
-	}
-	else
-	    glitz_context_draw_buffers (cctx->context, buffers, 1);
-	break;
-    case GL_BACK:
-	if (!cctx->doubleBuffer)
-	{
-	    xglRecordError (GL_INVALID_OPERATION);
-	    return;
-	}
-	buffers[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR;
-	glitz_context_draw_buffers (cctx->context, buffers, 1);
-	break;
-    default:
-	xglRecordError (GL_INVALID_ENUM);
-	return;
-    }
-
-    cctx->attrib.drawBuffer = pOp->u.enumeration;
-}
-
-static void
-xglDrawBuffer (GLenum mode)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglDrawBufferProc;
-
-    gl.u.enumeration = mode;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglReadBufferProc (xglGLOpPtr pOp)
-{
-    switch (pOp->u.enumeration) {
-    case GL_FRONT:
-	glitz_context_read_buffer (cctx->context,
-				   GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
-	break;
-    case GL_BACK:
-	if (!cctx->doubleBuffer)
-	{
-	    xglRecordError (GL_INVALID_OPERATION);
-	    return;
-	}
-	glitz_context_read_buffer (cctx->context,
-				   GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
-	break;
-    default:
-	xglRecordError (GL_INVALID_ENUM);
-	return;
-    }
-
-    cctx->attrib.readBuffer = pOp->u.enumeration;
-}
-
-static void
-xglReadBuffer (GLenum mode)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglReadBufferProc;
-
-    gl.u.enumeration = mode;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglDisableProc (xglGLOpPtr pOp)
-{
-    xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
-
-    switch (pOp->u.enumeration) {
-    case GL_SCISSOR_TEST:
-	cctx->attrib.scissorTest = GL_FALSE;
-	return;
-    case GL_TEXTURE_1D:
-	pTexUnit->enabled &= ~XGL_TEXTURE_1D_BIT;
-	break;
-    case GL_TEXTURE_2D:
-	pTexUnit->enabled &= ~XGL_TEXTURE_2D_BIT;
-	break;
-    case GL_TEXTURE_3D:
-	pTexUnit->enabled &= ~XGL_TEXTURE_3D_BIT;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	pTexUnit->enabled &= ~XGL_TEXTURE_RECTANGLE_BIT;
-	break;
-    case GL_TEXTURE_CUBE_MAP_ARB:
-	pTexUnit->enabled &= ~XGL_TEXTURE_CUBE_MAP_BIT;
-	break;
-    default:
-	break;
-    }
-
-    glDisable (pOp->u.enumeration);
-}
-
-static void
-xglDisable (GLenum cap)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglDisableProc;
-
-    gl.u.enumeration = cap;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglEnableProc (xglGLOpPtr pOp)
-{
-    xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
-
-    switch (pOp->u.enumeration) {
-    case GL_SCISSOR_TEST:
-	cctx->attrib.scissorTest = GL_TRUE;
-	return;
-    case GL_DEPTH_TEST:
-	if (!cctx->depthBits)
-	    return;
-    case GL_STENCIL_TEST:
-	if (!cctx->stencilBits)
-	    return;
-    case GL_TEXTURE_1D:
-	pTexUnit->enabled |= XGL_TEXTURE_1D_BIT;
-	break;
-    case GL_TEXTURE_2D:
-	pTexUnit->enabled |= XGL_TEXTURE_2D_BIT;
-	break;
-    case GL_TEXTURE_3D:
-	pTexUnit->enabled |= XGL_TEXTURE_3D_BIT;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	pTexUnit->enabled |= XGL_TEXTURE_RECTANGLE_BIT;
-	break;
-    case GL_TEXTURE_CUBE_MAP_ARB:
-	pTexUnit->enabled |= XGL_TEXTURE_CUBE_MAP_BIT;
-	break;
-    default:
-	break;
-    }
-
-    glEnable (pOp->u.enumeration);
-}
-
-static void
-xglEnable (GLenum cap)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglEnableProc;
-
-    gl.u.enumeration = cap;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglDeleteTexObj (xglTexObjPtr pTexObj)
-{
-    if (pTexObj->pPixmap)
-    {
-	ScreenPtr pScreen = pTexObj->pPixmap->drawable.pScreen;
-
-	(*pScreen->DestroyPixmap) (pTexObj->pPixmap);
-
-	glitz_texture_object_destroy (pTexObj->object);
-    }
-
-    if (pTexObj->name)
-    {
-	glDeleteTextures (1, &pTexObj->name);
-    }
-
-    pTexObj->key     = 0;
-    pTexObj->name    = 0;
-    pTexObj->pPixmap = NULL;
-    pTexObj->object  = NULL;
-}
-
-static void
-xglRefTexObj (xglTexObjPtr pTexObj)
-{
-    if (!pTexObj)
-	return;
-
-    pTexObj->refcnt++;
-}
-
-static void
-xglUnrefTexObj (xglTexObjPtr pTexObj)
-{
-    if (!pTexObj)
-	return;
-
-    pTexObj->refcnt--;
-    if (pTexObj->refcnt)
-	return;
-
-    xglDeleteTexObj (pTexObj);
-
-    xfree (pTexObj);
-}
-
-static void
-xglPushAttribProc (xglGLOpPtr pOp)
-{
-    xglGLAttributesPtr pAttrib;
-
-    if (cctx->nAttribStack == cctx->maxAttribStackDepth)
-    {
-	xglRecordError (GL_STACK_OVERFLOW);
-	return;
-    }
-
-    pAttrib = &cctx->attribStack[cctx->nAttribStack];
-
-    *pAttrib = cctx->attrib;
-    pAttrib->mask = pOp->u.bitfield;
-
-    if (pOp->u.bitfield & GL_TEXTURE_BIT)
-    {
-	int i;
-
-	for (i = 0; i < cctx->maxTexUnits; i++)
-	{
-	    xglRefTexObj (pAttrib->texUnits[i].p1D);
-	    xglRefTexObj (pAttrib->texUnits[i].p2D);
-	    xglRefTexObj (pAttrib->texUnits[i].p3D);
-	    xglRefTexObj (pAttrib->texUnits[i].pRect);
-	    xglRefTexObj (pAttrib->texUnits[i].pCubeMap);
-	}
-    }
-
-    cctx->nAttribStack++;
-
-    glPushAttrib (pOp->u.bitfield);
-}
-
-static void
-xglPushAttrib (GLbitfield mask)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglPushAttribProc;
-
-    gl.u.bitfield = mask;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglPopAttribProc (xglGLOpPtr pOp)
-{
-    xglGLAttributesPtr pAttrib;
-    GLbitfield	       mask;
-
-    if (!cctx->nAttribStack)
-    {
-	xglRecordError (GL_STACK_UNDERFLOW);
-	return;
-    }
-
-    cctx->nAttribStack--;
-
-    pAttrib = &cctx->attribStack[cctx->nAttribStack];
-    mask = pAttrib->mask;
-
-    if (mask & GL_COLOR_BUFFER_BIT)
-	xglDrawBuffer (pAttrib->drawBuffer);
-
-    if (mask & GL_PIXEL_MODE_BIT)
-	xglReadBuffer (pAttrib->readBuffer);
-
-    if (mask & GL_SCISSOR_BIT)
-    {
-	xglScissor (pAttrib->scissor.x,
-		    pAttrib->scissor.y,
-		    pAttrib->scissor.width,
-		    pAttrib->scissor.height);
-
-	if (pAttrib->scissorTest)
-	    xglEnable (GL_SCISSOR_TEST);
-	else
-	    xglDisable (GL_SCISSOR_TEST);
-    }
-    else if (mask & GL_ENABLE_BIT)
-    {
-	if (pAttrib->scissorTest)
-	    xglEnable (GL_SCISSOR_TEST);
-	else
-	    xglDisable (GL_SCISSOR_TEST);
-    }
-
-    if (mask & GL_VIEWPORT_BIT)
-	xglViewport (pAttrib->viewport.x,
-		     pAttrib->viewport.y,
-		     pAttrib->viewport.width,
-		     pAttrib->viewport.height);
-
-    if (mask & GL_TEXTURE_BIT)
-    {
-	int i;
-
-	for (i = 0; i < cctx->maxTexUnits; i++)
-	{
-	    xglUnrefTexObj (cctx->attrib.texUnits[i].p1D);
-	    xglUnrefTexObj (cctx->attrib.texUnits[i].p2D);
-	    xglUnrefTexObj (cctx->attrib.texUnits[i].p3D);
-	    xglUnrefTexObj (cctx->attrib.texUnits[i].pRect);
-	    xglUnrefTexObj (cctx->attrib.texUnits[i].pCubeMap);
-
-	    cctx->attrib.texUnits[i] = pAttrib->texUnits[i];
-	}
-    }
-    else if (mask & GL_ENABLE_BIT)
-    {
-	int i;
-
-	for (i = 0; i < cctx->maxTexUnits; i++)
-	    cctx->attrib.texUnits[i].enabled = pAttrib->texUnits[i].enabled;
-    }
-
-    glPopAttrib ();
-}
-
-static void
-xglPopAttrib (void)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglPopAttribProc;
-
-    xglGLOp (&gl);
-}
-
-static GLuint
-xglActiveTextureBinding (GLenum target)
-{
-    xglTexObjPtr pTexObj;
-
-    switch (target) {
-    case GL_TEXTURE_BINDING_1D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
-	break;
-    case GL_TEXTURE_BINDING_2D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	break;
-    case GL_TEXTURE_BINDING_3D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
-	break;
-    case GL_TEXTURE_BINDING_RECTANGLE_NV:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-	break;
-    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
-	break;
-    default:
-	return 0;
-    }
-
-    if (pTexObj)
-	return pTexObj->key;
-
-    return 0;
-}
-
-#define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE)
-#define INT_TO_BOOLEAN(I)    ((I) ? GL_TRUE : GL_FALSE)
-#define ENUM_TO_BOOLEAN(E)   ((E) ? GL_TRUE : GL_FALSE)
-
-static void
-xglGetBooleanv (GLenum	  pname,
-		GLboolean *params)
-{
-    switch (pname) {
-    case GL_CURRENT_RASTER_POSITION:
-    {
-	GLdouble v[4];
-
-	glGetDoublev (GL_CURRENT_RASTER_POSITION, v);
-
-	params[0] = DOUBLE_TO_BOOLEAN (v[0] - (GLdouble) cctx->drawXoff);
-	params[1] = DOUBLE_TO_BOOLEAN (v[1] - (GLdouble) cctx->drawYoff);
-	params[2] = DOUBLE_TO_BOOLEAN (v[2]);
-	params[3] = DOUBLE_TO_BOOLEAN (v[3]);
-    } break;
-    case GL_DOUBLEBUFFER:
-	params[0] = cctx->doubleBuffer;
-	break;
-    case GL_DEPTH_BITS:
-	params[0] = INT_TO_BOOLEAN (cctx->depthBits);
-	break;
-    case GL_STENCIL_BITS:
-	params[0] = INT_TO_BOOLEAN (cctx->stencilBits);
-	break;
-    case GL_DRAW_BUFFER:
-	params[0] = ENUM_TO_BOOLEAN (cctx->attrib.drawBuffer);
-	break;
-    case GL_READ_BUFFER:
-	params[0] = ENUM_TO_BOOLEAN (cctx->attrib.readBuffer);
-	break;
-    case GL_SCISSOR_BOX:
-	params[0] = INT_TO_BOOLEAN (cctx->attrib.scissor.x);
-	params[1] = INT_TO_BOOLEAN (cctx->attrib.scissor.y);
-	params[2] = INT_TO_BOOLEAN (cctx->attrib.scissor.width);
-	params[3] = INT_TO_BOOLEAN (cctx->attrib.scissor.height);
-	break;
-    case GL_SCISSOR_TEST:
-	params[0] = cctx->attrib.scissorTest;
-	break;
-    case GL_VIEWPORT:
-	params[0] = INT_TO_BOOLEAN (cctx->attrib.viewport.x);
-	params[1] = INT_TO_BOOLEAN (cctx->attrib.viewport.y);
-	params[2] = INT_TO_BOOLEAN (cctx->attrib.viewport.width);
-	params[3] = INT_TO_BOOLEAN (cctx->attrib.viewport.height);
-	break;
-    case GL_TEXTURE_BINDING_1D:
-    case GL_TEXTURE_BINDING_2D:
-    case GL_TEXTURE_BINDING_3D:
-    case GL_TEXTURE_BINDING_RECTANGLE_NV:
-    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
-	/* should be safe to fall-through here */
-    default:
-	glGetBooleanv (pname, params);
-    }
-}
-
-#define INT_TO_DOUBLE(I)     ((GLdouble) (I))
-#define ENUM_TO_DOUBLE(E)    ((GLdouble) (E))
-#define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetDoublev (GLenum	pname,
-	       GLdouble *params)
-{
-    switch (pname) {
-    case GL_CURRENT_RASTER_POSITION:
-	glGetDoublev (GL_CURRENT_RASTER_POSITION, params);
-
-	params[0] -= (GLdouble) cctx->drawXoff;
-	params[1] -= (GLdouble) cctx->drawYoff;
-	break;
-    case GL_DOUBLEBUFFER:
-	params[0] = BOOLEAN_TO_DOUBLE (cctx->doubleBuffer);
-	break;
-    case GL_DEPTH_BITS:
-	params[0] = INT_TO_DOUBLE (cctx->depthBits);
-	break;
-    case GL_STENCIL_BITS:
-	params[0] = INT_TO_DOUBLE (cctx->stencilBits);
-	break;
-    case GL_DRAW_BUFFER:
-	params[0] = ENUM_TO_DOUBLE (cctx->attrib.drawBuffer);
-	break;
-    case GL_READ_BUFFER:
-	params[0] = ENUM_TO_DOUBLE (cctx->attrib.readBuffer);
-	break;
-    case GL_SCISSOR_BOX:
-	params[0] = cctx->attrib.scissor.x;
-	params[1] = cctx->attrib.scissor.y;
-	params[2] = cctx->attrib.scissor.width;
-	params[3] = cctx->attrib.scissor.height;
-	break;
-    case GL_SCISSOR_TEST:
-	params[0] = BOOLEAN_TO_DOUBLE (cctx->attrib.scissorTest);
-	break;
-    case GL_VIEWPORT:
-	params[0] = cctx->attrib.viewport.x;
-	params[1] = cctx->attrib.viewport.y;
-	params[2] = cctx->attrib.viewport.width;
-	params[3] = cctx->attrib.viewport.height;
-	break;
-    case GL_TEXTURE_BINDING_1D:
-    case GL_TEXTURE_BINDING_2D:
-    case GL_TEXTURE_BINDING_3D:
-    case GL_TEXTURE_BINDING_RECTANGLE_NV:
-    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
-	params[0] = xglActiveTextureBinding (pname);
-	break;
-    case GL_MAX_TEXTURE_UNITS_ARB:
-	params[0] = cctx->maxTexUnits;
-	break;
-    case GL_MAX_ATTRIB_STACK_DEPTH:
-	params[0] = cctx->maxAttribStackDepth;
-	break;
-    default:
-	glGetDoublev (pname, params);
-    }
-}
-
-#define INT_TO_FLOAT(I)     ((GLfloat) (I))
-#define ENUM_TO_FLOAT(E)    ((GLfloat) (E))
-#define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F)
-
-static void
-xglGetFloatv (GLenum  pname,
-	      GLfloat *params)
-{
-    switch (pname) {
-    case GL_CURRENT_RASTER_POSITION:
-	glGetFloatv (GL_CURRENT_RASTER_POSITION, params);
-
-	params[0] -= (GLfloat) cctx->drawXoff;
-	params[1] -= (GLfloat) cctx->drawYoff;
-	break;
-    case GL_DOUBLEBUFFER:
-	params[0] = BOOLEAN_TO_FLOAT (cctx->doubleBuffer);
-	break;
-    case GL_DEPTH_BITS:
-	params[0] = INT_TO_FLOAT (cctx->depthBits);
-	break;
-    case GL_STENCIL_BITS:
-	params[0] = INT_TO_FLOAT (cctx->stencilBits);
-	break;
-    case GL_DRAW_BUFFER:
-	params[0] = ENUM_TO_FLOAT (cctx->attrib.drawBuffer);
-	break;
-    case GL_READ_BUFFER:
-	params[0] = ENUM_TO_FLOAT (cctx->attrib.readBuffer);
-	break;
-    case GL_SCISSOR_BOX:
-	params[0] = cctx->attrib.scissor.x;
-	params[1] = cctx->attrib.scissor.y;
-	params[2] = cctx->attrib.scissor.width;
-	params[3] = cctx->attrib.scissor.height;
-	break;
-    case GL_SCISSOR_TEST:
-	params[0] = BOOLEAN_TO_FLOAT (cctx->attrib.scissorTest);
-	break;
-    case GL_VIEWPORT:
-	params[0] = cctx->attrib.viewport.x;
-	params[1] = cctx->attrib.viewport.y;
-	params[2] = cctx->attrib.viewport.width;
-	params[3] = cctx->attrib.viewport.height;
-	break;
-    case GL_TEXTURE_BINDING_1D:
-    case GL_TEXTURE_BINDING_2D:
-    case GL_TEXTURE_BINDING_3D:
-    case GL_TEXTURE_BINDING_RECTANGLE_NV:
-    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
-	params[0] = xglActiveTextureBinding (pname);
-	break;
-    case GL_MAX_TEXTURE_UNITS_ARB:
-	params[0] = cctx->maxTexUnits;
-	break;
-    case GL_MAX_ATTRIB_STACK_DEPTH:
-	params[0] = cctx->maxAttribStackDepth;
-	break;
-    default:
-	glGetFloatv (pname, params);
-    }
-}
-
-#define ENUM_TO_INT(E)    ((GLint) (E))
-#define BOOLEAN_TO_INT(B) ((GLint) (B))
-
-static void
-xglGetIntegerv (GLenum pname,
-		GLint  *params)
-{
-    switch (pname) {
-    case GL_CURRENT_RASTER_POSITION:
-	glGetIntegerv (GL_CURRENT_RASTER_POSITION, params);
-
-	params[0] -= (GLint) cctx->drawXoff;
-	params[1] -= (GLint) cctx->drawYoff;
-	break;
-    case GL_DOUBLEBUFFER:
-	params[0] = BOOLEAN_TO_INT (cctx->doubleBuffer);
-	break;
-    case GL_DEPTH_BITS:
-	params[0] = cctx->depthBits;
-	break;
-    case GL_STENCIL_BITS:
-	params[0] = cctx->stencilBits;
-	break;
-    case GL_DRAW_BUFFER:
-	params[0] = ENUM_TO_INT (cctx->attrib.drawBuffer);
-	break;
-    case GL_READ_BUFFER:
-	params[0] = ENUM_TO_INT (cctx->attrib.readBuffer);
-	break;
-    case GL_SCISSOR_BOX:
-	params[0] = cctx->attrib.scissor.x;
-	params[1] = cctx->attrib.scissor.y;
-	params[2] = cctx->attrib.scissor.width;
-	params[3] = cctx->attrib.scissor.height;
-	break;
-    case GL_SCISSOR_TEST:
-	params[0] = BOOLEAN_TO_INT (cctx->attrib.scissorTest);
-	break;
-    case GL_VIEWPORT:
-	params[0] = cctx->attrib.viewport.x;
-	params[1] = cctx->attrib.viewport.y;
-	params[2] = cctx->attrib.viewport.width;
-	params[3] = cctx->attrib.viewport.height;
-	break;
-    case GL_TEXTURE_BINDING_1D:
-    case GL_TEXTURE_BINDING_2D:
-    case GL_TEXTURE_BINDING_3D:
-    case GL_TEXTURE_BINDING_RECTANGLE_NV:
-    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
-	params[0] = xglActiveTextureBinding (pname);
-	break;
-    case GL_MAX_TEXTURE_UNITS_ARB:
-	params[0] = cctx->maxTexUnits;
-	break;
-    case GL_MAX_ATTRIB_STACK_DEPTH:
-	params[0] = cctx->maxAttribStackDepth;
-	break;
-    default:
-	glGetIntegerv (pname, params);
-    }
-}
-
-static GLboolean
-xglIsEnabled (GLenum cap)
-{
-    switch (cap) {
-    case GL_SCISSOR_TEST:
-	return cctx->attrib.scissorTest;
-    default:
-	return glIsEnabled (cap);
-    }
-}
-
-static GLenum
-xglGetError (void)
-{
-    GLenum error = cctx->errorValue;
-
-    if (error != GL_NO_ERROR)
-    {
-	cctx->errorValue = GL_NO_ERROR;
-	return error;
-    }
-
-    return glGetError ();
-}
-
-static const GLubyte *
-xglGetString (GLenum name)
-{
-    switch (name) {
-    case GL_VERSION:
-	if (!cctx->versionString)
-	{
-	    static char *version = "1.2 (%s)";
-	    char	*nativeVersion = (char *) glGetString (GL_VERSION);
-
-	    cctx->versionString = xalloc (strlen (version) +
-					  strlen (nativeVersion));
-	    if (cctx->versionString)
-		sprintf (cctx->versionString, version, nativeVersion);
-	}
-	return (GLubyte *) cctx->versionString;
-    default:
-	return glGetString (name);
-    }
-}
-
-static void
-xglGenTextures (GLsizei n,
-		GLuint  *textures)
-{
-    xglTexObjPtr pTexObj;
-    GLuint	 name;
-
-    name = xglHashFindFreeKeyBlock (cctx->shared->texObjects, n);
-
-    glGenTextures (n, textures);
-
-    while (n--)
-    {
-	pTexObj = xalloc (sizeof (xglTexObjRec));
-	if (pTexObj)
-	{
-	    pTexObj->key     = name;
-	    pTexObj->name    = *textures;
-	    pTexObj->pPixmap = NULL;
-	    pTexObj->object  = NULL;
-	    pTexObj->refcnt  = 1;
-
-	    xglHashInsert (cctx->shared->texObjects, name, pTexObj);
-	}
-	else
-	{
-	    xglRecordError (GL_OUT_OF_MEMORY);
-	}
-
-	*textures++ = name++;
-    }
-}
-
-static void
-xglBindTextureProc (xglGLOpPtr pOp)
-{
-    xglTexObjPtr *ppTexObj;
-
-    switch (pOp->u.bind_texture.target) {
-    case GL_TEXTURE_1D:
-	ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p1D;
-	break;
-    case GL_TEXTURE_2D:
-	ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	break;
-    case GL_TEXTURE_3D:
-	ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].p3D;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-	break;
-    case GL_TEXTURE_CUBE_MAP_ARB:
-	ppTexObj = &cctx->attrib.texUnits[cctx->activeTexUnit].pCubeMap;
-	break;
-    default:
-	xglRecordError (GL_INVALID_ENUM);
-	return;
-    }
-
-    if (pOp->u.bind_texture.texture)
-    {
-	if (!*ppTexObj || pOp->u.bind_texture.texture != (*ppTexObj)->key)
-	{
-	    xglTexObjPtr pTexObj;
-
-	    pTexObj = (xglTexObjPtr)
-		xglHashLookup (cctx->shared->texObjects,
-			       pOp->u.bind_texture.texture);
-	    if (!pTexObj)
-	    {
-		pTexObj = xalloc (sizeof (xglTexObjRec));
-		if (!pTexObj)
-		{
-		    xglRecordError (GL_OUT_OF_MEMORY);
-		    return;
-		}
-
-		pTexObj->key     = pOp->u.bind_texture.texture;
-		pTexObj->pPixmap = NULL;
-		pTexObj->object  = NULL;
-		pTexObj->refcnt  = 1;
-
-		glGenTextures (1, &pTexObj->name);
-
-		xglHashInsert (cctx->shared->texObjects,
-			       pOp->u.bind_texture.texture,
-			       pTexObj);
-	    }
-
-	    xglRefTexObj (pTexObj);
-	    xglUnrefTexObj (*ppTexObj);
-	    *ppTexObj = pTexObj;
-
-	    glBindTexture (pOp->u.bind_texture.target, pTexObj->name);
-	}
-    }
-    else
-    {
-	xglUnrefTexObj (*ppTexObj);
-	*ppTexObj = NULL;
-
-	glBindTexture (pOp->u.bind_texture.target, 0);
-    }
-}
-
-static void
-xglBindTexture (GLenum target,
-		GLuint texture)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglBindTextureProc;
-
-    gl.u.bind_texture.target  = target;
-    gl.u.bind_texture.texture = texture;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglSetupTextures (void)
-{
-    xglGLContextPtr pContext = cctx;
-    xglTexUnitPtr   pTexUnit;
-    xglTexObjPtr    pTexObj[XGL_MAX_TEXTURE_UNITS];
-    int		    i, activeTexUnit;
-
-    for (i = 0; i < pContext->maxTexUnits; i++)
-    {
-	pTexObj[i] = NULL;
-
-	pTexUnit = &pContext->attrib.texUnits[i];
-	if (pTexUnit->enabled)
-	{
-	    if (pTexUnit->enabled & XGL_TEXTURE_RECTANGLE_BIT)
-		pTexObj[i] = pTexUnit->pRect;
-	    else if (pTexUnit->enabled & XGL_TEXTURE_2D_BIT)
-		pTexObj[i] = pTexUnit->p2D;
-
-	    if (pTexObj[i] && pTexObj[i]->pPixmap)
-	    {
-		if (!xglSyncSurface (&pTexObj[i]->pPixmap->drawable))
-		    pTexObj[i] = NULL;
-	    }
-	    else
-		pTexObj[i] = NULL;
-	}
-    }
-
-    if (pContext != cctx)
-    {
-	XGL_SCREEN_PRIV (pContext->pDrawBuffer->pGC->pScreen);
-
-	glitz_drawable_finish (pScreenPriv->drawable);
-
-	xglSetCurrentContext (pContext);
-    }
-
-    activeTexUnit = cctx->activeTexUnit;
-    for (i = 0; i < pContext->maxTexUnits; i++)
-    {
-	if (pTexObj[i])
-	{
-	    if (i != activeTexUnit)
-	    {
-		cctx->ActiveTextureARB (GL_TEXTURE0_ARB + i);
-		activeTexUnit = i;
-	    }
-	    glitz_context_bind_texture (cctx->context, pTexObj[i]->object);
-	}
-    }
-
-    if (activeTexUnit != cctx->activeTexUnit)
-	cctx->ActiveTextureARB (cctx->activeTexUnit);
-}
-
-static GLboolean
-xglAreTexturesResident (GLsizei	     n,
-			const GLuint *textures,
-			GLboolean    *residences)
-{
-    GLboolean allResident = GL_TRUE;
-    int	      i, j;
-
-    if (n < 0)
-    {
-	xglRecordError (GL_INVALID_VALUE);
-	return GL_FALSE;
-    }
-
-    if (!textures || !residences)
-	return GL_FALSE;
-
-    for (i = 0; i < n; i++)
-    {
-	xglTexObjPtr pTexObj;
-	GLboolean    resident;
-
-	if (!textures[i])
-	{
-	    xglRecordError (GL_INVALID_VALUE);
-	    return GL_FALSE;
-	}
-
-	pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
-						textures[i]);
-	if (!pTexObj)
-	{
-	    xglRecordError (GL_INVALID_VALUE);
-	    return GL_FALSE;
-	}
-
-	if (pTexObj->name == 0 ||
-	    glAreTexturesResident (1, &pTexObj->name, &resident))
-	{
-	    if (!allResident)
-		residences[i] = GL_TRUE;
-	}
-	else
-	{
-	    if (allResident)
-	    {
-		allResident = GL_FALSE;
-
-		for (j = 0; j < i; j++)
-		    residences[j] = GL_TRUE;
-	    }
-	    residences[i] = GL_FALSE;
-	}
-    }
-
-    return allResident;
-}
-
-static void
-xglDeleteTextures (GLsizei	n,
-		   const GLuint *textures)
-{
-    xglTexObjPtr pTexObj;
-
-    while (n--)
-    {
-	if (!*textures)
-	    continue;
-
-	pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
-						*textures);
-	if (pTexObj)
-	{
-	    xglDeleteTexObj (pTexObj);
-	    xglUnrefTexObj (pTexObj);
-	    xglHashRemove (cctx->shared->texObjects, *textures);
-	}
-	textures++;
-    }
-}
-
-static GLboolean
-xglIsTexture (GLuint texture)
-{
-    xglTexObjPtr pTexObj;
-
-    if (!texture)
-	return GL_FALSE;
-
-    pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects, texture);
-    if (pTexObj)
-	return GL_TRUE;
-
-    return GL_FALSE;
-}
-
-static void
-xglPrioritizeTextures (GLsizei	      n,
-		       const GLuint   *textures,
-		       const GLclampf *priorities)
-{
-    xglTexObjPtr pTexObj;
-    int		 i;
-
-    if (n < 0)
-    {
-	xglRecordError (GL_INVALID_VALUE);
-	return;
-    }
-
-    if (!priorities)
-	return;
-
-    for (i = 0; i < n; i++)
-    {
-	if (!textures[i])
-	    continue;
-
-	pTexObj = (xglTexObjPtr) xglHashLookup (cctx->shared->texObjects,
-						textures[i]);
-	if (pTexObj && pTexObj->name)
-	    glPrioritizeTextures (1, &pTexObj->name, &priorities[i]);
-    }
-}
-
-static glitz_texture_filter_t
-xglTextureFilter (GLenum param)
-{
-    switch (param) {
-    case GL_LINEAR:
-	return GLITZ_TEXTURE_FILTER_LINEAR;
-    case GL_NEAREST:
-    default:
-	return GLITZ_TEXTURE_FILTER_NEAREST;
-    }
-}
-
-static glitz_texture_wrap_t
-xglTextureWrap (GLenum param)
-{
-    switch (param) {
-    case GL_CLAMP_TO_EDGE:
-	return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE;
-    case GL_CLAMP_TO_BORDER:
-	return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER;
-    case GL_REPEAT:
-	return GLITZ_TEXTURE_WRAP_REPEAT;
-    case GL_MIRRORED_REPEAT:
-	return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT;
-    case GL_CLAMP:
-    default:
-	return GLITZ_TEXTURE_WRAP_CLAMP;
-    }
-}
-
-static void
-xglTexParameterfvProc (xglGLOpPtr pOp)
-{
-    xglTexObjPtr pTexObj;
-
-    glTexParameterfv (pOp->u.tex_parameter_fv.target,
-		      pOp->u.tex_parameter_fv.pname,
-		      pOp->u.tex_parameter_fv.params);
-
-    switch (pOp->u.tex_parameter_fv.target) {
-    case GL_TEXTURE_2D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-	break;
-    default:
-	pTexObj = NULL;
-	break;
-    }
-
-    if (pTexObj && pTexObj->pPixmap)
-    {
-	GLfloat *params = pOp->u.tex_parameter_fv.params;
-
-	switch (pOp->u.tex_parameter_fv.pname) {
-	case GL_TEXTURE_MIN_FILTER:
-	    glitz_texture_object_set_filter (pTexObj->object,
-					     GLITZ_TEXTURE_FILTER_TYPE_MIN,
-					     xglTextureFilter (params[0]));
-	    break;
-	case GL_TEXTURE_MAG_FILTER:
-	    glitz_texture_object_set_filter (pTexObj->object,
-					     GLITZ_TEXTURE_FILTER_TYPE_MAG,
-					     xglTextureFilter (params[0]));
-	    break;
-	case GL_TEXTURE_WRAP_S:
-	    glitz_texture_object_set_wrap (pTexObj->object,
-					   GLITZ_TEXTURE_WRAP_TYPE_S,
-					   xglTextureWrap (params[0]));
-	    break;
-	case GL_TEXTURE_WRAP_T:
-	    glitz_texture_object_set_wrap (pTexObj->object,
-					   GLITZ_TEXTURE_WRAP_TYPE_T,
-					   xglTextureWrap (params[0]));
-	    break;
-	case GL_TEXTURE_BORDER_COLOR: {
-	    glitz_color_t color;
-
-	    color.red   = params[0] * 0xffff;
-	    color.green = params[1] * 0xffff;
-	    color.blue  = params[2] * 0xffff;
-	    color.alpha = params[3] * 0xffff;
-
-	    glitz_texture_object_set_border_color (pTexObj->object, &color);
-	}
-	default:
-	    break;
-	}
-    }
-}
-
-static void
-xglTexParameterfv (GLenum	 target,
-		   GLenum	 pname,
-		   const GLfloat *params)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglTexParameterfvProc;
-
-    gl.u.tex_parameter_fv.target = target;
-    gl.u.tex_parameter_fv.pname  = pname;
-
-    switch (pname) {
-    case GL_TEXTURE_BORDER_COLOR:
-	gl.u.tex_parameter_fv.params[3] = params[3];
-	gl.u.tex_parameter_fv.params[2] = params[2];
-	gl.u.tex_parameter_fv.params[1] = params[1];
-	/* fall-through */
-    default:
-	gl.u.tex_parameter_fv.params[0] = params[0];
-	break;
-    }
-
-    xglGLOp (&gl);
-}
-
-static void
-xglTexParameteriv (GLenum      target,
-		   GLenum      pname,
-		   const GLint *params)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglTexParameterfvProc;
-
-    gl.u.tex_parameter_fv.target = target;
-    gl.u.tex_parameter_fv.pname  = pname;
-
-    switch (pname) {
-    case GL_TEXTURE_BORDER_COLOR:
-	gl.u.tex_parameter_fv.params[3] = (GLfloat) params[3] / INT_MAX;
-	gl.u.tex_parameter_fv.params[2] = (GLfloat) params[2] / INT_MAX;
-	gl.u.tex_parameter_fv.params[1] = (GLfloat) params[1] / INT_MAX;
-	gl.u.tex_parameter_fv.params[0] = (GLfloat) params[0] / INT_MAX;
-	break;
-    default:
-	gl.u.tex_parameter_fv.params[0] = params[0];
-	break;
-    }
-
-    xglGLOp (&gl);
-}
-
-static void
-xglTexParameterf (GLenum  target,
-		  GLenum  pname,
-		  GLfloat param)
-{
-    xglTexParameterfv (target, pname, (const GLfloat *) &param);
-}
-
-static void
-xglTexParameteri (GLenum target,
-		  GLenum pname,
-		  GLint  param)
-{
-    xglTexParameteriv (target, pname, (const GLint *) &param);
-}
-
-static void
-xglGetTexLevelParameterfv (GLenum  target,
-			   GLint   level,
-			   GLenum  pname,
-			   GLfloat *params)
-{
-    xglTexObjPtr pTexObj;
-
-    switch (target) {
-    case GL_TEXTURE_2D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-	break;
-    default:
-	pTexObj = NULL;
-	break;
-    }
-
-    if (pTexObj && pTexObj->pPixmap)
-    {
-	glitz_context_bind_texture (cctx->context, pTexObj->object);
-
-	glGetTexLevelParameterfv (target, level, pname, params);
-	glBindTexture (target, pTexObj->name);
-    }
-    else
-	glGetTexLevelParameterfv (target, level, pname, params);
-}
-
-static void
-xglGetTexLevelParameteriv (GLenum target,
-			   GLint  level,
-			   GLenum pname,
-			   GLint  *params)
-{
-    xglTexObjPtr pTexObj;
-
-    switch (target) {
-    case GL_TEXTURE_2D:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	break;
-    case GL_TEXTURE_RECTANGLE_NV:
-	pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-	break;
-    default:
-	pTexObj = NULL;
-	break;
-    }
-
-    if (pTexObj && pTexObj->pPixmap)
-    {
-	glitz_context_bind_texture (cctx->context, pTexObj->object);
-
-	glGetTexLevelParameteriv (target, level, pname, params);
-	glBindTexture (target, pTexObj->name);
-    }
-    else
-	glGetTexLevelParameteriv (target, level, pname, params);
-}
-
-static GLuint
-xglGenLists (GLsizei range)
-{
-    xglDisplayListPtr pDisplayList;
-    GLuint	      first, name;
-
-    first = xglHashFindFreeKeyBlock (cctx->shared->displayLists, range);
-
-    name = first;
-    for (name = first; range--; name++)
-    {
-	pDisplayList = xglCreateList ();
-	if (pDisplayList)
-	{
-	    xglHashInsert (cctx->shared->displayLists, name, pDisplayList);
-	}
-	else
-	{
-	    xglRecordError (GL_OUT_OF_MEMORY);
-	}
-    }
-
-    return first;
-}
-
-static void
-xglNewList (GLuint list,
-	    GLenum mode)
-{
-    if (!list)
-    {
-	xglRecordError (GL_INVALID_VALUE);
-	return;
-    }
-
-    if (cctx->list)
-    {
-	xglRecordError (GL_INVALID_OPERATION);
-	return;
-    }
-
-    cctx->pList = xglCreateList ();
-    if (!cctx->pList)
-    {
-	xglRecordError (GL_OUT_OF_MEMORY);
-	return;
-    }
-
-    cctx->list     = list;
-    cctx->listMode = mode;
-
-    xglStartList (XGL_LIST_OP_CALLS, mode);
-}
-
-static void
-xglEndList (void)
-{
-    xglDisplayListPtr pDisplayList;
-
-    if (!cctx->list)
-    {
-	xglRecordError (GL_INVALID_OPERATION);
-	return;
-    }
-
-    glEndList ();
-
-    pDisplayList = (xglDisplayListPtr)
-	xglHashLookup (cctx->shared->displayLists, cctx->list);
-    if (pDisplayList)
-    {
-	xglHashRemove (cctx->shared->displayLists, cctx->list);
-	xglDestroyList (pDisplayList);
-    }
-
-    xglHashInsert (cctx->shared->displayLists, cctx->list, cctx->pList);
-
-    cctx->list = 0;
-}
-
-static void
-xglDrawList (GLuint list)
-{
-    RegionRec region;
-    BoxRec    scissor, box;
-    BoxPtr    pBox;
-    int	      nBox;
-
-    XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-    while (nBox--)
-    {
-	XGL_GLX_DRAW_BOX (&box, pBox);
-
-	pBox++;
-
-	if (cctx->attrib.scissorTest)
-	    XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	if (box.x1 < box.x2 && box.y1 < box.y2)
-	{
-	    XGL_GLX_SET_SCISSOR_BOX (&box);
-
-	    glCallList (list);
-
-	    XGL_GLX_DRAW_DAMAGE (&box, &region);
-	}
-    }
-}
-
-static void
-xglCallDisplayList (GLuint list,
-		    int	   nesting)
-{
-    if (nesting > cctx->maxListNesting)
-	return;
-
-    if (!list)
-    {
-	xglRecordError (GL_INVALID_VALUE);
-	return;
-    }
-
-    if (cctx->list)
-    {
-	if (!xglResizeList (cctx->pList, cctx->pList->nOp + 1))
-	{
-	    xglRecordError (GL_OUT_OF_MEMORY);
-	    return;
-	}
-
-	cctx->pList->pOp[cctx->pList->nOp].type   = XGL_LIST_OP_LIST;
-	cctx->pList->pOp[cctx->pList->nOp].u.list = list;
-	cctx->pList->nOp++;
-    }
-    else
-    {
-	xglDisplayListPtr pDisplayList;
-
-	pDisplayList = (xglDisplayListPtr)
-	    xglHashLookup (cctx->shared->displayLists, list);
-	if (pDisplayList)
-	{
-	    xglListOpPtr pOp = pDisplayList->pOp;
-	    int		 nOp = pDisplayList->nOp;
-
-	    while (nOp--)
-	    {
-		switch (pOp->type) {
-		case XGL_LIST_OP_CALLS:
-		    glCallList (pOp->u.list);
-		    break;
-		case XGL_LIST_OP_DRAW:
-		    xglDrawList (pOp->u.list);
-		    break;
-		case XGL_LIST_OP_GL:
-		    (*pOp->u.gl->glProc) (pOp->u.gl);
-		    break;
-		case XGL_LIST_OP_LIST:
-		    xglCallDisplayList (pOp->u.list, nesting + 1);
-		    break;
-		}
-
-		pOp++;
-	    }
-	}
-    }
-}
-
-static void
-xglCallList (GLuint list)
-{
-    xglCallDisplayList (list, 1);
-}
-
-static void
-xglCallLists (GLsizei	   n,
-	      GLenum	   type,
-	      const GLvoid *lists)
-{
-    GLuint list;
-    GLint  base, i;
-
-    glGetIntegerv (GL_LIST_BASE, &base);
-
-    for (i = 0; i < n; i++)
-    {
-	switch (type) {
-	case GL_BYTE:
-	    list = (GLuint) *(((GLbyte *) lists) + n);
-	    break;
-	case GL_UNSIGNED_BYTE:
-	    list = (GLuint) *(((GLubyte *) lists) + n);
-	    break;
-	case GL_SHORT:
-	    list = (GLuint) *(((GLshort *) lists) + n);
-	    break;
-	case GL_UNSIGNED_SHORT:
-	    list = (GLuint) *(((GLushort *) lists) + n);
-	    break;
-	case GL_INT:
-	    list = (GLuint) *(((GLint *) lists) + n);
-	    break;
-	case GL_UNSIGNED_INT:
-	    list = (GLuint) *(((GLuint *) lists) + n);
-	    break;
-	case GL_FLOAT:
-	    list = (GLuint) *(((GLfloat *) lists) + n);
-	    break;
-	case GL_2_BYTES:
-	{
-	    GLubyte *ubptr = ((GLubyte *) lists) + 2 * n;
-	    list = (GLuint) *ubptr * 256 + (GLuint) *(ubptr + 1);
-	} break;
-	case GL_3_BYTES:
-	{
-	    GLubyte *ubptr = ((GLubyte *) lists) + 3 * n;
-	    list = (GLuint) * ubptr * 65536
-		+ (GLuint) * (ubptr + 1) * 256
-		+ (GLuint) * (ubptr + 2);
-	} break;
-	case GL_4_BYTES:
-	{
-	    GLubyte *ubptr = ((GLubyte *) lists) + 4 * n;
-	    list = (GLuint) * ubptr * 16777216
-		+ (GLuint) * (ubptr + 1) * 65536
-		+ (GLuint) * (ubptr + 2) * 256
-		+ (GLuint) * (ubptr + 3);
-	} break;
-	default:
-	    xglRecordError (GL_INVALID_ENUM);
-	    return;
-	}
-
-	xglCallDisplayList (base + list, 1);
-    }
-}
-
-static void
-xglDeleteLists (GLuint  list,
-		GLsizei range)
-{
-    xglDisplayListPtr pDisplayList;
-    GLint	      i;
-
-    if (range < 0)
-    {
-	xglRecordError (GL_INVALID_VALUE);
-	return;
-    }
-
-    for (i = list; i < list + range; i++)
-    {
-	if (!i)
-	    continue;
-
-	pDisplayList = (xglDisplayListPtr)
-	    xglHashLookup (cctx->shared->displayLists, i);
-	if (pDisplayList)
-	{
-	    xglHashRemove (cctx->shared->displayLists, i);
-	    xglDestroyList (pDisplayList);
-	}
-    }
-}
-
-static GLboolean
-xglIsList (GLuint list)
-{
-    xglDisplayListPtr pDisplayList;
-
-    if (!list)
-	return GL_FALSE;
-
-    pDisplayList = (xglDisplayListPtr)
-	xglHashLookup (cctx->shared->displayLists, list);
-    if (pDisplayList)
-	return GL_TRUE;
-
-    return GL_FALSE;
-}
-
-static void
-xglFlush (void)
-{
-    glFlush ();
-
-    if (cctx && cctx->pDrawBuffer->pDrawable)
-    {
-	xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
-	if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
-	{
-	    XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
-
-	    DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
-	    REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
-
-	    pPixmapPriv->damageBox = miEmptyBox;
-	}
-    }
-}
-
-static void
-xglFinish (void)
-{
-    glFinish ();
-
-    if (cctx && cctx->pDrawBuffer->pDrawable)
-    {
-	xglGLBufferPtr pBuffer = cctx->pDrawBuffer;
-
-	if (REGION_NOTEMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage))
-	{
-	    XGL_DRAWABLE_PIXMAP_PRIV (pBuffer->pDrawable);
-
-	    DamageDamageRegion (pBuffer->pDrawable, &pBuffer->damage);
-	    REGION_EMPTY (pBuffer->pDrawable->pScreen, &pBuffer->damage);
-
-	    pPixmapPriv->damageBox = miEmptyBox;
-	}
-    }
-}
-
-static void
-xglClear (GLbitfield mask)
-{
-    GLenum mode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glClear (mask);
-	glEndList ();
-
-	mode = cctx->listMode;
-    }
-    else
-	mode = GL_COMPILE_AND_EXECUTE;
-
-    if (mode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glClear (mask);
-
-		if (mask & GL_COLOR_BUFFER_BIT)
-		    XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglAccum (GLenum  op,
-	  GLfloat value)
-{
-    if (op == GL_RETURN)
-    {
-	GLenum listMode;
-
-	if (cctx->list)
-	{
-	    glEndList ();
-	    xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	    glAccum (GL_RETURN, value);
-	    glEndList ();
-
-	    listMode = cctx->listMode;
-	}
-	else
-	    listMode = GL_COMPILE_AND_EXECUTE;
-
-	if (listMode == GL_COMPILE_AND_EXECUTE)
-	{
-	    RegionRec region;
-	    BoxRec    scissor, box;
-	    BoxPtr    pBox;
-	    int	      nBox;
-
-	    XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
-
-	    while (nBox--)
-	    {
-		XGL_GLX_DRAW_BOX (&box, pBox);
-
-		pBox++;
-
-		if (cctx->attrib.scissorTest)
-		    XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-		if (box.x1 < box.x2 && box.y1 < box.y2)
-		{
-		    XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		    glAccum (GL_RETURN, value);
-
-		    XGL_GLX_DRAW_DAMAGE (&box, &region);
-		}
-	    }
-	}
-
-	if (cctx->list)
-	    xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-    }
-    else
-	glAccum (op, value);
-}
-
-static void
-xglDrawArrays (GLenum  mode,
-	       GLint   first,
-	       GLsizei count)
-{
-    GLenum listMode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glDrawArrays (mode, first, count);
-	glEndList ();
-
-	listMode = cctx->listMode;
-    }
-    else
-	listMode = GL_COMPILE_AND_EXECUTE;
-
-    if (listMode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glDrawArrays (mode, first, count);
-
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawElements (GLenum	      mode,
-		 GLsizei      count,
-		 GLenum	      type,
-		 const GLvoid *indices)
-{
-    GLenum listMode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glDrawElements (mode, count, type, indices);
-	glEndList ();
-
-	listMode = cctx->listMode;
-    }
-    else
-	listMode = GL_COMPILE_AND_EXECUTE;
-
-    if (listMode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glDrawElements (mode, count, type, indices);
-
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglDrawPixels (GLsizei	    width,
-	       GLsizei	    height,
-	       GLenum	    format,
-	       GLenum	    type,
-	       const GLvoid *pixels)
-{
-    GLenum listMode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glDrawPixels (width, height, format, type, pixels);
-	glEndList ();
-
-	listMode = cctx->listMode;
-    }
-    else
-	listMode = GL_COMPILE_AND_EXECUTE;
-
-    if (listMode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glDrawPixels (width, height, format, type, pixels);
-
-		if (format != GL_STENCIL_INDEX)
-		    XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglBitmap (GLsizei	 width,
-	   GLsizei	 height,
-	   GLfloat	 xorig,
-	   GLfloat	 yorig,
-	   GLfloat	 xmove,
-	   GLfloat	 ymove,
-	   const GLubyte *bitmap)
-{
-    GLenum listMode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
-	glEndList ();
-
-	listMode = cctx->listMode;
-    }
-    else
-	listMode = GL_COMPILE_AND_EXECUTE;
-
-    if (listMode == GL_COMPILE_AND_EXECUTE && width && height)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glBitmap (width, height, xorig, yorig, 0, 0, bitmap);
-
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-
-    glBitmap (0, 0, 0, 0, xmove, ymove, NULL);
-}
-
-static void
-xglRectdv (const GLdouble *v1,
-	   const GLdouble *v2)
-{
-    GLenum listMode;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-	glRectdv (v1, v2);
-	glEndList ();
-
-	listMode = cctx->listMode;
-    }
-    else
-	listMode = GL_COMPILE_AND_EXECUTE;
-
-    if (listMode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-
-	XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		glRectdv (v1, v2);
-
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglRectfv (const GLfloat *v1,
-	   const GLfloat *v2)
-{
-    GLdouble dv1[2];
-    GLdouble dv2[2];
-
-    dv1[0] = (GLdouble) v1[0];
-    dv1[1] = (GLdouble) v1[1];
-    dv2[0] = (GLdouble) v2[0];
-    dv2[1] = (GLdouble) v2[1];
-
-    xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectiv (const GLint *v1,
-	   const GLint *v2)
-{
-    GLdouble dv1[2];
-    GLdouble dv2[2];
-
-    dv1[0] = (GLdouble) v1[0];
-    dv1[1] = (GLdouble) v1[1];
-    dv2[0] = (GLdouble) v2[0];
-    dv2[1] = (GLdouble) v2[1];
-
-    xglRectdv (dv1, dv2);
-}
-
-static void
-xglRectsv (const GLshort *v1,
-	   const GLshort *v2)
-{
-    GLdouble dv1[2];
-    GLdouble dv2[2];
-
-    dv1[0] = (GLdouble) v1[0];
-    dv1[1] = (GLdouble) v1[1];
-    dv2[0] = (GLdouble) v2[0];
-    dv2[1] = (GLdouble) v2[1];
-
-    xglRectdv (dv1, dv2);
-}
-
-static void
-xglBegin (GLenum mode)
-{
-    if (mode > GL_POLYGON)
-    {
-	xglRecordError (GL_INVALID_ENUM);
-	return;
-    }
-
-    if (cctx->beginCnt)
-    {
-	xglRecordError (GL_INVALID_OPERATION);
-	return;
-    }
-
-    cctx->beginCnt++;
-
-    if (cctx->list)
-    {
-	glEndList ();
-	xglStartList (XGL_LIST_OP_DRAW, GL_COMPILE);
-    }
-    else
-    {
-	if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
-	{
-	    BoxRec scissor, box;
-	    BoxPtr pBox;
-	    int    nBox;
-
-	    XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    XGL_GLX_SET_SCISSOR_BOX (&box);
-	}
-	else
-	{
-	    if (!cctx->groupList)
-		cctx->groupList = glGenLists (1);
-
-	    glNewList (cctx->groupList, GL_COMPILE);
-	}
-    }
-
-    glBegin (mode);
-}
-
-static void
-xglEnd (void)
-{
-    if (!cctx->beginCnt)
-    {
-	xglRecordError (GL_INVALID_OPERATION);
-	return;
-    }
-
-    cctx->beginCnt--;
-
-    glEnd ();
-
-    if (!cctx->list || cctx->listMode == GL_COMPILE_AND_EXECUTE)
-    {
-	RegionRec region;
-	BoxRec    scissor, box;
-	BoxPtr    pBox;
-	int	  nBox;
-	GLuint	  list = 0;
-
-	if (cctx->list)
-	{
-	    XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-	    list = cctx->pList->pOp[cctx->pList->nOp - 1].u.list;
-	}
-	else
-	{
-	    if (REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip) == 1)
-	    {
-		XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, &scissor);
-	    }
-	    else
-	    {
-		XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-		list = cctx->groupList;
-	    }
-	}
-
-	if (list)
-	    glEndList ();
-
-	while (nBox--)
-	{
-	    XGL_GLX_DRAW_BOX (&box, pBox);
-
-	    pBox++;
-
-	    if (cctx->attrib.scissorTest)
-		XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	    if (box.x1 < box.x2 && box.y1 < box.y2)
-	    {
-		if (list)
-		{
-		    XGL_GLX_SET_SCISSOR_BOX (&box);
-
-		    glCallList (list);
-		}
-
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	    }
-	}
-    }
-    else
-    {
-	glEndList ();
-    }
-
-    if (cctx->list)
-	xglStartList (XGL_LIST_OP_CALLS, cctx->listMode);
-}
-
-static void
-xglCopyPixelsProc (xglGLOpPtr pOp)
-{
-    RegionRec region;
-    BoxRec    scissor, box;
-    BoxPtr    pBox;
-    int	      nBox;
-
-    XGL_GLX_DRAW_PROLOGUE (pBox, nBox, &scissor);
-
-    while (nBox--)
-    {
-	XGL_GLX_DRAW_BOX (&box, pBox);
-
-	pBox++;
-
-	if (cctx->attrib.scissorTest)
-	    XGL_GLX_INTERSECT_BOX (&box, &scissor);
-
-	if (box.x1 < box.x2 && box.y1 < box.y2)
-	{
-	    XGL_GLX_SET_SCISSOR_BOX (&box);
-
-	    glCopyPixels (pOp->u.copy_pixels.x + cctx->pReadBuffer->xOff,
-			  pOp->u.copy_pixels.y + cctx->pReadBuffer->yOff,
-			  pOp->u.copy_pixels.width,
-			  pOp->u.copy_pixels.height,
-			  pOp->u.copy_pixels.type);
-
-	    if (pOp->u.copy_pixels.type == GL_COLOR)
-		XGL_GLX_DRAW_DAMAGE (&box, &region);
-	}
-    }
-}
-
-static void
-xglCopyPixels (GLint   x,
-	       GLint   y,
-	       GLsizei width,
-	       GLsizei height,
-	       GLenum  type)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyPixelsProc;
-
-    gl.u.copy_pixels.x	    = x;
-    gl.u.copy_pixels.y	    = y;
-    gl.u.copy_pixels.width  = width;
-    gl.u.copy_pixels.height = height;
-    gl.u.copy_pixels.type   = type;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglReadPixels (GLint   x,
-	       GLint   y,
-	       GLsizei width,
-	       GLsizei height,
-	       GLenum  format,
-	       GLenum  type,
-	       GLvoid  *pixels)
-{
-    glReadPixels (x + cctx->pReadBuffer->xOff,
-		  y + cctx->pReadBuffer->yOff,
-		  width, height, format, type, pixels);
-}
-
-static void
-xglCopyTexImage1DProc (xglGLOpPtr pOp)
-{
-    glCopyTexImage1D (pOp->u.copy_tex_image_1d.target,
-		      pOp->u.copy_tex_image_1d.level,
-		      pOp->u.copy_tex_image_1d.internalformat,
-		      pOp->u.copy_tex_image_1d.x + cctx->pReadBuffer->xOff,
-		      pOp->u.copy_tex_image_1d.y + cctx->pReadBuffer->yOff,
-		      pOp->u.copy_tex_image_1d.width,
-		      pOp->u.copy_tex_image_1d.border);
-}
-
-static void
-xglCopyTexImage1D (GLenum  target,
-		   GLint   level,
-		   GLenum  internalformat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width,
-		   GLint   border)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyTexImage1DProc;
-
-    gl.u.copy_tex_image_1d.target	  = target;
-    gl.u.copy_tex_image_1d.level	  = level;
-    gl.u.copy_tex_image_1d.internalformat = internalformat;
-    gl.u.copy_tex_image_1d.x		  = x;
-    gl.u.copy_tex_image_1d.y		  = y;
-    gl.u.copy_tex_image_1d.width	  = width;
-    gl.u.copy_tex_image_1d.border	  = border;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyTexImage2DProc (xglGLOpPtr pOp)
-{
-    glCopyTexImage2D (pOp->u.copy_tex_image_2d.target,
-		      pOp->u.copy_tex_image_2d.level,
-		      pOp->u.copy_tex_image_2d.internalformat,
-		      pOp->u.copy_tex_image_2d.x + cctx->pReadBuffer->xOff,
-		      pOp->u.copy_tex_image_2d.y + cctx->pReadBuffer->yOff,
-		      pOp->u.copy_tex_image_2d.width,
-		      pOp->u.copy_tex_image_2d.height,
-		      pOp->u.copy_tex_image_2d.border);
-}
-
-static void
-xglCopyTexImage2D (GLenum  target,
-		   GLint   level,
-		   GLenum  internalformat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width,
-		   GLsizei height,
-		   GLint   border)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyTexImage2DProc;
-
-    gl.u.copy_tex_image_2d.target	  = target;
-    gl.u.copy_tex_image_2d.level	  = level;
-    gl.u.copy_tex_image_2d.internalformat = internalformat;
-    gl.u.copy_tex_image_2d.x		  = x;
-    gl.u.copy_tex_image_2d.y		  = y;
-    gl.u.copy_tex_image_2d.width	  = width;
-    gl.u.copy_tex_image_2d.height	  = height;
-    gl.u.copy_tex_image_2d.border	  = border;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage1DProc (xglGLOpPtr pOp)
-{
-    glCopyTexSubImage1D (pOp->u.copy_tex_sub_image_1d.target,
-			 pOp->u.copy_tex_sub_image_1d.level,
-			 pOp->u.copy_tex_sub_image_1d.xoffset,
-			 pOp->u.copy_tex_sub_image_1d.x +
-			 cctx->pReadBuffer->xOff,
-			 pOp->u.copy_tex_sub_image_1d.y +
-			 cctx->pReadBuffer->yOff,
-			 pOp->u.copy_tex_sub_image_1d.width);
-}
-
-static void
-xglCopyTexSubImage1D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyTexSubImage1DProc;
-
-    gl.u.copy_tex_sub_image_1d.target  = target;
-    gl.u.copy_tex_sub_image_1d.level   = level;
-    gl.u.copy_tex_sub_image_1d.xoffset = xoffset;
-    gl.u.copy_tex_sub_image_1d.x       = x;
-    gl.u.copy_tex_sub_image_1d.y       = y;
-    gl.u.copy_tex_sub_image_1d.width   = width;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage2DProc (xglGLOpPtr pOp)
-{
-    glCopyTexSubImage2D (pOp->u.copy_tex_sub_image_2d.target,
-			 pOp->u.copy_tex_sub_image_2d.level,
-			 pOp->u.copy_tex_sub_image_2d.xoffset,
-			 pOp->u.copy_tex_sub_image_2d.yoffset,
-			 pOp->u.copy_tex_sub_image_2d.x +
-			 cctx->pReadBuffer->xOff,
-			 pOp->u.copy_tex_sub_image_2d.y +
-			 cctx->pReadBuffer->yOff,
-			 pOp->u.copy_tex_sub_image_2d.width,
-			 pOp->u.copy_tex_sub_image_2d.height);
-}
-
-static void
-xglCopyTexSubImage2D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   yoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width,
-		      GLsizei height)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyTexSubImage2DProc;
-
-    gl.u.copy_tex_sub_image_2d.target  = target;
-    gl.u.copy_tex_sub_image_2d.level   = level;
-    gl.u.copy_tex_sub_image_2d.xoffset = xoffset;
-    gl.u.copy_tex_sub_image_2d.yoffset = yoffset;
-    gl.u.copy_tex_sub_image_2d.x       = x;
-    gl.u.copy_tex_sub_image_2d.y       = y;
-    gl.u.copy_tex_sub_image_2d.width   = width;
-    gl.u.copy_tex_sub_image_2d.height  = height;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyColorTableProc (xglGLOpPtr pOp)
-{
-    glCopyColorTable (pOp->u.copy_color_table.target,
-		      pOp->u.copy_color_table.internalformat,
-		      pOp->u.copy_color_table.x + cctx->pReadBuffer->xOff,
-		      pOp->u.copy_color_table.y + cctx->pReadBuffer->yOff,
-		      pOp->u.copy_color_table.width);
-}
-
-static void
-xglCopyColorTable (GLenum  target,
-		   GLenum  internalformat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyColorTableProc;
-
-    gl.u.copy_color_table.target	 = target;
-    gl.u.copy_color_table.internalformat = internalformat;
-    gl.u.copy_color_table.x		 = x;
-    gl.u.copy_color_table.y		 = y;
-    gl.u.copy_color_table.width		 = width;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyColorSubTableProc (xglGLOpPtr pOp)
-{
-    glCopyColorTable (pOp->u.copy_color_sub_table.target,
-		      pOp->u.copy_color_sub_table.start,
-		      pOp->u.copy_color_sub_table.x + cctx->pReadBuffer->xOff,
-		      pOp->u.copy_color_sub_table.y + cctx->pReadBuffer->yOff,
-		      pOp->u.copy_color_sub_table.width);
-}
-
-static void
-xglCopyColorSubTable (GLenum  target,
-		      GLsizei start,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyColorSubTableProc;
-
-    gl.u.copy_color_sub_table.target = target;
-    gl.u.copy_color_sub_table.start  = start;
-    gl.u.copy_color_sub_table.x	     = x;
-    gl.u.copy_color_sub_table.y	     = y;
-    gl.u.copy_color_sub_table.width  = width;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp)
-{
-    GLenum internalformat = pOp->u.copy_convolution_filter_1d.internalformat;
-
-    glCopyConvolutionFilter1D (pOp->u.copy_convolution_filter_1d.target,
-			       internalformat,
-			       pOp->u.copy_convolution_filter_1d.x +
-			       cctx->pReadBuffer->xOff,
-			       pOp->u.copy_convolution_filter_1d.y +
-			       cctx->pReadBuffer->yOff,
-			       pOp->u.copy_convolution_filter_1d.width);
-}
-
-static void
-xglCopyConvolutionFilter1D (GLenum  target,
-			    GLenum  internalformat,
-			    GLint   x,
-			    GLint   y,
-			    GLsizei width)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyConvolutionFilter1DProc;
-
-    gl.u.copy_convolution_filter_1d.target	   = target;
-    gl.u.copy_convolution_filter_1d.internalformat = internalformat;
-    gl.u.copy_convolution_filter_1d.x		   = x;
-    gl.u.copy_convolution_filter_1d.y		   = y;
-    gl.u.copy_convolution_filter_1d.width	   = width;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp)
-{
-    GLenum internalformat = pOp->u.copy_convolution_filter_2d.internalformat;
-
-    glCopyConvolutionFilter2D (pOp->u.copy_convolution_filter_2d.target,
-			       internalformat,
-			       pOp->u.copy_convolution_filter_2d.x +
-			       cctx->pReadBuffer->xOff,
-			       pOp->u.copy_convolution_filter_2d.y +
-			       cctx->pReadBuffer->yOff,
-			       pOp->u.copy_convolution_filter_2d.width,
-			       pOp->u.copy_convolution_filter_2d.height);
-}
-
-static void
-xglCopyConvolutionFilter2D (GLenum  target,
-			    GLenum  internalformat,
-			    GLint   x,
-			    GLint   y,
-			    GLsizei width,
-			    GLsizei height)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyConvolutionFilter2DProc;
-
-    gl.u.copy_convolution_filter_2d.target	   = target;
-    gl.u.copy_convolution_filter_2d.internalformat = internalformat;
-    gl.u.copy_convolution_filter_2d.x		   = x;
-    gl.u.copy_convolution_filter_2d.y		   = y;
-    gl.u.copy_convolution_filter_2d.width	   = width;
-    gl.u.copy_convolution_filter_2d.height	   = height;
-
-    xglGLOp (&gl);
-}
-
-static void
-xglCopyTexSubImage3DProc (xglGLOpPtr pOp)
-{
-    glCopyTexSubImage3D (pOp->u.copy_tex_sub_image_3d.target,
-			 pOp->u.copy_tex_sub_image_3d.level,
-			 pOp->u.copy_tex_sub_image_3d.xoffset,
-			 pOp->u.copy_tex_sub_image_3d.yoffset,
-			 pOp->u.copy_tex_sub_image_3d.zoffset,
-			 pOp->u.copy_tex_sub_image_3d.x +
-			 cctx->pReadBuffer->xOff,
-			 pOp->u.copy_tex_sub_image_3d.y +
-			 cctx->pReadBuffer->yOff,
-			 pOp->u.copy_tex_sub_image_3d.width,
-			 pOp->u.copy_tex_sub_image_3d.height);
-}
-
-static void
-xglCopyTexSubImage3D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   yoffset,
-		      GLint   zoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width,
-		      GLsizei height)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglCopyTexSubImage3DProc;
-
-    gl.u.copy_tex_sub_image_3d.target  = target;
-    gl.u.copy_tex_sub_image_3d.level   = level;
-    gl.u.copy_tex_sub_image_3d.xoffset = xoffset;
-    gl.u.copy_tex_sub_image_3d.yoffset = yoffset;
-    gl.u.copy_tex_sub_image_3d.zoffset = zoffset;
-    gl.u.copy_tex_sub_image_3d.x       = x;
-    gl.u.copy_tex_sub_image_3d.y       = y;
-    gl.u.copy_tex_sub_image_3d.width   = width;
-    gl.u.copy_tex_sub_image_3d.height  = height;
-
-    xglGLOp (&gl);
-}
-
-/* GL_ARB_multitexture */
-static void
-xglNoOpActiveTextureARB (GLenum texture) {}
-static void
-xglActiveTextureARBProc (xglGLOpPtr pOp)
-{
-    GLenum texUnit;
-
-    texUnit = pOp->u.enumeration - GL_TEXTURE0;
-    if (texUnit < 0 || texUnit >= cctx->maxTexUnits)
-    {
-	xglRecordError (GL_INVALID_ENUM);
-    }
-    else
-    {
-	cctx->activeTexUnit = texUnit;
-	(*cctx->ActiveTextureARB) (pOp->u.enumeration);
-    }
-}
-static void
-xglActiveTextureARB (GLenum texture)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglActiveTextureARBProc;
-
-    gl.u.enumeration = texture;
-
-    xglGLOp (&gl);
-}
-static void
-xglNoOpClientActiveTextureARB (GLenum texture) {}
-static void
-xglNoOpMultiTexCoord1dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord1fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord1ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord1svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord2dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord2fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord2ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord2svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord3dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord3fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord3ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord3svARB (GLenum target, const GLshort *v) {}
-static void
-xglNoOpMultiTexCoord4dvARB (GLenum target, const GLdouble *v) {}
-static void
-xglNoOpMultiTexCoord4fvARB (GLenum target, const GLfloat *v) {}
-static void
-xglNoOpMultiTexCoord4ivARB (GLenum target, const GLint *v) {}
-static void
-xglNoOpMultiTexCoord4svARB (GLenum target, const GLshort *v) {}
-
-/* GL_ARB_multisample */
-static void
-xglNoOpSampleCoverageARB (GLclampf value, GLboolean invert) {}
-
-/* GL_EXT_texture_object */
-static GLboolean
-xglNoOpAreTexturesResidentEXT (GLsizei n,
-			       const GLuint *textures,
-			       GLboolean *residences)
-{
-    return GL_FALSE;
-}
-static void
-xglNoOpGenTexturesEXT (GLsizei n, GLuint *textures) {}
-static GLboolean
-xglNoOpIsTextureEXT (GLuint texture)
-{
-    return GL_FALSE;
-}
-
-/* GL_SGIS_multisample */
-static void
-xglNoOpSampleMaskSGIS (GLclampf value, GLboolean invert) {}
-static void
-xglNoOpSamplePatternSGIS (GLenum pattern) {}
-
-/* GL_EXT_point_parameters */
-static void
-xglNoOpPointParameterfEXT (GLenum pname, GLfloat param) {}
-static void
-xglNoOpPointParameterfvEXT (GLenum pname, const GLfloat *params) {}
-
-/* GL_MESA_window_pos */
-static void
-xglNoOpWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z) {}
-static void
-xglWindowPos3fMESAProc (xglGLOpPtr pOp)
-{
-    (*cctx->WindowPos3fMESA) (pOp->u.window_pos_3f.x + cctx->pDrawBuffer->xOff,
-			      pOp->u.window_pos_3f.y + cctx->pDrawBuffer->yOff,
-			      pOp->u.window_pos_3f.z);
-}
-static void
-xglWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z)
-{
-    xglGLOpRec gl;
-
-    gl.glProc = xglWindowPos3fMESAProc;
-
-    gl.u.window_pos_3f.x = x;
-    gl.u.window_pos_3f.y = y;
-    gl.u.window_pos_3f.z = z;
-
-    xglGLOp (&gl);
-}
-
-/* GL_EXT_blend_func_separate */
-static void
-xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB,
-			     GLenum sfactorAlpha, GLenum dfactorAlpha) {}
-
-/* GL_EXT_fog_coord */
-static void
-xglNoOpFogCoordfvEXT (const GLfloat *coord) {}
-static void
-xglNoOpFogCoorddvEXT (const GLdouble *coord) {}
-static void
-xglNoOpFogCoordPointerEXT (GLenum type, GLsizei stride,
-			   const GLvoid *pointer) {}
-
-/* GL_EXT_secondary_color */
-static void
-xglNoOpSecondaryColor3bvEXT (const GLbyte *v) {}
-static void
-xglNoOpSecondaryColor3dvEXT (const GLdouble *v) {}
-static void
-xglNoOpSecondaryColor3fvEXT (const GLfloat *v) {}
-static void
-xglNoOpSecondaryColor3ivEXT (const GLint *v) {}
-static void
-xglNoOpSecondaryColor3svEXT (const GLshort *v) {}
-static void
-xglNoOpSecondaryColor3ubvEXT (const GLubyte *v) {}
-static void
-xglNoOpSecondaryColor3uivEXT (const GLuint *v) {}
-static void
-xglNoOpSecondaryColor3usvEXT (const GLushort *v) {}
-static void
-xglNoOpSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride,
-				 const GLvoid *pointer) {}
-
-/* GL_NV_point_sprite */
-static void
-xglNoOpPointParameteriNV (GLenum pname, GLint params) {}
-static void
-xglNoOpPointParameterivNV (GLenum pname, const GLint *params) {}
-
-/* GL_EXT_stencil_two_side */
-static void
-xglNoOpActiveStencilFaceEXT (GLenum face) {}
-
-/* GL_EXT_framebuffer_object */
-static GLboolean
-xglNoOpIsRenderbufferEXT (GLuint renderbuffer)
-{
-    return FALSE;
-}
-static void
-xglNoOpBindRenderbufferEXT (GLenum target, GLuint renderbuffer) {}
-static void
-xglNoOpDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers) {}
-static void
-xglNoOpGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers) {}
-static void
-xglNoOpRenderbufferStorageEXT (GLenum target, GLenum internalformat,
-			       GLsizei width, GLsizei height) {}
-static void
-xglNoOpGetRenderbufferParameterivEXT (GLenum target, GLenum pname,
-				      GLint *params) {}
-static GLboolean
-xglNoOpIsFramebufferEXT (GLuint framebuffer)
-{
-    return FALSE;
-}
-static void
-xglNoOpBindFramebufferEXT (GLenum target, GLuint framebuffer) {}
-static void
-xglNoOpDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers) {}
-static void
-xglNoOpGenFramebuffersEXT (GLsizei n, GLuint *framebuffers) {}
-static GLenum
-xglNoOpCheckFramebufferStatusEXT (GLenum target)
-{
-    return GL_FRAMEBUFFER_UNSUPPORTED_EXT;
-}
-static void
-xglNoOpFramebufferTexture1DEXT (GLenum target, GLenum attachment,
-				GLenum textarget, GLuint texture,
-				GLint level) {}
-static void
-xglNoOpFramebufferTexture2DEXT (GLenum target, GLenum attachment,
-				GLenum textarget, GLuint texture,
-				GLint level) {}
-static void
-xglNoOpFramebufferTexture3DEXT (GLenum target, GLenum attachment,
-				GLenum textarget, GLuint texture,
-				GLint level, GLint zoffset) {}
-static void
-xglNoOpFramebufferRenderbufferEXT (GLenum target, GLenum attachment,
-				   GLenum renderbuffertarget,
-				   GLuint renderbuffer) {}
-static void
-xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target,
-					       GLenum attachment,
-					       GLenum pname,
-					       GLint *params) {}
-static void
-xglNoOpGenerateMipmapEXT (GLenum target) {}
-
-static struct _glapi_table __glNativeRenderTable = {
-    xglNewList,
-    xglEndList,
-    xglCallList,
-    xglCallLists,
-    xglDeleteLists,
-    xglGenLists,
-    glListBase,
-    xglBegin,
-    xglBitmap,
-    0, /* glColor3b */
-    glColor3bv,
-    0, /* glColor3d */
-    glColor3dv,
-    0, /* glColor3f */
-    glColor3fv,
-    0, /* glColor3i */
-    glColor3iv,
-    0, /* glColor3s */
-    glColor3sv,
-    0, /* glColor3ub */
-    glColor3ubv,
-    0, /* glColor3ui */
-    glColor3uiv,
-    0, /* glColor3us */
-    glColor3usv,
-    0, /* glColor4b */
-    glColor4bv,
-    0, /* glColor4d */
-    glColor4dv,
-    0, /* glColor4f */
-    glColor4fv,
-    0, /* glColor4i */
-    glColor4iv,
-    0, /* glColor4s */
-    glColor4sv,
-    0, /* glColor4ub */
-    glColor4ubv,
-    0, /* glColor4ui */
-    glColor4uiv,
-    0, /* glColor4us */
-    glColor4usv,
-    0, /* glEdgeFlag */
-    glEdgeFlagv,
-    xglEnd,
-    0, /* glIndexd */
-    glIndexdv,
-    0, /* glIndexf */
-    glIndexfv,
-    0, /* glIndexi */
-    glIndexiv,
-    0, /* glIndexs */
-    glIndexsv,
-    0, /* glNormal3b */
-    glNormal3bv,
-    0, /* glNormal3d */
-    glNormal3dv,
-    0, /* glNormal3f */
-    glNormal3fv,
-    0, /* glNormal3i */
-    glNormal3iv,
-    0, /* glNormal3s */
-    glNormal3sv,
-    0, /* glRasterPos2d */
-    glRasterPos2dv,
-    0, /* glRasterPos2f */
-    glRasterPos2fv,
-    0, /* glRasterPos2i */
-    glRasterPos2iv,
-    0, /* glRasterPos2s */
-    glRasterPos2sv,
-    0, /* glRasterPos3d */
-    glRasterPos3dv,
-    0, /* glRasterPos3f */
-    glRasterPos3fv,
-    0, /* glRasterPos3i */
-    glRasterPos3iv,
-    0, /* glRasterPos3s */
-    glRasterPos3sv,
-    0, /* glRasterPos4d */
-    glRasterPos4dv,
-    0, /* glRasterPos4f */
-    glRasterPos4fv,
-    0, /* glRasterPos4i */
-    glRasterPos4iv,
-    0, /* glRasterPos4s */
-    glRasterPos4sv,
-    0, /* glRectd */
-    xglRectdv,
-    0, /* glRectf */
-    xglRectfv,
-    0, /* glRecti */
-    xglRectiv,
-    0, /* glRects */
-    xglRectsv,
-    0, /* glTexCoord1d */
-    glTexCoord1dv,
-    0, /* glTexCoord1f */
-    glTexCoord1fv,
-    0, /* glTexCoord1i */
-    glTexCoord1iv,
-    0, /* glTexCoord1s */
-    glTexCoord1sv,
-    0, /* glTexCoord2d */
-    glTexCoord2dv,
-    0, /* glTexCoord2f */
-    glTexCoord2fv,
-    0, /* glTexCoord2i */
-    glTexCoord2iv,
-    0, /* glTexCoord2s */
-    glTexCoord2sv,
-    0, /* glTexCoord3d */
-    glTexCoord3dv,
-    0, /* glTexCoord3f */
-    glTexCoord3fv,
-    0, /* glTexCoord3i */
-    glTexCoord3iv,
-    0, /* glTexCoord3s */
-    glTexCoord3sv,
-    0, /* glTexCoord4d */
-    glTexCoord4dv,
-    0, /* glTexCoord4f */
-    glTexCoord4fv,
-    0, /* glTexCoord4i */
-    glTexCoord4iv,
-    0, /* glTexCoord4s */
-    glTexCoord4sv,
-    0, /* glVertex2d */
-    glVertex2dv,
-    0, /* glVertex2f */
-    glVertex2fv,
-    0, /* glVertex2i */
-    glVertex2iv,
-    0, /* glVertex2s */
-    glVertex2sv,
-    0, /* glVertex3d */
-    glVertex3dv,
-    0, /* glVertex3f */
-    glVertex3fv,
-    0, /* glVertex3i */
-    glVertex3iv,
-    0, /* glVertex3s */
-    glVertex3sv,
-    0, /* glVertex4d */
-    glVertex4dv,
-    0, /* glVertex4f */
-    glVertex4fv,
-    0, /* glVertex4i */
-    glVertex4iv,
-    0, /* glVertex4s */
-    glVertex4sv,
-    glClipPlane,
-    glColorMaterial,
-    glCullFace,
-    glFogf,
-    glFogfv,
-    glFogi,
-    glFogiv,
-    glFrontFace,
-    glHint,
-    glLightf,
-    glLightfv,
-    glLighti,
-    glLightiv,
-    glLightModelf,
-    glLightModelfv,
-    glLightModeli,
-    glLightModeliv,
-    glLineStipple,
-    glLineWidth,
-    glMaterialf,
-    glMaterialfv,
-    glMateriali,
-    glMaterialiv,
-    glPointSize,
-    glPolygonMode,
-    glPolygonStipple,
-    xglScissor,
-    glShadeModel,
-    xglTexParameterf,
-    xglTexParameterfv,
-    xglTexParameteri,
-    xglTexParameteriv,
-    glTexImage1D,
-    glTexImage2D,
-    glTexEnvf,
-    glTexEnvfv,
-    glTexEnvi,
-    glTexEnviv,
-    glTexGend,
-    glTexGendv,
-    glTexGenf,
-    glTexGenfv,
-    glTexGeni,
-    glTexGeniv,
-    glFeedbackBuffer,
-    glSelectBuffer,
-    glRenderMode,
-    glInitNames,
-    glLoadName,
-    glPassThrough,
-    glPopName,
-    glPushName,
-    xglDrawBuffer,
-    xglClear,
-    glClearAccum,
-    glClearIndex,
-    glClearColor,
-    glClearStencil,
-    glClearDepth,
-    glStencilMask,
-    glColorMask,
-    glDepthMask,
-    glIndexMask,
-    xglAccum,
-    xglDisable,
-    xglEnable,
-    xglFinish,
-    xglFlush,
-    xglPopAttrib,
-    xglPushAttrib,
-    glMap1d,
-    glMap1f,
-    glMap2d,
-    glMap2f,
-    glMapGrid1d,
-    glMapGrid1f,
-    glMapGrid2d,
-    glMapGrid2f,
-    0, /* glEvalCoord1d */
-    glEvalCoord1dv,
-    0, /* glEvalCoord1f */
-    glEvalCoord1fv,
-    0, /* glEvalCoord2d */
-    glEvalCoord2dv,
-    0, /* glEvalCoord2f */
-    glEvalCoord2fv,
-    glEvalMesh1,
-    glEvalPoint1,
-    glEvalMesh2,
-    glEvalPoint2,
-    glAlphaFunc,
-    glBlendFunc,
-    glLogicOp,
-    glStencilFunc,
-    glStencilOp,
-    glDepthFunc,
-    glPixelZoom,
-    glPixelTransferf,
-    glPixelTransferi,
-    glPixelStoref,
-    glPixelStorei,
-    glPixelMapfv,
-    glPixelMapuiv,
-    glPixelMapusv,
-    xglReadBuffer,
-    xglCopyPixels,
-    xglReadPixels,
-    xglDrawPixels,
-    xglGetBooleanv,
-    glGetClipPlane,
-    xglGetDoublev,
-    xglGetError,
-    xglGetFloatv,
-    xglGetIntegerv,
-    glGetLightfv,
-    glGetLightiv,
-    glGetMapdv,
-    glGetMapfv,
-    glGetMapiv,
-    glGetMaterialfv,
-    glGetMaterialiv,
-    glGetPixelMapfv,
-    glGetPixelMapuiv,
-    glGetPixelMapusv,
-    glGetPolygonStipple,
-    xglGetString,
-    glGetTexEnvfv,
-    glGetTexEnviv,
-    glGetTexGendv,
-    glGetTexGenfv,
-    glGetTexGeniv,
-    glGetTexImage,
-    glGetTexParameterfv,
-    glGetTexParameteriv,
-    xglGetTexLevelParameterfv,
-    xglGetTexLevelParameteriv,
-    xglIsEnabled,
-    xglIsList,
-    glDepthRange,
-    glFrustum,
-    glLoadIdentity,
-    glLoadMatrixf,
-    glLoadMatrixd,
-    glMatrixMode,
-    glMultMatrixf,
-    glMultMatrixd,
-    glOrtho,
-    glPopMatrix,
-    glPushMatrix,
-    glRotated,
-    glRotatef,
-    glScaled,
-    glScalef,
-    glTranslated,
-    glTranslatef,
-    xglViewport,
-    glArrayElement,
-    xglBindTexture,
-    glColorPointer,
-    glDisableClientState,
-    xglDrawArrays,
-    xglDrawElements,
-    glEdgeFlagPointer,
-    glEnableClientState,
-    glIndexPointer,
-    0, /* glIndexub */
-    glIndexubv,
-    glInterleavedArrays,
-    glNormalPointer,
-    glPolygonOffset,
-    glTexCoordPointer,
-    glVertexPointer,
-    xglAreTexturesResident,
-    xglCopyTexImage1D,
-    xglCopyTexImage2D,
-    xglCopyTexSubImage1D,
-    xglCopyTexSubImage2D,
-    xglDeleteTextures,
-    xglGenTextures,
-    glGetPointerv,
-    xglIsTexture,
-    xglPrioritizeTextures,
-    glTexSubImage1D,
-    glTexSubImage2D,
-    glPopClientAttrib,
-    glPushClientAttrib,
-    glBlendColor,
-    glBlendEquation,
-    0, /* glDrawRangeElements */
-    glColorTable,
-    glColorTableParameterfv,
-    glColorTableParameteriv,
-    xglCopyColorTable,
-    glGetColorTable,
-    glGetColorTableParameterfv,
-    glGetColorTableParameteriv,
-    glColorSubTable,
-    xglCopyColorSubTable,
-    glConvolutionFilter1D,
-    glConvolutionFilter2D,
-    glConvolutionParameterf,
-    glConvolutionParameterfv,
-    glConvolutionParameteri,
-    glConvolutionParameteriv,
-    xglCopyConvolutionFilter1D,
-    xglCopyConvolutionFilter2D,
-    glGetConvolutionFilter,
-    glGetConvolutionParameterfv,
-    glGetConvolutionParameteriv,
-    glGetSeparableFilter,
-    glSeparableFilter2D,
-    glGetHistogram,
-    glGetHistogramParameterfv,
-    glGetHistogramParameteriv,
-    glGetMinmax,
-    glGetMinmaxParameterfv,
-    glGetMinmaxParameteriv,
-    glHistogram,
-    glMinmax,
-    glResetHistogram,
-    glResetMinmax,
-    glTexImage3D,
-    glTexSubImage3D,
-    xglCopyTexSubImage3D,
-    xglNoOpActiveTextureARB,
-    xglNoOpClientActiveTextureARB,
-    0, /* glMultiTexCoord1dARB */
-    xglNoOpMultiTexCoord1dvARB,
-    0, /* glMultiTexCoord1fARB */
-    xglNoOpMultiTexCoord1fvARB,
-    0, /* glMultiTexCoord1iARB */
-    xglNoOpMultiTexCoord1ivARB,
-    0, /* glMultiTexCoord1sARB */
-    xglNoOpMultiTexCoord1svARB,
-    0, /* glMultiTexCoord2dARB */
-    xglNoOpMultiTexCoord2dvARB,
-    0, /* glMultiTexCoord2fARB */
-    xglNoOpMultiTexCoord2fvARB,
-    0, /* glMultiTexCoord2iARB */
-    xglNoOpMultiTexCoord2ivARB,
-    0, /* glMultiTexCoord2sARB */
-    xglNoOpMultiTexCoord2svARB,
-    0, /* glMultiTexCoord3dARB */
-    xglNoOpMultiTexCoord3dvARB,
-    0, /* glMultiTexCoord3fARB */
-    xglNoOpMultiTexCoord3fvARB,
-    0, /* glMultiTexCoord3iARB */
-    xglNoOpMultiTexCoord3ivARB,
-    0, /* glMultiTexCoord3sARB */
-    xglNoOpMultiTexCoord3svARB,
-    0, /* glMultiTexCoord4dARB */
-    xglNoOpMultiTexCoord4dvARB,
-    0, /* glMultiTexCoord4fARB */
-    xglNoOpMultiTexCoord4fvARB,
-    0, /* glMultiTexCoord4iARB */
-    xglNoOpMultiTexCoord4ivARB,
-    0, /* glMultiTexCoord4sARB */
-    xglNoOpMultiTexCoord4svARB,
-    0, /* glLoadTransposeMatrixfARB */
-    0, /* glLoadTransposeMatrixdARB */
-    0, /* glMultTransposeMatrixfARB */
-    0, /* glMultTransposeMatrixdARB */
-    xglNoOpSampleCoverageARB,
-    0, /* glDrawBuffersARB */
-    0, /* glPolygonOffsetEXT */
-    0, /* glGetTexFilterFuncSGIS */
-    0, /* glTexFilterFuncSGIS */
-    0, /* glGetHistogramEXT */
-    0, /* glGetHistogramParameterfvEXT */
-    0, /* glGetHistogramParameterivEXT */
-    0, /* glGetMinmaxEXT */
-    0, /* glGetMinmaxParameterfvEXT */
-    0, /* glGetMinmaxParameterivEXT */
-    0, /* glGetConvolutionFilterEXT */
-    0, /* glGetConvolutionParameterfvEXT */
-    0, /* glGetConvolutionParameterivEXT */
-    0, /* glGetSeparableFilterEXT */
-    0, /* glGetColorTableSGI */
-    0, /* glGetColorTableParameterfvSGI */
-    0, /* glGetColorTableParameterivSGI */
-    0, /* glPixelTexGenSGIX */
-    0, /* glPixelTexGenParameteriSGIS */
-    0, /* glPixelTexGenParameterivSGIS */
-    0, /* glPixelTexGenParameterfSGIS */
-    0, /* glPixelTexGenParameterfvSGIS */
-    0, /* glGetPixelTexGenParameterivSGIS */
-    0, /* glGetPixelTexGenParameterfvSGIS */
-    0, /* glTexImage4DSGIS */
-    0, /* glTexSubImage4DSGIS */
-    xglNoOpAreTexturesResidentEXT,
-    xglNoOpGenTexturesEXT,
-    xglNoOpIsTextureEXT,
-    0, /* glDetailTexFuncSGIS */
-    0, /* glGetDetailTexFuncSGIS */
-    0, /* glSharpenTexFuncSGIS */
-    0, /* glGetSharpenTexFuncSGIS */
-    xglNoOpSampleMaskSGIS,
-    xglNoOpSamplePatternSGIS,
-    0, /* glColorPointerEXT */
-    0, /* glEdgeFlagPointerEXT */
-    0, /* glIndexPointerEXT */
-    0, /* glNormalPointerEXT */
-    0, /* glTexCoordPointerEXT */
-    0, /* glVertexPointerEXT */
-    0, /* glSpriteParameterfSGIX */
-    0, /* glSpriteParameterfvSGIX */
-    0, /* glSpriteParameteriSGIX */
-    0, /* glSpriteParameterivSGIX */
-    xglNoOpPointParameterfEXT,
-    xglNoOpPointParameterfvEXT,
-    0, /* glGetInstrumentsSGIX */
-    0, /* glInstrumentsBufferSGIX */
-    0, /* glPollInstrumentsSGIX */
-    0, /* glReadInstrumentsSGIX */
-    0, /* glStartInstrumentsSGIX */
-    0, /* glStopInstrumentsSGIX */
-    0, /* glFrameZoomSGIX */
-    0, /* glTagSampleBufferSGIX */
-    0, /* glReferencePlaneSGIX */
-    0, /* glFlushRasterSGIX */
-    0, /* glGetListParameterfvSGIX */
-    0, /* glGetListParameterivSGIX */
-    0, /* glListParameterfSGIX */
-    0, /* glListParameterfvSGIX */
-    0, /* glListParameteriSGIX */
-    0, /* glListParameterivSGIX */
-    0, /* glFragmentColorMaterialSGIX */
-    0, /* glFragmentLightfSGIX */
-    0, /* glFragmentLightfvSGIX */
-    0, /* glFragmentLightiSGIX */
-    0, /* glFragmentLightivSGIX */
-    0, /* glFragmentLightModelfSGIX */
-    0, /* glFragmentLightModelfvSGIX */
-    0, /* glFragmentLightModeliSGIX */
-    0, /* glFragmentLightModelivSGIX */
-    0, /* glFragmentMaterialfSGIX */
-    0, /* glFragmentMaterialfvSGIX */
-    0, /* glFragmentMaterialiSGIX */
-    0, /* glFragmentMaterialivSGIX */
-    0, /* glGetFragmentLightfvSGIX */
-    0, /* glGetFragmentLightivSGIX */
-    0, /* glGetFragmentMaterialfvSGIX */
-    0, /* glGetFragmentMaterialivSGIX */
-    0, /* glLightEnviSGIX */
-    0, /* glVertexWeightfEXT */
-    0, /* glVertexWeightfvEXT */
-    0, /* glVertexWeightPointerEXT */
-    0, /* glFlushVertexArrayRangeNV */
-    0, /* glVertexArrayRangeNV */
-    0, /* glCombinerParameterfvNV */
-    0, /* glCombinerParameterfNV */
-    0, /* glCombinerParameterivNV */
-    0, /* glCombinerParameteriNV */
-    0, /* glCombinerInputNV */
-    0, /* glCombinerOutputNV */
-    0, /* glFinalCombinerInputNV */
-    0, /* glGetCombinerInputParameterfvNV */
-    0, /* glGetCombinerInputParameterivNV */
-    0, /* glGetCombinerOutputParameterfvNV */
-    0, /* glGetCombinerOutputParameterivNV */
-    0, /* glGetFinalCombinerInputParameterfvNV */
-    0, /* glGetFinalCombinerInputParameterivNV */
-    0, /* glResizeBuffersMESA */
-    0, /* glWindowPos2dMESA */
-    0, /* glWindowPos2dvMESA */
-    0, /* glWindowPos2fMESA */
-    0, /* glWindowPos2fvMESA */
-    0, /* glWindowPos2iMESA */
-    0, /* glWindowPos2ivMESA */
-    0, /* glWindowPos2sMESA */
-    0, /* glWindowPos2svMESA */
-    0, /* glWindowPos3dMESA */
-    0, /* glWindowPos3dvMESA */
-    xglNoOpWindowPos3fMESA,
-    0, /* glWindowPos3fvMESA */
-    0, /* glWindowPos3iMESA */
-    0, /* glWindowPos3ivMESA */
-    0, /* glWindowPos3sMESA */
-    0, /* glWindowPos3svMESA */
-    0, /* glWindowPos4dMESA */
-    0, /* glWindowPos4dvMESA */
-    0, /* glWindowPos4fMESA */
-    0, /* glWindowPos4fvMESA */
-    0, /* glWindowPos4iMESA */
-    0, /* glWindowPos4ivMESA */
-    0, /* glWindowPos4sMESA */
-    0, /* glWindowPos4svMESA */
-    xglNoOpBlendFuncSeparateEXT,
-    0, /* glIndexMaterialEXT */
-    0, /* glIndexFuncEXT */
-    0, /* glLockArraysEXT */
-    0, /* glUnlockArraysEXT */
-    0, /* glCullParameterdvEXT */
-    0, /* glCullParameterfvEXT */
-    0, /* glHintPGI */
-    0, /* glFogCoordfEXT */
-    xglNoOpFogCoordfvEXT,
-    0, /* glFogCoorddEXT */
-    xglNoOpFogCoorddvEXT,
-    xglNoOpFogCoordPointerEXT,
-    0, /* glGetColorTableEXT */
-    0, /* glGetColorTableParameterivEXT */
-    0, /* glGetColorTableParameterfvEXT */
-    0, /* glTbufferMask3DFX */
-    0, /* glCompressedTexImage3DARB */
-    0, /* glCompressedTexImage2DARB */
-    0, /* glCompressedTexImage1DARB */
-    0, /* glCompressedTexSubImage3DARB */
-    0, /* glCompressedTexSubImage2DARB */
-    0, /* glCompressedTexSubImage1DARB */
-    0, /* glGetCompressedTexImageARB */
-    0, /* glSecondaryColor3bEXT */
-    xglNoOpSecondaryColor3bvEXT,
-    0, /* glSecondaryColor3dEXT */
-    xglNoOpSecondaryColor3dvEXT,
-    0, /* glSecondaryColor3fEXT */
-    xglNoOpSecondaryColor3fvEXT,
-    0, /* glSecondaryColor3iEXT */
-    xglNoOpSecondaryColor3ivEXT,
-    0, /* glSecondaryColor3sEXT */
-    xglNoOpSecondaryColor3svEXT,
-    0, /* glSecondaryColor3ubEXT */
-    xglNoOpSecondaryColor3ubvEXT,
-    0, /* glSecondaryColor3uiEXT */
-    xglNoOpSecondaryColor3uivEXT,
-    0, /* glSecondaryColor3usEXT */
-    xglNoOpSecondaryColor3usvEXT,
-    xglNoOpSecondaryColorPointerEXT,
-    0, /* glAreProgramsResidentNV */
-    0, /* glBindProgramNV */
-    0, /* glDeleteProgramsNV */
-    0, /* glExecuteProgramNV */
-    0, /* glGenProgramsNV */
-    0, /* glGetProgramParameterdvNV */
-    0, /* glGetProgramParameterfvNV */
-    0, /* glGetProgramivNV */
-    0, /* glGetProgramStringNV */
-    0, /* glGetTrackMatrixivNV */
-    0, /* glGetVertexAttribdvARB */
-    0, /* glGetVertexAttribfvARB */
-    0, /* glGetVertexAttribivARB */
-    0, /* glGetVertexAttribPointervNV */
-    0, /* glIsProgramNV */
-    0, /* glLoadProgramNV */
-    0, /* glProgramParameter4dNV */
-    0, /* glProgramParameter4dvNV */
-    0, /* glProgramParameter4fNV */
-    0, /* glProgramParameter4fvNV */
-    0, /* glProgramParameters4dvNV */
-    0, /* glProgramParameters4fvNV */
-    0, /* glRequestResidentProgramsNV */
-    0, /* glTrackMatrixNV */
-    0, /* glVertexAttribPointerNV */
-    0, /* glVertexAttrib1dARB */
-    0, /* glVertexAttrib1dvARB */
-    0, /* glVertexAttrib1fARB */
-    0, /* glVertexAttrib1fvARB */
-    0, /* glVertexAttrib1sARB */
-    0, /* glVertexAttrib1svARB */
-    0, /* glVertexAttrib2dARB */
-    0, /* glVertexAttrib2dvARB */
-    0, /* glVertexAttrib2fARB */
-    0, /* glVertexAttrib2fvARB */
-    0, /* glVertexAttrib2sARB */
-    0, /* glVertexAttrib2svARB */
-    0, /* glVertexAttrib3dARB */
-    0, /* glVertexAttrib3dvARB */
-    0, /* glVertexAttrib3fARB */
-    0, /* glVertexAttrib3fvARB */
-    0, /* glVertexAttrib3sARB */
-    0, /* glVertexAttrib3svARB */
-    0, /* glVertexAttrib4dARB */
-    0, /* glVertexAttrib4dvARB */
-    0, /* glVertexAttrib4fARB */
-    0, /* glVertexAttrib4fvARB */
-    0, /* glVertexAttrib4sARB */
-    0, /* glVertexAttrib4svARB */
-    0, /* glVertexAttrib4NubARB */
-    0, /* glVertexAttrib4NubvARB */
-    0, /* glVertexAttribs1dvNV */
-    0, /* glVertexAttribs1fvNV */
-    0, /* glVertexAttribs1svNV */
-    0, /* glVertexAttribs2dvNV */
-    0, /* glVertexAttribs2fvNV */
-    0, /* glVertexAttribs2svNV */
-    0, /* glVertexAttribs3dvNV */
-    0, /* glVertexAttribs3fvNV */
-    0, /* glVertexAttribs3svNV */
-    0, /* glVertexAttribs4dvNV */
-    0, /* glVertexAttribs4fvNV */
-    0, /* glVertexAttribs4svNV */
-    0, /* glVertexAttribs4ubvNV */
-    xglNoOpPointParameteriNV,
-    xglNoOpPointParameterivNV,
-    0, /* glMultiDrawArraysEXT */
-    0, /* glMultiDrawElementsEXT */
-    xglNoOpActiveStencilFaceEXT,
-    0, /* glDeleteFencesNV */
-    0, /* glGenFencesNV */
-    0, /* glIsFenceNV */
-    0, /* glTestFenceNV */
-    0, /* glGetFenceivNV */
-    0, /* glFinishFenceNV */
-    0, /* glSetFenceNV */
-    0, /* glVertexAttrib4bvARB */
-    0, /* glVertexAttrib4ivARB */
-    0, /* glVertexAttrib4ubvARB */
-    0, /* glVertexAttrib4usvARB */
-    0, /* glVertexAttrib4uivARB */
-    0, /* glVertexAttrib4NbvARB */
-    0, /* glVertexAttrib4NsvARB */
-    0, /* glVertexAttrib4NivARB */
-    0, /* glVertexAttrib4NusvARB */
-    0, /* glVertexAttrib4NuivARB */
-    0, /* glVertexAttribPointerARB */
-    0, /* glEnableVertexAttribArrayARB */
-    0, /* glDisableVertexAttribArrayARB */
-    0, /* glProgramStringARB */
-    0, /* glProgramEnvParameter4dARB */
-    0, /* glProgramEnvParameter4dvARB */
-    0, /* glProgramEnvParameter4fARB */
-    0, /* glProgramEnvParameter4fvARB */
-    0, /* glProgramLocalParameter4dARB */
-    0, /* glProgramLocalParameter4dvARB */
-    0, /* glProgramLocalParameter4fARB */
-    0, /* glProgramLocalParameter4fvARB */
-    0, /* glGetProgramEnvParameterdvARB */
-    0, /* glGetProgramEnvParameterfvARB */
-    0, /* glGetProgramLocalParameterdvARB */
-    0, /* glGetProgramLocalParameterfvARB */
-    0, /* glGetProgramivARB */
-    0, /* glGetProgramStringARB */
-    0, /* glProgramNamedParameter4fNV */
-    0, /* glProgramNamedParameter4dNV */
-    0, /* glProgramNamedParameter4fvNV */
-    0, /* glProgramNamedParameter4dvNV */
-    0, /* glGetProgramNamedParameterfvNV */
-    0, /* glGetProgramNamedParameterdvNV */
-    0, /* glBindBufferARB */
-    0, /* glBufferDataARB */
-    0, /* glBufferSubDataARB */
-    0, /* glDeleteBuffersARB */
-    0, /* glGenBuffersARB */
-    0, /* glGetBufferParameterivARB */
-    0, /* glGetBufferPointervARB */
-    0, /* glGetBufferSubDataARB */
-    0, /* glIsBufferARB */
-    0, /* glMapBufferARB */
-    0, /* glUnmapBufferARB */
-    0, /* glDepthBoundsEXT */
-    0, /* glGenQueriesARB */
-    0, /* glDeleteQueriesARB */
-    0, /* glIsQueryARB */
-    0, /* glBeginQueryARB */
-    0, /* glEndQueryARB */
-    0, /* glGetQueryivARB */
-    0, /* glGetQueryObjectivARB */
-    0, /* glGetQueryObjectuivARB */
-    0, /* glMultiModeDrawArraysIBM */
-    0, /* glMultiModeDrawElementsIBM */
-    0, /* glBlendEquationSeparateEXT */
-    0, /* glDeleteObjectARB */
-    0, /* glGetHandleARB */
-    0, /* glDetachObjectARB */
-    0, /* glCreateShaderObjectARB */
-    0, /* glShaderSourceARB */
-    0, /* glCompileShaderARB */
-    0, /* glCreateProgramObjectARB */
-    0, /* glAttachObjectARB */
-    0, /* glLinkProgramARB */
-    0, /* glUseProgramObjectARB */
-    0, /* glValidateProgramARB */
-    0, /* glUniform1fARB */
-    0, /* glUniform2fARB */
-    0, /* glUniform3fARB */
-    0, /* glUniform4fARB */
-    0, /* glUniform1iARB */
-    0, /* glUniform2iARB */
-    0, /* glUniform3iARB */
-    0, /* glUniform4iARB */
-    0, /* glUniform1fvARB */
-    0, /* glUniform2fvARB */
-    0, /* glUniform3fvARB */
-    0, /* glUniform4fvARB */
-    0, /* glUniform1ivARB */
-    0, /* glUniform2ivARB */
-    0, /* glUniform3ivARB */
-    0, /* glUniform4ivARB */
-    0, /* glUniformMatrix2fvARB */
-    0, /* glUniformMatrix3fvARB */
-    0, /* glUniformMatrix4fvARB */
-    0, /* glGetObjectParameterfvARB */
-    0, /* glGetObjectParameterivARB */
-    0, /* glGetInfoLogARB */
-    0, /* glGetAttachedObjectsARB */
-    0, /* glGetUniformLocationARB */
-    0, /* glGetActiveUniformARB */
-    0, /* glGetUniformfvARB */
-    0, /* glGetUniformivARB */
-    0, /* glGetShaderSourceARB */
-    0, /* glBindAttribLocationARB */
-    0, /* glGetActiveAttribARB */
-    0, /* glGetAttribLocationARB */
-    0, /* glGetVertexAttribdvNV */
-    0, /* glGetVertexAttribfvNV */
-    0, /* glGetVertexAttribivNV */
-    0, /* glVertexAttrib1dNV */
-    0, /* glVertexAttrib1dvNV */
-    0, /* glVertexAttrib1fNV */
-    0, /* glVertexAttrib1fvNV */
-    0, /* glVertexAttrib1sNV */
-    0, /* glVertexAttrib1svNV */
-    0, /* glVertexAttrib2dNV */
-    0, /* glVertexAttrib2dvNV */
-    0, /* glVertexAttrib2fNV */
-    0, /* glVertexAttrib2fvNV */
-    0, /* glVertexAttrib2sNV */
-    0, /* glVertexAttrib2svNV */
-    0, /* glVertexAttrib3dNV */
-    0, /* glVertexAttrib3dvNV */
-    0, /* glVertexAttrib3fNV */
-    0, /* glVertexAttrib3fvNV */
-    0, /* glVertexAttrib3sNV */
-    0, /* glVertexAttrib3svNV */
-    0, /* glVertexAttrib4dNV */
-    0, /* glVertexAttrib4dvNV */
-    0, /* glVertexAttrib4fNV */
-    0, /* glVertexAttrib4fvNV */
-    0, /* glVertexAttrib4sNV */
-    0, /* glVertexAttrib4svNV */
-    0, /* glVertexAttrib4ubNV */
-    0, /* glVertexAttrib4ubvNV */
-    0, /* glGenFragmentShadersATI */
-    0, /* glBindFragmentShaderATI */
-    0, /* glDeleteFragmentShaderATI */
-    0, /* glBeginFragmentShaderATI */
-    0, /* glEndFragmentShaderATI */
-    0, /* glPassTexCoordATI */
-    0, /* glSampleMapATI */
-    0, /* glColorFragmentOp1ATI */
-    0, /* glColorFragmentOp2ATI */
-    0, /* glColorFragmentOp3ATI */
-    0, /* glAlphaFragmentOp1ATI */
-    0, /* glAlphaFragmentOp2ATI */
-    0, /* glAlphaFragmentOp3ATI */
-    0, /* glSetFragmentShaderConstantATI */
-    xglNoOpIsRenderbufferEXT,
-    xglNoOpBindRenderbufferEXT,
-    xglNoOpDeleteRenderbuffersEXT,
-    xglNoOpGenRenderbuffersEXT,
-    xglNoOpRenderbufferStorageEXT,
-    xglNoOpGetRenderbufferParameterivEXT,
-    xglNoOpIsFramebufferEXT,
-    xglNoOpBindFramebufferEXT,
-    xglNoOpDeleteFramebuffersEXT,
-    xglNoOpGenFramebuffersEXT,
-    xglNoOpCheckFramebufferStatusEXT,
-    xglNoOpFramebufferTexture1DEXT,
-    xglNoOpFramebufferTexture2DEXT,
-    xglNoOpFramebufferTexture3DEXT,
-    xglNoOpFramebufferRenderbufferEXT,
-    xglNoOpGetFramebufferAttachmentParameterivEXT,
-    xglNoOpGenerateMipmapEXT,
-    0, /* glStencilFuncSeparate */
-    0, /* glStencilOpSeparate */
-    0, /* glStencilMaskSeparate */
-    0, /* glGetQueryObjecti64vEXT */
-    0  /* glGetQueryObjectui64vEXT */
-};
-
-static void
-xglInitExtensions (xglGLContextPtr pContext)
-{
-    const char *extensions;
-
-    extensions = (const char *) glGetString (GL_EXTENSIONS);
-
-    if (strstr (extensions, "GL_ARB_multitexture"))
-    {
-	pContext->ActiveTextureARB =
-	    (PFNGLACTIVETEXTUREARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glActiveTextureARB");
-	pContext->glRenderTable.ClientActiveTextureARB =
-	    (PFNGLCLIENTACTIVETEXTUREARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glClientActiveTextureARB");
-	pContext->glRenderTable.MultiTexCoord1dvARB =
-	    (PFNGLMULTITEXCOORD1DVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord1dvARB");
-	pContext->glRenderTable.MultiTexCoord1fvARB =
-	    (PFNGLMULTITEXCOORD1FVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord1fvARB");
-	pContext->glRenderTable.MultiTexCoord1ivARB =
-	    (PFNGLMULTITEXCOORD1IVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord1ivARB");
-	pContext->glRenderTable.MultiTexCoord1svARB =
-	    (PFNGLMULTITEXCOORD1SVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord1svARB");
-	pContext->glRenderTable.MultiTexCoord2dvARB =
-	    (PFNGLMULTITEXCOORD2DVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord2dvARB");
-	pContext->glRenderTable.MultiTexCoord2fvARB =
-	    (PFNGLMULTITEXCOORD2FVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord2fvARB");
-	pContext->glRenderTable.MultiTexCoord2ivARB =
-	    (PFNGLMULTITEXCOORD2IVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord2ivARB");
-	pContext->glRenderTable.MultiTexCoord2svARB =
-	    (PFNGLMULTITEXCOORD2SVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord2svARB");
-	pContext->glRenderTable.MultiTexCoord3dvARB =
-	    (PFNGLMULTITEXCOORD3DVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord3dvARB");
-	pContext->glRenderTable.MultiTexCoord3fvARB =
-	    (PFNGLMULTITEXCOORD3FVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord3fvARB");
-	pContext->glRenderTable.MultiTexCoord3ivARB =
-	    (PFNGLMULTITEXCOORD3IVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord3ivARB");
-	pContext->glRenderTable.MultiTexCoord3svARB =
-	    (PFNGLMULTITEXCOORD3SVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord3svARB");
-	pContext->glRenderTable.MultiTexCoord4dvARB =
-	    (PFNGLMULTITEXCOORD4DVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord4dvARB");
-	pContext->glRenderTable.MultiTexCoord4fvARB =
-	    (PFNGLMULTITEXCOORD4FVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord4fvARB");
-	pContext->glRenderTable.MultiTexCoord4ivARB =
-	    (PFNGLMULTITEXCOORD4IVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord4ivARB");
-	pContext->glRenderTable.MultiTexCoord4svARB =
-	    (PFNGLMULTITEXCOORD4SVARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glMultiTexCoord4svARB");
-
-	glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &pContext->maxTexUnits);
-	if (pContext->maxTexUnits > XGL_MAX_TEXTURE_UNITS)
-	    pContext->maxTexUnits = XGL_MAX_TEXTURE_UNITS;
-
-	pContext->glRenderTable.ActiveTextureARB = xglActiveTextureARB;
-    }
-    else
-	pContext->maxTexUnits = 1;
-
-    if (strstr (extensions, "GL_ARB_multisample"))
-    {
-	pContext->glRenderTable.SampleCoverageARB =
-	    (PFNGLSAMPLECOVERAGEARBPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSampleCoverageARB");
-    }
-
-    if (strstr (extensions, "GL_EXT_texture_object"))
-    {
-	pContext->glRenderTable.AreTexturesResidentEXT =
-	    xglAreTexturesResident;
-	pContext->glRenderTable.GenTexturesEXT = xglGenTextures;
-	pContext->glRenderTable.IsTextureEXT = xglIsTexture;
-    }
-
-    if (strstr (extensions, "GL_SGIS_multisample"))
-    {
-	pContext->glRenderTable.SampleMaskSGIS =
-	    (PFNGLSAMPLEMASKSGISPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSampleMaskSGIS");
-	pContext->glRenderTable.SamplePatternSGIS =
-	    (PFNGLSAMPLEPATTERNSGISPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSamplePatternSGIS");
-    }
-
-    if (strstr (extensions, "GL_EXT_point_parameters"))
-    {
-	pContext->glRenderTable.PointParameterfEXT =
-	    (PFNGLPOINTPARAMETERFEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glPointParameterfEXT");
-	pContext->glRenderTable.PointParameterfvEXT =
-	    (PFNGLPOINTPARAMETERFVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glPointParameterfvEXT");
-    }
-
-    if (strstr (extensions, "GL_MESA_window_pos"))
-    {
-	pContext->WindowPos3fMESA =
-	    (PFNGLWINDOWPOS3FMESAPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glWindowPos3fMESA");
-
-	pContext->glRenderTable.WindowPos3fMESA = xglWindowPos3fMESA;
-    }
-
-    if (strstr (extensions, "GL_EXT_blend_func_separate"))
-    {
-	pContext->glRenderTable.BlendFuncSeparateEXT =
-	    (PFNGLBLENDFUNCSEPARATEEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glBlendFuncSeparateEXT");
-    }
-
-    if (strstr (extensions, "GL_EXT_fog_coord"))
-    {
-	pContext->glRenderTable.FogCoordfvEXT =
-	    (PFNGLFOGCOORDFVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFogCoordfvEXT");
-	pContext->glRenderTable.FogCoorddvEXT =
-	    (PFNGLFOGCOORDDVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFogCoorddvEXT");
-	pContext->glRenderTable.FogCoordPointerEXT =
-	    (PFNGLFOGCOORDPOINTEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFogCoordPointerEXT");
-    }
-
-    if (strstr (extensions, "GL_EXT_secondary_color"))
-    {
-	pContext->glRenderTable.SecondaryColor3bvEXT =
-	    (PFNGLSECONDARYCOLOR3BVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3bvEXT");
-	pContext->glRenderTable.SecondaryColor3dvEXT =
-	    (PFNGLSECONDARYCOLOR3DVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3dvEXT");
-	pContext->glRenderTable.SecondaryColor3fvEXT =
-	    (PFNGLSECONDARYCOLOR3FVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3fvEXT");
-	pContext->glRenderTable.SecondaryColor3ivEXT =
-	    (PFNGLSECONDARYCOLOR3IVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3ivEXT");
-	pContext->glRenderTable.SecondaryColor3svEXT =
-	    (PFNGLSECONDARYCOLOR3SVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3svEXT");
-	pContext->glRenderTable.SecondaryColor3ubvEXT =
-	    (PFNGLSECONDARYCOLOR3UBVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3ubvEXT");
-	pContext->glRenderTable.SecondaryColor3uivEXT =
-	    (PFNGLSECONDARYCOLOR3UIVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3uivEXT");
-	pContext->glRenderTable.SecondaryColor3usvEXT =
-	    (PFNGLSECONDARYCOLOR3USVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColor3usvEXT");
-	pContext->glRenderTable.SecondaryColorPointerEXT =
-	    (PFNGLSECONDARYCOLORPOINTEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glSecondaryColorPointerEXT");
-    }
-
-    if (strstr (extensions, "GL_NV_point_sprite"))
-    {
-	pContext->glRenderTable.PointParameteriNV =
-	    (PFNGLPOINTPARAMETERINVPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glPointParameteriNV");
-	pContext->glRenderTable.PointParameterivNV =
-	    (PFNGLPOINTPARAMETERIVNVPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glPointParameterivNV");
-    }
-
-    if (strstr (extensions, "GL_EXT_stencil_two_side"))
-    {
-	pContext->glRenderTable.ActiveStencilFaceEXT =
-	    (PFNGLACTIVESTENCILFACEEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glActiveStencilFaceEXT");
-    }
-
-    if (strstr (extensions, "GL_EXT_framebuffer_object"))
-    {
-	pContext->glRenderTable.IsRenderbufferEXT =
-	    (PFNGLISRENDERBUFFEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glIsRenderbufferEXT");
-	pContext->glRenderTable.BindRenderbufferEXT =
-	    (PFNGLBINDRENDERBUFFEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glBindRenderbufferEXT");
-	pContext->glRenderTable.DeleteRenderbuffersEXT =
-	    (PFNGLDELETERENDERBUFFERSEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glDeleteRenderbuffersEXT");
-	pContext->glRenderTable.GenRenderbuffersEXT =
-	    (PFNGLGENRENDERBUFFERSEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glGenRenderbuffersEXT");
-	pContext->glRenderTable.RenderbufferStorageEXT =
-	    (PFNGLRENDERBUFFERSTORAGEEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glRenderbufferStorageEXT");
-	pContext->glRenderTable.GetRenderbufferParameterivEXT =
-	    (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glGetRenderbufferParameterivEXT");
-	pContext->glRenderTable.IsFramebufferEXT =
-	    (PFNGLISFRAMEBUFFEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glIsFramebufferEXT");
-	pContext->glRenderTable.BindFramebufferEXT =
-	    (PFNGLBINDFRAMEBUFFEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glBindFramebufferEXT");
-	pContext->glRenderTable.DeleteFramebuffersEXT =
-	    (PFNGLDELETEFRAMEBUFFERSEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glDeleteFramebuffersEXT");
-	pContext->glRenderTable.GenFramebuffersEXT =
-	    (PFNGLGENFRAMEBUFFERSEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glGenFramebuffersEXT");
-	pContext->glRenderTable.CheckFramebufferStatusEXT =
-	    (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glCheckFramebufferStatusEXT");
-	pContext->glRenderTable.FramebufferTexture1DEXT =
-	    (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFramebufferTexture1DEXT");
-	pContext->glRenderTable.FramebufferTexture2DEXT =
-	    (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFramebufferTexture2DEXT");
-	pContext->glRenderTable.FramebufferTexture3DEXT =
-	    (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFramebufferTexture3DEXT");
-	pContext->glRenderTable.FramebufferRenderbufferEXT =
-	    (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glFramebufferRenderbufferEXT");
-	pContext->glRenderTable.GetFramebufferAttachmentParameterivEXT =
-	    (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glGetFramebufferAttachment"
-					    "ParameterivEXT");
-	pContext->glRenderTable.GenerateMipmapEXT =
-	    (PFNGLGENERATEMIPMAPEXTPROC)
-	    glitz_context_get_proc_address (pContext->context,
-					    "glGenerateMipmapEXT");
-    }
-}
-
-static void
-xglSetCurrentContext (xglGLContextPtr pContext)
-{
-    cctx = pContext;
-
-    glitz_context_make_current (cctx->context, cctx->pDrawBuffer->drawable);
-
-    GlxSetRenderTables (&cctx->glRenderTable);
-}
-
-static void
-xglFreeContext (xglGLContextPtr pContext)
-{
-    int i;
-
-    pContext->refcnt--;
-    if (pContext->shared == pContext)
-	pContext->refcnt--;
-
-    if (pContext->refcnt)
-	return;
-
-    if (pContext->shared != pContext)
-	xglFreeContext (pContext->shared);
-
-    if (pContext->texObjects)
-    {
-	xglTexObjPtr pTexObj;
-	GLuint	     key;
-
-	do {
-	    key = xglHashFirstEntry (pContext->texObjects);
-	    if (key)
-	    {
-		pTexObj = (xglTexObjPtr) xglHashLookup (pContext->texObjects,
-							key);
-		if (pTexObj)
-		    xglUnrefTexObj (pTexObj);
-
-		xglHashRemove (pContext->texObjects, key);
-	    }
-	} while (key);
-
-	xglDeleteHashTable (pContext->texObjects);
-    }
-
-    if (pContext->displayLists)
-    {
-	xglDisplayListPtr pDisplayList;
-	GLuint		  key;
-
-	do {
-	    key = xglHashFirstEntry (pContext->displayLists);
-	    if (key)
-	    {
-		pDisplayList = (xglDisplayListPtr)
-		    xglHashLookup (pContext->displayLists, key);
-		if (pDisplayList)
-		    xglDestroyList (pDisplayList);
-
-		xglHashRemove (pContext->displayLists, key);
-	    }
-	} while (key);
-
-	xglDeleteHashTable (pContext->displayLists);
-    }
-
-    for (i = 0; i < pContext->maxTexUnits; i++)
-    {
-	xglUnrefTexObj (pContext->attrib.texUnits[i].p1D);
-	xglUnrefTexObj (pContext->attrib.texUnits[i].p2D);
-	xglUnrefTexObj (pContext->attrib.texUnits[i].p3D);
-	xglUnrefTexObj (pContext->attrib.texUnits[i].pRect);
-	xglUnrefTexObj (pContext->attrib.texUnits[i].pCubeMap);
-    }
-
-    if (pContext->groupList)
-	glDeleteLists (pContext->groupList, 1);
-
-    if (pContext->context)
-	glitz_context_destroy (pContext->context);
-
-    if (pContext->versionString)
-	xfree (pContext->versionString);
-
-    xfree (pContext);
-}
-
-static GLboolean
-xglDestroyContext (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    xglFreeContext (pContext);
-
-    if (!iface)
-	return GL_TRUE;
-
-    return (*iface->exports.destroyContext) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglLoseCurrent (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    GlxFlushContextCache ();
-    GlxSetRenderTables (0);
-
-    if (!iface)
-	return GL_TRUE;
-
-    return (*iface->exports.loseCurrent) ((__GLcontext *) iface);
-}
-
-static GLboolean
-xglMakeCurrent (__GLcontext *gc)
-{
-    xglGLContextPtr	pContext = (xglGLContextPtr) gc;
-    __GLinterface	*iface = &pContext->iface;
-    __GLinterface	*mIface = pContext->mIface;
-    __GLdrawablePrivate *drawPriv = iface->imports.getDrawablePrivate (gc);
-    __GLdrawablePrivate *readPriv = iface->imports.getReadablePrivate (gc);
-    xglGLBufferPtr	pDrawBufferPriv = drawPriv->private;
-    xglGLBufferPtr	pReadBufferPriv = readPriv->private;
-    GLboolean		status = GL_TRUE;
-
-    if (pReadBufferPriv->pDrawable && pDrawBufferPriv->pDrawable)
-    {
-	XID values[2] = { ClipByChildren, 0 };
-	int status;
-
-#ifdef COMPOSITE
-	/* XXX: temporary hack for root window drawing using
-	   IncludeInferiors */
-	if (pDrawBufferPriv->pDrawable->type == DRAWABLE_WINDOW &&
-	    (!((WindowPtr) (pDrawBufferPriv->pDrawable))->parent))
-	    values[0] = IncludeInferiors;
-#endif
-
-	/* this happens if client previously used this context with a buffer
-	   not supported by the native GL stack */
-	if (!pContext->context)
-	    return GL_FALSE;
-
-	/* XXX: GLX_SGI_make_current_read disabled for now */
-	if (pDrawBufferPriv != pReadBufferPriv)
-	    return GL_FALSE;
-
-	if (!pReadBufferPriv->pGC)
-	    pReadBufferPriv->pGC =
-		CreateGC (pReadBufferPriv->pDrawable,
-			  GCSubwindowMode | GCGraphicsExposures, values,
-			  &status);
-
-	ValidateGC (pReadBufferPriv->pDrawable, pReadBufferPriv->pGC);
-
-	if (!pDrawBufferPriv->pGC)
-	    pDrawBufferPriv->pGC =
-		CreateGC (pDrawBufferPriv->pDrawable,
-			  GCSubwindowMode | GCGraphicsExposures, values,
-			  &status);
-
-	ValidateGC (pDrawBufferPriv->pDrawable, pDrawBufferPriv->pGC);
-
-	pReadBufferPriv->pPixmap = (PixmapPtr) 0;
-	pDrawBufferPriv->pPixmap = (PixmapPtr) 0;
-
-	pContext->pReadBuffer = pReadBufferPriv;
-	pContext->pDrawBuffer = pDrawBufferPriv;
-
-	pContext->readPriv = readPriv;
-	pContext->drawPriv = drawPriv;
-
-	/* from now on this context can only be used with native GL stack */
-	if (mIface)
-	{
-	    (*mIface->exports.destroyContext) ((__GLcontext *) mIface);
-	    pContext->mIface = NULL;
-	}
-    }
-    else
-    {
-	/* this happens if client previously used this context with a buffer
-	   supported by the native GL stack */
-	if (!mIface)
-	    return GL_FALSE;
-
-	drawPriv->private = pDrawBufferPriv->private;
-	readPriv->private = pReadBufferPriv->private;
-
-	status = (*mIface->exports.makeCurrent) ((__GLcontext *) mIface);
-
-	drawPriv->private = pDrawBufferPriv;
-	readPriv->private = pReadBufferPriv;
-
-	/* from now on this context can not be used with native GL stack */
-	if (status == GL_TRUE && pContext->context)
-	{
-	    glitz_context_destroy (pContext->context);
-	    pContext->context = NULL;
-	}
-    }
-
-    return status;
-}
-
-static GLboolean
-xglShareContext (__GLcontext *gc,
-		 __GLcontext *gcShare)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    xglGLContextPtr pContextShare = (xglGLContextPtr) gcShare;
-    __GLinterface   *iface = pContext->mIface;
-    __GLinterface   *ifaceShare = pContextShare->mIface;
-
-    if (!iface || !ifaceShare)
-	return GL_TRUE;
-
-    return (*iface->exports.shareContext) ((__GLcontext *) iface,
-					   (__GLcontext *) ifaceShare);
-}
-
-static GLboolean
-xglCopyContext (__GLcontext	  *dst,
-		const __GLcontext *src,
-		GLuint		  mask)
-{
-    xglGLContextPtr   pDst = (xglGLContextPtr) dst;
-    xglGLContextPtr   pSrc = (xglGLContextPtr) src;
-    const __GLcontext *srcCtx = (const __GLcontext *) pSrc->mIface;
-    __GLinterface     *dstIface = (__GLinterface *) pDst->mIface;
-    GLboolean	      status = GL_TRUE;
-
-    if (pSrc->context && pDst->context)
-	glitz_context_copy (pSrc->context, pDst->context, mask);
-    else
-	status = GL_FALSE;
-
-    if (dstIface && srcCtx)
-	status = (*dstIface->exports.copyContext) ((__GLcontext *) dstIface,
-						   srcCtx,
-						   mask);
-
-    return status;
-}
-
-static Bool
-xglResizeBuffer (__GLdrawablePrivate *glPriv,
-		 int		      x,
-		 int		      y,
-		 unsigned int	      width,
-		 unsigned int	      height)
-{
-    xglGLBufferPtr pBufferPriv = glPriv->private;
-    DrawablePtr    pDrawable = pBufferPriv->pDrawable;
-
-    XGL_SCREEN_PRIV (pDrawable->pScreen);
-    XGL_DRAWABLE_PIXMAP (pBufferPriv->pDrawable);
-
-    if (pPixmap != pScreenPriv->pScreenPixmap)
-    {
-	if (!xglCreatePixmapSurface (pPixmap))
-	    return FALSE;
-
-	if (pBufferPriv->drawable == pScreenPriv->drawable)
-	{
-	    if (pBufferPriv->backSurface)
-		glitz_surface_destroy (pBufferPriv->backSurface);
-
-	    glitz_drawable_destroy (pBufferPriv->drawable);
-
-	    pBufferPriv->drawable    = NULL;
-	    pBufferPriv->backSurface = NULL;
-	}
-
-	if (pBufferPriv->drawable)
-	{
-	    glitz_drawable_update_size (pBufferPriv->drawable,
-					pPixmap->drawable.width,
-					pPixmap->drawable.height);
-	}
-	else
-	{
-	    glitz_drawable_format_t *format;
-
-	    format = pBufferPriv->pVisual->format.drawable;
-	    if (pBufferPriv->pVisual->pbuffer)
-	    {
-		pBufferPriv->drawable =
-		    glitz_create_pbuffer_drawable (pScreenPriv->drawable,
-						   format,
-						   pPixmap->drawable.width,
-						   pPixmap->drawable.height);
-	    }
-	    else
-	    {
-		pBufferPriv->drawable =
-		    glitz_create_drawable (pScreenPriv->drawable, format,
-					   pPixmap->drawable.width,
-					   pPixmap->drawable.height);
-
-		if (!pBufferPriv->drawable)
-		    return FALSE;
-
-		if (format->doublebuffer)
-		{
-		    glitz_format_t *backFormat;
-
-		    backFormat = pBufferPriv->pVisual->format.surface;
-
-		    pBufferPriv->backSurface =
-			glitz_surface_create (pScreenPriv->drawable, backFormat,
-					      pPixmap->drawable.width,
-					      pPixmap->drawable.height,
-					      0, NULL);
-		    if (pBufferPriv->backSurface)
-			glitz_surface_attach (pBufferPriv->backSurface,
-					      pBufferPriv->drawable,
-					      GLITZ_DRAWABLE_BUFFER_BACK_COLOR);
-		}
-	    }
-	}
-    }
-    else
-    {
-	glitz_drawable_reference (pScreenPriv->drawable);
-
-	if (pBufferPriv->backSurface)
-	    glitz_surface_destroy (pBufferPriv->backSurface);
-
-	if (pBufferPriv->drawable)
-	    glitz_drawable_destroy (pBufferPriv->drawable);
-
-	pBufferPriv->drawable    = pScreenPriv->drawable;
-	pBufferPriv->backSurface = NULL;
-    }
-
-    ValidateGC (pDrawable, pBufferPriv->pGC);
-
-    return TRUE;
-}
-
-static GLboolean
-xglForceCurrent (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-    GLboolean	    status = GL_TRUE;
-
-    if (pContext && pContext->context)
-    {
-	__GLdrawablePrivate *readPriv, *drawPriv;
-
-	readPriv = pContext->readPriv;
-	drawPriv = pContext->drawPriv;
-
-	drawPriv->lockDP (drawPriv, gc);
-	if (readPriv != drawPriv)
-	    readPriv->lockDP (readPriv, gc);
-
-	cctx = pContext;
-
-	if (cctx->pReadBuffer->pDrawable && cctx->pDrawBuffer->pDrawable)
-	{
-	    DrawablePtr pDrawable = cctx->pReadBuffer->pDrawable;
-	    PixmapPtr   pReadPixmap, pDrawPixmap;
-
-	    XGL_SCREEN_PRIV (pDrawable->pScreen);
-
-	    if (pDrawable->type != DRAWABLE_PIXMAP)
-	    {
-		pReadPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
-		cctx->pReadBuffer->screenX = __XGL_OFF_X_WIN (pReadPixmap);
-		cctx->pReadBuffer->screenY = __XGL_OFF_Y_WIN (pReadPixmap);
-		cctx->pReadBuffer->xOff = pDrawable->x +
-		    __XGL_OFF_X_WIN (pReadPixmap);
-		cctx->pReadBuffer->yOff = pReadPixmap->drawable.height -
-		    ((pDrawable->y + __XGL_OFF_Y_WIN (pReadPixmap)) +
-		     pDrawable->height);
-		cctx->pReadBuffer->yFlip = pReadPixmap->drawable.height;
-	    }
-	    else
-	    {
-		pReadPixmap = (PixmapPtr) pDrawable;
-		cctx->pReadBuffer->screenX = cctx->pReadBuffer->screenY = 0;
-		cctx->pReadBuffer->xOff = cctx->pReadBuffer->yOff = 0;
-		cctx->pReadBuffer->yFlip = pDrawable->height;
-	    }
-
-	    pDrawable = cctx->pDrawBuffer->pDrawable;
-	    if (pDrawable->type != DRAWABLE_PIXMAP)
-	    {
-		pDrawPixmap = XGL_GET_WINDOW_PIXMAP (pDrawable);
-		cctx->pDrawBuffer->screenX = __XGL_OFF_X_WIN (pDrawPixmap);
-		cctx->pDrawBuffer->screenY = __XGL_OFF_Y_WIN (pDrawPixmap);
-		cctx->pDrawBuffer->xOff = pDrawable->x +
-		    __XGL_OFF_X_WIN (pDrawPixmap);
-		cctx->pDrawBuffer->yOff = pDrawPixmap->drawable.height -
-		    ((pDrawable->y + __XGL_OFF_Y_WIN (pDrawPixmap)) +
-		     pDrawable->height);
-		cctx->pDrawBuffer->yFlip = pDrawPixmap->drawable.height;
-	    }
-	    else
-	    {
-		pDrawPixmap = (PixmapPtr) pDrawable;
-		cctx->pDrawBuffer->screenX = cctx->pDrawBuffer->screenY = 0;
-		cctx->pDrawBuffer->xOff = cctx->pDrawBuffer->yOff = 0;
-		cctx->pDrawBuffer->yFlip = pDrawable->height;
-	    }
-
-	    /* buffer changed */
-	    if (cctx->pDrawBuffer->pPixmap != pDrawPixmap ||
-		cctx->pReadBuffer->pPixmap != pReadPixmap)
-	    {
-		if (!xglResizeBuffer (drawPriv,
-				      pDrawable->x,
-				      pDrawable->y,
-				      pDrawable->width,
-				      pDrawable->height))
-		{
-		    drawPriv->unlockDP (drawPriv);
-		    if (readPriv != drawPriv)
-			readPriv->unlockDP (readPriv);
-
-		    return FALSE;
-		}
-
-		if (!xglResizeBuffer (readPriv,
-				      cctx->pReadBuffer->pDrawable->x,
-				      cctx->pReadBuffer->pDrawable->y,
-				      cctx->pReadBuffer->pDrawable->width,
-				      cctx->pReadBuffer->pDrawable->height))
-		{
-		    drawPriv->unlockDP (drawPriv);
-		    if (readPriv != drawPriv)
-			readPriv->unlockDP (readPriv);
-
-		    return FALSE;
-		}
-
-		cctx->pReadBuffer->pPixmap = pReadPixmap;
-		cctx->pDrawBuffer->pPixmap = pDrawPixmap;
-	    }
-
-	    if (!xglSyncSurface (pContext->pDrawBuffer->pDrawable))
-	    {
-		drawPriv->unlockDP (drawPriv);
-		if (readPriv != drawPriv)
-		    readPriv->unlockDP (readPriv);
-
-		return FALSE;
-	    }
-
-	    if (pDrawPixmap != pScreenPriv->pScreenPixmap)
-	    {
-		XGL_PIXMAP_PRIV (pDrawPixmap);
-
-		glitz_surface_attach (pPixmapPriv->surface,
-				      pContext->pDrawBuffer->drawable,
-				      GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
-
-		if (pPixmapPriv->target)
-		    pPixmapPriv->target = xglPixmapTargetOut;
-	    }
-
-	    xglSetCurrentContext (pContext);
-
-	    if (cctx->needInit)
-	    {
-		int i;
-
-		xglInitExtensions (cctx);
-
-		glGetIntegerv (GL_MAX_LIST_NESTING, &cctx->maxListNesting);
-		glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH,
-			       &cctx->maxAttribStackDepth);
-		if (cctx->maxAttribStackDepth > XGL_MAX_ATTRIB_STACK_DEPTH)
-		    cctx->maxAttribStackDepth = XGL_MAX_ATTRIB_STACK_DEPTH;
-
-		cctx->attrib.scissorTest = GL_FALSE;
-		cctx->attrib.scissor.x = cctx->attrib.scissor.y = 0;
-		cctx->attrib.scissor.width =
-		    cctx->pDrawBuffer->pDrawable->width;
-		cctx->attrib.scissor.height =
-		    cctx->pDrawBuffer->pDrawable->height;
-		cctx->attrib.viewport = cctx->attrib.scissor;
-
-		cctx->activeTexUnit = 0;
-
-		for (i = 0; i < cctx->maxTexUnits; i++)
-		{
-		    cctx->attrib.texUnits[i].enabled = 0;
-
-		    cctx->attrib.texUnits[i].p1D      = NULL;
-		    cctx->attrib.texUnits[i].p2D      = NULL;
-		    cctx->attrib.texUnits[i].p3D      = NULL;
-		    cctx->attrib.texUnits[i].pRect    = NULL;
-		    cctx->attrib.texUnits[i].pCubeMap = NULL;
-		}
-
-		glEnable (GL_SCISSOR_TEST);
-
-		cctx->needInit = FALSE;
-	    }
-
-	    /* update viewport and raster position */
-	    if (cctx->pDrawBuffer->xOff != cctx->drawXoff ||
-		cctx->pDrawBuffer->yOff != cctx->drawYoff)
-	    {
-		glViewport (cctx->attrib.viewport.x + cctx->pDrawBuffer->xOff,
-			    cctx->attrib.viewport.y + cctx->pDrawBuffer->yOff,
-			    cctx->attrib.viewport.width,
-			    cctx->attrib.viewport.height);
-
-		glBitmap (0, 0, 0, 0,
-			  cctx->pDrawBuffer->xOff - cctx->drawXoff,
-			  cctx->pDrawBuffer->yOff - cctx->drawYoff,
-			  NULL);
-
-		cctx->drawXoff = cctx->pDrawBuffer->xOff;
-		cctx->drawYoff = cctx->pDrawBuffer->yOff;
-	    }
-
-	    xglDrawBuffer (cctx->attrib.drawBuffer);
-	    xglReadBuffer (cctx->attrib.readBuffer);
-	}
-	else
-	{
-	    xglSetCurrentContext (pContext);
-	}
-
-	drawPriv->unlockDP (drawPriv);
-	if (readPriv != drawPriv)
-	    readPriv->unlockDP (readPriv);
-    }
-    else
-    {
-	cctx = NULL;
-	status = (*iface->exports.forceCurrent) ((__GLcontext *) iface);
-    }
-
-    return status;
-}
-
-static GLboolean
-xglNotifyResize (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    if (!iface)
-	return GL_TRUE;
-
-    return (*iface->exports.notifyResize) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifyDestroy (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    pContext->pReadBuffer->pDrawable = 0;
-    pContext->pDrawBuffer->pDrawable = 0;
-
-    if (iface)
-	(*iface->exports.notifyDestroy) ((__GLcontext *) iface);
-}
-
-static void
-xglNotifySwapBuffers (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    if (iface)
-	(*iface->exports.notifySwapBuffers) ((__GLcontext *) iface);
-}
-
-static struct __GLdispatchStateRec *
-xglDispatchExec (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    if (!iface)
-	return NULL;
-
-    return (*iface->exports.dispatchExec) ((__GLcontext *) iface);
-}
-
-static void
-xglBeginDispatchOverride (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    if (iface)
-	(*iface->exports.beginDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglEndDispatchOverride (__GLcontext *gc)
-{
-    xglGLContextPtr pContext = (xglGLContextPtr) gc;
-    __GLinterface   *iface = pContext->mIface;
-
-    if (iface)
-	(*iface->exports.endDispatchOverride) ((__GLcontext *) iface);
-}
-
-static void
-xglLoseCurrentContext (void *closure)
-{
-    if (closure == cctx)
-    {
-	cctx = NULL;
-
-	GlxFlushContextCache ();
-	GlxSetRenderTables (0);
-    }
-}
-
-static __GLinterface *
-xglCreateContext (__GLimports      *imports,
-		  __GLcontextModes *modes,
-		  __GLinterface    *shareGC)
-{
-    glitz_drawable_format_t *format;
-    xglGLContextPtr	    pShareContext = (xglGLContextPtr) shareGC;
-    xglGLContextPtr	    pContext;
-    __GLinterface	    *shareIface = NULL;
-    __GLinterface	    *iface;
-    __GLXcontext	    *glxCtx = (__GLXcontext *) imports->other;
-
-    XGL_SCREEN_PRIV (glxCtx->pScreen);
-
-    pContext = xalloc (sizeof (xglGLContextRec));
-    if (!pContext)
-	return NULL;
-
-    format = glitz_drawable_get_format (pScreenPriv->drawable);
-    pContext->context = glitz_context_create (pScreenPriv->drawable, format);
-    glitz_context_set_user_data (pContext->context, pContext,
-				 xglLoseCurrentContext);
-
-    pContext->glRenderTable = __glNativeRenderTable;
-    pContext->needInit	    = TRUE;
-    pContext->versionString = NULL;
-    pContext->errorValue    = GL_NO_ERROR;
-    pContext->shared	    = NULL;
-    pContext->list	    = 0;
-    pContext->groupList	    = 0;
-    pContext->beginCnt	    = 0;
-    pContext->nAttribStack  = 0;
-    pContext->refcnt	    = 1;
-    pContext->doubleBuffer  = glxCtx->modes->doubleBufferMode;
-    pContext->depthBits     = glxCtx->modes->depthBits;
-    pContext->stencilBits   = glxCtx->modes->stencilBits;
-    pContext->drawXoff	    = 0;
-    pContext->drawYoff	    = 0;
-    pContext->maxTexUnits   = 0;
-
-    if (pContext->doubleBuffer)
-    {
-	pContext->attrib.drawBuffer = GL_BACK;
-	pContext->attrib.readBuffer = GL_BACK;
-    }
-    else
-    {
-	pContext->attrib.drawBuffer = GL_FRONT;
-	pContext->attrib.readBuffer = GL_FRONT;
-    }
-
-    pContext->attrib.scissorTest = GL_FALSE;
-
-    if (shareGC)
-    {
-	pContext->texObjects   = NULL;
-	pContext->displayLists = NULL;
-
-	pContext->shared = pShareContext->shared;
-	shareIface = pShareContext->mIface;
-    }
-    else
-    {
-	pContext->texObjects = xglNewHashTable ();
-	if (!pContext->texObjects)
-	{
-	    xglFreeContext (pContext);
-	    return NULL;
-	}
-
-	pContext->displayLists = xglNewHashTable ();
-	if (!pContext->displayLists)
-	{
-	    xglFreeContext (pContext);
-	    return NULL;
-	}
-
-	pContext->shared = pContext;
-    }
-
-    pContext->shared->refcnt++;
-
-    iface = (*screenInfoPriv.createContext) (imports, modes, shareIface);
-    if (!iface)
-    {
-	xglFreeContext (pContext);
-	return NULL;
-    }
-
-    pContext->mIface = iface;
-    pContext->iface.imports = *imports;
-
-    pContext->iface.exports.destroyContext	  = xglDestroyContext;
-    pContext->iface.exports.loseCurrent		  = xglLoseCurrent;
-    pContext->iface.exports.makeCurrent		  = xglMakeCurrent;
-    pContext->iface.exports.shareContext	  = xglShareContext;
-    pContext->iface.exports.copyContext		  = xglCopyContext;
-    pContext->iface.exports.forceCurrent	  = xglForceCurrent;
-    pContext->iface.exports.notifyResize	  = xglNotifyResize;
-    pContext->iface.exports.notifyDestroy	  = xglNotifyDestroy;
-    pContext->iface.exports.notifySwapBuffers     = xglNotifySwapBuffers;
-    pContext->iface.exports.dispatchExec	  = xglDispatchExec;
-    pContext->iface.exports.beginDispatchOverride = xglBeginDispatchOverride;
-    pContext->iface.exports.endDispatchOverride   = xglEndDispatchOverride;
-
-    return (__GLinterface *) pContext;
-}
-
-static GLboolean
-xglSwapBuffers (__GLXdrawablePrivate *glxPriv)
-{
-    __GLdrawablePrivate	*glPriv = &glxPriv->glPriv;
-    xglGLBufferPtr	pBufferPriv = glPriv->private;
-    DrawablePtr		pDrawable = pBufferPriv->pDrawable;
-    GLboolean		status = GL_TRUE;
-
-    if (pDrawable)
-    {
-	if (glPriv->modes->doubleBufferMode)
-	{
-	    glitz_surface_t *surface;
-	    int		    xOff, yOff;
-	    GCPtr	    pGC = pBufferPriv->pGC;
-	    BoxPtr	    pBox = REGION_RECTS (pGC->pCompositeClip);
-	    int		    nBox = REGION_NUM_RECTS (pGC->pCompositeClip);
-
-	    XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
-	    glitz_drawable_swap_buffer_region (pBufferPriv->drawable,
-					       xOff, yOff,
-					       (glitz_box_t *) pBox, nBox);
-
-	    xglAddBitDamage (pDrawable, pGC->pCompositeClip);
-	    DamageDamageRegion (pDrawable, pGC->pCompositeClip);
-	    REGION_EMPTY (pGC->pScreen, &pBufferPriv->damage);
-	}
-    }
-    else if (pBufferPriv->private)
-    {
-	glPriv->private = pBufferPriv->private;
-	status = (*pBufferPriv->swapBuffers) (glxPriv);
-	glPriv->private = pBufferPriv;
-    }
-
-    return status;
-}
-
-static GLboolean
-xglResizeBuffers (__GLdrawableBuffer  *buffer,
-		  GLint		      x,
-		  GLint		      y,
-		  GLuint	      width,
-		  GLuint	      height,
-		  __GLdrawablePrivate *glPriv,
-		  GLuint	      bufferMask)
-{
-    xglGLBufferPtr pBufferPriv = glPriv->private;
-    DrawablePtr    pDrawable = pBufferPriv->pDrawable;
-    GLboolean	   status = GL_TRUE;
-
-    if (pDrawable)
-    {
-	if (!xglResizeBuffer (glPriv, x, y, width, height))
-	    return GL_FALSE;
-    }
-    else if (pBufferPriv->private)
-    {
-	glPriv->private = pBufferPriv->private;
-	status = (*pBufferPriv->resizeBuffers) (buffer,
-						x, y, width, height,
-						glPriv,
-						bufferMask);
-	glPriv->private = pBufferPriv;
-    }
-
-    return status;
-}
-
-static int
-xglBindBuffers (__GLXdrawablePrivate *glxPriv,
-		int		     buffer)
-{
-    __GLdrawablePrivate	*glPriv = &glxPriv->glPriv;
-    xglGLBufferPtr	pBufferPriv = glPriv->private;
-
-    if (cctx)
-    {
-	xglTexUnitPtr pTexUnit = &cctx->attrib.texUnits[cctx->activeTexUnit];
-	xglTexObjPtr  pTexObj = NULL;
-	DrawablePtr   pDrawable;
-
-	/* XXX: front left buffer is only supported so far */
-	if (buffer != GLX_FRONT_LEFT_EXT)
-	    return BadMatch;
-
-	/* Must be a GLXpixmap */
-	if (!glxPriv->pGlxPixmap)
-	    return BadDrawable;
-
-	pDrawable = glxPriv->pGlxPixmap->pDraw;
-
-	switch (glxPriv->texTarget) {
-	case GLX_TEXTURE_RECTANGLE_EXT:
-	    pTexObj = pTexUnit->pRect;
-	    break;
-	case GLX_TEXTURE_2D_EXT:
-	    pTexObj = pTexUnit->p2D;
-	    break;
-	default:
-	    break;
-	}
-
-	if (pTexObj)
-	{
-	    glitz_texture_object_t *object;
-
-	    XGL_SCREEN_PRIV (pDrawable->pScreen);
-	    XGL_DRAWABLE_PIXMAP (pDrawable);
-	    XGL_PIXMAP_PRIV (pPixmap);
-
-	    if (pPixmap == pScreenPriv->pScreenPixmap)
-		return BadDrawable;
-
-	    object = glitz_texture_object_create (pPixmapPriv->surface);
-	    if (object)
-	    {
-		pPixmap->refcnt++;
-
-		if (pTexObj->pPixmap)
-		    (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
-
-		if (pTexObj->object)
-		    glitz_texture_object_destroy (pTexObj->object);
-
-		pTexObj->pPixmap = pPixmap;
-		pTexObj->object  = object;
-
-		return Success;
-	    }
-	}
-    }
-    else if (pBufferPriv->private)
-    {
-	int status;
-
-	glPriv->private = pBufferPriv->private;
-	status = (*pBufferPriv->bindBuffers) (glxPriv, buffer);
-	glPriv->private = pBufferPriv;
-
-	return status;
-    }
-
-    return BadDrawable;
-}
-
-static int
-xglReleaseBuffers (__GLXdrawablePrivate *glxPriv,
-		   int		        buffer)
-{
-    __GLdrawablePrivate	*glPriv = &glxPriv->glPriv;
-    xglGLBufferPtr	pBufferPriv = glPriv->private;
-
-    if (cctx)
-    {
-	xglTexObjPtr pTexObj;
-
-	/* XXX: front left buffer is only supported so far */
-	if (buffer != GLX_FRONT_LEFT_EXT)
-	    return BadMatch;
-
-	/* Must be a GLXpixmap */
-	if (glxPriv->pGlxPixmap)
-	{
-	    DrawablePtr pDrawable = glxPriv->pGlxPixmap->pDraw;
-
-	    XGL_DRAWABLE_PIXMAP (pDrawable);
-
-	    pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].p2D;
-	    if (pTexObj && pTexObj->pPixmap == pPixmap)
-	    {
-		(*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
-		pTexObj->pPixmap = NULL;
-		glitz_texture_object_destroy (pTexObj->object);
-		pTexObj->object = NULL;
-
-		return Success;
-	    }
-	    else
-	    {
-		pTexObj = cctx->attrib.texUnits[cctx->activeTexUnit].pRect;
-		if (pTexObj && pTexObj->pPixmap == pPixmap)
-		{
-		    (*pDrawable->pScreen->DestroyPixmap) (pTexObj->pPixmap);
-		    pTexObj->pPixmap = NULL;
-		    glitz_texture_object_destroy (pTexObj->object);
-		    pTexObj->object = NULL;
-
-		    return Success;
-		}
-	    }
-	}
-    }
-    else if (pBufferPriv->private)
-    {
-	int status;
-
-	glPriv->private = pBufferPriv->private;
-	status = (*pBufferPriv->releaseBuffers) (glxPriv, buffer);
-	glPriv->private = pBufferPriv;
-
-	return status;
-    }
-
-    return BadDrawable;
-}
-static void
-xglFreeBuffers (__GLdrawablePrivate *glPriv)
-{
-    xglGLBufferPtr pBufferPriv = glPriv->private;
-
-    glPriv->private = pBufferPriv->private;
-
-    if (pBufferPriv->freeBuffers)
-	(*pBufferPriv->freeBuffers) (glPriv);
-
-    if (pBufferPriv->pGC)
-	FreeGC (pBufferPriv->pGC, (GContext) 0);
-
-    if (pBufferPriv->backSurface)
-	glitz_surface_destroy (pBufferPriv->backSurface);
-
-    if (pBufferPriv->drawable)
-	glitz_drawable_destroy (pBufferPriv->drawable);
-
-    xfree (pBufferPriv);
-}
-
-static void
-xglCreateBuffer (__GLXdrawablePrivate *glxPriv)
-{
-    __GLdrawablePrivate	*glPriv = &glxPriv->glPriv;
-    DrawablePtr	        pDrawable = glxPriv->pDraw;
-    ScreenPtr		pScreen = pDrawable->pScreen;
-    xglGLBufferPtr	pBufferPriv;
-    xglVisualPtr	v;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP (pDrawable);
-
-    pBufferPriv = xalloc (sizeof (xglGLBufferRec));
-    if (!pBufferPriv)
-	FatalError ("xglCreateBuffer: No memory\n");
-
-    pBufferPriv->pScreen   = pScreen;
-    pBufferPriv->pDrawable = NULL;
-    pBufferPriv->pPixmap   = NULL;
-    pBufferPriv->pGC	   = NULL;
-
-    pBufferPriv->swapBuffers = NULL;
-
-    pBufferPriv->bindBuffers    = NULL;
-    pBufferPriv->releaseBuffers = NULL;
-
-    pBufferPriv->resizeBuffers = NULL;
-    pBufferPriv->private       = NULL;
-    pBufferPriv->freeBuffers   = NULL;
-
-    pBufferPriv->drawable    = NULL;
-    pBufferPriv->backSurface = NULL;
-
-    REGION_INIT (pScreen, &pBufferPriv->damage, NullBox, 0);
-
-    pBufferPriv->pVisual = 0;
-
-    /* glx acceleration */
-    if (pScreenPriv->accel.glx.enabled &&
-	xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.glx.size))
-    {
-	for (v = pScreenPriv->pGlxVisual; v; v = v->next)
-	{
-	    glitz_drawable_format_t *format;
-
-	    if (pScreenPriv->accel.glx.pbuffer != v->pbuffer)
-		continue;
-
-	    format = v->format.drawable;
-	    if (!format)
-		continue;
-
-	    if (format->color.red_size   != glxPriv->modes->redBits   ||
-		format->color.green_size != glxPriv->modes->greenBits ||
-		format->color.blue_size  != glxPriv->modes->blueBits)
-		continue;
-
-	    if (format->color.alpha_size < glxPriv->modes->alphaBits   ||
-		format->depth_size	 < glxPriv->modes->depthBits   ||
-		format->stencil_size     < glxPriv->modes->stencilBits ||
-		format->doublebuffer     < glxPriv->modes->doubleBufferMode)
-		continue;
-
-	    /* this is good enought for pbuffers */
-	    if (v->pbuffer)
-		break;
-
-	    /* we want an exact match for non-pbuffer formats */
-	    if (format->color.alpha_size == glxPriv->modes->alphaBits   &&
-		format->depth_size	 == glxPriv->modes->depthBits   &&
-		format->stencil_size     == glxPriv->modes->stencilBits &&
-		format->doublebuffer     == glxPriv->modes->doubleBufferMode)
-		break;
-	}
-
-	pBufferPriv->pVisual = v;
-    }
-
-    if ((pDrawable->type == DRAWABLE_WINDOW)
-
-#ifdef COMPOSITE
-	&& (pBufferPriv->pVisual
-
-	    /* this is a root window, can't be redirected */
-	    || (!((WindowPtr) pDrawable)->parent))
-#endif
-
-	)
-    {
-	pBufferPriv->pDrawable = pDrawable;
-    }
-    else
-    {
-	(*screenInfoPriv.createBuffer) (glxPriv);
-
-	/* Wrap the swap buffers routine */
-	pBufferPriv->swapBuffers = glxPriv->swapBuffers;
-
-	/* Wrap the render texture routines */
-	pBufferPriv->bindBuffers    = glxPriv->bindBuffers;
-	pBufferPriv->releaseBuffers = glxPriv->releaseBuffers;
-
-	/* Wrap the front buffer's resize routine */
-	pBufferPriv->resizeBuffers = glPriv->frontBuffer.resize;
-
-	/* Save Xgl's private buffer structure */
-	pBufferPriv->freeBuffers = glPriv->freePrivate;
-	pBufferPriv->private	 = glPriv->private;
-    }
-
-    glxPriv->texTarget = GLX_NO_TEXTURE_EXT;
-
-    /* We enable render texture for all GLXPixmaps right now. Eventually, this
-       should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or
-       GLX_RENDER_TEXTURE_RGBA is set to TRUE. */
-    if (pDrawable->type != DRAWABLE_WINDOW)
-    {
-	XGL_DRAWABLE_PIXMAP (pDrawable);
-
-	if (xglCreatePixmapSurface (pPixmap))
-	{
-	    glitz_texture_object_t *texture;
-
-	    XGL_PIXMAP_PRIV (pPixmap);
-
-	    texture = glitz_texture_object_create (pPixmapPriv->surface);
-	    if (texture)
-	    {
-		switch (glitz_texture_object_get_target (texture)) {
-		case GLITZ_TEXTURE_TARGET_2D:
-		    glxPriv->texTarget = GLX_TEXTURE_2D_EXT;
-		    break;
-		case GLITZ_TEXTURE_TARGET_RECT:
-		    glxPriv->texTarget = GLX_TEXTURE_RECTANGLE_EXT;
-		    break;
-		}
-
-		glitz_texture_object_destroy (texture);
-	    }
-	}
-    }
-
-    glxPriv->swapBuffers = xglSwapBuffers;
-
-    glxPriv->bindBuffers    = xglBindBuffers;
-    glxPriv->releaseBuffers = xglReleaseBuffers;
-    glPriv->frontBuffer.resize = xglResizeBuffers;
-
-    glPriv->private	= (void *) pBufferPriv;
-    glPriv->freePrivate	= xglFreeBuffers;
-}
-
-static Bool
-xglScreenProbe (int screen)
-{
-    ScreenPtr    pScreen = screenInfo.screens[screen];
-    xglVisualPtr pVisual;
-    Bool         status;
-    int          i;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    status = (*screenInfoPriv.screenProbe) (screen);
-
-    /* Create Xgl GLX visuals */
-    for (i = 0; i < __xglScreenInfoPtr->numVisuals; i++)
-    {
-	pVisual = xglFindVisualWithId (pScreen, pScreen->visuals[i].vid);
-	if (pVisual)
-	{
-	    glitz_drawable_format_t templ, *format, *screenFormat;
-	    unsigned long	    mask;
-
-	    templ.color        = pVisual->format.surface->color;
-	    templ.depth_size   = __xglScreenInfoPtr->modes[i].depthBits;
-	    templ.stencil_size = __xglScreenInfoPtr->modes[i].stencilBits;
-	    templ.doublebuffer = __xglScreenInfoPtr->modes[i].doubleBufferMode;
-	    templ.samples      = 1;
-
-	    mask =
-		GLITZ_FORMAT_FOURCC_MASK       |
-		GLITZ_FORMAT_RED_SIZE_MASK     |
-		GLITZ_FORMAT_GREEN_SIZE_MASK   |
-		GLITZ_FORMAT_BLUE_SIZE_MASK    |
-		GLITZ_FORMAT_ALPHA_SIZE_MASK   |
-		GLITZ_FORMAT_DEPTH_SIZE_MASK   |
-		GLITZ_FORMAT_STENCIL_SIZE_MASK |
-		GLITZ_FORMAT_DOUBLEBUFFER_MASK |
-		GLITZ_FORMAT_SAMPLES_MASK;
-
-	    format = glitz_find_drawable_format (pScreenPriv->drawable,
-						 mask, &templ, 0);
-	    if (format)
-	    {
-		xglVisualPtr v, new, *prev;
-
-		new = xalloc (sizeof (xglVisualRec));
-		if (new)
-		{
-		    new->next    = 0;
-		    new->vid     = pVisual->vid;
-		    new->pPixel  = pVisual->pPixel;
-		    new->pbuffer = FALSE;
-
-		    new->format.surface  = pVisual->format.surface;
-		    new->format.drawable = format;
-
-		    prev = &pScreenPriv->pGlxVisual;
-		    while ((v = *prev))
-			prev = &v->next;
-
-		    *prev = new;
-		}
-	    }
-
-	    /* use same drawable format as screen for pbuffers */
-	    screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
-	    templ.id = screenFormat->id;
-
-	    mask =
-		GLITZ_FORMAT_ID_MASK	     |
-		GLITZ_FORMAT_FOURCC_MASK     |
-		GLITZ_FORMAT_RED_SIZE_MASK   |
-		GLITZ_FORMAT_GREEN_SIZE_MASK |
-		GLITZ_FORMAT_BLUE_SIZE_MASK  |
-		GLITZ_FORMAT_SAMPLES_MASK;
-
-	    format = glitz_find_pbuffer_format (pScreenPriv->drawable,
-						mask, &templ, 0);
-	    if (format)
-	    {
-		xglVisualPtr v, new, *prev;
-
-		new = xalloc (sizeof (xglVisualRec));
-		if (new)
-		{
-		    new->next    = 0;
-		    new->vid     = pVisual->vid;
-		    new->pPixel  = pVisual->pPixel;
-		    new->pbuffer = TRUE;
-
-		    new->format.surface  = pVisual->format.surface;
-		    new->format.drawable = format;
-
-		    prev = &pScreenPriv->pGlxVisual;
-		    while ((v = *prev))
-			prev = &v->next;
-
-		    *prev = new;
-		}
-	    }
-	}
-    }
-
-    /* Wrap createBuffer */
-    if (__xglScreenInfoPtr->createBuffer != xglCreateBuffer)
-    {
-	screenInfoPriv.createBuffer    = __xglScreenInfoPtr->createBuffer;
-	__xglScreenInfoPtr->createBuffer = xglCreateBuffer;
-    }
-
-    /* Wrap createContext */
-    if (__xglScreenInfoPtr->createContext != xglCreateContext)
-    {
-	screenInfoPriv.createContext    = __xglScreenInfoPtr->createContext;
-	__xglScreenInfoPtr->createContext = xglCreateContext;
-    }
-
-    return status;
-}
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen)
-{
-    miInitVisualsProcPtr    initVisualsProc = NULL;
-    VisualPtr		    visuals;
-    int			    nvisuals;
-    DepthPtr		    depths;
-    int			    ndepths;
-    int			    rootDepth;
-    VisualID		    defaultVis;
-    glitz_drawable_format_t *format;
-    xglVisualPtr	    pVisual;
-    __GLXvisualConfig	    *pConfig;
-    xglGLXVisualConfigPtr   pConfigPriv, *ppConfigPriv;
-    XID			    *installedCmaps;
-    ColormapPtr		    installedCmap;
-    int			    numInstalledCmaps;
-    int			    numConfig = 1;
-    int			    bpp, i;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (xglScreenInfo.depth != 16 && xglScreenInfo.depth != 24)
-	return FALSE;
-
-    for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
-    {
-	if (pVisual->pPixel->depth == xglScreenInfo.depth)
-	    break;
-    }
-
-    if (!pVisual)
-	return FALSE;
-
-    bpp = pVisual->pPixel->masks.bpp;
-
-    format = glitz_drawable_get_format (pScreenPriv->drawable);
-    if (format->doublebuffer)
-	numConfig *= 2;
-
-    pConfig = xcalloc (sizeof (__GLXvisualConfig), numConfig);
-    if (!pConfig)
-	return FALSE;
-
-    pConfigPriv = xcalloc (sizeof (xglGLXVisualConfigRec), numConfig);
-    if (!pConfigPriv)
-    {
-	xfree (pConfig);
-	return FALSE;
-    }
-
-    ppConfigPriv = xcalloc (sizeof (xglGLXVisualConfigPtr), numConfig);
-    if (!ppConfigPriv)
-    {
-	xfree (pConfigPriv);
-	xfree (pConfig);
-	return FALSE;
-    }
-
-    installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID));
-    if (!installedCmaps)
-    {
-	xfree (ppConfigPriv);
-	xfree (pConfigPriv);
-	xfree (pConfig);
-	return FALSE;
-    }
-
-    for (i = 0; i < numConfig; i++)
-    {
-	ppConfigPriv[i] = &pConfigPriv[i];
-
-	pConfig[i].vid   = (VisualID) (-1);
-	pConfig[i].class = -1;
-	pConfig[i].rgba  = TRUE;
-
-	pConfig[i].redSize   = format->color.red_size;
-	pConfig[i].greenSize = format->color.green_size;
-	pConfig[i].blueSize  = format->color.blue_size;
-	pConfig[i].alphaSize = format->color.alpha_size;
-
-	pConfig[i].redMask   = pVisual->pPixel->masks.red_mask;
-	pConfig[i].greenMask = pVisual->pPixel->masks.green_mask;
-	pConfig[i].blueMask  = pVisual->pPixel->masks.blue_mask;
-	pConfig[i].alphaMask = pVisual->pPixel->masks.alpha_mask;
-
-	if (i == 1)
-	{
-	    pConfig[i].doubleBuffer = FALSE;
-	    pConfig[i].depthSize    = 0;
-	    pConfig[i].stencilSize  = 0;
-	}
-	else
-	{
-	    pConfig[i].doubleBuffer = TRUE;
-	    pConfig[i].depthSize    = format->depth_size;
-	    pConfig[i].stencilSize  = format->stencil_size;
-	}
-
-	pConfig[i].stereo = FALSE;
-
-	if (pScreen->rootDepth == 16)
-	    pConfig[i].bufferSize = 16;
-	else
-	    pConfig[i].bufferSize = 32;
-
-	pConfig[i].auxBuffers = 0;
-	pConfig[i].level      = 0;
-
-	pConfig[i].visualRating = GLX_NONE;
-
-	pConfig[i].transparentPixel = GLX_NONE;
-	pConfig[i].transparentRed   = 0;
-	pConfig[i].transparentGreen = 0;
-	pConfig[i].transparentBlue  = 0;
-	pConfig[i].transparentAlpha = 0;
-	pConfig[i].transparentIndex = 0;
-    }
-
-    GlxSetVisualConfigs (numConfig, pConfig, (void **) ppConfigPriv);
-
-    /* Wrap screenProbe */
-    if (__xglScreenInfoPtr->screenProbe != xglScreenProbe)
-    {
-	screenInfoPriv.screenProbe    = __xglScreenInfoPtr->screenProbe;
-	__xglScreenInfoPtr->screenProbe = xglScreenProbe;
-    }
-
-    visuals    = pScreen->visuals;
-    nvisuals   = pScreen->numVisuals;
-    depths     = pScreen->allowedDepths;
-    ndepths    = pScreen->numDepths;
-    rootDepth  = pScreen->rootDepth;
-    defaultVis = pScreen->rootVisual;
-
-    /* Find installed colormaps */
-    numInstalledCmaps = (*pScreen->ListInstalledColormaps) (pScreen,
-							    installedCmaps);
-
-    GlxWrapInitVisuals (&initVisualsProc);
-    GlxInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootDepth,
-		    &defaultVis, ((unsigned long) 1 << (bpp - 1)), 8, -1);
-
-    /* Fix up any existing installed colormaps. */
-    for (i = 0; i < numInstalledCmaps; i++)
-    {
-	int j;
-
-	installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
-	if (!installedCmap)
-	    continue;
-
-	j = installedCmap->pVisual - pScreen->visuals;
-	installedCmap->pVisual = &visuals[j];
-    }
-
-    pScreen->visuals       = visuals;
-    pScreen->numVisuals    = nvisuals;
-    pScreen->allowedDepths = depths;
-    pScreen->numDepths     = ndepths;
-    pScreen->rootDepth     = rootDepth;
-    pScreen->rootVisual    = defaultVis;
-
-#ifndef NGLXLOG
-    xglInitGlxLog ();
-#endif
-
-    xfree (installedCmaps);
-    xfree (pConfigPriv);
-    xfree (pConfig);
-
-    return TRUE;
-}
diff --git a/hw/xgl/glxext/xglglxext.h b/hw/xgl/glxext/xglglxext.h
deleted file mode 100644
index c353783..0000000
--- a/hw/xgl/glxext/xglglxext.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#ifndef _XGL_GLXEXT_H_
-#define _XGL_GLXEXT_H_
-
-#include "scrnintstr.h"
-
-Bool
-xglInitVisualConfigs (ScreenPtr pScreen);
-
-#ifndef NGLXEXTLOG
-
-void
-xglInitGlxLog (void);
-
-#endif
-
-#endif /* _XGL_GLXEXT_H_ */
diff --git a/hw/xgl/glxext/xglglxlog.c b/hw/xgl/glxext/xglglxlog.c
deleted file mode 100644
index 0f194c9..0000000
--- a/hw/xgl/glxext/xglglxlog.c
+++ /dev/null
@@ -1,4519 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglglx.h"
-#include "xglglxext.h"
-#include "glapitable.h"
-
-#ifndef NGLXEXTLOG
-
-static struct _glapi_table *nativeRenderTable = 0;
-
-static FILE *logFp = 0;
-
-static Bool logVertexAttribs = FALSE;
-
-static struct VertexAttribCount {
-    int  n;
-    char *name;
-} vCnt[] = {
-    { 0, "glArrayElement"	},
-    { 0, "glCallList"		},
-    { 0, "glCallLists"		},
-    { 0, "glColor3bv"		},
-    { 0, "glColor3dv"		},
-    { 0, "glColor3fv"		},
-    { 0, "glColor3iv"		},
-    { 0, "glColor3sv"		},
-    { 0, "glColor3ubv"		},
-    { 0, "glColor3uiv"		},
-    { 0, "glColor3usv"		},
-    { 0, "glColor4bv"		},
-    { 0, "glColor4dv"		},
-    { 0, "glColor4fv"		},
-    { 0, "glColor4iv"		},
-    { 0, "glColor4sv"		},
-    { 0, "glColor4ubv"		},
-    { 0, "glColor4uiv"		},
-    { 0, "glColor4usv"		},
-    { 0, "glEdgeFlagv"		},
-    { 0, "glEvalCoord1dv"	},
-    { 0, "glEvalCoord1fv"	},
-    { 0, "glEvalCoord2dv"	},
-    { 0, "glEvalCoord2fv"	},
-    { 0, "glEvalPoint1"		},
-    { 0, "glEvalPoint2"		},
-    { 0, "glIndexdv"		},
-    { 0, "glIndexfv"		},
-    { 0, "glIndexiv"		},
-    { 0, "glIndexsv"		},
-    { 0, "glIndexubv"		},
-    { 0, "glMaterialf"		},
-    { 0, "glMaterialfv"		},
-    { 0, "glMateriali"		},
-    { 0, "glMaterialiv"		},
-    { 0, "glNormal3bv"		},
-    { 0, "glNormal3dv"		},
-    { 0, "glNormal3fv"		},
-    { 0, "glNormal3iv"		},
-    { 0, "glNormal3sv"		},
-    { 0, "glTexCoord1dv"	},
-    { 0, "glTexCoord1fv"	},
-    { 0, "glTexCoord1iv"	},
-    { 0, "glTexCoord1sv"	},
-    { 0, "glTexCoord2dv"	},
-    { 0, "glTexCoord2fv"	},
-    { 0, "glTexCoord2iv"	},
-    { 0, "glTexCoord2sv"	},
-    { 0, "glTexCoord3dv"	},
-    { 0, "glTexCoord3fv"	},
-    { 0, "glTexCoord3iv"	},
-    { 0, "glTexCoord3sv"	},
-    { 0, "glTexCoord4dv"	},
-    { 0, "glTexCoord4fv"	},
-    { 0, "glTexCoord4iv"	},
-    { 0, "glTexCoord4sv"	},
-    { 0, "glVertex2dv"		},
-    { 0, "glVertex2fv"		},
-    { 0, "glVertex2iv"		},
-    { 0, "glVertex2sv"		},
-    { 0, "glVertex3dv"		},
-    { 0, "glVertex3fv"		},
-    { 0, "glVertex3iv"		},
-    { 0, "glVertex3sv"		},
-    { 0, "glVertex4dv"		},
-    { 0, "glVertex4fv"		},
-    { 0, "glVertex4iv"		},
-    { 0, "glVertex4sv"		},
-    { 0, "glMultiTexCoord1dv"	},
-    { 0, "glMultiTexCoord1fv"	},
-    { 0, "glMultiTexCoord1iv"	},
-    { 0, "glMultiTexCoord1sv"	},
-    { 0, "glMultiTexCoord2dv"	},
-    { 0, "glMultiTexCoord2fv"	},
-    { 0, "glMultiTexCoord2iv"	},
-    { 0, "glMultiTexCoord2sv"	},
-    { 0, "glMultiTexCoord3dv"	},
-    { 0, "glMultiTexCoord3fv"	},
-    { 0, "glMultiTexCoord3iv"	},
-    { 0, "glMultiTexCoord3sv"	},
-    { 0, "glMultiTexCoord4dv"	},
-    { 0, "glMultiTexCoord4fv"	},
-    { 0, "glMultiTexCoord4iv"	},
-    { 0, "glMultiTexCoord4sv"	},
-    { 0, "glFogCoordfv"		},
-    { 0, "glFogCoorddv"		},
-    { 0, "glSecondaryColor3bv"	},
-    { 0, "glSecondaryColor3dv"	},
-    { 0, "glSecondaryColor3fv"	},
-    { 0, "glSecondaryColor3iv"	},
-    { 0, "glSecondaryColor3sv"	},
-    { 0, "glSecondaryColor3ubv"	},
-    { 0, "glSecondaryColor3uiv"	},
-    { 0, "glSecondaryColor3usv"	}
-};
-
-#define arrayElementIndex	0
-#define callListIndex		1
-#define callListsIndex		2
-#define color3bvIndex		3
-#define color3dvIndex		4
-#define color3fvIndex		5
-#define color3ivIndex		6
-#define color3svIndex		7
-#define color3ubvIndex		8
-#define color3uivIndex		9
-#define color3usvIndex		10
-#define color4bvIndex		11
-#define color4dvIndex		12
-#define color4fvIndex		13
-#define color4ivIndex		14
-#define color4svIndex		15
-#define color4ubvIndex		16
-#define color4uivIndex		17
-#define color4usvIndex		18
-#define edgeFlagvIndex		19
-#define evalCoord1dvIndex	20
-#define evalCoord1fvIndex	21
-#define evalCoord2dvIndex	22
-#define evalCoord2fvIndex	23
-#define evalPoint1Index		24
-#define evalPoint2Index		25
-#define indexdvIndex		26
-#define indexfvIndex		27
-#define indexivIndex		28
-#define indexsvIndex		29
-#define indexubvIndex		30
-#define materialfIndex		31
-#define materialfvIndex		32
-#define materialiIndex		33
-#define materialivIndex		34
-#define normal3bvIndex		35
-#define normal3dvIndex		36
-#define normal3fvIndex		37
-#define normal3ivIndex		38
-#define normal3svIndex		39
-#define texCoord1dvIndex	40
-#define texCoord1fvIndex	41
-#define texCoord1ivIndex	42
-#define texCoord1svIndex	43
-#define texCoord2dvIndex	44
-#define texCoord2fvIndex	45
-#define texCoord2ivIndex	46
-#define texCoord2svIndex	47
-#define texCoord3dvIndex	48
-#define texCoord3fvIndex	49
-#define texCoord3ivIndex	50
-#define texCoord3svIndex	51
-#define texCoord4dvIndex	52
-#define texCoord4fvIndex	53
-#define texCoord4ivIndex	54
-#define texCoord4svIndex	55
-#define vertex2dvIndex		56
-#define vertex2fvIndex		57
-#define vertex2ivIndex		58
-#define vertex2svIndex		59
-#define vertex3dvIndex		60
-#define vertex3fvIndex		61
-#define vertex3ivIndex		62
-#define vertex3svIndex		63
-#define vertex4dvIndex		64
-#define vertex4fvIndex		65
-#define vertex4ivIndex		66
-#define vertex4svIndex		67
-#define multiTexCoord1dvIndex	68
-#define multiTexCoord1fvIndex	69
-#define multiTexCoord1ivIndex	70
-#define multiTexCoord1svIndex	71
-#define multiTexCoord2dvIndex	72
-#define multiTexCoord2fvIndex	73
-#define multiTexCoord2ivIndex	74
-#define multiTexCoord2svIndex	75
-#define multiTexCoord3dvIndex	76
-#define multiTexCoord3fvIndex	77
-#define multiTexCoord3ivIndex	78
-#define multiTexCoord3svIndex	79
-#define multiTexCoord4dvIndex	80
-#define multiTexCoord4fvIndex	81
-#define multiTexCoord4ivIndex	82
-#define multiTexCoord4svIndex	83
-#define fogCoordfvIndex		84
-#define fogCoorddvIndex		85
-#define secondaryColor3bvIndex	86
-#define secondaryColor3dvIndex	87
-#define secondaryColor3fvIndex	88
-#define secondaryColor3ivIndex	89
-#define secondaryColor3svIndex	90
-#define secondaryColor3ubvIndex 91
-#define secondaryColor3uivIndex 92
-#define secondaryColor3usvIndex 93
-
-static void
-logAccum (GLenum  op,
-	  GLfloat value)
-{
-    fprintf (logFp, "glAccum (0x%x, %f)\n", op, value);
-    (*nativeRenderTable->Accum) (op, value);
-}
-
-static void
-logAlphaFunc (GLenum   func,
-	      GLclampf ref)
-{
-    fprintf (logFp, "glAlphaFunc (0x%x, %f)\n", func, ref);
-    (*nativeRenderTable->AlphaFunc) (func, ref);
-}
-
-static GLboolean
-logAreTexturesResident (GLsizei	     n,
-			const GLuint *textures,
-			GLboolean    *residences)
-{
-    fprintf (logFp, "glAreTexturesResident (%d, %p, %p)\n", n, textures,
-	     residences);
-    return (*nativeRenderTable->AreTexturesResident) (n, textures,
-						      residences);
-}
-
-static void
-logArrayElement (GLint i)
-{
-    vCnt[arrayElementIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glArrayElement (%d)\n", i);
-    (*nativeRenderTable->ArrayElement) (i);
-}
-
-static void
-logBegin (GLenum mode)
-{
-    fprintf (logFp, "glBegin (0x%x)\n", mode);
-    (*nativeRenderTable->Begin) (mode);
-}
-
-static void
-logBindTexture (GLenum target,
-		GLuint texture)
-{
-    fprintf (logFp, "glBindTexture (0x%x, %u)\n", target, texture);
-    (*nativeRenderTable->BindTexture) (target, texture);
-}
-
-static void
-logBitmap (GLsizei	 width,
-	   GLsizei	 height,
-	   GLfloat	 xorig,
-	   GLfloat	 yorig,
-	   GLfloat	 xmove,
-	   GLfloat	 ymove,
-	   const GLubyte *bitmap)
-{
-    fprintf (logFp, "glBitmap (%d, %d, %f, %f, %f, %f, %p)\n",
-	     width, height, xorig, yorig, xmove, ymove, bitmap);
-    (*nativeRenderTable->Bitmap) (width, height, xorig, yorig,
-				  xmove, ymove, bitmap);
-}
-
-static void
-logBlendFunc (GLenum sfactor,
-	      GLenum dfactor)
-{
-    fprintf (logFp, "glBlendFunc (0x%x, 0x%x)\n", sfactor, dfactor);
-    (*nativeRenderTable->BlendFunc) (sfactor, dfactor);
-}
-
-static void
-logCallList (GLuint list)
-{
-    vCnt[callListIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glCallList (%u)\n", list);
-    (*nativeRenderTable->CallList) (list);
-}
-
-static void
-logCallLists (GLsizei	 n,
-	      GLenum	 type,
-	      const void *lists)
-{
-    vCnt[callListsIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glCallLists (%d, 0x%x, %p)\n", n, type, lists);
-    (*nativeRenderTable->CallLists) (n, type, lists);
-}
-
-static void
-logClear (GLbitfield mask)
-{
-    fprintf (logFp, "glClear (0x%x)\n", mask);
-    (*nativeRenderTable->Clear) (mask);
-}
-
-static void
-logClearAccum (GLfloat red,
-	       GLfloat green,
-	       GLfloat blue,
-	       GLfloat alpha)
-{
-    fprintf (logFp, "glClearAccum (%f, %f, %f, %f)\n",
-	     red, green, blue, alpha);
-    (*nativeRenderTable->ClearAccum) (red, green, blue, alpha);
-}
-
-static void
-logClearColor (GLclampf red,
-	       GLclampf green,
-	       GLclampf blue,
-	       GLclampf alpha)
-{
-    fprintf (logFp, "glClearColor (%f, %f, %f, %f)\n",
-	     red, green, blue, alpha);
-    (*nativeRenderTable->ClearColor) (red, green, blue, alpha);
-}
-
-static void
-logClearDepth (GLclampd depth)
-{
-    fprintf (logFp, "glClearDepth (%f)\n", depth);
-    (*nativeRenderTable->ClearDepth) (depth);
-}
-
-static void
-logClearIndex (GLfloat c)
-{
-    fprintf (logFp, "glClearIndex (%f)\n", c);
-    (*nativeRenderTable->ClearIndex) (c);
-}
-
-static void
-logClearStencil (GLint s)
-{
-    fprintf (logFp, "glClearStencil (%d)\n", s);
-    (*nativeRenderTable->ClearStencil) (s);
-}
-
-static void
-logClipPlane (GLenum	     plane,
-	      const GLdouble *equation)
-{
-    fprintf (logFp, "glClipPlane (0x%x, %p)\n", plane, equation);
-    (*nativeRenderTable->ClipPlane) (plane, equation);
-}
-
-static void
-logColor3bv (const GLbyte *v)
-{
-    vCnt[color3bvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3bv (%p)\n", v);
-    (*nativeRenderTable->Color3bv) (v);
-}
-
-static void
-logColor3dv (const GLdouble *v)
-{
-    vCnt[color3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3dv (%p)\n", v);
-    (*nativeRenderTable->Color3dv) (v);
-}
-
-static void
-logColor3fv (const GLfloat *v)
-{
-    vCnt[color3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3fv (%p)\n", v);
-    (*nativeRenderTable->Color3fv) (v);
-}
-
-static void
-logColor3iv (const GLint *v)
-{
-    vCnt[color3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3iv (%p)\n", v);
-    (*nativeRenderTable->Color3iv) (v);
-}
-
-static void
-logColor3sv (const GLshort *v)
-{
-    vCnt[color3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3sv (%p)\n", v);
-    (*nativeRenderTable->Color3sv) (v);
-}
-
-static void
-logColor3ubv (const GLubyte *v)
-{
-    vCnt[color3ubvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3ubv (%p)\n", v);
-    (*nativeRenderTable->Color3ubv) (v);
-}
-
-static void
-logColor3uiv (const GLuint *v)
-{
-    vCnt[color3uivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3uiv (%p)\n", v);
-    (*nativeRenderTable->Color3uiv) (v);
-}
-
-static void
-logColor3usv (const GLushort *v)
-{
-    vCnt[color3usvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor3usv (%p)\n", v);
-    (*nativeRenderTable->Color3usv) (v);
-}
-
-static void
-logColor4bv (const GLbyte *v)
-{
-    vCnt[color4bvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4bv (%p)\n", v);
-    (*nativeRenderTable->Color4bv) (v);
-}
-
-static void
-logColor4dv (const GLdouble *v)
-{
-    vCnt[color4dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4dv (%p)\n", v);
-    (*nativeRenderTable->Color4dv) (v);
-}
-
-static void
-logColor4fv (const GLfloat *v)
-{
-    vCnt[color4fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4fv (%p)\n", v);
-    (*nativeRenderTable->Color4fv) (v);
-}
-
-static void
-logColor4iv (const GLint *v)
-{
-    vCnt[color4ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4iv (%p)\n", v);
-    (*nativeRenderTable->Color4iv) (v);
-}
-
-static void
-logColor4sv (const GLshort *v)
-{
-    vCnt[color4svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4sv (%p)\n", v);
-    (*nativeRenderTable->Color4sv) (v);
-}
-
-static void
-logColor4ubv (const GLubyte *v)
-{
-    vCnt[color4ubvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4ubv (%p)\n", v);
-    (*nativeRenderTable->Color4ubv) (v);
-}
-
-static void
-logColor4uiv(const GLuint *v)
-{
-    vCnt[color4uivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4uiv (%p)\n", v);
-    (*nativeRenderTable->Color4uiv) (v);
-}
-
-static void
-logColor4usv (const GLushort *v)
-{
-    vCnt[color4usvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glColor4usv (%p)\n", v);
-    (*nativeRenderTable->Color4usv) (v);
-}
-
-static void
-logColorMask (GLboolean red,
-	      GLboolean green,
-	      GLboolean blue,
-	      GLboolean alpha)
-{
-    fprintf (logFp, "glColorMask (%d, %d, %d, %d)\n", red, green, blue, alpha);
-    (*nativeRenderTable->ColorMask) (red, green, blue, alpha);
-}
-
-static void
-logColorMaterial (GLenum face,
-		  GLenum mode)
-{
-    fprintf (logFp, "glColorMaterial (0x%x, 0x%x)\n", face, mode);
-    (*nativeRenderTable->ColorMaterial) (face, mode);
-}
-
-static void
-logColorPointer (GLint	    size,
-		 GLenum	    type,
-		 GLsizei    stride,
-		 const void *pointer)
-{
-    fprintf (logFp, "glColorPointer (%d, 0x%x, %d, %p)\n",
-	     size, type, stride, pointer);
-    (*nativeRenderTable->ColorPointer) (size, type, stride, pointer);
-}
-
-static void
-logCopyPixels (GLint   x,
-	       GLint   y,
-	       GLsizei width,
-	       GLsizei height,
-	       GLenum  type)
-{
-    fprintf (logFp, "glCopyPixels (%d, %d, %d, %d, 0x%x)\n",
-	     x, y, width, height, type);
-    (*nativeRenderTable->CopyPixels) (x, y, width, height, type);
-}
-
-static void
-logCopyTexImage1D (GLenum  target,
-		   GLint   level,
-		   GLenum  internalFormat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width,
-		   GLint   border)
-{
-    fprintf (logFp, "glCopyTexImage1D (0x%x, %d, 0x%x, %d, %d, %d, %d)\n",
-	     target, level, internalFormat, x, y, width, border);
-    (*nativeRenderTable->CopyTexImage1D) (target, level, internalFormat,
-					  x, y, width, border);
-}
-
-static void
-logCopyTexImage2D (GLenum  target,
-		   GLint   level,
-		   GLenum  internalFormat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width,
-		   GLsizei height,
-		   GLint   border)
-{
-    fprintf (logFp, "glCopyTexImage2D (0x%x, %d, 0x%x, %d, %d, %d, %d, %d)\n",
-	     target, level, internalFormat, x, y, width, height, border);
-    (*nativeRenderTable->CopyTexImage2D) (target, level, internalFormat,
-					  x, y, width, height, border);
-}
-
-static void
-logCopyTexSubImage1D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width)
-{
-    fprintf (logFp, "glCopyTexSubImage1D (0x%x, %d, %d, %d, %d, %d)\n",
-	     target, level, xoffset, x, y, width);
-    (*nativeRenderTable->CopyTexSubImage1D) (target, level, xoffset, x, y,
-					     width);
-}
-
-static void
-logCopyTexSubImage2D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   yoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width,
-		      GLsizei height)
-{
-    fprintf (logFp, "glCopyTexSubImage2D (0x%x, %d, %d, %d, %d, %d, %d, %d)\n",
-	     target, level, xoffset, yoffset, x, y, width, height);
-    (*nativeRenderTable->CopyTexSubImage2D) (target, level,
-					     xoffset, yoffset, x, y,
-					     width, height);
-}
-
-static void
-logCullFace (GLenum mode)
-{
-    fprintf (logFp, "glCullFace (0x%x)\n", mode);
-    (*nativeRenderTable->CullFace) (mode);
-}
-
-static void
-logDeleteLists (GLuint  list,
-		GLsizei range)
-{
-    fprintf (logFp, "glDeleteLists (%d, %d)\n", list, range);
-    (*nativeRenderTable->DeleteLists) (list, range);
-}
-
-static void
-logDeleteTextures (GLsizei n, const GLuint *textures)
-{
-    fprintf (logFp, "glDeleteTextures (%d, %p)\n", n, textures);
-    (*nativeRenderTable->DeleteTextures) (n, textures);
-}
-
-static void
-logDepthFunc (GLenum func)
-{
-    fprintf (logFp, "glDepthFunc (0x%x)\n", func);
-    (*nativeRenderTable->DepthFunc) (func);
-}
-
-static void
-logDepthMask (GLboolean flag)
-{
-    fprintf (logFp, "glDepthMask (%d)\n", flag);
-    (*nativeRenderTable->DepthMask) (flag);
-}
-
-static void
-logDepthRange (GLclampd zNear,
-	       GLclampd zFar)
-{
-    fprintf (logFp, "glDepthRange (%f, %f)\n", zNear, zFar);
-    (*nativeRenderTable->DepthRange) (zNear, zFar);
-}
-
-static void
-logDisable (GLenum cap)
-{
-    fprintf (logFp, "glDisable (0x%x)\n", cap);
-    (*nativeRenderTable->Disable) (cap);
-}
-
-static void
-logDisableClientState (GLenum array)
-{
-    fprintf (logFp, "glDisableClientState (0x%x)\n", array);
-    (*nativeRenderTable->DisableClientState) (array);
-}
-
-static void
-logDrawArrays (GLenum  mode,
-	       GLint   first,
-	       GLsizei count)
-{
-    fprintf (logFp, "glDrawArrays (0x%x, %d, %d)\n", mode, first, count);
-    (*nativeRenderTable->DrawArrays) (mode, first, count);
-}
-
-static void
-logDrawBuffer (GLenum mode)
-{
-    fprintf (logFp, "glDrawBuffer (0x%x)\n", mode);
-    (*nativeRenderTable->DrawBuffer) (mode);
-}
-
-static void
-logDrawElements (GLenum     mode,
-		 GLsizei    count,
-		 GLenum	    type,
-		 const void *indices)
-{
-    fprintf (logFp, "glDrawElements (0x%x, %d, 0x%x, %p)\n",
-	     mode, count, type, indices);
-    (*nativeRenderTable->DrawElements) (mode, count, type, indices);
-}
-
-static void
-logDrawPixels (GLsizei	  width,
-	       GLsizei    height,
-	       GLenum	  format,
-	       GLenum	  type,
-	       const void *pixels)
-{
-    fprintf (logFp, "glDrawPixels (%d, %d, 0x%x, 0x%x, %p)\n",
-	     width, height, format, type, pixels);
-    (*nativeRenderTable->DrawPixels) (width, height, format, type, pixels);
-}
-
-static void
-logEdgeFlagPointer (GLsizei    stride,
-		    const void *pointer)
-{
-    fprintf (logFp, "glEdgeFlagPointer (%d, %p)", stride, pointer);
-    (*nativeRenderTable->EdgeFlagPointer) (stride, pointer);
-}
-
-static void
-logEdgeFlagv (const GLboolean *flag)
-{
-    vCnt[edgeFlagvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEdgeFlagv (%p)\n", flag);
-    (*nativeRenderTable->EdgeFlagv) (flag);
-}
-
-static void
-logEnable (GLenum cap)
-{
-    fprintf (logFp, "glEnable (0x%x)\n", cap);
-    (*nativeRenderTable->Enable) (cap);
-}
-
-static void
-logEnableClientState (GLenum array)
-{
-    fprintf (logFp, "glEnableClientState (0x%x)\n", array);
-    (*nativeRenderTable->EnableClientState) (array);
-}
-
-static void
-logEnd (void)
-{
-    int i;
-
-    for (i = 0; i < sizeof (vCnt) / sizeof (vCnt[0]); i++)
-    {
-	if (vCnt[i].n)
-	{
-	    fprintf (logFp, "  %s: %d\n", vCnt[i].name, vCnt[i].n);
-	    vCnt[i].n = 0;
-	}
-    }
-
-    fprintf (logFp, "glEnd ()\n" );
-    (*nativeRenderTable->End) ();
-}
-
-static void
-logEndList (void)
-{
-    fprintf (logFp, "glEndList ()\n" );
-    (*nativeRenderTable->EndList) ();
-}
-
-static void
-logEvalCoord1dv (const GLdouble *u)
-{
-    vCnt[evalCoord1dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalCoord1dv (%p)\n", u);
-    (*nativeRenderTable->EvalCoord1dv) (u);
-}
-
-static void
-logEvalCoord1fv (const GLfloat *u)
-{
-    vCnt[evalCoord1fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalCoord1fv (%p)\n", u);
-    (*nativeRenderTable->EvalCoord1fv) (u);
-}
-
-static void
-logEvalCoord2dv (const GLdouble *u)
-{
-    vCnt[evalCoord2dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalCoord2dv (%p)\n", u);
-    (*nativeRenderTable->EvalCoord2dv) (u);
-}
-
-static void
-logEvalCoord2fv (const GLfloat *u)
-{
-    vCnt[evalCoord1fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalCoord2fv (%p)\n", u);
-    (*nativeRenderTable->EvalCoord2fv) (u);
-}
-
-static void
-logEvalMesh1 (GLenum mode,
-	      GLint  i1,
-	      GLint  i2)
-{
-    fprintf (logFp, "glEvalMesh1 (0x%x, %d, %d)\n", mode, i1, i2);
-    (*nativeRenderTable->EvalMesh1) (mode, i1, i2 );
-}
-
-static void
-logEvalMesh2 (GLenum mode,
-	      GLint  i1,
-	      GLint  i2,
-	      GLint  j1,
-	      GLint  j2)
-{
-    fprintf (logFp, "glEvalMesh2 (0x%x, %d, %d, %d, %d)\n",
-	     mode, i1, i2, j1, j2);
-    (*nativeRenderTable->EvalMesh2) (mode, i1, i2, j1, j2);
-}
-
-static void
-logEvalPoint1 (GLint i)
-{
-    vCnt[evalPoint1Index].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalPoint1 (%d)\n", i);
-    (*nativeRenderTable->EvalPoint1) (i);
-}
-
-static void
-logEvalPoint2 (GLint i, GLint j)
-{
-    vCnt[evalPoint2Index].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glEvalPoint2 (%d, %d)\n", i, j);
-    (*nativeRenderTable->EvalPoint2) (i, j);
-}
-
-static void
-logFeedbackBuffer (GLsizei size,
-		   GLenum  type,
-		   GLfloat *buffer)
-{
-    fprintf (logFp, "glFeedbackBuffer (%d, 0x%x, %p)\n", size, type, buffer);
-    (*nativeRenderTable->FeedbackBuffer) (size, type, buffer);
-}
-
-static void
-logFinish (void)
-{
-    fprintf (logFp, "glFinish ()\n");
-    (*nativeRenderTable->Finish) ();
-}
-
-static void
-logFlush (void)
-{
-    fprintf (logFp, "glFlush ()\n");
-    (*nativeRenderTable->Flush) ();
-}
-
-static void
-logFogf (GLenum  pname,
-	 GLfloat param)
-{
-    fprintf (logFp, "glFogf (0x%x, %f)\n", pname, param);
-    (*nativeRenderTable->Fogf) (pname, param);
-}
-
-static void
-logFogfv (GLenum	pname,
-	  const GLfloat *params)
-{
-    fprintf (logFp, "glFogfv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->Fogfv) (pname, params);
-}
-
-static void
-logFogi (GLenum pname,
-	 GLint  param)
-{
-    fprintf (logFp, "glFogi (0x%x, %d)\n", pname, param);
-    (*nativeRenderTable->Fogi) (pname, param);
-}
-
-static void
-logFogiv (GLenum      pname,
-	  const GLint *params)
-{
-    fprintf (logFp, "glFogiv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->Fogiv) (pname, params);
-}
-
-static void
-logFrontFace (GLenum mode)
-{
-    fprintf (logFp, "glFrontFace (0x%x)\n", mode);
-    (*nativeRenderTable->FrontFace) (mode);
-}
-
-static void
-logFrustum (GLdouble left,
-	    GLdouble right,
-	    GLdouble bottom,
-	    GLdouble top,
-	    GLdouble zNear,
-	    GLdouble zFar)
-{
-    fprintf (logFp, "glFrustum (%f, %f, %f, %f, %f, %f)\n",
-	     left, right, bottom, top, zNear, zFar);
-    (*nativeRenderTable->Frustum) (left, right, bottom, top, zNear, zFar);
-}
-
-static GLuint
-logGenLists (GLsizei range)
-{
-    fprintf (logFp, "glGenLists (%d)\n", range);
-    return (*nativeRenderTable->GenLists) (range);
-}
-
-static void
-logGenTextures (GLsizei n,
-		GLuint *textures)
-{
-    fprintf (logFp, "glGenTextures (%d, %p)\n", n, textures);
-    (*nativeRenderTable->GenTextures) (n, textures);
-}
-static void
-logGetBooleanv (GLenum	  pname,
-		GLboolean *params)
-{
-    fprintf (logFp, "glGetBooleanv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->GetBooleanv) (pname, params);
-}
-
-static void
-logGetClipPlane (GLenum   plane,
-		 GLdouble *equation)
-{
-    fprintf (logFp, "glGetClipPlane (0x%x, %p)\n", plane, equation);
-    (*nativeRenderTable->GetClipPlane) (plane, equation);
-}
-
-static void
-logGetDoublev (GLenum   pname,
-	       GLdouble *params)
-{
-    fprintf (logFp, "glGetDoublev (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->GetDoublev) (pname, params);
-}
-
-static GLenum
-logGetError (void)
-{
-    fprintf (logFp, "glGetError ()\n");
-    return (*nativeRenderTable->GetError) ();
-}
-
-static void
-logGetFloatv (GLenum  pname,
-	      GLfloat *params)
-{
-    fprintf (logFp, "glGetFloatv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->GetFloatv) (pname, params);
-}
-
-static void
-logGetIntegerv (GLenum pname,
-		GLint  *params)
-{
-    fprintf (logFp, "glGetIntegerv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->GetIntegerv) (pname, params);
-}
-
-static void
-logGetLightfv (GLenum  light,
-	       GLenum  pname,
-	       GLfloat *params)
-{
-    fprintf (logFp, "glGetLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
-    (*nativeRenderTable->GetLightfv) (light, pname, params);
-}
-
-static void
-logGetLightiv (GLenum light,
-	       GLenum pname,
-	       GLint  *params)
-{
-    fprintf (logFp, "glGetLightiv (0x%x, 0x%x, %p)\n",
-	     light, pname, params);
-    (*nativeRenderTable->GetLightiv) (light, pname, params);
-}
-
-static void
-logGetMapdv (GLenum   target,
-	     GLenum   query,
-	     GLdouble *v)
-{
-    fprintf (logFp, "glGetMapdv (0x%x, 0x%x, %p)\n", target, query, v);
-    (*nativeRenderTable->GetMapdv) (target, query, v);
-}
-
-static void
-logGetMapfv (GLenum  target,
-	     GLenum  query,
-	     GLfloat *v)
-{
-    fprintf (logFp, "glGetMapfv (0x%x, 0x%x, %p)\n", target, query, v);
-    (*nativeRenderTable->GetMapfv) (target, query, v);
-}
-
-static void
-logGetMapiv (GLenum target,
-	     GLenum query,
-	     GLint  *v)
-{
-    fprintf (logFp, "glGetMapiv (0x%x, 0x%x, %p)\n", target, query, v);
-    (*nativeRenderTable->GetMapiv) (target, query, v);
-}
-
-static void
-logGetMaterialfv (GLenum  face,
-		  GLenum  pname,
-		  GLfloat *params)
-{
-    fprintf (logFp, "glGetMaterialfv (0x%x, 0x%x, %p)\n", face, pname, params);
-    (*nativeRenderTable->GetMaterialfv) (face, pname, params);
-}
-
-static void
-logGetMaterialiv (GLenum face,
-		  GLenum pname,
-		  GLint  *params)
-{
-    fprintf (logFp, "glGetMaterialiv (0x%x, 0x%x, %p)\n", face, pname, params);
-    (*nativeRenderTable->GetMaterialiv) (face, pname, params);
-}
-
-static void
-logGetPixelMapfv (GLenum  map,
-		  GLfloat *values)
-{
-    fprintf (logFp, "glGetPixelMapfv (0x%x, %p)\n", map, values);
-    (*nativeRenderTable->GetPixelMapfv) (map, values);
-}
-
-static void
-logGetPixelMapuiv (GLenum map,
-		   GLuint *values)
-{
-    fprintf (logFp, "glGetPixelMapuiv (0x%x, %p)\n", map, values);
-    (*nativeRenderTable->GetPixelMapuiv) (map, values);
-}
-
-static void
-logGetPixelMapusv (GLenum   map,
-		   GLushort *values)
-{
-    fprintf (logFp, "glGetPixelMapusv (0x%x, %p)\n", map, values);
-    (*nativeRenderTable->GetPixelMapusv) (map, values);
-}
-
-static void
-logGetPointerv (GLenum pname,
-		GLvoid **params)
-{
-    fprintf (logFp, "glGetPointerv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->GetPointerv) (pname, params);
-}
-
-static void
-logGetPolygonStipple (GLubyte *mask)
-{
-    fprintf (logFp, "glGetPolygonStipple (%p)\n", mask);
-    (*nativeRenderTable->GetPolygonStipple) (mask);
-}
-
-static const GLubyte *
-logGetString (GLenum name)
-{
-    fprintf (logFp, "glGetString (0x%x)\n", name);
-    return (*nativeRenderTable->GetString) (name);
-}
-
-static void
-logGetTexEnvfv (GLenum  target,
-		GLenum  pname,
-		GLfloat *params)
-{
-    fprintf (logFp, "glGetTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
-    (*nativeRenderTable->GetTexEnvfv) (target, pname, params);
-}
-
-static void
-logGetTexEnviv (GLenum target,
-		GLenum pname,
-		GLint  *params)
-{
-    fprintf (logFp, "glGetTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
-    (*nativeRenderTable->GetTexEnviv) (target, pname, params);
-}
-
-static void
-logGetTexGendv (GLenum   coord,
-		GLenum   pname,
-		GLdouble *params)
-{
-    fprintf (logFp, "glGetTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->GetTexGendv) (coord, pname, params);
-}
-
-static void
-logGetTexGenfv (GLenum  coord,
-		GLenum  pname,
-		GLfloat *params)
-{
-    fprintf (logFp, "glGetTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->GetTexGenfv) (coord, pname, params);
-}
-
-static void
-logGetTexGeniv (GLenum coord,
-		GLenum pname,
-		GLint  *params)
-{
-    fprintf (logFp, "glGetTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->GetTexGeniv) (coord, pname, params);
-}
-
-static void
-logGetTexImage (GLenum target,
-		GLint  level,
-		GLenum format,
-		GLenum type,
-		void   *pixels)
-{
-    fprintf (logFp, "glGetTexImage (0x%x, %d, 0x%x, 0x%x, %p)\n",
-	     target, level, format, type, pixels);
-    (*nativeRenderTable->GetTexImage) (target, level, format, type,
-				       pixels);
-}
-static void
-logGetTexLevelParameterfv (GLenum  target,
-			   GLint   level,
-			   GLenum  pname,
-			   GLfloat *params)
-{
-    fprintf (logFp, "glGetTexLevelParameterfv (0x%x, %d, 0x%x, %p)\n",
-	     target, level, pname, params);
-    (*nativeRenderTable->GetTexLevelParameterfv) (target, level,
-						  pname, params);
-}
-
-static void
-logGetTexLevelParameteriv (GLenum target,
-			   GLint  level,
-			   GLenum pname,
-			   GLint  *params)
-{
-    fprintf (logFp, "glGetTexLevelParameteriv (0x%x, %d, 0x%x, %p)\n",
-	     target, level, pname, params);
-    (*nativeRenderTable->GetTexLevelParameteriv) (target, level,
-						  pname, params);
-}
-
-static void
-logGetTexParameterfv (GLenum  target,
-		      GLenum  pname,
-		      GLfloat *params)
-{
-    fprintf (logFp, "glGetTexParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetTexParameterfv) (target, pname, params);
-}
-
-static void
-logGetTexParameteriv (GLenum target,
-		      GLenum pname,
-		      GLint  *params)
-{
-    fprintf (logFp, "glGetTexParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetTexParameteriv) (target, pname, params);
-}
-
-static void
-logHint (GLenum target,
-	 GLenum mode)
-{
-    fprintf (logFp, "glHint (0x%x, 0x%x)\n", target, mode);
-    (*nativeRenderTable->Hint) (target, mode);
-}
-
-static void
-logIndexMask (GLuint mask)
-{
-    fprintf (logFp, "glIndexMask (%d)\n", mask);
-    (*nativeRenderTable->IndexMask) (mask);
-}
-
-static void
-logIndexPointer (GLenum	    type,
-		 GLsizei    stride,
-		 const void *pointer)
-{
-    fprintf (logFp, "glIndexPointer (0x%x, %d, %p)\n", type, stride, pointer);
-    (*nativeRenderTable->IndexPointer) (type, stride, pointer);
-}
-
-static void
-logIndexdv (const GLdouble *c)
-{
-    vCnt[indexdvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glIndexdv (%p)\n", c);
-    (*nativeRenderTable->Indexdv) (c);
-}
-
-static void
-logIndexfv (const GLfloat *c)
-{
-    vCnt[indexfvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glIndexfv (%p)\n", c);
-    (*nativeRenderTable->Indexfv) (c);
-}
-
-static void
-logIndexiv (const GLint *c)
-{
-    vCnt[indexivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glIndexiv (%p)\n", c);
-    (*nativeRenderTable->Indexiv) (c);
-}
-
-static void
-logIndexsv (const GLshort *c)
-{
-    vCnt[indexsvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glIndexsv (%p)\n", c);
-    (*nativeRenderTable->Indexsv) (c);
-}
-
-static void
-logIndexubv (const GLubyte *c)
-{
-    vCnt[indexubvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glIndexubv (%p)\n", c);
-    (*nativeRenderTable->Indexubv) (c);
-}
-
-static void
-logInitNames (void)
-{
-    fprintf (logFp, "glInitNames ()\n" );
-    (*nativeRenderTable->InitNames) ();
-}
-
-static void
-logInterleavedArrays (GLenum	 format,
-		      GLsizei	 stride,
-		      const void *pointer)
-{
-    fprintf (logFp, "glInterleavedArrays (0x%x, %d, %p)\n",
-	     format, stride, pointer);
-    (*nativeRenderTable->InterleavedArrays) (format, stride, pointer);
-}
-
-static GLboolean
-logIsEnabled (GLenum cap)
-{
-    fprintf (logFp, "glIsEnabled (0x%x)\n", cap);
-    return (*nativeRenderTable->IsEnabled) (cap);
-}
-
-static GLboolean
-logIsList (GLuint list)
-{
-    fprintf (logFp, "glIsList (%d)\n", list);
-    return (*nativeRenderTable->IsList) (list);
-}
-
-static GLboolean
-logIsTexture (GLuint texture)
-{
-    fprintf (logFp, "glIsTexture (%d)\n", texture);
-    return (*nativeRenderTable->IsTexture) (texture);
-}
-
-static void
-logLightModelf (GLenum  pname,
-		GLfloat param)
-{
-    fprintf (logFp, "glLightModelf (0x%x, %f)\n", pname, param);
-    (*nativeRenderTable->LightModelf) (pname, param);
-}
-
-static void
-logLightModelfv (GLenum	       pname,
-		 const GLfloat *params)
-{
-    fprintf (logFp, "glLightModelfv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->LightModelfv) (pname, params);
-}
-
-static void
-logLightModeli (GLenum pname,
-		GLint  param)
-{
-    fprintf (logFp, "glLightModeli (0x%x, %d)\n", pname, param);
-    (*nativeRenderTable->LightModeli) (pname, param);
-}
-
-static void
-logLightModeliv (GLenum	     pname,
-		 const GLint *params)
-{
-    fprintf (logFp, "glLightModeliv (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->LightModeliv) (pname, params);
-}
-
-static void
-logLightf (GLenum  light,
-	   GLenum  pname,
-	   GLfloat param)
-{
-    fprintf (logFp, "glLightf (0x%x, 0x%x, %f)\n", light, pname, param);
-    (*nativeRenderTable->Lightf) (light, pname, param);
-}
-
-static void
-logLightfv (GLenum	  light,
-	    GLenum	  pname,
-	    const GLfloat *params)
-{
-    fprintf (logFp, "glLightfv (0x%x, 0x%x, %p)\n", light, pname, params);
-    (*nativeRenderTable->Lightfv) (light, pname, params);
-}
-
-static void
-logLighti (GLenum light,
-	   GLenum pname,
-	   GLint  param)
-{
-    fprintf (logFp, "glLighti (0x%x, 0x%x, %d)\n", light, pname, param);
-    (*nativeRenderTable->Lighti) (light, pname, param);
-}
-
-static void
-logLightiv (GLenum	light,
-	    GLenum	pname,
-	    const GLint *params)
-{
-    fprintf (logFp, "glLightiv (0x%x, 0x%x, %p)\n", light, pname, params);
-    (*nativeRenderTable->Lightiv) (light, pname, params);
-}
-
-static void
-logLineStipple (GLint    factor,
-		GLushort pattern)
-{
-    fprintf (logFp, "glLineStipple (%d, %d)\n", factor, pattern);
-    (*nativeRenderTable->LineStipple) (factor, pattern);
-}
-
-static void
-logLineWidth (GLfloat width)
-{
-    fprintf (logFp, "glLineWidth (%f)\n", width);
-    (*nativeRenderTable->LineWidth) (width);
-}
-
-static void
-logListBase (GLuint base)
-{
-    fprintf (logFp, "glListBase (%d)\n", base);
-    (*nativeRenderTable->ListBase) (base);
-}
-
-static void
-logLoadIdentity (void)
-{
-    fprintf (logFp, "glLoadIdentity ()\n");
-    (*nativeRenderTable->LoadIdentity) ();
-}
-
-static void
-logLoadMatrixd (const GLdouble *m)
-{
-    fprintf (logFp, "glLoadMatrixd (%p)\n", m);
-    (*nativeRenderTable->LoadMatrixd) (m);
-}
-
-static void
-logLoadMatrixf (const GLfloat *m)
-{
-    fprintf (logFp, "glLoadMatrixf (%p)\n", m);
-    (*nativeRenderTable->LoadMatrixf) (m);
-}
-
-static void
-logLoadName (GLuint name)
-{
-    fprintf (logFp, "glLoadName (%d)\n", name);
-    (*nativeRenderTable->LoadName) (name);
-}
-
-static void
-logLogicOp (GLenum opcode)
-{
-    fprintf (logFp, "glLogicOp(0x%x)\n", opcode);
-    (*nativeRenderTable->LogicOp) (opcode);
-}
-
-static void
-logMap1d (GLenum	 target,
-	  GLdouble	 u1,
-	  GLdouble	 u2,
-	  GLint		 stride,
-	  GLint		 order,
-	  const GLdouble *points)
-{
-    fprintf (logFp, "glMap1d (0x%x, %f, %f, %d, %d, %p)\n",
-	     target, u1, u2, stride, order, points);
-    (*nativeRenderTable->Map1d) (target, u1, u2, stride, order, points);
-}
-
-static void
-logMap1f (GLenum	target,
-	  GLfloat	u1,
-	  GLfloat	u2,
-	  GLint		stride,
-	  GLint		order,
-	  const GLfloat *points)
-{
-    fprintf (logFp, "glMap1f (0x%x, %f, %f, %d, %d, %p)\n",
-	     target, u1, u2, stride, order, points);
-    (*nativeRenderTable->Map1f) (target, u1, u2, stride, order, points);
-}
-
-static void
-logMap2d (GLenum	 target,
-	  GLdouble	 u1,
-	  GLdouble	 u2,
-	  GLint		 ustride,
-	  GLint		 uorder,
-	  GLdouble	 v1,
-	  GLdouble	 v2,
-	  GLint		 vstride,
-	  GLint		 vorder,
-	  const GLdouble *points)
-{
-    fprintf (logFp, "glMap2d (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
-	     target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-    (*nativeRenderTable->Map2d) (target, u1, u2, ustride, uorder, v1, v2,
-				 vstride, vorder, points);
-}
-
-static void
-logMap2f (GLenum	target,
-	  GLfloat	u1,
-	  GLfloat	u2,
-	  GLint		ustride,
-	  GLint		uorder,
-	  GLfloat	v1,
-	  GLfloat	v2,
-	  GLint		vstride,
-	  GLint		vorder,
-	  const GLfloat *points)
-{
-    fprintf (logFp, "glMap2f (0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p)\n",
-	     target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
-    (*nativeRenderTable->Map2f) (target, u1, u2, ustride, uorder, v1, v2,
-				 vstride, vorder, points);
-}
-
-static void
-logMapGrid1d (GLint    un,
-	      GLdouble u1,
-	      GLdouble u2)
-{
-    fprintf (logFp, "glMapGrid1d (%d, %f, %f)\n", un, u1, u2);
-    (*nativeRenderTable->MapGrid1d) (un, u1, u2);
-}
-
-static void
-logMapGrid1f (GLint   un,
-	      GLfloat u1,
-	      GLfloat u2)
-{
-    fprintf (logFp, "glMapGrid1f (%d, %f, %f)\n", un, u1, u2);
-    (*nativeRenderTable->MapGrid1f) (un, u1, u2);
-}
-
-static void
-logMapGrid2d (GLint    un,
-	      GLdouble u1,
-	      GLdouble u2,
-	      GLint    vn,
-	      GLdouble v1,
-	      GLdouble v2)
-{
-    fprintf (logFp, "glMapGrid2d (%d, %f, %f, %d, %f, %f)\n",
-	     un, u1, u2, vn, v1, v2);
-    (*nativeRenderTable->MapGrid2d) (un, u1, u2, vn, v1, v2);
-}
-
-static void
-logMapGrid2f (GLint   un,
-	      GLfloat u1,
-	      GLfloat u2,
-	      GLint   vn,
-	      GLfloat v1,
-	      GLfloat v2)
-{
-    fprintf (logFp, "glMapGrid2f (%d, %f, %f, %d, %f, %f)\n",
-	     un, u1, u2, vn, v1, v2);
-    (*nativeRenderTable->MapGrid2f) (un, u1, u2, vn, v1, v2);
-}
-
-static void
-logMaterialf (GLenum  face,
-	      GLenum  pname,
-	      GLfloat param)
-{
-    vCnt[materialfIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMaterialf (0x%x, 0x%x, %f)\n", face, pname, param);
-    (*nativeRenderTable->Materialf) (face, pname, param);
-}
-
-static void
-logMaterialfv (GLenum	     face,
-	       GLenum	     pname,
-	       const GLfloat *params)
-{
-    vCnt[materialfvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMaterialfv (0x%x, 0x%x, %p)\n",
-		 face, pname, params);
-    (*nativeRenderTable->Materialfv) (face, pname, params);
-}
-
-static void
-logMateriali (GLenum face,
-	      GLenum pname,
-	      GLint  param)
-{
-    vCnt[materialiIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMateriali (0x%x, 0x%x, %d)\n", face, pname, param);
-    (*nativeRenderTable->Materiali) (face, pname, param);
-}
-
-static void
-logMaterialiv (GLenum	   face,
-	       GLenum	   pname,
-	       const GLint *params)
-{
-    vCnt[materialivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMaterialiv (0x%x, 0x%x, %p)\n",
-		 face, pname, params);
-    (*nativeRenderTable->Materialiv) (face, pname, params);
-}
-
-static void
-logMatrixMode (GLenum mode)
-{
-    fprintf (logFp, "glMatrixMode (0x%x)\n", mode);
-    (*nativeRenderTable->MatrixMode) (mode);
-}
-
-static void
-logMultMatrixd (const GLdouble *m)
-{
-    fprintf (logFp, "glMultMatrixd (%p)\n", m);
-    (*nativeRenderTable->MultMatrixd) (m);
-}
-
-static void
-logMultMatrixf (const GLfloat *m)
-{
-    fprintf (logFp, "glMultMatrixf (%p)\n", m);
-    (*nativeRenderTable->MultMatrixf) (m);
-}
-
-static void
-logNewList (GLuint list,
-	    GLenum mode)
-{
-    fprintf (logFp, "glNewList (%d, 0x%x)\n", list, mode);
-    (*nativeRenderTable->NewList) (list, mode);
-}
-
-static void
-logNormal3bv (const GLbyte *v)
-{
-    vCnt[normal3bvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glNormal3bv (%p)\n", v);
-    (*nativeRenderTable->Normal3bv) (v);
-}
-
-static void
-logNormal3dv (const GLdouble *v)
-{
-    vCnt[normal3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glNormal3dv (%p)\n", v);
-    (*nativeRenderTable->Normal3dv) (v);
-}
-
-static void
-logNormal3fv (const GLfloat *v)
-{
-    vCnt[normal3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glNormal3fv (%p)\n", v);
-    (*nativeRenderTable->Normal3fv) (v);
-}
-
-static void
-logNormal3iv (const GLint *v)
-{
-    vCnt[normal3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glNormal3iv (%p)\n", v);
-    (*nativeRenderTable->Normal3iv) (v);
-}
-
-static void
-logNormal3sv (const GLshort *v)
-{
-    vCnt[normal3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glNormal3sv (%p)\n", v);
-    (*nativeRenderTable->Normal3sv) (v);
-}
-
-static void
-logNormalPointer (GLenum     type,
-		  GLsizei    stride,
-		  const void *pointer)
-{
-    fprintf (logFp, "glNormalPointer (0x%x, %d, %p)\n", type, stride, pointer);
-    (*nativeRenderTable->NormalPointer) (type, stride, pointer);
-}
-
-static void
-logOrtho (GLdouble left,
-	  GLdouble right,
-	  GLdouble bottom,
-	  GLdouble top,
-	  GLdouble zNear,
-	  GLdouble zFar)
-{
-    fprintf (logFp, "glOrtho (%f, %f, %f, %f, %f, %f)\n",
-	     left, right, bottom, top, zNear, zFar);
-    (*nativeRenderTable->Ortho) (left, right, bottom, top, zNear, zFar);
-}
-
-static void
-logPassThrough (GLfloat token)
-{
-    fprintf (logFp, "glPassThrough (%f)\n", token);
-    (*nativeRenderTable->PassThrough) (token);
-}
-
-static void
-logPixelMapfv (GLenum	     map,
-	       GLsizei	     mapsize,
-	       const GLfloat *values)
-{
-    fprintf (logFp, "glPixelMapfv (0x%x, %d, %p)\n", map, mapsize, values);
-    (*nativeRenderTable->PixelMapfv) (map, mapsize, values);
-}
-
-static void
-logPixelMapuiv (GLenum	     map,
-		GLsizei	     mapsize,
-		const GLuint *values)
-{
-    fprintf (logFp, "glPixelMapuiv (0x%x, %d, %p)\n", map, mapsize, values);
-    (*nativeRenderTable->PixelMapuiv) (map, mapsize, values);
-}
-
-static void
-logPixelMapusv (GLenum	       map,
-		GLsizei	       mapsize,
-		const GLushort *values)
-{
-    fprintf (logFp, "glPixelMapusv (0x%x, %d, %p)\n", map, mapsize, values);
-    (*nativeRenderTable->PixelMapusv) (map, mapsize, values);
-}
-
-static void
-logPixelStoref (GLenum  pname,
-		GLfloat param)
-{
-    fprintf (logFp, "glPixelStoref (0x%x, %f)\n", pname, param);
-    (*nativeRenderTable->PixelStoref) (pname, param);
-}
-
-static void
-logPixelStorei (GLenum pname,
-		GLint  param)
-{
-    fprintf (logFp, "glPixelStorei (0x%x, %d)\n", pname, param);
-    (*nativeRenderTable->PixelStorei) (pname, param);
-}
-
-static void
-logPixelTransferf (GLenum pname, GLfloat param)
-{
-    fprintf (logFp, "glPixelTransferf (0x%x, %f)\n", pname, param);
-    (*nativeRenderTable->PixelTransferf) (pname, param);
-}
-
-static void
-logPixelTransferi (GLenum pname,
-		   GLint  param)
-{
-    fprintf (logFp, "glPixelTransferi (0x%x, %d)\n", pname, param);
-    (*nativeRenderTable->PixelTransferi) (pname, param);
-}
-
-static void
-logPixelZoom (GLfloat xfactor,
-	      GLfloat yfactor)
-{
-    fprintf (logFp, "glPixelZoom (%f, %f)\n", xfactor, yfactor);
-    (*nativeRenderTable->PixelZoom) (xfactor, yfactor);
-}
-
-static void
-logPointSize (GLfloat size)
-{
-    fprintf (logFp, "glPointSize" );
-    (*nativeRenderTable->PointSize) (size);
-}
-
-static void
-logPolygonMode (GLenum face,
-		GLenum mode)
-{
-    fprintf (logFp, "glPolygonMode (0x%x, 0x%x)\n", face, mode );
-    (*nativeRenderTable->PolygonMode) (face, mode);
-}
-
-static void
-logPolygonOffset (GLfloat factor,
-		  GLfloat units)
-{
-    fprintf (logFp, "glPolygonOffset (%f, %f)\n", factor, units);
-    (*nativeRenderTable->PolygonOffset) (factor, units);
-}
-
-static void
-logPolygonStipple (const GLubyte *mask)
-{
-    fprintf (logFp, "glPolygonStipple (%p)\n", mask);
-    (*nativeRenderTable->PolygonStipple) (mask);
-}
-
-static void
-logPopAttrib (void)
-{
-    fprintf (logFp, "glPopAttrib ()\n");
-    (*nativeRenderTable->PopAttrib) ();
-}
-
-static void
-logPopClientAttrib (void)
-{
-    fprintf (logFp, "glPopClientAttrib ()\n" );
-    (*nativeRenderTable->PopClientAttrib) ();
-}
-
-static void
-logPopMatrix (void)
-{
-    fprintf (logFp, "glPopMatrix ()\n" );
-    (*nativeRenderTable->PopMatrix) ();
-}
-
-static void
-logPopName (void)
-{
-    fprintf (logFp, "glPopName ()\n");
-    (*nativeRenderTable->PopName) ();
-}
-
-static void
-logPrioritizeTextures (GLsizei	      n,
-		       const GLuint   *textures,
-		       const GLclampf *priorities)
-{
-    fprintf (logFp, "glPrioritizeTextures (%d, %p, %p)\n",
-	     n, textures, priorities);
-    (*nativeRenderTable->PrioritizeTextures) (n, textures, priorities);
-}
-
-static void
-logPushAttrib (GLbitfield mask)
-{
-    fprintf (logFp, "glPushAttrib (0x%x)\n", mask);
-    (*nativeRenderTable->PushAttrib) (mask);
-}
-
-static void
-logPushClientAttrib (GLbitfield mask)
-{
-    fprintf (logFp, "glPushClientAttrib (0x%x)\n", mask);
-    (*nativeRenderTable->PushClientAttrib) (mask);
-}
-
-static void
-logPushMatrix (void)
-{
-    fprintf (logFp, "glPushMatrix ()\n" );
-    (*nativeRenderTable->PushMatrix) ();
-}
-
-static void
-logPushName (GLuint name)
-{
-    fprintf (logFp, "glPushName (%d)\n", name);
-    (*nativeRenderTable->PushName) (name);
-}
-
-static void
-logRasterPos2dv (const GLdouble *v)
-{
-    fprintf (logFp, "glRasterPos2dv (%p)\n", v);
-    (*nativeRenderTable->RasterPos2dv) (v);
-}
-
-static void
-logRasterPos2fv (const GLfloat *v)
-{
-    fprintf (logFp, "glRasterPos2dv (%p)\n", v);
-    (*nativeRenderTable->RasterPos2fv) (v);
-}
-
-static void
-logRasterPos2iv (const GLint *v)
-{
-    fprintf (logFp, "glRasterPos2iv (%p)\n", v);
-    (*nativeRenderTable->RasterPos2iv) (v);
-}
-
-static void
-logRasterPos2sv (const GLshort *v)
-{
-    fprintf (logFp, "glRasterPos2sv (%p)\n", v);
-    (*nativeRenderTable->RasterPos2sv) (v);
-}
-
-static void
-logRasterPos3dv (const GLdouble *v)
-{
-    fprintf (logFp, "glRasterPos3dv (%p)\n", v);
-    (*nativeRenderTable->RasterPos3dv) (v);
-}
-
-static void
-logRasterPos3fv (const GLfloat *v)
-{
-    fprintf (logFp, "glRasterPos3fv (%p)\n", v);
-    (*nativeRenderTable->RasterPos3fv) (v);
-}
-
-static void
-logRasterPos3iv (const GLint *v)
-{
-    fprintf (logFp, "glRasterPos3iv (%p)\n", v);
-    (*nativeRenderTable->RasterPos3iv) (v);
-}
-
-static void
-logRasterPos3sv (const GLshort *v)
-{
-    fprintf (logFp, "glRasterPos3sv (%p)\n", v);
-    (*nativeRenderTable->RasterPos3sv) (v);
-}
-
-static void
-logRasterPos4dv (const GLdouble *v)
-{
-    fprintf (logFp, "glRasterPos4dv (%p)\n", v);
-    (*nativeRenderTable->RasterPos4dv) (v);
-}
-
-static void
-logRasterPos4fv (const GLfloat *v)
-{
-    fprintf (logFp, "glRasterPos4fv (%p)\n", v);
-    (*nativeRenderTable->RasterPos4fv) (v);
-}
-
-static void
-logRasterPos4iv (const GLint *v)
-{
-    fprintf (logFp, "glRasterPos4iv (%p)\n", v);
-    (*nativeRenderTable->RasterPos4iv) (v);
-}
-
-static void
-logRasterPos4sv (const GLshort *v)
-{
-    fprintf (logFp, "glRasterPos4sv (%p)\n", v);
-    (*nativeRenderTable->RasterPos4sv) (v);
-}
-
-static void
-logReadBuffer (GLenum mode)
-{
-    fprintf (logFp, "glReadBuffer (0x%x)\n", mode);
-    (*nativeRenderTable->ReadBuffer) (mode);
-}
-
-static void
-logReadPixels (GLint   x,
-	       GLint   y,
-	       GLsizei width,
-	       GLsizei height,
-	       GLenum  format,
-	       GLenum  type,
-	       void    *pixels)
-{
-    fprintf (logFp, "glReadPixels (%d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
-	     x, y, width, height, format, type, pixels);
-    (*nativeRenderTable->ReadPixels) (x, y, width, height, format, type,
-				      pixels);
-}
-
-static void
-logRectdv (const GLdouble *v1,
-	   const GLdouble *v2)
-{
-    fprintf (logFp, "glRectdv (%p, %p)\n", v1, v2);
-    (*nativeRenderTable->Rectdv) (v1, v2);
-}
-
-static void
-logRectfv (const GLfloat *v1,
-	   const GLfloat *v2)
-{
-    fprintf (logFp, "glRectfv (%p, %p)\n", v1, v2);
-    (*nativeRenderTable->Rectfv) (v1, v2);
-}
-
-static void
-logRectiv (const GLint *v1,
-	   const GLint *v2)
-{
-    fprintf (logFp, "glRectiv (%p, %p)\n", v1, v2);
-    (*nativeRenderTable->Rectiv) (v1, v2);
-}
-
-static void
-logRectsv (const GLshort *v1,
-	   const GLshort *v2)
-{
-    fprintf (logFp, "glRectsv (%p, %p)\n", v1, v2);
-    (*nativeRenderTable->Rectsv) (v1, v2);
-}
-
-static GLint
-logRenderMode (GLenum mode)
-{
-    fprintf (logFp, "glRenderMode (0x%x)\n", mode);
-    return (*nativeRenderTable->RenderMode) (mode);
-}
-
-static void
-logRotated (GLdouble angle,
-	    GLdouble x,
-	    GLdouble y,
-	    GLdouble z)
-{
-    fprintf (logFp, "glRotated (%f, %f, %f, %f)\n", angle, x, y, z);
-    (*nativeRenderTable->Rotated) (angle, x, y, z);
-}
-
-static void
-logRotatef (GLfloat angle,
-	    GLfloat x,
-	    GLfloat y,
-	    GLfloat z)
-{
-    fprintf (logFp, "glRotatef (%f, %f, %f, %f)\n", angle, x, y, z);
-    (*nativeRenderTable->Rotatef) (angle, x, y, z);
-}
-
-static void
-logScaled (GLdouble x,
-	   GLdouble y,
-	   GLdouble z)
-{
-    fprintf (logFp, "glScaled (%f, %f, %f)\n", x, y, z);
-    (*nativeRenderTable->Scaled) (x, y, z);
-}
-
-static void
-logScalef (GLfloat x,
-	   GLfloat y,
-	   GLfloat z)
-{
-    fprintf (logFp, "glScalef (%f, %f, %f)\n", x, y, z);
-    (*nativeRenderTable->Scalef) (x, y, z);
-}
-
-static void
-logScissor (GLint   x,
-	    GLint   y,
-	    GLsizei width,
-	    GLsizei height)
-{
-    fprintf (logFp, "glScissor (%d, %d, %d, %d)\n", x, y, width, height);
-    (*nativeRenderTable->Scissor) (x, y, width, height);
-}
-
-static void
-logSelectBuffer (GLsizei size,
-		 GLuint  *buffer)
-{
-    fprintf (logFp, "glSelectBuffer (%d, %p)\n", size, buffer);
-    (*nativeRenderTable->SelectBuffer) (size, buffer);
-}
-
-static void
-logShadeModel (GLenum mode)
-{
-    fprintf (logFp, "glShadeModel (0x%x)\n", mode);
-    (*nativeRenderTable->ShadeModel) (mode);
-}
-
-static void
-logStencilFunc (GLenum func,
-		GLint  ref,
-		GLuint mask)
-{
-    fprintf (logFp, "glStencilFunc (0x%x, %d, %d)\n", func, ref, mask);
-    (*nativeRenderTable->StencilFunc) (func, ref, mask);
-}
-
-static void
-logStencilMask (GLuint mask)
-{
-    fprintf (logFp, "glStencilMask (0x%x)\n", mask);
-    (*nativeRenderTable->StencilMask) (mask);
-}
-
-static void
-logStencilOp (GLenum fail,
-	      GLenum zfail,
-	      GLenum zpass)
-{
-    fprintf (logFp, "glStencilOp (0x%x, 0x%x, 0x%x)\n", fail, zfail, zpass);
-    (*nativeRenderTable->StencilOp) (fail, zfail, zpass);
-}
-
-static void
-logTexCoord1dv (const GLdouble *v)
-{
-    vCnt[texCoord1dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord1dv (%p)\n", v);
-    (*nativeRenderTable->TexCoord1dv) (v);
-}
-
-static void
-logTexCoord1fv (const GLfloat *v)
-{
-    vCnt[texCoord1fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord1fv (%p)\n", v);
-    (*nativeRenderTable->TexCoord1fv) (v);
-}
-
-static void
-logTexCoord1iv (const GLint *v)
-{
-    vCnt[texCoord1ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord1iv (%p)\n", v);
-    (*nativeRenderTable->TexCoord1iv) (v);
-}
-
-static void
-logTexCoord1sv (const GLshort *v)
-{
-    vCnt[texCoord1svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord1sv (%p)\n", v);
-    (*nativeRenderTable->TexCoord1sv) (v);
-}
-
-static void
-logTexCoord2dv (const GLdouble *v)
-{
-    vCnt[texCoord2dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord2dv (%p)\n", v);
-    (*nativeRenderTable->TexCoord2dv) (v);
-}
-
-static void
-logTexCoord2fv (const GLfloat *v)
-{
-    vCnt[texCoord2fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord2fv (%p)\n", v);
-    (*nativeRenderTable->TexCoord2fv) (v);
-}
-
-static void
-logTexCoord2iv (const GLint *v)
-{
-    vCnt[texCoord2ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord2iv (%p)\n", v);
-    (*nativeRenderTable->TexCoord2iv) (v);
-}
-
-static void
-logTexCoord2sv (const GLshort *v)
-{
-    vCnt[texCoord2svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord2sv (%p)\n", v);
-    (*nativeRenderTable->TexCoord2sv) (v);
-}
-
-
-static void
-logTexCoord3dv (const GLdouble *v)
-{
-    vCnt[texCoord3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord3dv (%p)\n", v);
-    (*nativeRenderTable->TexCoord3dv) (v);
-}
-
-static void
-logTexCoord3fv (const GLfloat *v)
-{
-    vCnt[texCoord3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord3fv (%p)\n", v);
-    (*nativeRenderTable->TexCoord3fv) (v);
-}
-
-static void
-logTexCoord3iv (const GLint *v)
-{
-    vCnt[texCoord3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord3iv (%p)\n", v);
-    (*nativeRenderTable->TexCoord3iv) (v);
-}
-
-static void
-logTexCoord3sv (const GLshort *v)
-{
-    vCnt[texCoord3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord3sv (%p)\n", v);
-    (*nativeRenderTable->TexCoord3sv) (v);
-}
-
-static void
-logTexCoord4dv (const GLdouble *v)
-{
-    vCnt[texCoord4dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord4dv (%p)\n", v);
-    (*nativeRenderTable->TexCoord4dv) (v);
-}
-
-static void
-logTexCoord4fv (const GLfloat *v)
-{
-    vCnt[texCoord4fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord4fv (%p)\n", v);
-    (*nativeRenderTable->TexCoord4fv) (v);
-}
-
-static void
-logTexCoord4iv (const GLint *v)
-{
-    vCnt[texCoord4ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord4iv (%p)\n", v);
-    (*nativeRenderTable->TexCoord4iv) (v);
-}
-
-static void
-logTexCoord4sv (const GLshort *v)
-{
-    vCnt[texCoord4svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glTexCoord4sv (%p)\n", v);
-    (*nativeRenderTable->TexCoord4sv) (v);
-}
-
-static void
-logTexCoordPointer (GLint      size,
-		    GLenum     type,
-		    GLsizei    stride,
-		    const void *pointer)
-{
-    fprintf (logFp, "glTexCoordPointer (%d, 0x%x, %d, %p)\n",
-	     size, type, stride, pointer);
-    (*nativeRenderTable->TexCoordPointer) (size, type, stride, pointer);
-}
-
-static void
-logTexEnvf (GLenum  target,
-	    GLenum  pname,
-	    GLfloat param)
-{
-    fprintf (logFp, "glTexEnvf (0x%x, 0x%x, %f)\n", target, pname, param);
-    (*nativeRenderTable->TexEnvf) (target, pname, param);
-}
-
-static void
-logTexEnvfv (GLenum	   target,
-	     GLenum	   pname,
-	     const GLfloat *params)
-{
-    fprintf (logFp, "glTexEnvfv (0x%x, 0x%x, %p)\n", target, pname, params);
-    (*nativeRenderTable->TexEnvfv) (target, pname, params);
-}
-
-static void
-logTexEnvi (GLenum target,
-	    GLenum pname,
-	    GLint  param)
-{
-    fprintf (logFp, "glTexEnvi (0x%x, 0x%x, %d)\n", target, pname, param);
-    (*nativeRenderTable->TexEnvi) (target, pname, param);
-}
-
-static void
-logTexEnviv (GLenum	 target,
-	     GLenum	 pname,
-	     const GLint *params)
-{
-    fprintf (logFp, "glTexEnviv (0x%x, 0x%x, %p)\n", target, pname, params);
-    (*nativeRenderTable->TexEnviv) (target, pname, params);
-}
-
-static void
-logTexGend (GLenum   coord,
-	    GLenum   pname,
-	    GLdouble param)
-{
-    fprintf (logFp, "glTexGend (0x%x, 0x%x, %f)\n", coord, pname, param);
-    (*nativeRenderTable->TexGend) (coord, pname, param);
-}
-
-static void
-logTexGendv (GLenum	    coord,
-	     GLenum	    pname,
-	     const GLdouble *params)
-{
-    fprintf (logFp, "glTexGendv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->TexGendv) (coord, pname, params);
-}
-
-static void
-logTexGenf (GLenum  coord,
-	    GLenum  pname,
-	    GLfloat param)
-{
-    fprintf (logFp, "glTexGenf (0x%x, 0x%x, %f)\n", coord, pname, param);
-    (*nativeRenderTable->TexGenf) (coord, pname, param);
-}
-
-static void
-logTexGenfv (GLenum	   coord,
-	     GLenum	   pname,
-	     const GLfloat *params)
-{
-    fprintf (logFp, "glTexGenfv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->TexGenfv) (coord, pname, params);
-}
-
-static void
-logTexGeni (GLenum coord,
-	    GLenum pname,
-	    GLint  param)
-{
-    fprintf (logFp, "glTexGeni (0x%x, 0x%x, %d)\n", coord, pname, param);
-    (*nativeRenderTable->TexGeni) (coord, pname, param);
-}
-
-static void
-logTexGeniv (GLenum	 coord,
-	     GLenum	 pname,
-	     const GLint *params)
-{
-    fprintf (logFp, "glTexGeniv (0x%x, 0x%x, %p)\n", coord, pname, params);
-    (*nativeRenderTable->TexGeniv) (coord, pname, params);
-}
-
-static void
-logTexImage1D (GLenum	  target,
-	       GLint	  level,
-	       GLint	  internalformat,
-	       GLsizei	  width,
-	       GLint	  border,
-	       GLenum	  format,
-	       GLenum	  type,
-	       const void *pixels)
-{
-    fprintf (logFp, "glTexImage1D (0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p)\n",
-	     target, level, internalformat, width, border, format, type,
-	     pixels);
-    (*nativeRenderTable->TexImage1D) (target, level, internalformat,
-				      width, border, format, type,
-				      pixels);
-}
-
-static void
-logTexImage2D (GLenum     target,
-	       GLint	  level,
-	       GLint	  internalformat,
-	       GLsizei	  width,
-	       GLsizei	  height,
-	       GLint	  border,
-	       GLenum	  format,
-	       GLenum	  type,
-	       const void *pixels)
-{
-    fprintf (logFp, "glTexImage2D (0x%x, %d, %d, %d, %d, %d, "
-	     "0x%x, 0x%x, %p)\n", target, level, internalformat,
-	     width, height, border, format, type, pixels);
-    (*nativeRenderTable->TexImage2D) (target, level, internalformat,
-				      width, height, border, format, type,
-				      pixels);
-}
-
-static void
-logTexParameterf (GLenum  target,
-		  GLenum  pname,
-		  GLfloat param)
-{
-    fprintf (logFp, "glTexParameterf (0x%x, 0x%x, %f)\n",
-	     target, pname, param);
-    (*nativeRenderTable->TexParameterf) (target, pname, param);
-}
-
-static void
-logTexParameterfv (GLenum	 target,
-		   GLenum	 pname,
-		   const GLfloat *params)
-{
-    fprintf (logFp, "glTexParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->TexParameterfv) (target, pname, params);
-}
-
-static void
-logTexParameteri (GLenum target,
-		  GLenum pname,
-		  GLint  param)
-{
-    fprintf (logFp, "glTexParameteri (0x%x, 0x%x, 0x%x)\n",
-	     target, pname, param);
-    (*nativeRenderTable->TexParameteri) (target, pname, param);
-}
-
-static void
-logTexParameteriv (GLenum      target,
-		   GLenum      pname,
-		   const GLint *params)
-{
-    fprintf (logFp, "glTexParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->TexParameteriv) (target, pname, params);
-}
-
-static void
-logTexSubImage1D (GLenum     target,
-		  GLint	     level,
-		  GLint	     xoffset,
-		  GLsizei    width,
-		  GLenum     format,
-		  GLenum     type,
-		  const void *pixels)
-{
-    fprintf (logFp, "glTexSubImage1D (0x%x, %d, %d, %d, 0x%x, 0x%x, %p)\n",
-	     target, level, xoffset, width, format, type, pixels);
-    (*nativeRenderTable->TexSubImage1D) (target, level, xoffset, width,
-					 format, type, pixels);
-}
-
-static void
-logTexSubImage2D (GLenum     target,
-		  GLint	     level,
-		  GLint	     xoffset,
-		  GLint	     yoffset,
-		  GLsizei    width,
-		  GLsizei    height,
-		  GLenum     format,
-		  GLenum     type,
-		  const void *pixels)
-{
-    fprintf (logFp, "glTexSubImage2D (0x%x, %d, %d, %d, %d, %d, "
-	     "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset,
-	     width, height, format, type, pixels);
-    (*nativeRenderTable->TexSubImage2D) (target, level, xoffset, yoffset,
-					 width, height, format, type,
-					 pixels);
-}
-
-static void
-logTranslated (GLdouble x,
-	       GLdouble y,
-	       GLdouble z)
-{
-    fprintf (logFp, "glTranslated (%f, %f, %f)\n", x, y, z);
-    (*nativeRenderTable->Translated) (x, y, z);
-}
-
-static void
-logTranslatef (GLfloat x,
-	       GLfloat y,
-	       GLfloat z)
-{
-    fprintf (logFp, "glTranslatef (%f, %f, %f)\n", x, y, z);
-    (*nativeRenderTable->Translatef) (x, y, z);
-}
-
-static void
-logVertex2dv (const GLdouble *v)
-{
-    vCnt[vertex2dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex2dv (%p)\n", v);
-    (*nativeRenderTable->Vertex2dv) (v);
-}
-
-static void
-logVertex2fv (const GLfloat *v)
-{
-    vCnt[vertex2fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex2dv (%p)\n", v);
-    (*nativeRenderTable->Vertex2fv) (v);
-}
-
-static void
-logVertex2iv (const GLint *v)
-{
-    vCnt[vertex2ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex2iv (%p)\n", v);
-    (*nativeRenderTable->Vertex2iv) (v);
-}
-
-static void
-logVertex2sv (const GLshort *v)
-{
-    vCnt[vertex2svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex2sv (%p)\n", v);
-    (*nativeRenderTable->Vertex2sv) (v);
-}
-
-static void
-logVertex3dv (const GLdouble *v)
-{
-    vCnt[vertex3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex3dv (%p)\n", v);
-    (*nativeRenderTable->Vertex3dv) (v);
-}
-
-static void
-logVertex3fv (const GLfloat *v)
-{
-    vCnt[vertex3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex3fv (%p)\n", v);
-    (*nativeRenderTable->Vertex3fv) (v);
-}
-
-static void
-logVertex3iv (const GLint *v)
-{
-    vCnt[vertex3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex3iv (%p)\n", v);
-    (*nativeRenderTable->Vertex3iv) (v);
-}
-
-static void
-logVertex3sv (const GLshort *v)
-{
-    vCnt[vertex3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex3sv (%p)\n", v);
-    (*nativeRenderTable->Vertex3sv) (v);
-}
-
-static void
-logVertex4dv (const GLdouble *v)
-{
-    vCnt[vertex4dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex4dv (%p)\n", v);
-    (*nativeRenderTable->Vertex4dv) (v);
-}
-
-static void
-logVertex4fv (const GLfloat *v)
-{
-    vCnt[vertex4fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex4fv (%p)\n", v);
-    (*nativeRenderTable->Vertex4fv) (v);
-}
-
-static void
-logVertex4iv (const GLint *v)
-{
-    vCnt[vertex4ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex4iv (%p)\n", v);
-    (*nativeRenderTable->Vertex4iv) (v);
-}
-
-static void
-logVertex4sv (const GLshort *v)
-{
-    vCnt[vertex4svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glVertex4sv (%p)\n", v);
-    (*nativeRenderTable->Vertex4sv) (v);
-}
-
-static void
-logVertexPointer (GLint	     size,
-		  GLenum     type,
-		  GLsizei    stride,
-		  const void *pointer)
-{
-    fprintf (logFp, "glVertexPointer (%d, 0x%x, %d, %p)\n",
-	     size, type, stride, pointer);
-    (*nativeRenderTable->VertexPointer) (size, type, stride, pointer);
-}
-
-static void
-logViewport (GLint   x,
-	     GLint   y,
-	     GLsizei width,
-	     GLsizei height)
-{
-    fprintf (logFp, "glViewport (%d %d %d %d)\n", x, y, width, height);
-    (*nativeRenderTable->Viewport) (x, y, width, height);
-}
-
-static void
-logBlendColor (GLclampf red,
-	       GLclampf green,
-	       GLclampf blue,
-	       GLclampf alpha)
-{
-    fprintf (logFp, "glBlendColor (%f, %f, %f, %f)\n",
-	     red, green, blue, alpha);
-    (*nativeRenderTable->BlendColor) (red, green, blue, alpha);
-}
-
-static void
-logBlendEquation (GLenum mode)
-{
-    fprintf (logFp, "glBlendEquation (0x%x)\n", mode);
-    (*nativeRenderTable->BlendEquation) (mode);
-}
-
-static void
-logColorTable (GLenum       target,
-	       GLenum       internalformat,
-	       GLsizei      width,
-	       GLenum       format,
-	       GLenum	    type,
-	       const GLvoid *table)
-{
-    fprintf (logFp, "glColorTable (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
-	     target, internalformat, width, format, type, table);
-    (*nativeRenderTable->ColorTable) (target, internalformat, width,
-				      format, type, table);
-}
-
-static void
-logColorTableParameterfv (GLenum	target,
-			  GLenum	pname,
-			  const GLfloat *params)
-{
-    fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->ColorTableParameterfv) (target, pname, params);
-}
-
-static void
-logColorTableParameteriv (GLenum      target,
-			  GLenum      pname,
-			  const GLint *params)
-{
-    fprintf (logFp, "glColorTableParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->ColorTableParameteriv) (target, pname, params);
-}
-
-static void
-logCopyColorTable (GLenum  target,
-		   GLenum  internalformat,
-		   GLint   x,
-		   GLint   y,
-		   GLsizei width)
-{
-    fprintf (logFp, "glCopyColorTable (0x%x, 0x%x, %d, %d, %d)\n",
-	     target, internalformat, x, y, width);
-    (*nativeRenderTable->CopyColorTable) (target, internalformat,
-					  x, y, width);
-}
-
-static void
-logGetColorTable (GLenum target,
-		  GLenum format,
-		  GLenum type,
-		  GLvoid *table)
-{
-    fprintf (logFp, "glGetColorTable (0x%x, 0x%x, 0x%x, %p)\n",
-	     target, format, type, table);
-    (*nativeRenderTable->GetColorTable) (target, format, type, table);
-}
-
-static void
-logGetColorTableParameterfv (GLenum  target,
-			     GLenum  pname,
-			     GLfloat *params)
-{
-    fprintf (logFp, "glGetColorTableParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetColorTableParameterfv) (target, pname, params);
-}
-
-static void
-logGetColorTableParameteriv (GLenum target,
-			     GLenum pname,
-			     GLint  *params)
-{
-    fprintf (logFp, "glGetColorTableParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetColorTableParameteriv) (target, pname, params);
-}
-
-static void
-logColorSubTable (GLenum       target,
-		  GLsizei      start,
-		  GLsizei      count,
-		  GLenum       format,
-		  GLenum       type,
-		  const GLvoid *data)
-{
-    fprintf (logFp, "glColorSubTable (0x%x, %d, %d, 0x%x, 0x%x, %p)\n",
-	     target, start, count, format, type, data);
-    (*nativeRenderTable->ColorSubTable) (target, start, count,
-					 format, type, data);
-}
-
-static void
-logCopyColorSubTable (GLenum  target,
-		      GLsizei start,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width)
-{
-    fprintf (logFp, "glCopyColorSubTable (0x%x, %d, %d, %d, %d)\n",
-	     target, start, x, y, width);
-    (*nativeRenderTable->CopyColorSubTable) (target, start, x, y, width);
-}
-
-static void
-logConvolutionFilter1D (GLenum	     target,
-			GLenum	     internalformat,
-			GLsizei	     width,
-			GLenum	     format,
-			GLenum	     type,
-			const GLvoid *image)
-{
-    fprintf (logFp, "glConvolutionFilter1D (0x%x, 0x%x, %d, 0x%x, 0x%x, %p)\n",
-	     target, internalformat, width, format, type, image);
-    (*nativeRenderTable->ConvolutionFilter1D) (target, internalformat,
-					       width, format, type, image);
-}
-
-static void
-logConvolutionFilter2D (GLenum	     target,
-			GLenum	     internalformat,
-			GLsizei	     width,
-			GLsizei	     height,
-			GLenum	     format,
-			GLenum	     type,
-			const GLvoid *image)
-{
-    fprintf (logFp, "glConvolutionFilter2D (0x%x, 0x%x, %d, %d, "
-	     "0x%x, 0x%x, %p)\n", target, internalformat, width, height,
-	     format, type, image);
-    (*nativeRenderTable->ConvolutionFilter2D) (target, internalformat,
-					       width, height, format,
-					       type, image);
-}
-
-static void
-logConvolutionParameterf (GLenum  target,
-			  GLenum  pname,
-			  GLfloat param)
-{
-    fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %f)\n",
-	     target, pname, param);
-    (*nativeRenderTable->ConvolutionParameterf) (target, pname, param);
-}
-
-static void
-logConvolutionParameterfv (GLenum	 target,
-			   GLenum	 pname,
-			   const GLfloat *params)
-{
-    fprintf (logFp, "glConvolutionParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->ConvolutionParameterfv) (target, pname, params);
-}
-
-static void
-logConvolutionParameteri (GLenum target,
-			  GLenum pname,
-			  GLint  param)
-{
-    fprintf (logFp, "glConvolutionParameterf (0x%x, 0x%x, %d)\n",
-	     target, pname, param);
-    (*nativeRenderTable->ConvolutionParameteri) (target, pname, param);
-}
-
-static void
-logConvolutionParameteriv (GLenum      target,
-			   GLenum      pname,
-			   const GLint *params)
-{
-    fprintf (logFp, "glConvolutionParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->ConvolutionParameteriv) (target, pname, params);
-}
-
-static void
-logCopyConvolutionFilter1D (GLenum  target,
-			    GLenum  internalformat,
-			    GLint   x,
-			    GLint   y,
-			    GLsizei width)
-{
-    fprintf (logFp, "glCopyConvolutionFilter1D (0x%x, 0x%x, %d, %d, %d)\n",
-	     target, internalformat, x, y, width);
-    (*nativeRenderTable->CopyConvolutionFilter1D) (target, internalformat,
-						   x, y, width);
-}
-
-static void
-logCopyConvolutionFilter2D (GLenum  target,
-			    GLenum  internalformat,
-			    GLint   x,
-			    GLint   y,
-			    GLsizei width,
-			    GLsizei height)
-{
-    fprintf (logFp, "glCopyConvolutionFilter2D (0x%x, 0x%x, %d, %d, %d, %d)\n",
-	     target, internalformat, x, y, width, height);
-    (*nativeRenderTable->CopyConvolutionFilter2D) (target, internalformat,
-						   x, y, width, height);
-}
-
-static void
-logGetConvolutionFilter (GLenum target,
-			 GLenum format,
-			 GLenum type,
-			 GLvoid *image)
-{
-    fprintf (logFp, "glGetConvolutionFilter (0x%x, 0x%x, 0x%x, %p)\n",
-	     target, format, type, image);
-    (*nativeRenderTable->GetConvolutionFilter) (target, format, type,
-						image);
-}
-
-static void
-logGetConvolutionParameterfv (GLenum  target,
-			      GLenum  pname,
-			      GLfloat *params)
-{
-    fprintf (logFp, "glGetConvolutionParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetConvolutionParameterfv) (target, pname,
-						     params);
-}
-
-static void
-logGetConvolutionParameteriv (GLenum target,
-			      GLenum pname,
-			      GLint  *params)
-{
-    fprintf (logFp, "glGetConvolutionParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetConvolutionParameteriv) (target, pname,
-						     params);
-}
-
-static void
-logGetSeparableFilter (GLenum target,
-		       GLenum format,
-		       GLenum type,
-		       GLvoid *row,
-		       GLvoid *column,
-		       GLvoid *span)
-{
-    fprintf (logFp, "glGetSeparableFilter (0x%x, 0x%x, 0x%x, %p, %p, %p)\n",
-	     target, format, type, row, column, span);
-    (*nativeRenderTable->GetSeparableFilter) (target, format, type,
-					      row, column, span);
-}
-
-static void
-logSeparableFilter2D (GLenum	   target,
-		      GLenum	   internalformat,
-		      GLsizei	   width,
-		      GLsizei	   height,
-		      GLenum	   format,
-		      GLenum	   type,
-		      const GLvoid *row,
-		      const GLvoid *column)
-{
-    fprintf (logFp, "glSeparableFilter2D (0x%x, 0x%x, %d, %d, "
-	     "0x%x, 0x%x, %p, %p)\n", target, internalformat, width, height,
-	     format, type, row, column);
-    (*nativeRenderTable->SeparableFilter2D) (target, internalformat,
-					     width, height, format,
-					     type, row, column);
-}
-
-static void
-logGetHistogram (GLenum	   target,
-		 GLboolean reset,
-		 GLenum	   format,
-		 GLenum	   type,
-		 GLvoid	   *values)
-{
-    fprintf (logFp, "glGetHistogram (0x%x, %d, 0x%x, 0x%x, %p)\n",
-	     target, reset, format, type, values);
-    (*nativeRenderTable->GetHistogram) (target, reset, format, type,
-					values);
-}
-
-static void
-logGetHistogramParameterfv (GLenum  target,
-			    GLenum  pname,
-			    GLfloat *params)
-{
-    fprintf (logFp, "glGetHistogramParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetHistogramParameterfv) (target, pname, params);
-}
-
-static void
-logGetHistogramParameteriv (GLenum target,
-			    GLenum pname,
-			    GLint  *params)
-{
-    fprintf (logFp, "glGetHistogramParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetHistogramParameteriv) (target, pname, params);
-}
-
-static void
-logGetMinmax (GLenum	target,
-	      GLboolean reset,
-	      GLenum	format,
-	      GLenum	type,
-	      GLvoid	*values)
-{
-    fprintf (logFp, "glGetMinmax (0x%x, %d, 0x%x, 0x%x, %p)\n",
-	     target, reset, format, type, values);
-    (*nativeRenderTable->GetMinmax) (target, reset, format, type, values);
-}
-
-static void
-logGetMinmaxParameterfv (GLenum  target,
-			 GLenum  pname,
-			 GLfloat *params)
-{
-    fprintf (logFp, "GetMinmaxParameterfv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetMinmaxParameterfv) (target, pname, params);
-}
-
-static void
-logGetMinmaxParameteriv (GLenum target,
-			 GLenum pname,
-			 GLint  *params)
-{
-    fprintf (logFp, "GetMinmaxParameteriv (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetMinmaxParameteriv) (target, pname, params);
-}
-
-static void
-logHistogram (GLenum	target,
-	      GLsizei	width,
-	      GLenum	internalformat,
-	      GLboolean sink)
-{
-    fprintf (logFp, "glHistogram (0x%x, %d, 0x%x, %d)\n",
-	     target, width, internalformat, sink);
-    (*nativeRenderTable->Histogram) (target, width, internalformat, sink);
-}
-
-static void
-logMinmax (GLenum    target,
-	   GLenum    internalformat,
-	   GLboolean sink)
-{
-    fprintf (logFp, "glMinmax (0x%x, 0x%x, %d)\n",
-	     target, internalformat, sink);
-    (*nativeRenderTable->Minmax) (target, internalformat, sink);
-}
-
-static void
-logResetHistogram (GLenum target)
-{
-    fprintf (logFp, "glResetHistogram (0x%x)\n", target);
-    (*nativeRenderTable->ResetHistogram) (target);
-}
-
-static void
-logResetMinmax (GLenum target)
-{
-    fprintf (logFp, "glResetMinmax (0x%x)\n", target);
-    (*nativeRenderTable->ResetMinmax) (target);
-}
-
-static void
-logCopyTexSubImage3D (GLenum  target,
-		      GLint   level,
-		      GLint   xoffset,
-		      GLint   yoffset,
-		      GLint   zoffset,
-		      GLint   x,
-		      GLint   y,
-		      GLsizei width,
-		      GLsizei height)
-{
-    fprintf (logFp, "glCopyTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
-	     "%d, %d)\n", target, level, xoffset, yoffset, zoffset,
-	     x, y, width, height);
-    (*nativeRenderTable->CopyTexSubImage3D) (target, level,
-					     xoffset, yoffset, zoffset,
-					     x, y, width, height);
-}
-
-static void
-logTexImage3D (GLenum	    target,
-	       GLint	    level,
-	       GLint	    internalformat,
-	       GLsizei	    width,
-	       GLsizei	    height,
-	       GLsizei	    depth,
-	       GLint	    border,
-	       GLenum	    format,
-	       GLenum	    type,
-	       const GLvoid *pixels)
-{
-    fprintf (logFp, "glTexImage3D (0x%x, %d, %d, %d, %d, %d, %d, "
-	     "0x%x, 0x%x, %p)\n", target, level, internalformat,
-	     width, height, depth, border, format, type, pixels);
-    (*nativeRenderTable->TexImage3D) (target, level, internalformat,
-				      width, height, depth, border,
-				      format, type, pixels);
-}
-
-static void
-logTexSubImage3D (GLenum       target,
-		  GLint	       level,
-		  GLint	       xoffset,
-		  GLint	       yoffset,
-		  GLint	       zoffset,
-		  GLsizei      width,
-		  GLsizei      height,
-		  GLsizei      depth,
-		  GLenum       format,
-		  GLenum       type,
-		  const GLvoid *pixels)
-{
-    fprintf (logFp, "glTexSubImage3D (0x%x, %d, %d, %d, %d, %d, %d, %d, "
-	     "0x%x, 0x%x, %p)\n", target, level, xoffset, yoffset, zoffset,
-	     width, height, depth, format, type, pixels);
-    (*nativeRenderTable->TexSubImage3D) (target, level,
-					 xoffset, yoffset, zoffset,
-					 width, height, depth,
-					 format, type, pixels);
-}
-
-/* GL_ARB_multitexture */
-
-static void
-logActiveTextureARB (GLenum texture)
-{
-    fprintf (logFp, "glActiveTextureARB (0x%x)\n", texture);
-    (*nativeRenderTable->ActiveTextureARB) (texture);
-}
-
-static void
-logClientActiveTextureARB (GLenum texture)
-{
-    fprintf (logFp, "glClientActiveTextureARB (0x%x)\n", texture);
-    (*nativeRenderTable->ClientActiveTextureARB) (texture);
-}
-
-static void
-logMultiTexCoord1dvARB (GLenum	       target,
-			const GLdouble *v)
-{
-    vCnt[multiTexCoord1dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord1dvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord1dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord1fvARB (GLenum	      target,
-			const GLfloat *v)
-{
-    vCnt[multiTexCoord1fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord1fvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord1fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord1ivARB (GLenum	    target,
-			const GLint *v)
-{
-    vCnt[multiTexCoord1ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord1ivARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord1ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord1svARB (GLenum	      target,
-			const GLshort *v)
-{
-    vCnt[multiTexCoord1svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord1svARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord1svARB) (target, v);
-}
-
-static void
-logMultiTexCoord2dvARB (GLenum	       target,
-			const GLdouble *v)
-{
-    vCnt[multiTexCoord2dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord2dvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord2dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord2fvARB (GLenum	      target,
-			const GLfloat *v)
-{
-    vCnt[multiTexCoord2fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord2fvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord2fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord2ivARB (GLenum	    target,
-			const GLint *v)
-{
-    vCnt[multiTexCoord2ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord2ivARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord2ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord2svARB (GLenum	      target,
-			const GLshort *v)
-{
-    vCnt[multiTexCoord2svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord2svARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord2svARB) (target, v);
-}
-
-static void
-logMultiTexCoord3dvARB (GLenum	       target,
-			const GLdouble *v)
-{
-    vCnt[multiTexCoord3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord3dvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord3dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord3fvARB (GLenum	      target,
-			const GLfloat *v)
-{
-    vCnt[multiTexCoord3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord3fvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord3fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord3ivARB (GLenum	    target,
-			const GLint *v)
-{
-    vCnt[multiTexCoord3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord3ivARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord3ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord3svARB (GLenum	      target,
-			const GLshort *v)
-{
-    vCnt[multiTexCoord3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord3svARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord3svARB) (target, v);
-}
-
-static void
-logMultiTexCoord4dvARB (GLenum	       target,
-			const GLdouble *v)
-{
-    vCnt[multiTexCoord4dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord4dvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord4dvARB) (target, v);
-}
-
-static void
-logMultiTexCoord4fvARB (GLenum	      target,
-			const GLfloat *v)
-{
-    vCnt[multiTexCoord4fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord4fvARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord4fvARB) (target, v);
-}
-
-static void
-logMultiTexCoord4ivARB (GLenum	    target,
-			const GLint *v)
-{
-    vCnt[multiTexCoord4ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord4ivARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord4ivARB) (target, v);
-}
-
-static void
-logMultiTexCoord4svARB (GLenum	      target,
-			const GLshort *v)
-{
-    vCnt[multiTexCoord4svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glMultiTexCoord4svARB (0x%x, %p)\n", target, v);
-    (*nativeRenderTable->MultiTexCoord4svARB) (target, v);
-}
-
-
-/* GL_ARB_multisample */
-
-static void
-logSampleCoverageARB (GLclampf  value,
-		      GLboolean invert)
-{
-    fprintf (logFp, "glSampleCoverageARB (%f, %d)\n", value, invert);
-    (*nativeRenderTable->SampleCoverageARB) (value, invert);
-}
-
-
-/* GL_EXT_texture_object */
-
-static GLboolean
-logAreTexturesResidentEXT (GLsizei	n,
-			   const GLuint *textures,
-			   GLboolean	*residences)
-{
-    fprintf (logFp, "glAreTexturesResidentEXT (%d, %p, %p)\n",
-	     n, textures, residences);
-    return (*nativeRenderTable->AreTexturesResidentEXT) (n, textures,
-							 residences);
-}
-static void
-logGenTexturesEXT (GLsizei n,
-		   GLuint  *textures)
-{
-    fprintf (logFp, "glGenTexturesEXT (%d, %p)\n", n, textures);
-    (*nativeRenderTable->GenTexturesEXT) (n, textures);
-}
-
-static GLboolean
-logIsTextureEXT (GLuint texture)
-{
-    fprintf (logFp, "glIsTextureEXT (%d)\n", texture);
-    return (*nativeRenderTable->IsTextureEXT) (texture);
-}
-
-
-/* GL_SGIS_multisample */
-
-static void
-logSampleMaskSGIS (GLclampf  value,
-		   GLboolean invert)
-{
-    fprintf (logFp, "glSampleMaskSGIS (%f, %d)\n", value, invert);
-    (*nativeRenderTable->SampleMaskSGIS) (value, invert);
-}
-
-static void
-logSamplePatternSGIS (GLenum pattern)
-{
-    fprintf (logFp, "glSamplePatternSGIS (0x%x)\n", pattern);
-    (*nativeRenderTable->SamplePatternSGIS) (pattern);
-}
-
-
-/* GL_EXT_point_parameters */
-
-static void
-logPointParameterfEXT (GLenum  pname,
-		       GLfloat param)
-{
-    fprintf (logFp, "glPointParameterfEXT (0x%x, %f)\n", pname, param);
-    (*nativeRenderTable->PointParameterfEXT) (pname, param);
-}
-
-static void
-logPointParameterfvEXT (GLenum	      pname,
-			const GLfloat *params)
-{
-    fprintf (logFp, "glPointParameterfvEXT (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->PointParameterfvEXT) (pname, params);
-}
-
-
-/* GL_MESA_window_pos */
-
-static void
-logWindowPos3fMESA (GLfloat x,
-		    GLfloat y,
-		    GLfloat z)
-{
-    fprintf (logFp, "glWindowPos3fMESA (%f, %f, %f)\n", x, y, z);
-    (*nativeRenderTable->WindowPos3fMESA) (x, y, z);
-}
-
-
-/* GL_EXT_blend_func_separate */
-
-static void
-logBlendFuncSeparateEXT (GLenum sfactorRGB,
-			 GLenum dfactorRGB,
-			 GLenum sfactorAlpha,
-			 GLenum dfactorAlpha)
-{
-    fprintf (logFp, "glBlendFuncSeparateEXT (0x%x, 0x%x, 0x%x, 0x%x)\n",
-	     sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
-    (*nativeRenderTable->BlendFuncSeparateEXT) (sfactorRGB,
-						dfactorRGB,
-						sfactorAlpha,
-						dfactorAlpha);
-}
-
-
-/* GL_EXT_fog_coord */
-
-static void
-logFogCoordfvEXT (const GLfloat *coord)
-{
-    vCnt[fogCoordfvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glFogCoordfvEXT (%p)\n", coord);
-    (*nativeRenderTable->FogCoordfvEXT) (coord);
-}
-
-static void
-logFogCoorddvEXT (const GLdouble *coord)
-{
-    vCnt[fogCoorddvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glFogCoorddvEXT (%p)\n", coord);
-    (*nativeRenderTable->FogCoorddvEXT) (coord);
-}
-
-static void
-logFogCoordPointerEXT (GLenum	    type,
-		       GLsizei	    stride,
-		       const GLvoid *pointer)
-{
-    fprintf (logFp, "glFogCoordPointerEXT (0x%x, %d, %p)\n",
-	     type, stride, pointer);
-    (*nativeRenderTable->FogCoordPointerEXT) (type, stride, pointer);
-}
-
-
-/* GL_EXT_secondary_color */
-
-static void
-logSecondaryColor3bvEXT (const GLbyte *v)
-{
-    vCnt[secondaryColor3bvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3bvEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3bvEXT) (v);
-}
-
-static void
-logSecondaryColor3dvEXT (const GLdouble *v)
-{
-    vCnt[secondaryColor3dvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3dvEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3dvEXT) (v);
-}
-
-static void
-logSecondaryColor3fvEXT (const GLfloat *v)
-{
-    vCnt[secondaryColor3fvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3fvEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3fvEXT) (v);
-}
-
-static void
-logSecondaryColor3ivEXT (const GLint *v)
-{
-    vCnt[secondaryColor3ivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3ivEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3ivEXT) (v);
-}
-
-static void
-logSecondaryColor3svEXT (const GLshort *v)
-{
-    vCnt[secondaryColor3svIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3svEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3svEXT) (v);
-}
-
-static void
-logSecondaryColor3ubvEXT (const GLubyte *v)
-{
-    vCnt[secondaryColor3ubvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3ubvEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3ubvEXT) (v);
-}
-
-static void
-logSecondaryColor3uivEXT (const GLuint *v)
-{
-    vCnt[secondaryColor3uivIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3uivEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3uivEXT) (v);
-}
-
-static void
-logSecondaryColor3usvEXT (const GLushort *v)
-{
-    vCnt[secondaryColor3usvIndex].n++;
-    if (logVertexAttribs)
-	fprintf (logFp, "glSecondaryColor3usvEXT (%p)\n", v);
-    (*nativeRenderTable->SecondaryColor3usvEXT) (v);
-}
-
-static void
-logSecondaryColorPointerEXT (GLint	  size,
-			     GLenum	  type,
-			     GLsizei	  stride,
-			     const GLvoid *pointer)
-{
-    fprintf (logFp, "glSecondaryColorPointerEXT (%d, 0x%x, %d, %p)\n",
-	     size, type, stride, pointer);
-    (*nativeRenderTable->SecondaryColorPointerEXT) (size, type,
-						    stride, pointer);
-}
-
-
-/* GL_NV_point_sprite */
-
-static void
-logPointParameteriNV (GLenum pname,
-		      GLint  param)
-{
-    fprintf (logFp, "glPointParameteriNV (0x%x, %d)\n", pname, param);
-    (*nativeRenderTable->PointParameteriNV) (pname, param);
-}
-
-static void
-logPointParameterivNV (GLenum	   pname,
-		       const GLint *params)
-{
-    fprintf (logFp, "glPointParameterivNV (0x%x, %p)\n", pname, params);
-    (*nativeRenderTable->PointParameterivNV) (pname, params);
-}
-
-
-/* GL_EXT_stencil_two_side */
-
-static void
-logActiveStencilFaceEXT (GLenum face)
-{
-    fprintf (logFp, "glActiveStencilFaceEXT (0x%x)\n", face);
-    (*nativeRenderTable->ActiveStencilFaceEXT) (face);
-}
-
-
-/* GL_EXT_framebuffer_object */
-
-static GLboolean
-logIsRenderbufferEXT (GLuint renderbuffer)
-{
-    fprintf (logFp, "glIsRenderbufferEXT (%d)\n", renderbuffer);
-    return (*nativeRenderTable->IsRenderbufferEXT) (renderbuffer);
-}
-
-static void
-logBindRenderbufferEXT (GLenum target,
-			GLuint renderbuffer)
-{
-    fprintf (logFp, "glBindRenderbufferEXT (0x%x, %d)\n",
-	     target, renderbuffer);
-    (*nativeRenderTable->BindRenderbufferEXT) (target, renderbuffer);
-}
-
-static void
-logDeleteRenderbuffersEXT (GLsizei	n,
-			   const GLuint *renderbuffers)
-{
-    fprintf (logFp, "glDeleteRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
-    (*nativeRenderTable->DeleteRenderbuffersEXT) (n, renderbuffers);
-}
-
-static void
-logGenRenderbuffersEXT (GLsizei n,
-			GLuint  *renderbuffers)
-{
-    fprintf (logFp, "glGenRenderbuffersEXT (%d, %p)\n", n, renderbuffers);
-    (*nativeRenderTable->GenRenderbuffersEXT) (n, renderbuffers);
-}
-
-static void
-logRenderbufferStorageEXT (GLenum  target,
-			   GLenum  internalformat,
-			   GLsizei width,
-			   GLsizei height)
-{
-    fprintf (logFp, "glRenderbufferStorageEXT (0x%x, 0x%x, %d, %d)\n",
-	     target, internalformat, width, height);
-    (*nativeRenderTable->RenderbufferStorageEXT) (target,
-						  internalformat,
-						  width, height);
-}
-
-static void
-logGetRenderbufferParameterivEXT (GLenum target,
-				  GLenum pname,
-				  GLint  *params)
-{
-    fprintf (logFp, "glGetRenderbufferParameterivEXT (0x%x, 0x%x, %p)\n",
-	     target, pname, params);
-    (*nativeRenderTable->GetRenderbufferParameterivEXT) (target,
-							 pname,
-							 params);
-}
-
-static GLboolean
-logIsFramebufferEXT (GLuint framebuffer)
-{
-    fprintf (logFp, "glIsFramebufferEXT (%d)\n", framebuffer);
-    return (*nativeRenderTable->IsFramebufferEXT) (framebuffer);
-}
-
-static void
-logBindFramebufferEXT (GLenum target,
-		       GLuint framebuffer)
-{
-    fprintf (logFp, "glBindFramebufferEXT (0x%x, %d)\n", target, framebuffer);
-    (*nativeRenderTable->BindFramebufferEXT) (target, framebuffer);
-}
-
-static void
-logDeleteFramebuffersEXT (GLsizei      n,
-			  const GLuint *framebuffers)
-{
-    fprintf (logFp, "glDeleteFramebuffersEXT (%d, %p)\n", n, framebuffers);
-    (*nativeRenderTable->DeleteFramebuffersEXT) (n, framebuffers);
-}
-
-static void
-logGenFramebuffersEXT (GLsizei n,
-		       GLuint  *framebuffers)
-{
-    fprintf (logFp, "glGenFramebuffersEXT (%d, %p)\n", n, framebuffers);
-    (*nativeRenderTable->GenFramebuffersEXT) (n, framebuffers);
-}
-
-static GLenum
-logCheckFramebufferStatusEXT (GLenum target)
-{
-    fprintf (logFp, "glCheckFramebufferStatusEXT (0x%x)\n", target);
-    return (*nativeRenderTable->CheckFramebufferStatusEXT) (target);
-}
-
-static void
-logFramebufferTexture1DEXT (GLenum target,
-			    GLenum attachment,
-			    GLenum textarget,
-			    GLuint texture,
-			    GLint  level)
-{
-    fprintf (logFp, "glFramebufferTexture1DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
-	     target, attachment, textarget, texture, level);
-    (*nativeRenderTable->FramebufferTexture1DEXT) (target, attachment,
-						   textarget, texture,
-						   level);
-}
-
-static void
-logFramebufferTexture2DEXT (GLenum target,
-			    GLenum attachment,
-			    GLenum textarget,
-			    GLuint texture,
-			    GLint  level)
-{
-    fprintf (logFp, "glFramebufferTexture2DEXT (0x%x, 0x%x, 0x%x, %d, %d)\n",
-	     target, attachment, textarget, texture, level);
-    (*nativeRenderTable->FramebufferTexture2DEXT) (target, attachment,
-						   textarget, texture,
-						   level);
-}
-
-static void
-logFramebufferTexture3DEXT (GLenum target,
-			    GLenum attachment,
-			    GLenum textarget,
-			    GLuint texture,
-			    GLint  level,
-			    GLint  zoffset)
-{
-    fprintf (logFp, "glFramebufferTexture3DEXT (0x%x, 0x%x, 0x%x, "
-	     "%d, %d, %d)\n", target, attachment, textarget, texture,
-	     level, zoffset);
-    (*nativeRenderTable->FramebufferTexture3DEXT) (target, attachment,
-						   textarget, texture,
-						   level, zoffset);
-}
-
-static void
-logFramebufferRenderbufferEXT (GLenum target,
-			       GLenum attachment,
-			       GLenum buffertarget,
-			       GLuint renderbuffer)
-{
-    fprintf (logFp, "glFramebufferRenderbufferEXT (0x%x, 0x%x, 0x%x, %d)\n",
-	     target, attachment, buffertarget, renderbuffer);
-    (*nativeRenderTable->FramebufferRenderbufferEXT) (target,
-						      attachment,
-						      buffertarget,
-						      renderbuffer);
-}
-
-static void
-logGetFramebufferAttachmentParameterivEXT (GLenum target,
-					   GLenum attach,
-					   GLenum pname,
-					   GLint  *params)
-{
-    fprintf (logFp, "glGetFramebufferAttachmentParameterivEXT (0x%x, "
-	     "0x%x, 0x%x, %p)\n", target, attach, pname, params);
-    (*nativeRenderTable->GetFramebufferAttachmentParameterivEXT) (target,
-								  attach,
-								  pname,
-								  params);
-}
-
-static void
-logGenerateMipmapEXT (GLenum target)
-{
-    fprintf (logFp, "glGenerateMipmapEXT (0x%x)\n", target);
-    (*nativeRenderTable->GenerateMipmapEXT) (target);
-}
-
-static struct _glapi_table __logRenderTable = {
-    logNewList,
-    logEndList,
-    logCallList,
-    logCallLists,
-    logDeleteLists,
-    logGenLists,
-    logListBase,
-    logBegin,
-    logBitmap,
-    0, /* glColor3b */
-    logColor3bv,
-    0, /* glColor3d */
-    logColor3dv,
-    0, /* glColor3f */
-    logColor3fv,
-    0, /* glColor3i */
-    logColor3iv,
-    0, /* glColor3s */
-    logColor3sv,
-    0, /* glColor3ub */
-    logColor3ubv,
-    0, /* glColor3ui */
-    logColor3uiv,
-    0, /* glColor3us */
-    logColor3usv,
-    0, /* glColor4b */
-    logColor4bv,
-    0, /* glColor4d */
-    logColor4dv,
-    0, /* glColor4f */
-    logColor4fv,
-    0, /* glColor4i */
-    logColor4iv,
-    0, /* glColor4s */
-    logColor4sv,
-    0, /* glColor4ub */
-    logColor4ubv,
-    0, /* glColor4ui */
-    logColor4uiv,
-    0, /* glColor4us */
-    logColor4usv,
-    0, /* glEdgeFlag */
-    logEdgeFlagv,
-    logEnd,
-    0, /* glIndexd */
-    logIndexdv,
-    0, /* glIndexf */
-    logIndexfv,
-    0, /* glIndexi */
-    logIndexiv,
-    0, /* glIndexs */
-    logIndexsv,
-    0, /* glNormal3b */
-    logNormal3bv,
-    0, /* glNormal3d */
-    logNormal3dv,
-    0, /* glNormal3f */
-    logNormal3fv,
-    0, /* glNormal3i */
-    logNormal3iv,
-    0, /* glNormal3s */
-    logNormal3sv,
-    0, /* glRasterPos2d */
-    logRasterPos2dv,
-    0, /* glRasterPos2f */
-    logRasterPos2fv,
-    0, /* glRasterPos2i */
-    logRasterPos2iv,
-    0, /* glRasterPos2s */
-    logRasterPos2sv,
-    0, /* glRasterPos3d */
-    logRasterPos3dv,
-    0, /* glRasterPos3f */
-    logRasterPos3fv,
-    0, /* glRasterPos3i */
-    logRasterPos3iv,
-    0, /* glRasterPos3s */
-    logRasterPos3sv,
-    0, /* glRasterPos4d */
-    logRasterPos4dv,
-    0, /* glRasterPos4f */
-    logRasterPos4fv,
-    0, /* glRasterPos4i */
-    logRasterPos4iv,
-    0, /* glRasterPos4s */
-    logRasterPos4sv,
-    0, /* glRectd */
-    logRectdv,
-    0, /* glRectf */
-    logRectfv,
-    0, /* glRecti */
-    logRectiv,
-    0, /* glRects */
-    logRectsv,
-    0, /* glTexCoord1d */
-    logTexCoord1dv,
-    0, /* glTexCoord1f */
-    logTexCoord1fv,
-    0, /* glTexCoord1i */
-    logTexCoord1iv,
-    0, /* glTexCoord1s */
-    logTexCoord1sv,
-    0, /* glTexCoord2d */
-    logTexCoord2dv,
-    0, /* glTexCoord2f */
-    logTexCoord2fv,
-    0, /* glTexCoord2i */
-    logTexCoord2iv,
-    0, /* glTexCoord2s */
-    logTexCoord2sv,
-    0, /* glTexCoord3d */
-    logTexCoord3dv,
-    0, /* glTexCoord3f */
-    logTexCoord3fv,
-    0, /* glTexCoord3i */
-    logTexCoord3iv,
-    0, /* glTexCoord3s */
-    logTexCoord3sv,
-    0, /* glTexCoord4d */
-    logTexCoord4dv,
-    0, /* glTexCoord4f */
-    logTexCoord4fv,
-    0, /* glTexCoord4i */
-    logTexCoord4iv,
-    0, /* glTexCoord4s */
-    logTexCoord4sv,
-    0, /* glVertex2d */
-    logVertex2dv,
-    0, /* glVertex2f */
-    logVertex2fv,
-    0, /* glVertex2i */
-    logVertex2iv,
-    0, /* glVertex2s */
-    logVertex2sv,
-    0, /* glVertex3d */
-    logVertex3dv,
-    0, /* glVertex3f */
-    logVertex3fv,
-    0, /* glVertex3i */
-    logVertex3iv,
-    0, /* glVertex3s */
-    logVertex3sv,
-    0, /* glVertex4d */
-    logVertex4dv,
-    0, /* glVertex4f */
-    logVertex4fv,
-    0, /* glVertex4i */
-    logVertex4iv,
-    0, /* glVertex4s */
-    logVertex4sv,
-    logClipPlane,
-    logColorMaterial,
-    logCullFace,
-    logFogf,
-    logFogfv,
-    logFogi,
-    logFogiv,
-    logFrontFace,
-    logHint,
-    logLightf,
-    logLightfv,
-    logLighti,
-    logLightiv,
-    logLightModelf,
-    logLightModelfv,
-    logLightModeli,
-    logLightModeliv,
-    logLineStipple,
-    logLineWidth,
-    logMaterialf,
-    logMaterialfv,
-    logMateriali,
-    logMaterialiv,
-    logPointSize,
-    logPolygonMode,
-    logPolygonStipple,
-    logScissor,
-    logShadeModel,
-    logTexParameterf,
-    logTexParameterfv,
-    logTexParameteri,
-    logTexParameteriv,
-    logTexImage1D,
-    logTexImage2D,
-    logTexEnvf,
-    logTexEnvfv,
-    logTexEnvi,
-    logTexEnviv,
-    logTexGend,
-    logTexGendv,
-    logTexGenf,
-    logTexGenfv,
-    logTexGeni,
-    logTexGeniv,
-    logFeedbackBuffer,
-    logSelectBuffer,
-    logRenderMode,
-    logInitNames,
-    logLoadName,
-    logPassThrough,
-    logPopName,
-    logPushName,
-    logDrawBuffer,
-    logClear,
-    logClearAccum,
-    logClearIndex,
-    logClearColor,
-    logClearStencil,
-    logClearDepth,
-    logStencilMask,
-    logColorMask,
-    logDepthMask,
-    logIndexMask,
-    logAccum,
-    logDisable,
-    logEnable,
-    logFinish,
-    logFlush,
-    logPopAttrib,
-    logPushAttrib,
-    logMap1d,
-    logMap1f,
-    logMap2d,
-    logMap2f,
-    logMapGrid1d,
-    logMapGrid1f,
-    logMapGrid2d,
-    logMapGrid2f,
-    0, /* glEvalCoord1d */
-    logEvalCoord1dv,
-    0, /* glEvalCoord1f */
-    logEvalCoord1fv,
-    0, /* glEvalCoord2d */
-    logEvalCoord2dv,
-    0, /* glEvalCoord2f */
-    logEvalCoord2fv,
-    logEvalMesh1,
-    logEvalPoint1,
-    logEvalMesh2,
-    logEvalPoint2,
-    logAlphaFunc,
-    logBlendFunc,
-    logLogicOp,
-    logStencilFunc,
-    logStencilOp,
-    logDepthFunc,
-    logPixelZoom,
-    logPixelTransferf,
-    logPixelTransferi,
-    logPixelStoref,
-    logPixelStorei,
-    logPixelMapfv,
-    logPixelMapuiv,
-    logPixelMapusv,
-    logReadBuffer,
-    logCopyPixels,
-    logReadPixels,
-    logDrawPixels,
-    logGetBooleanv,
-    logGetClipPlane,
-    logGetDoublev,
-    logGetError,
-    logGetFloatv,
-    logGetIntegerv,
-    logGetLightfv,
-    logGetLightiv,
-    logGetMapdv,
-    logGetMapfv,
-    logGetMapiv,
-    logGetMaterialfv,
-    logGetMaterialiv,
-    logGetPixelMapfv,
-    logGetPixelMapuiv,
-    logGetPixelMapusv,
-    logGetPolygonStipple,
-    logGetString,
-    logGetTexEnvfv,
-    logGetTexEnviv,
-    logGetTexGendv,
-    logGetTexGenfv,
-    logGetTexGeniv,
-    logGetTexImage,
-    logGetTexParameterfv,
-    logGetTexParameteriv,
-    logGetTexLevelParameterfv,
-    logGetTexLevelParameteriv,
-    logIsEnabled,
-    logIsList,
-    logDepthRange,
-    logFrustum,
-    logLoadIdentity,
-    logLoadMatrixf,
-    logLoadMatrixd,
-    logMatrixMode,
-    logMultMatrixf,
-    logMultMatrixd,
-    logOrtho,
-    logPopMatrix,
-    logPushMatrix,
-    logRotated,
-    logRotatef,
-    logScaled,
-    logScalef,
-    logTranslated,
-    logTranslatef,
-    logViewport,
-    logArrayElement,
-    logBindTexture,
-    logColorPointer,
-    logDisableClientState,
-    logDrawArrays,
-    logDrawElements,
-    logEdgeFlagPointer,
-    logEnableClientState,
-    logIndexPointer,
-    0, /* glIndexub */
-    logIndexubv,
-    logInterleavedArrays,
-    logNormalPointer,
-    logPolygonOffset,
-    logTexCoordPointer,
-    logVertexPointer,
-    logAreTexturesResident,
-    logCopyTexImage1D,
-    logCopyTexImage2D,
-    logCopyTexSubImage1D,
-    logCopyTexSubImage2D,
-    logDeleteTextures,
-    logGenTextures,
-    logGetPointerv,
-    logIsTexture,
-    logPrioritizeTextures,
-    logTexSubImage1D,
-    logTexSubImage2D,
-    logPopClientAttrib,
-    logPushClientAttrib,
-    logBlendColor,
-    logBlendEquation,
-    0, /* glDrawRangeElements */
-    logColorTable,
-    logColorTableParameterfv,
-    logColorTableParameteriv,
-    logCopyColorTable,
-    logGetColorTable,
-    logGetColorTableParameterfv,
-    logGetColorTableParameteriv,
-    logColorSubTable,
-    logCopyColorSubTable,
-    logConvolutionFilter1D,
-    logConvolutionFilter2D,
-    logConvolutionParameterf,
-    logConvolutionParameterfv,
-    logConvolutionParameteri,
-    logConvolutionParameteriv,
-    logCopyConvolutionFilter1D,
-    logCopyConvolutionFilter2D,
-    logGetConvolutionFilter,
-    logGetConvolutionParameterfv,
-    logGetConvolutionParameteriv,
-    logGetSeparableFilter,
-    logSeparableFilter2D,
-    logGetHistogram,
-    logGetHistogramParameterfv,
-    logGetHistogramParameteriv,
-    logGetMinmax,
-    logGetMinmaxParameterfv,
-    logGetMinmaxParameteriv,
-    logHistogram,
-    logMinmax,
-    logResetHistogram,
-    logResetMinmax,
-    logTexImage3D,
-    logTexSubImage3D,
-    logCopyTexSubImage3D,
-    logActiveTextureARB,
-    logClientActiveTextureARB,
-    0, /* glMultiTexCoord1dARB */
-    logMultiTexCoord1dvARB,
-    0, /* glMultiTexCoord1fARB */
-    logMultiTexCoord1fvARB,
-    0, /* glMultiTexCoord1iARB */
-    logMultiTexCoord1ivARB,
-    0, /* glMultiTexCoord1sARB */
-    logMultiTexCoord1svARB,
-    0, /* glMultiTexCoord2dARB */
-    logMultiTexCoord2dvARB,
-    0, /* glMultiTexCoord2fARB */
-    logMultiTexCoord2fvARB,
-    0, /* glMultiTexCoord2iARB */
-    logMultiTexCoord2ivARB,
-    0, /* glMultiTexCoord2sARB */
-    logMultiTexCoord2svARB,
-    0, /* glMultiTexCoord3dARB */
-    logMultiTexCoord3dvARB,
-    0, /* glMultiTexCoord3fARB */
-    logMultiTexCoord3fvARB,
-    0, /* glMultiTexCoord3iARB */
-    logMultiTexCoord3ivARB,
-    0, /* glMultiTexCoord3sARB */
-    logMultiTexCoord3svARB,
-    0, /* glMultiTexCoord4dARB */
-    logMultiTexCoord4dvARB,
-    0, /* glMultiTexCoord4fARB */
-    logMultiTexCoord4fvARB,
-    0, /* glMultiTexCoord4iARB */
-    logMultiTexCoord4ivARB,
-    0, /* glMultiTexCoord4sARB */
-    logMultiTexCoord4svARB,
-    0, /* glLoadTransposeMatrixfARB */
-    0, /* glLoadTransposeMatrixdARB */
-    0, /* glMultTransposeMatrixfARB */
-    0, /* glMultTransposeMatrixdARB */
-    logSampleCoverageARB,
-    0, /* glDrawBuffersARB */
-    0, /* glPolygonOffsetEXT */
-    0, /* glGetTexFilterFuncSGIS */
-    0, /* glTexFilterFuncSGIS */
-    0, /* glGetHistogramEXT */
-    0, /* glGetHistogramParameterfvEXT */
-    0, /* glGetHistogramParameterivEXT */
-    0, /* glGetMinmaxEXT */
-    0, /* glGetMinmaxParameterfvEXT */
-    0, /* glGetMinmaxParameterivEXT */
-    0, /* glGetConvolutionFilterEXT */
-    0, /* glGetConvolutionParameterfvEXT */
-    0, /* glGetConvolutionParameterivEXT */
-    0, /* glGetSeparableFilterEXT */
-    0, /* glGetColorTableSGI */
-    0, /* glGetColorTableParameterfvSGI */
-    0, /* glGetColorTableParameterivSGI */
-    0, /* glPixelTexGenSGIX */
-    0, /* glPixelTexGenParameteriSGIS */
-    0, /* glPixelTexGenParameterivSGIS */
-    0, /* glPixelTexGenParameterfSGIS */
-    0, /* glPixelTexGenParameterfvSGIS */
-    0, /* glGetPixelTexGenParameterivSGIS */
-    0, /* glGetPixelTexGenParameterfvSGIS */
-    0, /* glTexImage4DSGIS */
-    0, /* glTexSubImage4DSGIS */
-    logAreTexturesResidentEXT,
-    logGenTexturesEXT,
-    logIsTextureEXT,
-    0, /* glDetailTexFuncSGIS */
-    0, /* glGetDetailTexFuncSGIS */
-    0, /* glSharpenTexFuncSGIS */
-    0, /* glGetSharpenTexFuncSGIS */
-    logSampleMaskSGIS,
-    logSamplePatternSGIS,
-    0, /* glColorPointerEXT */
-    0, /* glEdgeFlagPointerEXT */
-    0, /* glIndexPointerEXT */
-    0, /* glNormalPointerEXT */
-    0, /* glTexCoordPointerEXT */
-    0, /* glVertexPointerEXT */
-    0, /* glSpriteParameterfSGIX */
-    0, /* glSpriteParameterfvSGIX */
-    0, /* glSpriteParameteriSGIX */
-    0, /* glSpriteParameterivSGIX */
-    logPointParameterfEXT,
-    logPointParameterfvEXT,
-    0, /* glGetInstrumentsSGIX */
-    0, /* glInstrumentsBufferSGIX */
-    0, /* glPollInstrumentsSGIX */
-    0, /* glReadInstrumentsSGIX */
-    0, /* glStartInstrumentsSGIX */
-    0, /* glStopInstrumentsSGIX */
-    0, /* glFrameZoomSGIX */
-    0, /* glTagSampleBufferSGIX */
-    0, /* glReferencePlaneSGIX */
-    0, /* glFlushRasterSGIX */
-    0, /* glGetListParameterfvSGIX */
-    0, /* glGetListParameterivSGIX */
-    0, /* glListParameterfSGIX */
-    0, /* glListParameterfvSGIX */
-    0, /* glListParameteriSGIX */
-    0, /* glListParameterivSGIX */
-    0, /* glFragmentColorMaterialSGIX */
-    0, /* glFragmentLightfSGIX */
-    0, /* glFragmentLightfvSGIX */
-    0, /* glFragmentLightiSGIX */
-    0, /* glFragmentLightivSGIX */
-    0, /* glFragmentLightModelfSGIX */
-    0, /* glFragmentLightModelfvSGIX */
-    0, /* glFragmentLightModeliSGIX */
-    0, /* glFragmentLightModelivSGIX */
-    0, /* glFragmentMaterialfSGIX */
-    0, /* glFragmentMaterialfvSGIX */
-    0, /* glFragmentMaterialiSGIX */
-    0, /* glFragmentMaterialivSGIX */
-    0, /* glGetFragmentLightfvSGIX */
-    0, /* glGetFragmentLightivSGIX */
-    0, /* glGetFragmentMaterialfvSGIX */
-    0, /* glGetFragmentMaterialivSGIX */
-    0, /* glLightEnviSGIX */
-    0, /* glVertexWeightfEXT */
-    0, /* glVertexWeightfvEXT */
-    0, /* glVertexWeightPointerEXT */
-    0, /* glFlushVertexArrayRangeNV */
-    0, /* glVertexArrayRangeNV */
-    0, /* glCombinerParameterfvNV */
-    0, /* glCombinerParameterfNV */
-    0, /* glCombinerParameterivNV */
-    0, /* glCombinerParameteriNV */
-    0, /* glCombinerInputNV */
-    0, /* glCombinerOutputNV */
-    0, /* glFinalCombinerInputNV */
-    0, /* glGetCombinerInputParameterfvNV */
-    0, /* glGetCombinerInputParameterivNV */
-    0, /* glGetCombinerOutputParameterfvNV */
-    0, /* glGetCombinerOutputParameterivNV */
-    0, /* glGetFinalCombinerInputParameterfvNV */
-    0, /* glGetFinalCombinerInputParameterivNV */
-    0, /* glResizeBuffersMESA */
-    0, /* glWindowPos2dMESA */
-    0, /* glWindowPos2dvMESA */
-    0, /* glWindowPos2fMESA */
-    0, /* glWindowPos2fvMESA */
-    0, /* glWindowPos2iMESA */
-    0, /* glWindowPos2ivMESA */
-    0, /* glWindowPos2sMESA */
-    0, /* glWindowPos2svMESA */
-    0, /* glWindowPos3dMESA */
-    0, /* glWindowPos3dvMESA */
-    logWindowPos3fMESA,
-    0, /* glWindowPos3fvMESA */
-    0, /* glWindowPos3iMESA */
-    0, /* glWindowPos3ivMESA */
-    0, /* glWindowPos3sMESA */
-    0, /* glWindowPos3svMESA */
-    0, /* glWindowPos4dMESA */
-    0, /* glWindowPos4dvMESA */
-    0, /* glWindowPos4fMESA */
-    0, /* glWindowPos4fvMESA */
-    0, /* glWindowPos4iMESA */
-    0, /* glWindowPos4ivMESA */
-    0, /* glWindowPos4sMESA */
-    0, /* glWindowPos4svMESA */
-    logBlendFuncSeparateEXT,
-    0, /* glIndexMaterialEXT */
-    0, /* glIndexFuncEXT */
-    0, /* glLockArraysEXT */
-    0, /* glUnlockArraysEXT */
-    0, /* glCullParameterdvEXT */
-    0, /* glCullParameterfvEXT */
-    0, /* glHintPGI */
-    0, /* glFogCoordfEXT */
-    logFogCoordfvEXT,
-    0, /* glFogCoorddEXT */
-    logFogCoorddvEXT,
-    logFogCoordPointerEXT,
-    0, /* glGetColorTableEXT */
-    0, /* glGetColorTableParameterivEXT */
-    0, /* glGetColorTableParameterfvEXT */
-    0, /* glTbufferMask3DFX */
-    0, /* glCompressedTexImage3DARB */
-    0, /* glCompressedTexImage2DARB */
-    0, /* glCompressedTexImage1DARB */
-    0, /* glCompressedTexSubImage3DARB */
-    0, /* glCompressedTexSubImage2DARB */
-    0, /* glCompressedTexSubImage1DARB */
-    0, /* glGetCompressedTexImageARB */
-    0, /* glSecondaryColor3bEXT */
-    logSecondaryColor3bvEXT,
-    0, /* glSecondaryColor3dEXT */
-    logSecondaryColor3dvEXT,
-    0, /* glSecondaryColor3fEXT */
-    logSecondaryColor3fvEXT,
-    0, /* glSecondaryColor3iEXT */
-    logSecondaryColor3ivEXT,
-    0, /* glSecondaryColor3sEXT */
-    logSecondaryColor3svEXT,
-    0, /* glSecondaryColor3ubEXT */
-    logSecondaryColor3ubvEXT,
-    0, /* glSecondaryColor3uiEXT */
-    logSecondaryColor3uivEXT,
-    0, /* glSecondaryColor3usEXT */
-    logSecondaryColor3usvEXT,
-    logSecondaryColorPointerEXT,
-    0, /* glAreProgramsResidentNV */
-    0, /* glBindProgramNV */
-    0, /* glDeleteProgramsNV */
-    0, /* glExecuteProgramNV */
-    0, /* glGenProgramsNV */
-    0, /* glGetProgramParameterdvNV */
-    0, /* glGetProgramParameterfvNV */
-    0, /* glGetProgramivNV */
-    0, /* glGetProgramStringNV */
-    0, /* glGetTrackMatrixivNV */
-    0, /* glGetVertexAttribdvARB */
-    0, /* glGetVertexAttribfvARB */
-    0, /* glGetVertexAttribivARB */
-    0, /* glGetVertexAttribPointervNV */
-    0, /* glIsProgramNV */
-    0, /* glLoadProgramNV */
-    0, /* glProgramParameter4dNV */
-    0, /* glProgramParameter4dvNV */
-    0, /* glProgramParameter4fNV */
-    0, /* glProgramParameter4fvNV */
-    0, /* glProgramParameters4dvNV */
-    0, /* glProgramParameters4fvNV */
-    0, /* glRequestResidentProgramsNV */
-    0, /* glTrackMatrixNV */
-    0, /* glVertexAttribPointerNV */
-    0, /* glVertexAttrib1dARB */
-    0, /* glVertexAttrib1dvARB */
-    0, /* glVertexAttrib1fARB */
-    0, /* glVertexAttrib1fvARB */
-    0, /* glVertexAttrib1sARB */
-    0, /* glVertexAttrib1svARB */
-    0, /* glVertexAttrib2dARB */
-    0, /* glVertexAttrib2dvARB */
-    0, /* glVertexAttrib2fARB */
-    0, /* glVertexAttrib2fvARB */
-    0, /* glVertexAttrib2sARB */
-    0, /* glVertexAttrib2svARB */
-    0, /* glVertexAttrib3dARB */
-    0, /* glVertexAttrib3dvARB */
-    0, /* glVertexAttrib3fARB */
-    0, /* glVertexAttrib3fvARB */
-    0, /* glVertexAttrib3sARB */
-    0, /* glVertexAttrib3svARB */
-    0, /* glVertexAttrib4dARB */
-    0, /* glVertexAttrib4dvARB */
-    0, /* glVertexAttrib4fARB */
-    0, /* glVertexAttrib4fvARB */
-    0, /* glVertexAttrib4sARB */
-    0, /* glVertexAttrib4svARB */
-    0, /* glVertexAttrib4NubARB */
-    0, /* glVertexAttrib4NubvARB */
-    0, /* glVertexAttribs1dvNV */
-    0, /* glVertexAttribs1fvNV */
-    0, /* glVertexAttribs1svNV */
-    0, /* glVertexAttribs2dvNV */
-    0, /* glVertexAttribs2fvNV */
-    0, /* glVertexAttribs2svNV */
-    0, /* glVertexAttribs3dvNV */
-    0, /* glVertexAttribs3fvNV */
-    0, /* glVertexAttribs3svNV */
-    0, /* glVertexAttribs4dvNV */
-    0, /* glVertexAttribs4fvNV */
-    0, /* glVertexAttribs4svNV */
-    0, /* glVertexAttribs4ubvNV */
-    logPointParameteriNV,
-    logPointParameterivNV,
-    0, /* glMultiDrawArraysEXT */
-    0, /* glMultiDrawElementsEXT */
-    logActiveStencilFaceEXT,
-    0, /* glDeleteFencesNV */
-    0, /* glGenFencesNV */
-    0, /* glIsFenceNV */
-    0, /* glTestFenceNV */
-    0, /* glGetFenceivNV */
-    0, /* glFinishFenceNV */
-    0, /* glSetFenceNV */
-    0, /* glVertexAttrib4bvARB */
-    0, /* glVertexAttrib4ivARB */
-    0, /* glVertexAttrib4ubvARB */
-    0, /* glVertexAttrib4usvARB */
-    0, /* glVertexAttrib4uivARB */
-    0, /* glVertexAttrib4NbvARB */
-    0, /* glVertexAttrib4NsvARB */
-    0, /* glVertexAttrib4NivARB */
-    0, /* glVertexAttrib4NusvARB */
-    0, /* glVertexAttrib4NuivARB */
-    0, /* glVertexAttribPointerARB */
-    0, /* glEnableVertexAttribArrayARB */
-    0, /* glDisableVertexAttribArrayARB */
-    0, /* glProgramStringARB */
-    0, /* glProgramEnvParameter4dARB */
-    0, /* glProgramEnvParameter4dvARB */
-    0, /* glProgramEnvParameter4fARB */
-    0, /* glProgramEnvParameter4fvARB */
-    0, /* glProgramLocalParameter4dARB */
-    0, /* glProgramLocalParameter4dvARB */
-    0, /* glProgramLocalParameter4fARB */
-    0, /* glProgramLocalParameter4fvARB */
-    0, /* glGetProgramEnvParameterdvARB */
-    0, /* glGetProgramEnvParameterfvARB */
-    0, /* glGetProgramLocalParameterdvARB */
-    0, /* glGetProgramLocalParameterfvARB */
-    0, /* glGetProgramivARB */
-    0, /* glGetProgramStringARB */
-    0, /* glProgramNamedParameter4fNV */
-    0, /* glProgramNamedParameter4dNV */
-    0, /* glProgramNamedParameter4fvNV */
-    0, /* glProgramNamedParameter4dvNV */
-    0, /* glGetProgramNamedParameterfvNV */
-    0, /* glGetProgramNamedParameterdvNV */
-    0, /* glBindBufferARB */
-    0, /* glBufferDataARB */
-    0, /* glBufferSubDataARB */
-    0, /* glDeleteBuffersARB */
-    0, /* glGenBuffersARB */
-    0, /* glGetBufferParameterivARB */
-    0, /* glGetBufferPointervARB */
-    0, /* glGetBufferSubDataARB */
-    0, /* glIsBufferARB */
-    0, /* glMapBufferARB */
-    0, /* glUnmapBufferARB */
-    0, /* glDepthBoundsEXT */
-    0, /* glGenQueriesARB */
-    0, /* glDeleteQueriesARB */
-    0, /* glIsQueryARB */
-    0, /* glBeginQueryARB */
-    0, /* glEndQueryARB */
-    0, /* glGetQueryivARB */
-    0, /* glGetQueryObjectivARB */
-    0, /* glGetQueryObjectuivARB */
-    0, /* glMultiModeDrawArraysIBM */
-    0, /* glMultiModeDrawElementsIBM */
-    0, /* glBlendEquationSeparateEXT */
-    0, /* glDeleteObjectARB */
-    0, /* glGetHandleARB */
-    0, /* glDetachObjectARB */
-    0, /* glCreateShaderObjectARB */
-    0, /* glShaderSourceARB */
-    0, /* glCompileShaderARB */
-    0, /* glCreateProgramObjectARB */
-    0, /* glAttachObjectARB */
-    0, /* glLinkProgramARB */
-    0, /* glUseProgramObjectARB */
-    0, /* glValidateProgramARB */
-    0, /* glUniform1fARB */
-    0, /* glUniform2fARB */
-    0, /* glUniform3fARB */
-    0, /* glUniform4fARB */
-    0, /* glUniform1iARB */
-    0, /* glUniform2iARB */
-    0, /* glUniform3iARB */
-    0, /* glUniform4iARB */
-    0, /* glUniform1fvARB */
-    0, /* glUniform2fvARB */
-    0, /* glUniform3fvARB */
-    0, /* glUniform4fvARB */
-    0, /* glUniform1ivARB */
-    0, /* glUniform2ivARB */
-    0, /* glUniform3ivARB */
-    0, /* glUniform4ivARB */
-    0, /* glUniformMatrix2fvARB */
-    0, /* glUniformMatrix3fvARB */
-    0, /* glUniformMatrix4fvARB */
-    0, /* glGetObjectParameterfvARB */
-    0, /* glGetObjectParameterivARB */
-    0, /* glGetInfoLogARB */
-    0, /* glGetAttachedObjectsARB */
-    0, /* glGetUniformLocationARB */
-    0, /* glGetActiveUniformARB */
-    0, /* glGetUniformfvARB */
-    0, /* glGetUniformivARB */
-    0, /* glGetShaderSourceARB */
-    0, /* glBindAttribLocationARB */
-    0, /* glGetActiveAttribARB */
-    0, /* glGetAttribLocationARB */
-    0, /* glGetVertexAttribdvNV */
-    0, /* glGetVertexAttribfvNV */
-    0, /* glGetVertexAttribivNV */
-    0, /* glVertexAttrib1dNV */
-    0, /* glVertexAttrib1dvNV */
-    0, /* glVertexAttrib1fNV */
-    0, /* glVertexAttrib1fvNV */
-    0, /* glVertexAttrib1sNV */
-    0, /* glVertexAttrib1svNV */
-    0, /* glVertexAttrib2dNV */
-    0, /* glVertexAttrib2dvNV */
-    0, /* glVertexAttrib2fNV */
-    0, /* glVertexAttrib2fvNV */
-    0, /* glVertexAttrib2sNV */
-    0, /* glVertexAttrib2svNV */
-    0, /* glVertexAttrib3dNV */
-    0, /* glVertexAttrib3dvNV */
-    0, /* glVertexAttrib3fNV */
-    0, /* glVertexAttrib3fvNV */
-    0, /* glVertexAttrib3sNV */
-    0, /* glVertexAttrib3svNV */
-    0, /* glVertexAttrib4dNV */
-    0, /* glVertexAttrib4dvNV */
-    0, /* glVertexAttrib4fNV */
-    0, /* glVertexAttrib4fvNV */
-    0, /* glVertexAttrib4sNV */
-    0, /* glVertexAttrib4svNV */
-    0, /* glVertexAttrib4ubNV */
-    0, /* glVertexAttrib4ubvNV */
-    0, /* glGenFragmentShadersATI */
-    0, /* glBindFragmentShaderATI */
-    0, /* glDeleteFragmentShaderATI */
-    0, /* glBeginFragmentShaderATI */
-    0, /* glEndFragmentShaderATI */
-    0, /* glPassTexCoordATI */
-    0, /* glSampleMapATI */
-    0, /* glColorFragmentOp1ATI */
-    0, /* glColorFragmentOp2ATI */
-    0, /* glColorFragmentOp3ATI */
-    0, /* glAlphaFragmentOp1ATI */
-    0, /* glAlphaFragmentOp2ATI */
-    0, /* glAlphaFragmentOp3ATI */
-    0, /* glSetFragmentShaderConstantATI */
-    logIsRenderbufferEXT,
-    logBindRenderbufferEXT,
-    logDeleteRenderbuffersEXT,
-    logGenRenderbuffersEXT,
-    logRenderbufferStorageEXT,
-    logGetRenderbufferParameterivEXT,
-    logIsFramebufferEXT,
-    logBindFramebufferEXT,
-    logDeleteFramebuffersEXT,
-    logGenFramebuffersEXT,
-    logCheckFramebufferStatusEXT,
-    logFramebufferTexture1DEXT,
-    logFramebufferTexture2DEXT,
-    logFramebufferTexture3DEXT,
-    logFramebufferRenderbufferEXT,
-    logGetFramebufferAttachmentParameterivEXT,
-    logGenerateMipmapEXT,
-    0, /* glStencilFuncSeparate */
-    0, /* glStencilOpSeparate */
-    0, /* glStencilMaskSeparate */
-    0, /* glGetQueryObjecti64vEXT */
-    0  /* glGetQueryObjectui64vEXT */
-};
-
-static Bool isCurrent = FALSE;
-
-static void (*flushContextCache) (void);
-static void (*setRenderTables)   (struct _glapi_table *table);
-
-static void
-GlxLogFlushContextCache (void)
-{
-    if (isCurrent)
-    {
-	fprintf (logFp, "LOSE CURRENT\n");
-	isCurrent = FALSE;
-    }
-
-    (*flushContextCache) ();
-}
-
-static void
-GlxLogSetRenderTables (struct _glapi_table *table)
-{
-    nativeRenderTable = table;
-
-    if (table)
-    {
-	fprintf (logFp, "FORCE CURRENT\n");
-	isCurrent = TRUE;
-
-	(*setRenderTables) (&__logRenderTable);
-    }
-    else
-    {
-	(*setRenderTables) (0);
-    }
-}
-
-void
-xglInitGlxLog (void)
-{
-    if (logFp)
-	return;
-
-    if (__xglGLXLogFp)
-    {
-	logFp = __xglGLXLogFp;
-
-	flushContextCache = __xglGLXFunc.flushContextCache;
-	setRenderTables   = __xglGLXFunc.setRenderTables;
-
-	__xglGLXFunc.flushContextCache = GlxLogFlushContextCache;
-	__xglGLXFunc.setRenderTables   = GlxLogSetRenderTables;
-    }
-}
-
-#endif
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
deleted file mode 100644
index 03dc90c..0000000
--- a/hw/xgl/xgl.h
+++ /dev/null
@@ -1,1474 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#ifndef _XGL_H_
-#define _XGL_H_
-
-#include <xgl-config.h>
-
-#include <X11/X.h>
-#define NEED_EVENTS
-#include <X11/Xproto.h>
-#include <X11/Xos.h>
-#include <glitz.h>
-
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "servermd.h"
-#include "mi.h"
-#include "dix.h"
-#include "damage.h"
-#include "gc.h"
-#include "micmap.h"
-/* I'd like gc.h to provide this */
-typedef struct _GCFuncs *GCFuncsPtr;
-
-#ifdef RENDER
-#include "mipict.h"
-#else
-#ifdef XV
-#undef XV /* Xv implementation require RENDER */
-#endif
-#endif
-
-#ifdef XV
-#define XGL_XV_FORMAT_YUY2 0
-#define XGL_XV_FORMAT_YV12 1
-#define XGL_XV_FORMAT_RGB  2
-#define XGL_XV_FORMAT_NUM  3
-#endif
-
-/* For the modules.  We should decide what the actual version numbering should
- * be.
- */
-#define VERSION "0.0.1"
-
-extern WindowPtr *WindowTable;
-
-#define XGL_DEFAULT_PBO_MASK 0
-
-typedef struct _xglSizeConstraint {
-    int minWidth;
-    int minHeight;
-    int aboveWidth;
-    int aboveHeight;
-} xglSizeConstraintRec, *xglSizeConstraintPtr;
-
-typedef struct _xglAccelInfo {
-    Bool		 enabled;
-    Bool		 pbuffer;
-    xglSizeConstraintRec size;
-} xglAccelInfoRec, *xglAccelInfoPtr;
-
-typedef struct _xglScreenAccelInfo {
-    xglAccelInfoRec pixmap;
-    xglAccelInfoRec window;
-    xglAccelInfoRec glx;
-    xglAccelInfoRec xv;
-} xglScreenAccelInfoRec, *xglScreenAccelInfoPtr;
-
-typedef struct _xglScreenInfo {
-    glitz_drawable_t	  *drawable;
-    unsigned int	  depth;
-    unsigned int	  width;
-    unsigned int	  height;
-    unsigned int	  widthMm;
-    unsigned int	  heightMm;
-    int			  geometryDataType;
-    int			  geometryUsage;
-    Bool		  yInverted;
-    int			  pboMask;
-    Bool		  lines;
-    xglScreenAccelInfoRec accel;
-} xglScreenInfoRec, *xglScreenInfoPtr;
-
-extern xglScreenInfoRec xglScreenInfo;
-
-typedef struct _xglPixelFormat {
-    CARD8		depth, bitsPerRGB;
-    glitz_pixel_masks_t masks;
-} xglPixelFormatRec, *xglPixelFormatPtr;
-
-typedef struct _xglVisual {
-    struct _xglVisual *next;
-    VisualID	      vid;
-    xglPixelFormatPtr pPixel;
-    Bool	      pbuffer;
-    struct {
-	glitz_drawable_format_t *drawable;
-	glitz_format_t	        *surface;
-    } format;
-} xglVisualRec, *xglVisualPtr;
-
-extern xglVisualPtr xglVisuals;
-
-#define xglAreaAvailable 0
-#define xglAreaDivided   1
-#define xglAreaOccupied  2
-
-typedef struct _xglRootArea *xglRootAreaPtr;
-
-typedef struct _xglArea {
-    int		    state;
-    int		    level;
-    int		    x, y;
-    int		    width, height;
-    struct _xglArea *pArea[4];
-    xglRootAreaPtr  pRoot;
-    pointer	    closure;
-    DevUnion	    devPrivate;
-} xglAreaRec, *xglAreaPtr;
-
-typedef struct _xglAreaFuncs {
-    Bool (*Create)	(xglAreaPtr pArea);
-
-    Bool (*MoveIn)      (xglAreaPtr pArea,
-			 pointer    closure);
-
-    void (*MoveOut)     (xglAreaPtr pArea,
-			 pointer    closure);
-
-    int (*CompareScore) (xglAreaPtr pArea,
-			 pointer    closure1,
-			 pointer    closure2);
-
-} xglAreaFuncsRec, *xglAreaFuncsPtr;
-
-typedef struct _xglRootArea {
-    int		    maxLevel;
-    int		    width, height;
-    xglAreaPtr	    pArea;
-    xglAreaFuncsPtr funcs;
-    int		    devPrivateSize;
-    pointer	    closure;
-} xglRootAreaRec;
-
-typedef struct xglGeometry {
-    glitz_buffer_t          *buffer;
-    pointer	            *data;
-    Bool		    broken;
-    glitz_fixed16_16_t	    xOff, yOff;
-    int			    dataType;
-    int			    usage;
-    int			    size, endOffset;
-    glitz_geometry_type_t   type;
-    glitz_geometry_format_t f;
-    int			    first, width, count;
-    glitz_multi_array_t     *array;
-} xglGeometryRec, *xglGeometryPtr;
-
-#ifdef RENDER
-typedef struct _xglFBox {
-    glitz_float_t x1, y1, x2, y2;
-} xglFBoxRec;
-
-typedef union _xglBox {
-    BoxRec     sBox;
-    xglFBoxRec fBox;
-} xglBoxRec, *xglBoxPtr;
-
-typedef struct _xglRange {
-    int		 first;
-    unsigned int count;
-} xglRangeRec, *xglRangePtr;
-
-typedef struct _xglGlyphTexture {
-    PicturePtr		    pMask;
-    glitz_pixel_format_t    pixel;
-    glitz_geometry_format_t format;
-    int			    geometryDataType;
-} xglGlyphTextureRec, *xglGlyphTexturePtr;
-
-typedef struct _xglGlyphArea {
-    unsigned long serial;
-    union {
-	xglBoxRec   box;
-	xglRangeRec range;
-    } u;
-} xglGlyphAreaRec, *xglGlyphAreaPtr;
-
-typedef struct _xglGlyphCache {
-    ScreenPtr		    pScreen;
-    int			    depth;
-    xglRootAreaRec	    rootArea;
-    union {
-	xglGlyphTextureRec texture;
-	xglGeometryRec	   geometry;
-    } u;
-} xglGlyphCacheRec, *xglGlyphCachePtr;
-
-typedef struct _xglGlyph {
-    xglAreaPtr pArea;
-} xglGlyphRec, *xglGlyphPtr;
-
-extern DevPrivateKey xglGlyphPrivateKey;
-
-#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr)		     \
-    dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen),	     \
-    					        xglGlyphPrivateKey))
-
-#define XGL_GLYPH_PRIV(pScreen, pGlyph)				  \
-    xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph)
-
-#endif
-
-typedef struct _xglScreen {
-    xglVisualPtr		  pVisual;
-
-#ifdef GLXEXT
-    xglVisualPtr		  pGlxVisual;
-#endif
-
-#ifdef XV
-    xglVisualRec		  pXvVisual[XGL_XV_FORMAT_NUM];
-#endif
-
-    xglVisualPtr		  rootVisual;
-    glitz_drawable_t		  *drawable;
-    glitz_surface_t		  *surface;
-    PixmapPtr			  pScreenPixmap;
-    unsigned long		  features;
-    int				  geometryUsage;
-    int				  geometryDataType;
-    Bool			  yInverted;
-    int				  pboMask;
-    Bool			  lines;
-    xglGeometryRec		  scratchGeometry;
-    xglScreenAccelInfoRec	  accel;
-
-#ifdef RENDER
-    xglGlyphCacheRec		  glyphCache[33];
-    PicturePtr			  pSolidAlpha;
-    struct _trapInfo {
-	PicturePtr		  pMask;
-	glitz_geometry_format_t	  format;
-    } trapInfo;
-#endif
-
-    GetImageProcPtr		  GetImage;
-    GetSpansProcPtr		  GetSpans;
-    CreateWindowProcPtr		  CreateWindow;
-    DestroyWindowProcPtr	  DestroyWindow;
-    ChangeWindowAttributesProcPtr ChangeWindowAttributes;
-    CopyWindowProcPtr		  CopyWindow;
-    CreateGCProcPtr		  CreateGC;
-    CloseScreenProcPtr		  CloseScreen;
-    SetWindowPixmapProcPtr	  SetWindowPixmap;
-    BitmapToRegionProcPtr	  BitmapToRegion;
-
-#ifdef RENDER
-    CompositeProcPtr		  Composite;
-    GlyphsProcPtr		  Glyphs;
-    TrapezoidsProcPtr		  Trapezoids;
-    AddTrapsProcPtr		  AddTraps;
-    AddTrianglesProcPtr		  AddTriangles;
-    ChangePictureProcPtr	  ChangePicture;
-    ChangePictureTransformProcPtr ChangePictureTransform;
-    ChangePictureFilterProcPtr	  ChangePictureFilter;
-
-    RealizeGlyphProcPtr		  RealizeGlyph;
-    UnrealizeGlyphProcPtr	  UnrealizeGlyph;
-#endif
-} xglScreenRec, *xglScreenPtr;
-
-extern DevPrivateKey xglScreenPrivateKey;
-
-#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey))
-
-#define XGL_SET_SCREEN_PRIV(pScreen, v) \
-    dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v)
-
-#define XGL_SCREEN_PRIV(pScreen)			     \
-    xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen)
-
-#define XGL_SCREEN_WRAP(field, wrapper)	 \
-    pScreenPriv->field = pScreen->field; \
-    pScreen->field     = wrapper
-
-#define XGL_SCREEN_UNWRAP(field)	\
-    pScreen->field = pScreenPriv->field
-
-#ifdef RENDER
-#define XGL_PICTURE_SCREEN_WRAP(field, wrapper)	   \
-    pScreenPriv->field    = pPictureScreen->field; \
-    pPictureScreen->field = wrapper
-
-#define XGL_PICTURE_SCREEN_UNWRAP(field)       \
-    pPictureScreen->field = pScreenPriv->field
-#endif
-
-#define xglGCSoftwareDrawableFlag (1L << 0)
-#define xglGCBadFunctionFlag	  (1L << 1)
-#define xglGCPlaneMaskFlag	  (1L << 2)
-
-typedef struct _xglGC {
-    glitz_surface_t   *fg;
-    glitz_surface_t   *bg;
-    glitz_format_id_t id;
-    glitz_operator_t  op;
-    unsigned long     flags;
-    GCFuncsPtr	      funcs;
-    GCOpsPtr	      ops;
-} xglGCRec, *xglGCPtr;
-
-extern DevPrivateKey xglGCPrivateKey;
-
-#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \
-    dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey))
-
-#define XGL_GC_PRIV(pGC)		     \
-    xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC)
-
-#define XGL_GC_WRAP(field, wrapper) \
-    pGCPriv->field = pGC->field;    \
-    pGC->field     = wrapper
-
-#define XGL_GC_UNWRAP(field)    \
-    pGC->field = pGCPriv->field
-
-
-#define xglPCFillMask		(1L << 0)
-#define xglPCFilterMask		(1L << 1)
-#define xglPCTransformMask	(1L << 2)
-#define xglPCComponentAlphaMask (1L << 3)
-#define xglPCDitherMask		(1L << 4)
-
-#define xglPFFilterMask		(1L << 8)
-
-#define xglPixmapTargetNo  0
-#define xglPixmapTargetOut 1
-#define xglPixmapTargetIn  2
-
-#ifdef XV
-
-typedef struct _xglXvPort {
-    PixmapPtr  pPixmap;
-    PicturePtr pSrc;
-    PicturePtr pDst;
-} xglXvPortRec, *xglXvPortPtr;
-
-#endif
-
-typedef struct _xglPixmap {
-    xglVisualPtr     pVisual;
-    glitz_surface_t  *surface;
-    glitz_drawable_t *drawable;
-    glitz_buffer_t   *buffer;
-    int		     target;
-    Bool	     acceleratedTile;
-    pointer	     bits;
-    int		     stride;
-    DamagePtr	     pDamage;
-    BoxRec	     damageBox;
-    RegionRec	     bitRegion;
-    Bool	     allBits;
-    unsigned long    pictureMask;
-    xglGeometryPtr   pGeometry;
-
-#ifdef XV
-    xglXvPortPtr     pPortPriv;
-#endif
-
-} xglPixmapRec, *xglPixmapPtr;
-
-extern DevPrivateKey xglPixmapPrivateKey;
-
-#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \
-    dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey))
-
-#define XGL_PIXMAP_PRIV(pPixmap)			     \
-    xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap)
-
-#define XGL_PICTURE_CHANGES(pictureMask)  (pictureMask & 0x0000ffff)
-#define XGL_PICTURE_FAILURES(pictureMask) (pictureMask & 0xffff0000)
-
-typedef struct _xglWin {
-    PixmapPtr    pPixmap;
-} xglWinRec, *xglWinPtr;
-
-extern DevPrivateKey xglWinPrivateKey;
-
-#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \
-    dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey))
-
-#define XGL_WINDOW_PRIV(pWin)			    \
-    xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin)
-
-#define XGL_GET_WINDOW_PIXMAP(pWin)		       \
-    (XGL_GET_WINDOW_PRIV((WindowPtr) (pWin))->pPixmap)
-
-
-#define XGL_GET_DRAWABLE_PIXMAP(pDrawable)   \
-    (((pDrawable)->type == DRAWABLE_WINDOW)? \
-     XGL_GET_WINDOW_PIXMAP (pDrawable):	     \
-     (PixmapPtr) (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP(pDrawable)			    \
-    PixmapPtr pPixmap = XGL_GET_DRAWABLE_PIXMAP (pDrawable)
-
-#define XGL_GET_DRAWABLE_PIXMAP_PRIV(pDrawable)		      \
-    XGL_GET_PIXMAP_PRIV (XGL_GET_DRAWABLE_PIXMAP (pDrawable))
-
-#define XGL_DRAWABLE_PIXMAP_PRIV(pDrawable)			        \
-    xglPixmapPtr pPixmapPriv = XGL_GET_DRAWABLE_PIXMAP_PRIV (pDrawable)
-
-#ifdef COMPOSITE
-#define __XGL_OFF_X_WIN(pPix) (-(pPix)->screen_x)
-#define __XGL_OFF_Y_WIN(pPix) (-(pPix)->screen_y)
-#else
-#define __XGL_OFF_X_WIN(pPix) (0)
-#define __XGL_OFF_Y_WIN(pPix) (0)
-#endif
-
-#define XGL_GET_DRAWABLE(pDrawable, pSurface, xOff, yOff)  \
-    {							   \
-	PixmapPtr _pPix;				   \
-	if ((pDrawable)->type != DRAWABLE_PIXMAP) {	   \
-	    _pPix = XGL_GET_WINDOW_PIXMAP (pDrawable);	   \
-	    (xOff) = __XGL_OFF_X_WIN (_pPix);		   \
-	    (yOff) = __XGL_OFF_Y_WIN (_pPix);		   \
-	} else {					   \
-	    _pPix = (PixmapPtr) (pDrawable);		   \
-	    (yOff) = (xOff) = 0;			   \
-	}						   \
-	(pSurface) = XGL_GET_PIXMAP_PRIV (_pPix)->surface; \
-    }
-
-#define XGL_DEFAULT_DPI 96
-
-#define XGL_SW_FAILURE_STRING "software fall-back failure"
-
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-
-#define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
-
-#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
-
-#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
-#define FLOAT_TO_FIXED(f) ((int) ((f) * 65536))
-
-#define BOX_NOTEMPTY(pBox)	      \
-    (((pBox)->x2 - (pBox)->x1) > 0 && \
-     ((pBox)->y2 - (pBox)->y1) > 0)
-
-
-/* xglinput.c */
-
-int
-xglMouseProc (DeviceIntPtr pDevice,
-	      int	   onoff);
-
-int
-xglKeybdProc (DeviceIntPtr pDevice,
-	      int	   onoff);
-
-void
-xglBell (int	      volume,
-	 DeviceIntPtr pDev,
-	 pointer      ctrl,
-	 int	      something);
-
-void
-xglKbdCtrl (DeviceIntPtr pDevice,
-	    KeybdCtrl	 *ctrl);
-
-void
-xglInitInput (int argc, char **argv);
-
-
-/* xgloutput.c */
-
-void
-xglSetPixmapFormats (ScreenInfo *pScreenInfo);
-
-void
-xglSetRootClip (ScreenPtr pScreen,
-		Bool	  enable);
-
-
-/* xglcmap.c */
-
-void
-xglSetVisualTypes (int depth,
-		   int visuals,
-		   int redSize,
-		   int greenSize,
-		   int blueSize);
-
-Bool
-xglHasVisualTypes (xglVisualPtr pVisual,
-		   int		depth);
-
-glitz_format_t *
-xglFindBestSurfaceFormat (ScreenPtr         pScreen,
-			  xglPixelFormatPtr pPixel);
-
-void
-xglInitVisuals (ScreenPtr pScreen);
-
-xglVisualPtr
-xglFindVisualWithDepth (ScreenPtr pScreen,
-			int       depth);
-
-xglVisualPtr
-xglFindVisualWithId (ScreenPtr pScreen,
-		     int       vid);
-
-void
-xglClearVisualTypes (void);
-
-
-/* xglparse.c */
-
-char *
-xglParseFindNext (char *cur,
-		  char *delim,
-		  char *save,
-		  char *last);
-
-void
-xglParseScreen (char *arg);
-
-void
-xglUseMsg (void);
-
-int
-xglProcessArgument (int	 argc,
-		    char **argv,
-		    int	 i);
-
-
-/* xglscreen.c */
-
-Bool
-xglScreenInit (ScreenPtr pScreen);
-
-Bool
-xglFinishScreenInit (ScreenPtr pScreen);
-
-Bool
-xglCloseScreen (int	  index,
-		ScreenPtr pScreen);
-
-void
-xglCreateSolidAlphaPicture (ScreenPtr pScreen);
-
-
-/* xglarea.c */
-
-Bool
-xglRootAreaInit (xglRootAreaPtr	    pRoot,
-		 int		    maxLevel,
-		 int		    width,
-		 int		    height,
-		 int		    devPrivateSize,
-		 xglAreaFuncsPtr    funcs,
-		 pointer	    closure);
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot);
-
-void
-xglLeaveArea (xglAreaPtr pArea);
-
-void
-xglWithdrawArea (xglAreaPtr pArea);
-
-Bool
-xglFindArea (xglAreaPtr pArea,
-	     int	width,
-	     int	height,
-	     Bool	kickOut,
-	     pointer	closure);
-
-
-/* xglgeometry.c */
-
-#define GEOMETRY_DATA_TYPE_SHORT 0
-#define GEOMETRY_DATA_TYPE_FLOAT 1
-
-typedef struct _xglDataTypeInfo {
-    glitz_data_type_t type;
-    int		      size;
-} xglDataTypeInfoRec, *xglDataTypeInfoPtr;
-
-extern xglDataTypeInfoRec xglGeometryDataTypes[2];
-
-#define DEFAULT_GEOMETRY_DATA_TYPE GEOMETRY_DATA_TYPE_FLOAT
-
-#define GEOMETRY_USAGE_STREAM  0
-#define GEOMETRY_USAGE_STATIC  1
-#define GEOMETRY_USAGE_DYNAMIC 2
-#define GEOMETRY_USAGE_SYSMEM  3
-
-#define DEFAULT_GEOMETRY_USAGE GEOMETRY_USAGE_SYSMEM
-
-#define GEOMETRY_INIT(pScreen, pGeometry, _type, _usage, _size)		  \
-    {									  \
-	(pGeometry)->type      = _type;					  \
-	(pGeometry)->usage     = _usage;				  \
-	(pGeometry)->dataType  = DEFAULT_GEOMETRY_DATA_TYPE;		  \
-	(pGeometry)->usage     = _usage;				  \
-	(pGeometry)->size      = 0;					  \
-	(pGeometry)->endOffset = 0;					  \
-	(pGeometry)->data      = (pointer) 0;				  \
-	(pGeometry)->buffer    = NULL;					  \
-	(pGeometry)->broken    = FALSE;					  \
-	(pGeometry)->xOff      = 0;					  \
-	(pGeometry)->yOff      = 0;					  \
-	(pGeometry)->array     = NULL;					  \
-	(pGeometry)->first     = 0;					  \
-	(pGeometry)->count     = 0;					  \
-	if (_type == GLITZ_GEOMETRY_TYPE_VERTEX)			  \
-	{								  \
-	    (pGeometry)->width = 2;					  \
-	    (pGeometry)->f.vertex.type =				  \
-		xglGeometryDataTypes[(pGeometry)->dataType].type;	  \
-	    (pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width * \
-		xglGeometryDataTypes[(pGeometry)->dataType].size;	  \
-	    (pGeometry)->f.vertex.primitive = GLITZ_PRIMITIVE_QUADS;	  \
-	    (pGeometry)->f.vertex.attributes = 0;			  \
-	    (pGeometry)->f.vertex.src.type = GLITZ_DATA_TYPE_FLOAT;	  \
-	    (pGeometry)->f.vertex.src.size = GLITZ_COORDINATE_SIZE_X;	  \
-	    (pGeometry)->f.vertex.src.offset = 0;			  \
-	    (pGeometry)->f.vertex.mask.type = GLITZ_DATA_TYPE_FLOAT;	  \
-	    (pGeometry)->f.vertex.mask.size = GLITZ_COORDINATE_SIZE_X;	  \
-	    (pGeometry)->f.vertex.mask.offset = 0;			  \
-	}								  \
-	else								  \
-	{								  \
-	    (pGeometry)->width = 0;					  \
-	    (pGeometry)->f.bitmap.scanline_order =			  \
-		GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;			  \
-	    (pGeometry)->f.bitmap.bytes_per_line = 0;			  \
-	    (pGeometry)->f.bitmap.pad = GLYPHPADBYTES;			  \
-	}								  \
-	if (_size)							  \
-	    xglGeometryResize (pScreen, pGeometry, _size);		  \
-    }
-
-#define GEOMETRY_UNINIT(pGeometry)			    \
-    {							    \
-	if ((pGeometry)->array)				    \
-	    glitz_multi_array_destroy ((pGeometry)->array); \
-	if ((pGeometry)->buffer)			    \
-	    glitz_buffer_destroy ((pGeometry)->buffer);     \
-	if ((pGeometry)->data)				    \
-	    xfree ((pGeometry)->data);			    \
-    }
-
-#define GEOMETRY_SET_BUFFER(pGeometry, _buffer)		\
-    {							\
-	glitz_buffer_reference (_buffer);		\
-	if ((pGeometry)->buffer)			\
-	    glitz_buffer_destroy ((pGeometry)->buffer); \
-	(pGeometry)->buffer = _buffer;			\
-    }
-
-#define GEOMETRY_SET_MULTI_ARRAY(pGeometry, _array)	    \
-    {							    \
-	glitz_multi_array_reference (_array);		    \
-	if ((pGeometry)->array)				    \
-	    glitz_multi_array_destroy ((pGeometry)->array); \
-	(pGeometry)->array = _array;			    \
-    }
-
-#define GEOMETRY_RESIZE(pScreen, pGeometry, size) \
-    xglGeometryResize (pScreen, pGeometry, size)
-
-#define GEOMETRY_SET_TRANSLATE(pGeometry, _x, _y) \
-    {						  \
-	(pGeometry)->xOff = (_x) << 16;		  \
-	(pGeometry)->yOff = (_y) << 16;		  \
-    }
-
-#define GEOMETRY_TRANSLATE(pGeometry, tx, ty) \
-    {				              \
-	(pGeometry)->xOff += (tx) << 16;      \
-	(pGeometry)->yOff += (ty) << 16;      \
-    }
-
-#define GEOMETRY_TRANSLATE_FIXED(pGeometry, ftx, fty) \
-    {						      \
-	(pGeometry)->xOff += (ftx);		      \
-	(pGeometry)->yOff += (fty);		      \
-    }
-
-#define GEOMETRY_SET_VERTEX_PRIMITIVE(pGeometry, _primitive) \
-    (pGeometry)->f.vertex.primitive = _primitive
-
-#define GEOMETRY_SET_VERTEX_DATA_TYPE(pGeometry, _type)		       \
-    {								       \
-	(pGeometry)->dataType = _type;				       \
-	(pGeometry)->f.vertex.type = xglGeometryDataTypes[_type].type; \
-	(pGeometry)->f.vertex.bytes_per_vertex = (pGeometry)->width *  \
-	    xglGeometryDataTypes[_type].size;			       \
-    }
-
-#define GEOMETRY_ADD_BOX(pScreen, pGeometry, pBox, nBox) \
-    xglGeometryAddBox (pScreen, pGeometry, pBox, nBox,	 \
-		       (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_REGION_AT(pScreen, pGeometry, pRegion, offset) \
-     xglGeometryAddBox (pScreen, pGeometry,			    \
-			REGION_RECTS (pRegion),			    \
-			REGION_NUM_RECTS (pRegion),		    \
-			offset)
-
-#define GEOMETRY_ADD_REGION(pScreen, pGeometry, pRegion) \
-    xglGeometryAddBox (pScreen, pGeometry,		 \
-		       REGION_RECTS (pRegion),		 \
-		       REGION_NUM_RECTS (pRegion),	 \
-		       (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SPAN(pScreen, pGeometry, ppt, pwidth, n) \
-    xglGeometryAddSpan (pScreen, pGeometry, ppt, pwidth, n,   \
-			(pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_LINE(pScreen, pGeometry, loop, mode, npt, ppt) \
-    xglGeometryAddLine (pScreen, pGeometry, loop, mode, npt, ppt,   \
-			(pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_SEGMENT(pScreen, pGeometry, nsegInit, pSegInit) \
-    xglGeometryAddSegment (pScreen, pGeometry, nsegInit, pSegInit,   \
-			   (pGeometry)->endOffset)
-
-#define GEOMETRY_FOR_GLYPH(pScreen, pGeometry, nGlyph, ppciInit, pglyphBase) \
-    xglGeometryForGlyph (pScreen, pGeometry, nGlyph, ppciInit, pglyphBase);
-
-#define GEOMETRY_ADD_TRAPEZOID(pScreen, pGeometry, pTrap, nTrap) \
-    xglGeometryAddTrapezoid (pScreen, pGeometry, pTrap, nTrap,	 \
-			     (pGeometry)->endOffset)
-
-#define GEOMETRY_ADD_TRAP(pScreen, pGeometry, pTrap, nTrap) \
-    xglGeometryAddTrap (pScreen, pGeometry, pTrap, nTrap,   \
-			(pGeometry)->endOffset)
-
-#define GEOMETRY_GET_FORMAT(pGeometry, format) \
-    xglGeometryGetFormat (pGeometry, format)
-
-#define GEOMETRY_ENABLE(pGeometry, surface) \
-    xglSetGeometry (pGeometry, surface)
-
-#define GEOMETRY_DISABLE(surface)				       \
-    glitz_set_geometry (surface, GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL)
-
-void
-xglGeometryResize (ScreenPtr	  pScreen,
-		   xglGeometryPtr pGeometry,
-		   int		  size);
-
-void
-xglGeometryAddBox (ScreenPtr	  pScreen,
-		   xglGeometryPtr pGeometry,
-		   BoxPtr	  pBox,
-		   int		  nBox,
-		   int		  offset);
-
-void
-xglGeometryAddSpan (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    DDXPointPtr	   ppt,
-		    int		   *pwidth,
-		    int		   n,
-		    int		   offset);
-
-void
-xglGeometryAddLine (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    int		   loop,
-		    int		   mode,
-		    int		   npt,
-		    DDXPointPtr    ppt,
-		    int		   offset);
-
-void
-xglGeometryAddSegment (ScreenPtr      pScreen,
-		       xglGeometryPtr pGeometry,
-		       int	      nsegInit,
-		       xSegment       *pSegInit,
-		       int	      offset);
-
-void
-xglGeometryForGlyph (ScreenPtr	    pScreen,
-		     xglGeometryPtr pGeometry,
-		     unsigned int   nGlyph,
-		     CharInfoPtr    *ppciInit,
-		     pointer	    pglyphBase);
-
-void
-xglGeometryAddTrapezoid (ScreenPtr	pScreen,
-			 xglGeometryPtr pGeometry,
-			 xTrapezoid	*pTrap,
-			 int		nTrap,
-			 int		offset);
-
-void
-xglGeometryAddTrap (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    xTrap	   *pTrap,
-		    int		   nTrap,
-		    int		   offset);
-
-xglGeometryPtr
-xglGetScratchGeometryWithSize (ScreenPtr pScreen,
-			       int	 size);
-
-xglGeometryPtr
-xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
-				     int       type,
-				     int       count);
-
-xglGeometryPtr
-xglGetScratchVertexGeometry (ScreenPtr pScreen,
-			     int       count);
-
-Bool
-xglSetGeometry (xglGeometryPtr	pGeometry,
-		glitz_surface_t *surface);
-
-
-/* xglpixmap.c */
-
-#define XGL_PIXMAP_USAGE_HINT_STREAM_DRAW  1
-#define XGL_PIXMAP_USAGE_HINT_STREAM_READ  2
-#define XGL_PIXMAP_USAGE_HINT_STREAM_COPY  3
-#define XGL_PIXMAP_USAGE_HINT_STATIC_DRAW  4
-#define XGL_PIXMAP_USAGE_HINT_STATIC_READ  5
-#define XGL_PIXMAP_USAGE_HINT_STATIC_COPY  6
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_DRAW 7
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_READ 8
-#define XGL_PIXMAP_USAGE_HINT_DYNAMIC_COPY 9
-
-#define XGL_PIXMAP_USAGE_HINT_DEFAULT XGL_PIXMAP_USAGE_HINT_STREAM_DRAW
-
-PixmapPtr
-xglCreatePixmap (ScreenPtr  pScreen,
-		 int	    width,
-		 int	    height,
-		 int	    depth,
-		 unsigned   usage_hint);
-
-void
-xglFiniPixmap (PixmapPtr pPixmap);
-
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap);
-
-Bool
-xglModifyPixmapHeader (PixmapPtr pPixmap,
-		       int	 width,
-		       int	 height,
-		       int	 depth,
-		       int	 bitsPerPixel,
-		       int	 devKind,
-		       pointer	 pPixData);
-
-void
-xglSetPixmapVisual (PixmapPtr    pPixmap,
-		    xglVisualPtr pVisual);
-
-RegionPtr
-xglPixmapToRegion (PixmapPtr pPixmap);
-
-xglGeometryPtr
-xglPixmapToGeometry (PixmapPtr pPixmap,
-		     int       xOff,
-		     int       yOff);
-
-Bool
-xglCreatePixmapSurface (PixmapPtr pPixmap);
-
-Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap, int hint);
-
-Bool
-xglMapPixmapBits (PixmapPtr pPixmap);
-
-Bool
-xglUnmapPixmapBits (PixmapPtr pPixmap);
-
-Bool
-xglCheckPixmapSize (PixmapPtr		 pPixmap,
-		    xglSizeConstraintPtr pSize);
-
-void
-xglEnablePixmapAccel (PixmapPtr	      pPixmap,
-		      xglAccelInfoPtr pAccel);
-
-
-/* xglsync.c */
-
-Bool
-xglSyncBits (DrawablePtr pDrawable,
-	     BoxPtr	 pExtents);
-
-void
-xglSyncDamageBoxBits (DrawablePtr pDrawable);
-
-Bool
-xglSyncSurface (DrawablePtr pDrawable);
-
-Bool
-xglPrepareTarget (DrawablePtr pDrawable);
-
-void
-xglAddSurfaceDamage (DrawablePtr pDrawable,
-		     RegionPtr   pRegion);
-
-void
-xglAddCurrentSurfaceDamage (DrawablePtr pDrawable);
-
-void
-xglAddBitDamage (DrawablePtr pDrawable,
-		 RegionPtr   pRegion);
-
-void
-xglAddCurrentBitDamage (DrawablePtr pDrawable);
-
-
-/* xglsolid.c */
-
-Bool
-xglSolid (DrawablePtr	   pDrawable,
-	  glitz_operator_t op,
-	  glitz_surface_t  *solid,
-	  xglGeometryPtr   pGeometry,
-	  int		   x,
-	  int		   y,
-	  int		   width,
-	  int		   height,
-	  BoxPtr	   pBox,
-	  int		   nBox);
-
-Bool
-xglSolidGlyph (DrawablePtr  pDrawable,
-	       GCPtr	    pGC,
-	       int	    x,
-	       int	    y,
-	       unsigned int nGlyph,
-	       CharInfoPtr  *ppci,
-	       pointer      pglyphBase);
-
-
-/* xgltile.c */
-
-xglGeometryPtr
-xglTiledBoxGeometry (PixmapPtr pTile,
-		     int       tileX,
-		     int       tileY,
-		     BoxPtr    pBox,
-		     int       nBox);
-
-Bool
-xglTile (DrawablePtr	  pDrawable,
-	 glitz_operator_t op,
-	 PixmapPtr	  pTile,
-	 int		  tileX,
-	 int		  tileY,
-	 xglGeometryPtr	  pGeometry,
-	 int		  x,
-	 int		  y,
-	 int		  width,
-	 int		  height,
-	 BoxPtr		  pBox,
-	 int		  nBox);
-
-
-/* xglcopy.c */
-
-Bool
-xglCopy (DrawablePtr pSrc,
-	 DrawablePtr pDst,
-	 int	     dx,
-	 int	     dy,
-	 BoxPtr	     pBox,
-	 int	     nBox);
-
-void
-xglCopyProc (DrawablePtr pSrc,
-	     DrawablePtr pDst,
-	     GCPtr	 pGC,
-	     BoxPtr	 pBox,
-	     int	 nBox,
-	     int	 dx,
-	     int	 dy,
-	     Bool	 reverse,
-	     Bool	 upsidedown,
-	     Pixel	 bitplane,
-	     void	 *closure);
-
-
-/* xglfill.c */
-
-Bool
-xglFill (DrawablePtr	pDrawable,
-	 GCPtr		pGC,
-	 xglGeometryPtr pGeometry,
-	 int		x,
-	 int		y,
-	 int		width,
-	 int		height,
-	 BoxPtr		pBox,
-	 int		nBox);
-
-void
-xglFillSpan (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 n,
-	     DDXPointPtr ppt,
-	     int	 *pwidth);
-
-void
-xglFillRect (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 nrect,
-	     xRectangle  *prect);
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
-	     GCPtr       pGC,
-	     int	 mode,
-	     int	 npt,
-	     DDXPointPtr ppt);
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    nsegInit,
-		xSegment    *pSegInit);
-
-Bool
-xglFillGlyph (DrawablePtr  pDrawable,
-	      GCPtr	   pGC,
-	      int	   x,
-	      int	   y,
-	      unsigned int nglyph,
-	      CharInfoPtr  *ppciInit,
-	      pointer      pglyphBase);
-
-
-/* xglwindow.c */
-
-Bool
-xglCreateWindow (WindowPtr pWin);
-
-Bool
-xglDestroyWindow (WindowPtr pWin);
-
-Bool
-xglChangeWindowAttributes (WindowPtr	 pWin,
-			   unsigned long mask);
-
-void
-xglCopyWindow (WindowPtr   pWin,
-	       DDXPointRec ptOldOrg,
-	       RegionPtr   prgnSrc);
-
-PixmapPtr
-xglGetWindowPixmap (WindowPtr pWin);
-
-void
-xglSetWindowPixmap (WindowPtr pWin,
-		    PixmapPtr pPixmap);
-
-
-/* xglget.c */
-
-void
-xglGetImage (DrawablePtr   pDrawable,
-	     int	   x,
-	     int	   y,
-	     int	   w,
-	     int	   h,
-	     unsigned int  format,
-	     unsigned long planeMask,
-	     char	   *d);
-
-void
-xglGetSpans (DrawablePtr pDrawable,
-	     int	 wMax,
-	     DDXPointPtr ppt,
-	     int	 *pwidth,
-	     int	 nspans,
-	     char	 *pchardstStart);
-
-
-/* xglgc.c */
-
-Bool
-xglCreateGC (GCPtr pGC);
-
-void
-xglDestroyGC (GCPtr pGC);
-
-void
-xglValidateGC (GCPtr	     pGC,
-	       unsigned long changes,
-	       DrawablePtr   pDrawable);
-
-void
-xglFillSpans  (DrawablePtr pDrawable,
-	       GCPtr	   pGC,
-	       int	   nspans,
-	       DDXPointPtr ppt,
-	       int	   *pwidth,
-	       int	   fSorted);
-
-void
-xglSetSpans (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     char	 *psrc,
-	     DDXPointPtr ppt,
-	     int	 *pwidth,
-	     int	 nspans,
-	     int	 fSorted);
-
-void
-xglPutImage (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 depth,
-	     int	 x,
-	     int	 y,
-	     int	 w,
-	     int	 h,
-	     int	 leftPad,
-	     int	 format,
-	     char	 *bits);
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
-	     DrawablePtr pDst,
-	     GCPtr	 pGC,
-	     int	 srcX,
-	     int	 srcY,
-	     int	 w,
-	     int	 h,
-	     int	 dstX,
-	     int	 dstY);
-
-RegionPtr
-xglCopyPlane (DrawablePtr   pSrc,
-	      DrawablePtr   pDst,
-	      GCPtr	    pGC,
-	      int	    srcX,
-	      int	    srcY,
-	      int	    w,
-	      int	    h,
-	      int	    dstX,
-	      int	    dstY,
-	      unsigned long bitPlane);
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
-	      GCPtr       pGC,
-	      int	  mode,
-	      int	  npt,
-	      DDXPointPtr pptInit);
-
-void
-xglPolylines (DrawablePtr pDrawable,
-	      GCPtr       pGC,
-	      int	  mode,
-	      int	  npt,
-	      DDXPointPtr ppt);
-
-void
-xglPolySegment (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    nsegInit,
-		xSegment    *pSegInit);
-
-void
-xglPolyArc (DrawablePtr pDrawable,
-	    GCPtr	pGC,
-	    int		narcs,
-	    xArc	*pArcs);
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
-		 GCPtr	     pGC,
-		 int	     nrect,
-		 xRectangle  *prect);
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    narcs,
-		xArc	    *pArcs);
-
-void
-xglImageGlyphBlt (DrawablePtr  pDrawable,
-		  GCPtr	       pGC,
-		  int	       x,
-		  int	       y,
-		  unsigned int nglyph,
-		  CharInfoPtr  *ppci,
-		  pointer      pglyphBase);
-
-void
-xglPolyGlyphBlt (DrawablePtr  pDrawable,
-		 GCPtr	      pGC,
-		 int	      x,
-		 int	      y,
-		 unsigned int nglyph,
-		 CharInfoPtr  *ppci,
-		 pointer      pglyphBase);
-void
-xglPushPixels (GCPtr	   pGC,
-	       PixmapPtr   pBitmap,
-	       DrawablePtr pDrawable,
-	       int	   w,
-	       int	   h,
-	       int	   x,
-	       int	   y);
-
-
-#ifdef MITSHM
-
-/* xglshm.c */
-
-void
-xglShmPutImage (DrawablePtr  pDrawable,
-		GCPtr	     pGC,
-		int	     depth,
-		unsigned int format,
-		int	     w,
-		int	     h,
-		int	     sx,
-		int	     sy,
-		int	     sw,
-		int	     sh,
-		int	     dx,
-		int	     dy,
-		char	     *data);
-
-#endif
-
-
-#ifdef RENDER
-
-/* xglpict.c */
-
-void
-xglComposite (CARD8	 op,
-	      PicturePtr pSrc,
-	      PicturePtr pMask,
-	      PicturePtr pDst,
-	      INT16	 xSrc,
-	      INT16	 ySrc,
-	      INT16	 xMask,
-	      INT16	 yMask,
-	      INT16	 xDst,
-	      INT16	 yDst,
-	      CARD16	 width,
-	      CARD16	 height);
-
-void
-xglAddTriangles (PicturePtr pDst,
-		 INT16	    xOff,
-		 INT16	    yOff,
-		 int	    ntri,
-		 xTriangle  *tris);
-
-void
-xglChangePicture (PicturePtr pPicture,
-		  Mask	     mask);
-
-int
-xglChangePictureTransform (PicturePtr    pPicture,
-			   PictTransform *transform);
-
-int
-xglChangePictureFilter (PicturePtr pPicture,
-			int	   filter,
-			xFixed	   *params,
-			int	   nparams);
-
-PicturePtr
-xglCreateDevicePicture (pointer data);
-
-Bool
-xglSyncPicture (ScreenPtr  pScreen,
-		PicturePtr pPicture,
-		INT16	   x,
-		INT16	   y,
-		CARD16	   width,
-		CARD16	   height,
-		INT16	   *xOff,
-		INT16	   *yOff);
-
-Bool
-xglPictureInit (ScreenPtr pScreen);
-
-void
-xglPictureClipExtents (PicturePtr pPicture,
-		       BoxPtr     extents);
-
-
-/* xglcompose.c */
-
-Bool
-xglCompositeGeneral (CARD8	     op,
-		     PicturePtr	     pSrc,
-		     PicturePtr	     pMask,
-		     PicturePtr	     pDst,
-		     xglGeometryPtr  pGeometry,
-		     INT16	     xSrc,
-		     INT16	     ySrc,
-		     INT16	     xMask,
-		     INT16	     yMask,
-		     INT16	     xDst,
-		     INT16	     yDst,
-		     CARD16	     width,
-		     CARD16	     height);
-
-
-/* xglglyph.c */
-
-Bool
-xglRealizeGlyph (ScreenPtr pScreen,
-		 GlyphPtr  pGlyph);
-
-void
-xglUnrealizeGlyph (ScreenPtr pScreen,
-		   GlyphPtr  pGlyph);
-
-Bool
-xglInitGlyphCache (xglGlyphCachePtr pCache,
-		   ScreenPtr	    pScreen,
-		   PictFormatPtr    format);
-
-void
-xglFiniGlyphCache (xglGlyphCachePtr pCache);
-
-void
-xglGlyphs (CARD8	 op,
-	   PicturePtr	 pSrc,
-	   PicturePtr	 pDst,
-	   PictFormatPtr maskFormat,
-	   INT16	 xSrc,
-	   INT16	 ySrc,
-	   int		 nlist,
-	   GlyphListPtr	 list,
-	   GlyphPtr	 *glyphs);
-
-
-/* xgltrap.c */
-
-void
-xglTrapezoids (CARD8	     op,
-	       PicturePtr    pSrc,
-	       PicturePtr    pDst,
-	       PictFormatPtr maskFormat,
-	       INT16	     xSrc,
-	       INT16	     ySrc,
-	       int	     nTrap,
-	       xTrapezoid    *traps);
-
-void
-xglAddTraps (PicturePtr pDst,
-	     INT16	xOff,
-	     INT16	yOff,
-	     int	nTrap,
-	     xTrap	*traps);
-
-#endif
-
-#ifdef XGL_MODULAR
-
-/* xglloader.c */
-
-typedef struct _xglSymbol {
-    void       **ptr;
-    const char *name;
-} xglSymbolRec, *xglSymbolPtr;
-
-void *
-xglLoadModule (const char *name,
-	       int	  flag);
-
-void
-xglUnloadModule (void *handle);
-
-Bool
-xglLookupSymbols (void         *handle,
-		  xglSymbolPtr sym,
-		  int	       nSym);
-
-#endif
-
-
-/* xglxv.c */
-
-#ifdef XV
-
-Bool
-xglXvScreenInit (ScreenPtr pScreen);
-
-#endif
-
-
-/* xglhash.c */
-
-typedef struct _xglHashTable *xglHashTablePtr;
-
-Bool
-xglLoadHashFuncs (void *handle);
-
-xglHashTablePtr
-xglNewHashTable (void);
-
-void
-xglDeleteHashTable (xglHashTablePtr pTable);
-
-void *
-xglHashLookup (const xglHashTablePtr pTable,
-	       unsigned int	     key);
-
-void
-xglHashInsert (xglHashTablePtr pTable,
-	       unsigned int    key,
-	       void	       *data);
-
-void
-xglHashRemove (xglHashTablePtr pTable,
-	       unsigned int    key);
-
-unsigned int
-xglHashFirstEntry (xglHashTablePtr pTable);
-
-unsigned int
-xglHashNextEntry (const xglHashTablePtr pTable,
-		  unsigned int		key);
-
-unsigned int
-xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
-			 unsigned int	 numKeys);
-
-#endif /* _XGL_H_ */
diff --git a/hw/xgl/xglarea.c b/hw/xgl/xglarea.c
deleted file mode 100644
index cdf652d..0000000
--- a/hw/xgl/xglarea.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-static Bool
-xglAreaMoveIn (xglAreaPtr pArea,
-	       pointer	  closure)
-{
-    pArea->closure = closure;
-    pArea->state   = xglAreaOccupied;
-
-    return (*pArea->pRoot->funcs->MoveIn) (pArea, closure);
-}
-
-static void
-xglAreaMoveOut (xglAreaPtr pArea)
-{
-    (*pArea->pRoot->funcs->MoveOut) (pArea, pArea->closure);
-
-    pArea->closure = (pointer) 0;
-    pArea->state   = xglAreaAvailable;
-}
-
-static xglAreaPtr
-xglAreaCreate (xglRootAreaPtr pRoot,
-	       int	      level,
-	       int	      x,
-	       int	      y,
-	       int	      width,
-	       int	      height)
-{
-    xglAreaPtr pArea;
-    int	       n = 4;
-
-    pArea = xalloc (sizeof (xglAreaRec) + pRoot->devPrivateSize);
-    if (!pArea)
-	return NULL;
-
-    pArea->level   = level;
-    pArea->x	   = x;
-    pArea->y	   = y;
-    pArea->width   = width;
-    pArea->height  = height;
-    pArea->pRoot   = pRoot;
-    pArea->closure = (pointer) 0;
-    pArea->state   = xglAreaAvailable;
-
-    while (n--)
-	pArea->pArea[n] = NULL;
-
-    if (pRoot->devPrivateSize)
-	pArea->devPrivate.ptr = pArea + 1;
-    else
-	pArea->devPrivate.ptr = (pointer) 0;
-
-    if (!(*pArea->pRoot->funcs->Create) (pArea))
-    {
-	free (pArea);
-	return NULL;
-    }
-
-    return pArea;
-}
-
-static void
-xglAreaDestroy (xglAreaPtr pArea)
-{
-    if (!pArea)
-	return;
-
-    if (pArea->state == xglAreaOccupied)
-    {
-	xglAreaMoveOut (pArea);
-    }
-    else
-    {
-	int n = 4;
-
-	while (n--)
-	    xglAreaDestroy (pArea->pArea[n]);
-    }
-
-    xfree (pArea);
-}
-
-static xglAreaPtr
-xglAreaGetTopScoredSubArea (xglAreaPtr pArea)
-{
-    if (!pArea)
-	return NULL;
-
-    switch (pArea->state) {
-    case xglAreaOccupied:
-	return pArea;
-    case xglAreaAvailable:
-	break;
-    case xglAreaDivided: {
-	xglAreaPtr tmp, top = NULL;
-	int	   i;
-
-	for (i = 0; i < 4; i++)
-	{
-	    tmp = xglAreaGetTopScoredSubArea (pArea->pArea[i]);
-	    if (tmp && top)
-	    {
-		if ((*pArea->pRoot->funcs->CompareScore) (tmp,
-							  tmp->closure,
-							  top->closure) > 0)
-		    top = tmp;
-	    }
-	    else if (tmp)
-	    {
-		top = tmp;
-	    }
-	}
-	return top;
-    }
-    }
-
-    return NULL;
-}
-
-static Bool
-xglAreaFind (xglAreaPtr pArea,
-	     int	width,
-	     int	height,
-	     Bool	kickOut,
-	     pointer	closure)
-{
-    if (pArea->width < width || pArea->height < height)
-	return FALSE;
-
-    switch (pArea->state) {
-    case xglAreaOccupied:
-	if (kickOut)
-	{
-	    if ((*pArea->pRoot->funcs->CompareScore) (pArea,
-						      pArea->closure,
-						      closure) >= 0)
-		return FALSE;
-
-	    xglAreaMoveOut (pArea);
-	} else
-	    return FALSE;
-
-    /* fall-through */
-    case xglAreaAvailable:
-    {
-	if (pArea->level == pArea->pRoot->maxLevel ||
-	    (pArea->width == width && pArea->height == height))
-	{
-	    if (xglAreaMoveIn (pArea, closure))
-		return TRUE;
-	}
-	else
-	{
-	    int dx[4], dy[4], w[4], h[4], i;
-
-	    dx[0] = dx[2] = dy[0] = dy[1] = 0;
-
-	    w[0] = w[2] = dx[1] = dx[3] = width;
-	    h[0] = h[1] = dy[2] = dy[3] = height;
-
-	    w[1] = w[3] = pArea->width - width;
-	    h[2] = h[3] = pArea->height - height;
-
-	    for (i = 0; i < 2; i++)
-	    {
-		if (w[i])
-		    pArea->pArea[i] =
-			xglAreaCreate (pArea->pRoot,
-				       pArea->level + 1,
-				       pArea->x + dx[i],
-				       pArea->y + dy[i],
-				       w[i], h[i]);
-	    }
-
-	    for (; i < 4; i++)
-	    {
-		if (w[i] && h[i])
-		    pArea->pArea[i] =
-			xglAreaCreate (pArea->pRoot,
-				       pArea->level + 1,
-				       pArea->x + dx[i],
-				       pArea->y + dy[i],
-				       w[i], h[i]);
-	    }
-
-	    pArea->state = xglAreaDivided;
-
-	    if (xglAreaFind (pArea->pArea[0], width, height, kickOut, closure))
-		return TRUE;
-	}
-    } break;
-    case xglAreaDivided:
-    {
-	xglAreaPtr topArea;
-	int	   i, rejected = FALSE;
-
-	for (i = 0; i < 4; i++)
-	{
-	    if (pArea->pArea[i])
-	    {
-		if (pArea->pArea[i]->width >= width &&
-		    pArea->pArea[i]->height >= height)
-		{
-		    if (xglFindArea (pArea->pArea[i], width, height, kickOut,
-				     closure))
-			return TRUE;
-
-		    rejected = TRUE;
-		}
-	    }
-	}
-
-	if (rejected)
-	    return FALSE;
-
-	topArea = xglAreaGetTopScoredSubArea (pArea);
-	if (topArea)
-	{
-	    if (kickOut)
-	    {
-		if ((*pArea->pRoot->funcs->CompareScore) (topArea,
-							  topArea->closure,
-							  closure) >= 0)
-		    return FALSE;
-	    } else
-		return FALSE;
-	}
-
-	for (i = 0; i < 4; i++)
-	{
-	    xglAreaDestroy (pArea->pArea[i]);
-	    pArea->pArea[i] = NULL;
-	}
-
-	pArea->closure = (pointer) 0;
-	pArea->state   = xglAreaAvailable;
-	if (xglFindArea (pArea, width, height, TRUE, closure))
-	    return TRUE;
-
-    } break;
-    }
-
-    return FALSE;
-}
-
-Bool
-xglRootAreaInit (xglRootAreaPtr	    pRoot,
-		 int		    maxLevel,
-		 int		    width,
-		 int		    height,
-		 int		    devPrivateSize,
-		 xglAreaFuncsPtr    funcs,
-		 pointer	    closure)
-{
-    pRoot->maxLevel	  = maxLevel;
-    pRoot->funcs	  = funcs;
-    pRoot->devPrivateSize = devPrivateSize;
-    pRoot->closure	  = closure;
-
-    pRoot->pArea = xglAreaCreate (pRoot, 0, 0, 0, width, height);
-    if (!pRoot->pArea)
-	return FALSE;
-
-    return TRUE;
-}
-
-void
-xglRootAreaFini (xglRootAreaPtr pRoot)
-{
-    xglAreaDestroy (pRoot->pArea);
-}
-
-void
-xglLeaveArea (xglAreaPtr pArea)
-{
-    xglAreaMoveOut (pArea);
-}
-
-void
-xglWithdrawArea (xglAreaPtr pArea)
-{
-    pArea->closure = NULL;
-    pArea->state   = xglAreaAvailable;
-}
-
-Bool
-xglFindArea (xglAreaPtr pArea,
-	     int	width,
-	     int	height,
-	     Bool	kickOut,
-	     pointer	closure)
-{
-    if (width < 1 || height < 0)
-	return FALSE;
-
-    return xglAreaFind (pArea, width, height, kickOut, closure);
-}
diff --git a/hw/xgl/xglcmap.c b/hw/xgl/xglcmap.c
deleted file mode 100644
index b96308d..0000000
--- a/hw/xgl/xglcmap.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "colormapst.h"
-#include "micmap.h"
-#include "fb.h"
-
-static xglPixelFormatRec xglPixelFormats[] = {
-    {
-	8, 8,
-	{
-	    8,
-	    0x000000ff,
-	    0x00000000,
-	    0x00000000,
-	    0x00000000
-	}
-    }, {
-	15, 5,
-	{
-	    16,
-	    0x00000000,
-	    0x00007c00,
-	    0x000003e0,
-	    0x0000001f
-	}
-    }, {
-	16, 6,
-	{
-	    16,
-	    0x00000000,
-	    0x0000f800,
-	    0x000007e0,
-	    0x0000001f
-	}
-    }, {
-	24, 8,
-	{
-	    32,
-	    0x00000000,
-	    0x00ff0000,
-	    0x0000ff00,
-	    0x000000ff
-	}
-    }, {
-	32, 8,
-	{
-	    32,
-	    0xff000000,
-	    0x00ff0000,
-	    0x0000ff00,
-	    0x000000ff
-	}
-    }
-};
-
-#define NUM_XGL_PIXEL_FORMATS				     \
-    (sizeof (xglPixelFormats) / sizeof (xglPixelFormats[0]))
-
-xglVisualPtr xglVisuals = NULL;
-
-void
-xglSetVisualTypes (int depth,
-		   int visuals,
-		   int redSize,
-		   int greenSize,
-		   int blueSize)
-{
-    xglPixelFormatPtr pBestFormat = 0;
-    int		      i, rs, gs, bs, diff, bestDiff = 0;
-
-    for (i = 0; i < NUM_XGL_PIXEL_FORMATS; i++)
-    {
-	if (xglPixelFormats[i].depth == depth)
-	{
-	    if (visuals)
-	    {
-		rs = Ones (xglPixelFormats[i].masks.red_mask);
-		gs = Ones (xglPixelFormats[i].masks.green_mask);
-		bs = Ones (xglPixelFormats[i].masks.blue_mask);
-
-		if (redSize   >= rs &&
-		    greenSize >= gs &&
-		    blueSize  >= bs)
-		{
-		    diff = (redSize - rs) + (greenSize - gs) + (blueSize - bs);
-		    if (pBestFormat)
-		    {
-			if (diff < bestDiff)
-			{
-			    pBestFormat = &xglPixelFormats[i];
-			    bestDiff = diff;
-			}
-		    }
-		    else
-		    {
-			pBestFormat = &xglPixelFormats[i];
-			bestDiff = diff;
-		    }
-		}
-	    }
-	    else
-	    {
-		pBestFormat = &xglPixelFormats[i];
-		break;
-	    }
-	}
-    }
-
-    if (pBestFormat)
-    {
-	xglVisualPtr new, *prev, v;
-	unsigned int bitsPerRGB;
-	Pixel	     rm, gm, bm;
-
-	new = xalloc (sizeof (xglVisualRec));
-	if (!new)
-	    return;
-
-	new->next = 0;
-
-	new->format.surface  = 0;
-	new->format.drawable = 0;
-	new->pPixel	     = pBestFormat;
-	new->vid	     = 0;
-
-	bitsPerRGB = pBestFormat->bitsPerRGB;
-
-	rm = pBestFormat->masks.red_mask;
-	gm = pBestFormat->masks.green_mask;
-	bm = pBestFormat->masks.blue_mask;
-
-	fbSetVisualTypesAndMasks (depth, visuals, bitsPerRGB, rm, gm, bm);
-
-	for (prev = &xglVisuals; (v = *prev); prev = &v->next);
-	*prev = new;
-    }
-    else
-    {
-	fbSetVisualTypesAndMasks (depth, 0, 0, 0, 0, 0);
-    }
-}
-
-Bool
-xglHasVisualTypes (xglVisualPtr pVisual,
-		   int		depth)
-{
-    xglVisualPtr v;
-
-    for (v = pVisual; v; v = v->next)
-	if (v->pPixel->depth == depth)
-	    return TRUE;
-
-    return FALSE;
-}
-
-glitz_format_t *
-xglFindBestSurfaceFormat (ScreenPtr         pScreen,
-			  xglPixelFormatPtr pPixel)
-{
-    glitz_format_t templ, *format, *best = 0;
-    unsigned int   mask;
-    unsigned short rs, gs, bs, as;
-    int	           i = 0;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    rs = Ones (pPixel->masks.red_mask);
-    gs = Ones (pPixel->masks.green_mask);
-    bs = Ones (pPixel->masks.blue_mask);
-    as = Ones (pPixel->masks.alpha_mask);
-
-    templ.color.fourcc = GLITZ_FOURCC_RGB;
-    mask = GLITZ_FORMAT_FOURCC_MASK;
-
-    do {
-	format = glitz_find_format (pScreenPriv->drawable, mask, &templ, i++);
-	if (format)
-	{
-	    if (format->color.red_size   >= rs &&
-		format->color.green_size >= gs &&
-		format->color.blue_size  >= bs &&
-		format->color.alpha_size >= as)
-	    {
-		if (best)
-		{
-		    if (((format->color.red_size   - rs) +
-			 (format->color.green_size - gs) +
-			 (format->color.blue_size  - bs)) <
-			((best->color.red_size   - rs) +
-			 (best->color.green_size - gs) +
-			 (best->color.blue_size  - bs)))
-			best = format;
-		}
-		else
-		{
-		    best = format;
-		}
-	    }
-	}
-    } while (format);
-
-    return best;
-}
-
-static Bool
-xglInitVisual (ScreenPtr	 pScreen,
-	       xglVisualPtr	 pVisual,
-	       xglPixelFormatPtr pPixel,
-	       VisualID		 vid)
-{
-    glitz_format_t *format;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    format = xglFindBestSurfaceFormat (pScreen, pPixel);
-    if (format)
-    {
-	glitz_drawable_format_t templ;
-	unsigned long	        mask;
-
-	templ.color        = format->color;
-	templ.depth_size   = 0;
-	templ.stencil_size = 0;
-	templ.doublebuffer = 0;
-	templ.samples      = 1;
-
-	mask =
-	    GLITZ_FORMAT_FOURCC_MASK       |
-	    GLITZ_FORMAT_RED_SIZE_MASK     |
-	    GLITZ_FORMAT_GREEN_SIZE_MASK   |
-	    GLITZ_FORMAT_BLUE_SIZE_MASK    |
-	    GLITZ_FORMAT_ALPHA_SIZE_MASK   |
-	    GLITZ_FORMAT_DEPTH_SIZE_MASK   |
-	    GLITZ_FORMAT_STENCIL_SIZE_MASK |
-	    GLITZ_FORMAT_DOUBLEBUFFER_MASK |
-	    GLITZ_FORMAT_SAMPLES_MASK;
-
-	pVisual->next	 = 0;
-	pVisual->vid	 = vid;
-	pVisual->pPixel	 = pPixel;
-	pVisual->pbuffer = FALSE;
-
-	pVisual->format.surface  = format;
-	pVisual->format.drawable =
-	    glitz_find_drawable_format (pScreenPriv->drawable,
-					mask, &templ, 0);
-
-	return TRUE;
-    }
-
-    return FALSE;
-}
-
-static Bool
-xglInitPbufferVisual (ScreenPtr	        pScreen,
-		      xglVisualPtr	pVisual,
-		      xglPixelFormatPtr pPixel,
-		      VisualID		vid)
-{
-    glitz_format_t *format;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    format = xglFindBestSurfaceFormat (pScreen, pPixel);
-    if (format)
-    {
-	glitz_drawable_format_t templ, *screenFormat;
-	unsigned long	        mask;
-
-	/* use same drawable format as screen for pbuffers */
-	screenFormat = glitz_drawable_get_format (pScreenPriv->drawable);
-	templ.id = screenFormat->id;
-
-	templ.color   = format->color;
-	templ.samples = 1;
-
-	mask =
-	    GLITZ_FORMAT_ID_MASK	 |
-	    GLITZ_FORMAT_FOURCC_MASK     |
-	    GLITZ_FORMAT_RED_SIZE_MASK   |
-	    GLITZ_FORMAT_GREEN_SIZE_MASK |
-	    GLITZ_FORMAT_BLUE_SIZE_MASK  |
-	    GLITZ_FORMAT_SAMPLES_MASK;
-
-	pVisual->next	 = 0;
-	pVisual->vid	 = vid;
-	pVisual->pPixel	 = pPixel;
-	pVisual->pbuffer = TRUE;
-
-	pVisual->format.surface  = format;
-	pVisual->format.drawable =
-	    glitz_find_pbuffer_format (pScreenPriv->drawable,
-				       mask, &templ, 0);
-
-	if (pVisual->format.drawable)
-	    return TRUE;
-    }
-
-    return FALSE;
-}
-
-void
-xglInitVisuals (ScreenPtr pScreen)
-{
-    xglVisualPtr pVisual, v, new, *prev;
-    int		 i;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    for (i = 0; i < pScreen->numVisuals; i++)
-    {
-	for (pVisual = xglVisuals; pVisual; pVisual = pVisual->next)
-	    if (pVisual->pPixel->depth == pScreen->visuals[i].nplanes)
-		break;
-
-	if (pVisual)
-	{
-	    new = xalloc (sizeof (xglVisualRec));
-	    if (new)
-	    {
-		if (xglInitVisual (pScreen, new, pVisual->pPixel,
-				   pScreen->visuals[i].vid))
-		{
-		    new->next = 0;
-
-		    prev = &pScreenPriv->pVisual;
-		    while ((v = *prev))
-			prev = &v->next;
-
-		    *prev = new;
-		}
-		else
-		{
-		    xfree (new);
-		}
-	    }
-
-	    new = xalloc (sizeof (xglVisualRec));
-	    if (new)
-	    {
-		if (xglInitPbufferVisual (pScreen, new, pVisual->pPixel,
-					  pScreen->visuals[i].vid))
-		{
-		    new->next = 0;
-
-		    prev = &pScreenPriv->pVisual;
-		    while ((v = *prev))
-			prev = &v->next;
-
-		    *prev = new;
-		}
-		else
-		{
-		    xfree (new);
-		}
-	    }
-	}
-    }
-
-    /* Add additional Xgl visuals for pixmap formats */
-    for (i = 0; i < screenInfo.numPixmapFormats; i++)
-    {
-	if (!xglHasVisualTypes (pScreenPriv->pVisual,
-				screenInfo.formats[i].depth))
-	{
-	    for (v = xglVisuals; v; v = v->next)
-		if (v->pPixel->depth == screenInfo.formats[i].depth)
-		    break;
-
-	    if (v)
-	    {
-		new = xalloc (sizeof (xglVisualRec));
-		if (new)
-		{
-		    if (xglInitVisual (pScreen, new, v->pPixel, 0))
-		    {
-			new->next = 0;
-
-			prev = &pScreenPriv->pVisual;
-			while ((v = *prev))
-			    prev = &v->next;
-
-			*prev = new;
-		    }
-		    else
-		    {
-			xfree (new);
-		    }
-		}
-	    }
-	}
-    }
-}
-
-xglVisualPtr
-xglFindVisualWithDepth (ScreenPtr pScreen,
-			int       depth)
-{
-    xglVisualPtr v;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    for (v = pScreenPriv->pVisual; v; v = v->next)
-    {
-	if (v->pPixel->depth == depth)
-	    return v;
-    }
-
-    return 0;
-}
-
-xglVisualPtr
-xglFindVisualWithId (ScreenPtr pScreen,
-		     int       vid)
-{
-    xglVisualPtr v;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    for (v = pScreenPriv->pVisual; v; v = v->next)
-    {
-	if (v->vid == vid)
-	    return v;
-    }
-
-    return 0;
-}
-
-void
-xglClearVisualTypes (void)
-{
-    xglVisualPtr v;
-
-    while (xglVisuals)
-    {
-	v = xglVisuals;
-	xglVisuals = v->next;
-	xfree (v);
-    }
-
-    miClearVisualTypes ();
-}
diff --git a/hw/xgl/xglcompose.c b/hw/xgl/xglcompose.c
deleted file mode 100644
index 34f7a0c..0000000
--- a/hw/xgl/xglcompose.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef RENDER
-
-static glitz_operator_t xglOperators[] = {
-    GLITZ_OPERATOR_CLEAR,
-    GLITZ_OPERATOR_SRC,
-    GLITZ_OPERATOR_DST,
-    GLITZ_OPERATOR_OVER,
-    GLITZ_OPERATOR_OVER_REVERSE,
-    GLITZ_OPERATOR_IN,
-    GLITZ_OPERATOR_IN_REVERSE,
-    GLITZ_OPERATOR_OUT,
-    GLITZ_OPERATOR_OUT_REVERSE,
-    GLITZ_OPERATOR_ATOP,
-    GLITZ_OPERATOR_ATOP_REVERSE,
-    GLITZ_OPERATOR_XOR,
-    GLITZ_OPERATOR_ADD
-};
-
-#define NUM_XGL_OPERATORS			       \
-    (sizeof (xglOperators) / sizeof (xglOperators[0]))
-
-#define XGL_OPERATOR(op) (xglOperators[op])
-
-#define XGL_GET_SOURCE_PICTURE(pPicture, outSurface)			   \
-    (outSurface) = ((pPicture)->pDrawable) ?				   \
-	XGL_GET_PIXMAP_PRIV ((PixmapPtr) (pPicture)->pDrawable)->surface : \
-	(glitz_surface_t *) (pPicture)->pSourcePict->source.devPrivate.ptr
-
-Bool
-xglCompositeGeneral (CARD8	     op,
-		     PicturePtr	     pSrc,
-		     PicturePtr	     pMask,
-		     PicturePtr	     pDst,
-		     xglGeometryPtr  pGeometry,
-		     INT16	     xSrc,
-		     INT16	     ySrc,
-		     INT16	     xMask,
-		     INT16	     yMask,
-		     INT16	     xDst,
-		     INT16	     yDst,
-		     CARD16	     width,
-		     CARD16	     height)
-{
-    ScreenPtr	    pScreen = pDst->pDrawable->pScreen;
-    INT16	    xOff, yOff;
-    glitz_surface_t *src, *mask = NULL, *dst;
-    int		    dstXoff, dstYoff;
-    RegionRec	    region;
-    BoxPtr	    pBox, pExt;
-    int		    nBox;
-
-    if (pDst->alphaMap)
-	return FALSE;
-
-    if (op >= NUM_XGL_OPERATORS)
-	return FALSE;
-
-    if (pSrc->pDrawable)
-    {
-	if (pSrc->pDrawable->type != DRAWABLE_PIXMAP)
-	    return FALSE;
-
-	if (pSrc->pDrawable->bitsPerPixel == 1)
-	    return FALSE;
-    }
-
-    if (pMask)
-    {
-       if (pMask->pDrawable)
-       {
-	   if (pMask->pDrawable->type != DRAWABLE_PIXMAP)
-	       return FALSE;
-
-	   if (pSrc->pDrawable == pMask->pDrawable && pSrc != pMask)
-	       return FALSE;
-       }
-    }
-
-    if (!xglPrepareTarget (pDst->pDrawable))
-	return FALSE;
-
-    if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-				   xSrc, ySrc, xMask, yMask,
-				   xDst, yDst, width, height))
-	return TRUE;
-
-    pBox = REGION_RECTS (&region);
-    nBox = REGION_NUM_RECTS (&region);
-    pExt = REGION_EXTENTS (pScreen, &region);
-
-    XGL_GET_DRAWABLE (pDst->pDrawable, dst, dstXoff, dstYoff);
-
-    if (!xglSyncPicture (pScreen, pSrc,
-			 pExt->x1 + xSrc - xDst,
-			 pExt->y1 + ySrc - yDst,
-			 pExt->x2 - pExt->x1,
-			 pExt->y2 - pExt->y1,
-			 &xOff, &yOff))
-    {
-	REGION_UNINIT (pScreen, &region);
-	return FALSE;
-    }
-
-    xSrc -= xOff;
-    ySrc -= yOff;
-
-    XGL_GET_SOURCE_PICTURE (pSrc, src);
-
-    if (pMask)
-    {
-	/* bitmap as mask */
-	if (pMask->pDrawable && pMask->pDrawable->bitsPerPixel == 1)
-	{
-	    if (pGeometry)
-	    {
-		REGION_UNINIT (pScreen, &region);
-		return FALSE;
-	    }
-
-	    pGeometry = xglPixmapToGeometry ((PixmapPtr) pMask->pDrawable,
-					     xDst - xMask,
-					     yDst - yMask);
-	    if (!pGeometry)
-	    {
-		REGION_UNINIT (pScreen, &region);
-		return FALSE;
-	    }
-	}
-	else
-	{
-	    if (!xglSyncPicture (pScreen, pMask,
-				 pExt->x1 + xMask - xDst,
-				 pExt->y1 + yMask - yDst,
-				 pExt->x2 - pExt->x1,
-				 pExt->y2 - pExt->y1,
-				 &xOff, &yOff))
-	    {
-		REGION_UNINIT (pScreen, &region);
-		return FALSE;
-	    }
-
-	    xMask -= xOff;
-	    yMask -= yOff;
-
-	    XGL_GET_SOURCE_PICTURE (pMask, mask);
-	}
-    }
-
-    if (!pGeometry)
-    {
-	if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
-	{
-	    if (pSrc->pDrawable && pSrc->repeatType == RepeatNormal)
-	    {
-		XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);
-
-		/* tile */
-		if (!pPixmapPriv->acceleratedTile)
-		{
-		    pGeometry =
-			xglTiledBoxGeometry ((PixmapPtr) pSrc->pDrawable,
-					     xSrc - xDst, ySrc - yDst,
-					     pBox, nBox);
-		    if (!pGeometry)
-		    {
-			REGION_UNINIT (pScreen, &region);
-			return FALSE;
-		    }
-
-		    pBox = pExt;
-		    nBox = 1;
-		}
-	    }
-	    else
-	    {
-		/* copy */
-		if (op == PictOpSrc && !mask)
-		{
-		    if (xglCopy (pSrc->pDrawable,
-				 pDst->pDrawable,
-				 xSrc - xDst,
-				 ySrc - yDst,
-				 pBox,
-				 nBox))
-		    {
-			REGION_UNINIT (pScreen, &region);
-			return TRUE;
-		    }
-		}
-	    }
-	}
-
-	if (nBox > 1)
-	{
-	    pGeometry = xglGetScratchVertexGeometry (pScreen, 4 * nBox);
-
-	    GEOMETRY_ADD_BOX (pScreen, pGeometry, pBox, nBox);
-
-	    pBox = pExt;
-	}
-
-	xSrc += pBox->x1 - xDst;
-	ySrc += pBox->y1 - yDst;
-
-	if (pMask)
-	{
-	    xMask += pBox->x1 - xDst;
-	    yMask += pBox->y1 - yDst;
-	}
-
-	xDst = pBox->x1;
-	yDst = pBox->y1;
-
-	width  = pBox->x2 - pBox->x1;
-	height = pBox->y2 - pBox->y1;
-    }
-    else
-    {
-	glitz_surface_set_clip_region (dst,
-				       dstXoff, dstYoff,
-				       (glitz_box_t *) pBox, nBox);
-    }
-
-    if (pGeometry)
-    {
-	GEOMETRY_TRANSLATE (pGeometry, dstXoff, dstYoff);
-
-	if (!GEOMETRY_ENABLE (pGeometry, dst))
-	{
-	    REGION_UNINIT (pScreen, &region);
-	    return FALSE;
-	}
-    }
-    else
-	GEOMETRY_DISABLE (dst);
-
-    glitz_composite (XGL_OPERATOR (op),
-		     src, mask, dst,
-		     xSrc, ySrc,
-		     xMask, yMask,
-		     xDst + dstXoff, yDst + dstYoff,
-		     width, height);
-
-    glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
-    REGION_UNINIT (pScreen, &region);
-
-    if (glitz_surface_get_status (dst))
-	return FALSE;
-
-    return TRUE;
-}
-
-#endif
diff --git a/hw/xgl/xglcopy.c b/hw/xgl/xglcopy.c
deleted file mode 100644
index d612b33..0000000
--- a/hw/xgl/xglcopy.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-Bool
-xglCopy (DrawablePtr pSrc,
-	 DrawablePtr pDst,
-	 int	     dx,
-	 int	     dy,
-	 BoxPtr	     pBox,
-	 int	     nBox)
-{
-    glitz_surface_t *src, *dst;
-    int		    srcXoff, srcYoff;
-    int		    dstXoff, dstYoff;
-
-    XGL_DRAWABLE_PIXMAP (pDst);
-
-    if (!nBox)
-	return TRUE;
-
-    if (xglPrepareTarget (pDst))
-    {
-	if (!xglSyncSurface (pSrc))
-	    return FALSE;
-    }
-    else
-    {
-	if (!xglPrepareTarget (pSrc))
-	    return FALSE;
-
-	if (!xglSyncSurface (pDst))
-	    return FALSE;
-    }
-
-    XGL_GET_DRAWABLE (pSrc, src, srcXoff, srcYoff);
-    XGL_GET_DRAWABLE (pDst, dst, dstXoff, dstYoff);
-
-    glitz_surface_set_clip_region (dst,
-				   dstXoff, dstYoff,
-				   (glitz_box_t *) pBox, nBox);
-
-    glitz_copy_area (src,
-		     dst,
-		     srcXoff + dx,
-		     srcYoff + dy,
-		     pPixmap->drawable.width - dstXoff,
-		     pPixmap->drawable.height - dstYoff,
-		     dstXoff,
-		     dstYoff);
-
-    glitz_surface_set_clip_region (dst, 0, 0, NULL, 0);
-
-    if (glitz_surface_get_status (dst))
-	return FALSE;
-
-    return TRUE;
-}
-
-void
-xglCopyProc (DrawablePtr pSrc,
-	     DrawablePtr pDst,
-	     GCPtr	 pGC,
-	     BoxPtr	 pBox,
-	     int	 nBox,
-	     int	 dx,
-	     int	 dy,
-	     Bool	 reverse,
-	     Bool	 upsidedown,
-	     Pixel	 bitplane,
-	     void	 *closure)
-{
-    BoxPtr pSrcBox = (BoxPtr) closure;
-
-    if (!xglCopy (pSrc, pDst, dx, dy, pBox, nBox))
-    {
-	RegionRec region;
-
-	XGL_DRAWABLE_PIXMAP (pDst);
-	XGL_PIXMAP_PRIV (pPixmap);
-
-	if (!xglSyncBits (pSrc, pSrcBox))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	if (!xglMapPixmapBits (pPixmap))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	fbCopyNtoN (pSrc, pDst, pGC,
-		    pBox, nBox,
-		    dx, dy,
-		    reverse, upsidedown, bitplane,
-		    (void *) 0);
-
-	pPixmapPriv->damageBox = miEmptyBox;
-
-	while (nBox--)
-	{
-	    REGION_INIT (pDst->pScreen, &region, pBox, 1);
-	    xglAddSurfaceDamage (pDst, &region);
-	    REGION_UNINIT (pDst->pScreen, &region);
-
-	    pBox++;
-	}
-    } else
-	xglAddCurrentBitDamage (pDst);
-}
diff --git a/hw/xgl/xglfill.c b/hw/xgl/xglfill.c
deleted file mode 100644
index 64759ab..0000000
--- a/hw/xgl/xglfill.c
+++ /dev/null
@@ -1,742 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include "fb.h"
-
-Bool
-xglFill (DrawablePtr	pDrawable,
-	 GCPtr		pGC,
-	 xglGeometryPtr pGeometry,
-	 int		x,
-	 int		y,
-	 int		width,
-	 int		height,
-	 BoxPtr		pBox,
-	 int		nBox)
-{
-    XGL_GC_PRIV (pGC);
-
-    switch (pGC->fillStyle) {
-    case FillSolid:
-	if (xglSolid (pDrawable,
-		      pGCPriv->op, pGCPriv->fg,
-		      pGeometry,
-		      x, y,
-		      width, height,
-		      pBox, nBox))
-	    return TRUE;
-	break;
-    case FillStippled:
-    case FillOpaqueStippled:
-	break;
-    case FillTiled:
-	if (xglTile (pDrawable,
-		     pGCPriv->op, pGC->tile.pixmap,
-		     -(pGC->patOrg.x + pDrawable->x),
-		     -(pGC->patOrg.y + pDrawable->y),
-		     pGeometry,
-		     x, y,
-		     width, height,
-		     pBox, nBox))
-	    return TRUE;
-	break;
-    }
-
-    return FALSE;
-}
-
-static void
-xglFillBox (DrawablePtr pDrawable,
-	    GCPtr	pGC,
-	    int		x,
-	    int		y,
-	    int		width,
-	    int		height,
-	    BoxPtr	pBox,
-	    int		nBox)
-{
-    if (!nBox)
-	return;
-
-    if (!xglFill (pDrawable, pGC, NULL, x, y, width, height, pBox, nBox))
-    {
-	RegionRec region;
-
-	XGL_DRAWABLE_PIXMAP (pDrawable);
-	XGL_PIXMAP_PRIV (pPixmap);
-
-	if (!xglMapPixmapBits (pPixmap))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	switch (pGC->fillStyle) {
-	case FillSolid:
-	    break;
-	case FillStippled:
-	case FillOpaqueStippled:
-	    if (!xglSyncBits (&pGC->stipple->drawable, NullBox))
-		FatalError (XGL_SW_FAILURE_STRING);
-	    break;
-	case FillTiled:
-	    if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox))
-		FatalError (XGL_SW_FAILURE_STRING);
-	    break;
-	}
-
-	pPixmapPriv->damageBox = miEmptyBox;
-
-	while (nBox--)
-	{
-	    fbFill (pDrawable, pGC,
-		    pBox->x1, pBox->y1,
-		    pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
-
-	    REGION_INIT (pDrawable->pScreen, &region, pBox, 1);
-	    xglAddSurfaceDamage (pDrawable, &region);
-	    REGION_UNINIT (pDrawable->pScreen, &region);
-
-	    pBox++;
-	}
-    } else
-	xglAddCurrentBitDamage (pDrawable);
-}
-
-#define N_STACK_BOX 1024
-
-static BoxPtr
-xglMoreBoxes (BoxPtr stackBox,
-	      BoxPtr heapBox,
-	      int    nBoxes)
-{
-    Bool stack = !heapBox;
-
-    heapBox = xrealloc (heapBox, sizeof (BoxRec) * nBoxes);
-    if (!heapBox)
-	return NULL;
-
-    if (stack)
-	memcpy (heapBox, stackBox, sizeof (BoxRec) * N_STACK_BOX);
-
-    return heapBox;
-}
-
-#define ADD_BOX(pBox, nBox, stackBox, heapBox, size, box)	\
-    {								\
-	if ((nBox) == (size))					\
-	{							\
-	    (size) *= 2;					\
-	    (heapBox) = xglMoreBoxes (stackBox, heapBox, size);	\
-	    if (heapBox)					\
-	    {							\
-		(pBox) = (heapBox) + (nBox);			\
-		*(pBox)++ = (box);				\
-		(nBox)++;					\
-	    }							\
-	}							\
-	else							\
-	{							\
-	    *(pBox)++ = (box);					\
-	    (nBox)++;						\
-	}							\
-    }
-
-void
-xglFillRect (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 nrect,
-	     xRectangle  *prect)
-{
-    RegionPtr pClip = pGC->pCompositeClip;
-    BoxPtr    pClipBox;
-    BoxPtr    pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
-    BoxRec    part, full;
-    BoxPtr    heapBox = NULL;
-    BoxRec    stackBox[N_STACK_BOX];
-    int       size = N_STACK_BOX;
-    BoxPtr    pBox = stackBox;
-    int	      nClip, nBox = 0;
-
-    while (nrect--)
-    {
-	full.x1 = prect->x + pDrawable->x;
-	full.y1 = prect->y + pDrawable->y;
-	full.x2 = full.x1 + (int) prect->width;
-	full.y2 = full.y1 + (int) prect->height;
-
-	prect++;
-
-	if (full.x1 < pExtent->x1)
-	    full.x1 = pExtent->x1;
-	if (full.y1 < pExtent->y1)
-	    full.y1 = pExtent->y1;
-	if (full.x2 > pExtent->x2)
-	    full.x2 = pExtent->x2;
-	if (full.y2 > pExtent->y2)
-	    full.y2 = pExtent->y2;
-
-	if (full.x1 >= full.x2 || full.y1 >= full.y2)
-	    continue;
-
-	nClip = REGION_NUM_RECTS (pClip);
-	if (nClip == 1)
-	{
-	    ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
-	}
-	else
-	{
-	    pClipBox = REGION_RECTS (pClip);
-	    while (nClip--)
-	    {
-		part = *pClipBox++;
-
-		if (part.x1 < full.x1)
-		    part.x1 = full.x1;
-		if (part.y1 < full.y1)
-		    part.y1 = full.y1;
-		if (part.x2 > full.x2)
-		    part.x2 = full.x2;
-		if (part.y2 > full.y2)
-		    part.y2 = full.y2;
-
-		if (part.x1 < part.x2 && part.y1 < part.y2)
-		    ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
-	    }
-	}
-    }
-
-    xglFillBox (pDrawable, pGC,
-		pExtent->x1, pExtent->y1,
-		pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		(heapBox) ? heapBox : stackBox, nBox);
-
-    if (heapBox)
-	xfree (heapBox);
-}
-
-void
-xglFillSpan (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 n,
-	     DDXPointPtr ppt,
-	     int	 *pwidth)
-{
-    RegionPtr pClip = pGC->pCompositeClip;
-    BoxPtr    pClipBox;
-    BoxPtr    pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
-    BoxRec    part, full;
-    BoxPtr    heapBox = NULL;
-    BoxRec    stackBox[N_STACK_BOX];
-    int       size = N_STACK_BOX;
-    BoxPtr    pBox = stackBox;
-    int	      nClip, nBox = 0;
-
-    while (n--)
-    {
-	full.x1 = ppt->x;
-	full.y1 = ppt->y;
-	full.x2 = full.x1 + *pwidth;
-	full.y2 = full.y1 + 1;
-
-	pwidth++;
-	ppt++;
-
-	if (full.x1 < pExtent->x1)
-	    full.x1 = pExtent->x1;
-	if (full.y1 < pExtent->y1)
-	    full.y1 = pExtent->y1;
-	if (full.x2 > pExtent->x2)
-	    full.x2 = pExtent->x2;
-	if (full.y2 > pExtent->y2)
-	    full.y2 = pExtent->y2;
-
-	if (full.x1 >= full.x2 || full.y1 >= full.y2)
-	    continue;
-
-	nClip = REGION_NUM_RECTS (pClip);
-	if (nClip == 1)
-	{
-	    ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
-	}
-	else
-	{
-	    pClipBox = REGION_RECTS (pClip);
-	    while (nClip--)
-	    {
-		part = *pClipBox++;
-
-		if (part.x1 < full.x1)
-		    part.x1 = full.x1;
-		if (part.y1 < full.y1)
-		    part.y1 = full.y1;
-		if (part.x2 > full.x2)
-		    part.x2 = full.x2;
-		if (part.y2 > full.y2)
-		    part.y2 = full.y2;
-
-		if (part.x1 < part.x2 && part.y1 < part.y2)
-		    ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
-	    }
-	}
-    }
-
-    xglFillBox (pDrawable, pGC,
-		pExtent->x1, pExtent->y1,
-		pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		(heapBox) ? heapBox : stackBox, nBox);
-
-    if (heapBox)
-	xfree (heapBox);
-}
-
-Bool
-xglFillLine (DrawablePtr pDrawable,
-	     GCPtr       pGC,
-	     int	 mode,
-	     int	 npt,
-	     DDXPointPtr ppt)
-{
-    RegionPtr	   pClip = pGC->pCompositeClip;
-    BoxPtr	   pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
-    Bool	   coincidentEndpoints = FALSE;
-    Bool	   horizontalAndVertical = TRUE;
-    DDXPointPtr    pptTmp;
-    int		   nptTmp;
-    DDXPointRec    pt;
-    xglGeometryPtr pGeometry;
-
-    XGL_SCREEN_PRIV (pGC->pScreen);
-
-    if (npt < 2)
-	return TRUE;
-
-    pt = *ppt;
-
-    nptTmp = npt - 1;
-    pptTmp = ppt + 1;
-
-    if (mode == CoordModePrevious)
-    {
-	while (nptTmp--)
-	{
-	    if (pptTmp->x && pptTmp->y)
-		horizontalAndVertical = FALSE;
-
-	    pt.x += pptTmp->x;
-	    pt.y += pptTmp->y;
-
-	    pptTmp++;
-	}
-
-	if (pt.x == ppt->x && pt.y == ppt->y)
-	    coincidentEndpoints = TRUE;
-    }
-    else
-    {
-	while (nptTmp--)
-	{
-	    if (pptTmp->x != pt.x && pptTmp->y != pt.y)
-	    {
-		horizontalAndVertical = FALSE;
-		break;
-	    }
-
-	    pt = *pptTmp++;
-	}
-
-	if (ppt[npt - 1].x == ppt->x && ppt[npt - 1].y == ppt->y)
-	    coincidentEndpoints = TRUE;
-    }
-
-    if (horizontalAndVertical)
-    {
-	BoxPtr pClipBox;
-	BoxRec part, full;
-	BoxPtr heapBox = NULL;
-	BoxRec stackBox[N_STACK_BOX];
-	int    size = N_STACK_BOX;
-	BoxPtr pBox = stackBox;
-	int    nClip, nBox = 0;
-	int    dx, dy;
-
-	pt = *ppt;
-
-	ppt++;
-	npt--;
-
-	while (npt--)
-	{
-	    if (mode == CoordModePrevious)
-	    {
-		dx = ppt->x;
-		dy = ppt->y;
-	    }
-	    else
-	    {
-		dx = ppt->x - pt.x;
-		dy = ppt->y - pt.y;
-	    }
-
-	    if (dx)
-	    {
-		if (dx > 0)
-		{
-		    full.x1 = pt.x + pDrawable->x;
-
-		    if (npt || coincidentEndpoints)
-			full.x2 = full.x1 + dx;
-		    else
-			full.x2 = full.x1 + dx + 1;
-		}
-		else
-		{
-		    full.x2 = pt.x + pDrawable->x + 1;
-
-		    if (npt || coincidentEndpoints)
-			full.x1 = full.x2 + dx;
-		    else
-			full.x1 = full.x2 + dx - 1;
-		}
-
-		full.y1 = pt.y + pDrawable->y;
-		full.y2 = full.y1 + 1;
-	    }
-	    else
-	    {
-		if (dy > 0)
-		{
-		    full.y1 = pt.y + pDrawable->y;
-
-		    if (npt || coincidentEndpoints)
-			full.y2 = full.y1 + dy;
-		    else
-			full.y2 = full.y1 + dy + 1;
-		}
-		else
-		{
-		    full.y2 = pt.y + pDrawable->y + 1;
-
-		    if (npt || coincidentEndpoints)
-			full.y1 = full.y2 + dy;
-		    else
-			full.y1 = full.y2 + dy - 1;
-		}
-
-		full.x1 = pt.x + pDrawable->x;
-		full.x2 = full.x1 + 1;
-	    }
-
-	    pt.x += dx;
-	    pt.y += dy;
-
-	    ppt++;
-
-	    if (full.x1 < pExtent->x1)
-		full.x1 = pExtent->x1;
-	    if (full.y1 < pExtent->y1)
-		full.y1 = pExtent->y1;
-	    if (full.x2 > pExtent->x2)
-		full.x2 = pExtent->x2;
-	    if (full.y2 > pExtent->y2)
-		full.y2 = pExtent->y2;
-
-	    if (full.x1 >= full.x2 || full.y1 >= full.y2)
-		continue;
-
-	    nClip = REGION_NUM_RECTS (pClip);
-	    if (nClip == 1)
-	    {
-		ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
-	    }
-	    else
-	    {
-		pClipBox = REGION_RECTS (pClip);
-		while (nClip--)
-		{
-		    part = *pClipBox++;
-
-		    if (part.x1 < full.x1)
-			part.x1 = full.x1;
-		    if (part.y1 < full.y1)
-			part.y1 = full.y1;
-		    if (part.x2 > full.x2)
-			part.x2 = full.x2;
-		    if (part.y2 > full.y2)
-			part.y2 = full.y2;
-
-		    if (part.x1 < part.x2 && part.y1 < part.y2)
-			ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
-		}
-	    }
-	}
-
-	xglFillBox (pDrawable, pGC,
-		    pExtent->x1, pExtent->y1,
-		    pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		    (heapBox) ? heapBox : stackBox, nBox);
-
-	if (heapBox)
-	    xfree (heapBox);
-
-	return TRUE;
-    }
-
-    if (!pScreenPriv->lines)
-	return FALSE;
-
-    if (coincidentEndpoints)
-	npt--;
-
-    pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, npt);
-
-    GEOMETRY_ADD_LINE (pGC->pScreen, pGeometry,
-		       coincidentEndpoints, mode, npt, ppt);
-
-    if (coincidentEndpoints)
-	GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_LOOP);
-    else
-	GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINE_STRIP);
-
-    /* Lines need a 0.5 translate */
-    GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
-
-    GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
-    pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
-    if (xglFill (pDrawable, pGC, pGeometry,
-		 pExtent->x1, pExtent->y1,
-		 pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		 REGION_RECTS (pGC->pCompositeClip),
-		 REGION_NUM_RECTS (pGC->pCompositeClip)))
-    {
-	xglAddCurrentBitDamage (pDrawable);
-	return TRUE;
-    }
-
-    return FALSE;
-}
-
-Bool
-xglFillSegment (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    nSegInit,
-		xSegment    *pSegInit)
-{
-    RegionPtr	   pClip = pGC->pCompositeClip;
-    BoxPtr	   pExtent = REGION_EXTENTS (pGC->pScreen, pClip);
-    Bool	   horizontalAndVertical = TRUE;
-    xglGeometryPtr pGeometry;
-    xSegment	   *pSeg;
-    int		   nSeg;
-
-    XGL_SCREEN_PRIV (pGC->pScreen);
-
-    if (nSegInit < 1)
-	return TRUE;
-
-    pSeg = pSegInit;
-    nSeg = nSegInit;
-    while (nSeg--)
-    {
-	if (pSeg->x1 != pSeg->x2 && pSeg->y1 != pSeg->y2)
-	    horizontalAndVertical = FALSE;
-
-	pSeg++;
-    }
-
-    if (horizontalAndVertical)
-    {
-	BoxPtr pClipBox;
-	BoxRec part, full;
-	BoxPtr heapBox = NULL;
-	BoxRec stackBox[N_STACK_BOX];
-	int    size = N_STACK_BOX;
-	BoxPtr pBox = stackBox;
-	int    nClip, nBox = 0;
-
-	while (nSegInit--)
-	{
-	    if (pSegInit->x1 != pSegInit->x2)
-	    {
-		if (pSegInit->x1 < pSegInit->x2)
-		{
-		    full.x1 = pSegInit->x1;
-		    full.x2 = pSegInit->x2;
-		}
-		else
-		{
-		    full.x1 = pSegInit->x2;
-		    full.x2 = pSegInit->x1;
-		}
-
-		full.x1 += pDrawable->x;
-		full.x2 += pDrawable->x + 1;
-		full.y1  = pSegInit->y1 + pDrawable->y;
-		full.y2  = full.y1 + 1;
-	    }
-	    else
-	    {
-		if (pSegInit->y1 < pSegInit->y2)
-		{
-		    full.y1 = pSegInit->y1;
-		    full.y2 = pSegInit->y2;
-		}
-		else
-		{
-		    full.y1 = pSegInit->y2;
-		    full.y2 = pSegInit->y1;
-		}
-
-		full.y1 += pDrawable->y;
-		full.y2 += pDrawable->y + 1;
-		full.x1  = pSegInit->x1 + pDrawable->x;
-		full.x2  = full.x1 + 1;
-	    }
-
-	    pSegInit++;
-
-	    if (full.x1 < pExtent->x1)
-		full.x1 = pExtent->x1;
-	    if (full.y1 < pExtent->y1)
-		full.y1 = pExtent->y1;
-	    if (full.x2 > pExtent->x2)
-		full.x2 = pExtent->x2;
-	    if (full.y2 > pExtent->y2)
-		full.y2 = pExtent->y2;
-
-	    if (full.x1 >= full.x2 || full.y1 >= full.y2)
-		continue;
-
-	    nClip = REGION_NUM_RECTS (pClip);
-	    if (nClip == 1)
-	    {
-		ADD_BOX (pBox, nBox, stackBox, heapBox, size, full);
-	    }
-	    else
-	    {
-		pClipBox = REGION_RECTS (pClip);
-		while (nClip--)
-		{
-		    part = *pClipBox++;
-
-		    if (part.x1 < full.x1)
-			part.x1 = full.x1;
-		    if (part.y1 < full.y1)
-			part.y1 = full.y1;
-		    if (part.x2 > full.x2)
-			part.x2 = full.x2;
-		    if (part.y2 > full.y2)
-			part.y2 = full.y2;
-
-		    if (part.x1 < part.x2 && part.y1 < part.y2)
-			ADD_BOX (pBox, nBox, stackBox, heapBox, size, part);
-		}
-	    }
-	}
-
-	xglFillBox (pDrawable, pGC,
-		    pExtent->x1, pExtent->y1,
-		    pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		    (heapBox) ? heapBox : stackBox, nBox);
-
-	if (heapBox)
-	    xfree (heapBox);
-
-	return TRUE;
-    }
-
-    if (!pScreenPriv->lines)
-	return FALSE;
-
-    pGeometry = xglGetScratchVertexGeometry (pGC->pScreen, 2 * nSegInit);
-
-    GEOMETRY_ADD_SEGMENT (pGC->pScreen, pGeometry, nSegInit, pSegInit);
-
-    /* Line segments need 0.5 translate */
-    GEOMETRY_TRANSLATE_FIXED (pGeometry, 1 << 15, 1 << 15);
-    GEOMETRY_SET_VERTEX_PRIMITIVE (pGeometry, GLITZ_PRIMITIVE_LINES);
-
-    GEOMETRY_TRANSLATE (pGeometry, pDrawable->x, pDrawable->y);
-
-    if (xglFill (pDrawable, pGC, pGeometry,
-		 pExtent->x1, pExtent->y1,
-		 pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		 REGION_RECTS (pGC->pCompositeClip),
-		 REGION_NUM_RECTS (pGC->pCompositeClip)))
-    {
-	xglAddCurrentBitDamage (pDrawable);
-	return TRUE;
-    }
-
-    return FALSE;
-}
-
-Bool
-xglFillGlyph (DrawablePtr  pDrawable,
-	      GCPtr	   pGC,
-	      int	   x,
-	      int	   y,
-	      unsigned int nGlyph,
-	      CharInfoPtr  *ppci,
-	      pointer      pglyphBase)
-{
-    BoxPtr	   pExtent;
-    xglGeometryRec geometry;
-
-    if (nGlyph < 1)
-	return TRUE;
-
-    pExtent = REGION_EXTENTS (pDrawable->pScreen, pGC->pCompositeClip);
-
-    x += pDrawable->x;
-    y += pDrawable->y;
-
-    GEOMETRY_INIT (pDrawable->pScreen, &geometry,
-		   GLITZ_GEOMETRY_TYPE_BITMAP,
-		   GEOMETRY_USAGE_SYSMEM, 0);
-
-    GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
-			&geometry,
-			nGlyph,
-			ppci,
-			pglyphBase);
-
-    GEOMETRY_TRANSLATE (&geometry, x, y);
-
-    if (xglFill (pDrawable, pGC, &geometry,
-		 pExtent->x1, pExtent->y1,
-		 pExtent->x2 - pExtent->x1, pExtent->y2 - pExtent->y1,
-		 REGION_RECTS (pGC->pCompositeClip),
-		 REGION_NUM_RECTS (pGC->pCompositeClip)))
-    {
-	GEOMETRY_UNINIT (&geometry);
-	xglAddCurrentBitDamage (pDrawable);
-	return TRUE;
-    }
-
-    GEOMETRY_UNINIT (&geometry);
-    return FALSE;
-}
diff --git a/hw/xgl/xglgc.c b/hw/xgl/xglgc.c
deleted file mode 100644
index 7e7e751..0000000
--- a/hw/xgl/xglgc.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-#include "gcstruct.h"
-#include "migc.h"
-
-#define XGL_GC_OP_FALLBACK_PROLOGUE(pDrawable) \
-    xglSyncDamageBoxBits (pDrawable);	       \
-    XGL_GC_UNWRAP (funcs);		       \
-    XGL_GC_UNWRAP (ops)
-
-#define XGL_GC_OP_FALLBACK_EPILOGUE(pDrawable)	  \
-    XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs); \
-    XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);	  \
-    xglAddCurrentSurfaceDamage (pDrawable)
-
-#define XGL_GC_FILL_OP_FALLBACK_PROLOGUE(pDrawable)		 \
-    switch (pGC->fillStyle) {					 \
-    case FillSolid:						 \
-	break;							 \
-    case FillStippled:						 \
-    case FillOpaqueStippled:					 \
-	if (!xglSyncBits (&pGC->stipple->drawable, NullBox))	 \
-	    FatalError (XGL_SW_FAILURE_STRING);			 \
-	break;							 \
-    case FillTiled:						 \
-	if (!xglSyncBits (&pGC->tile.pixmap->drawable, NullBox)) \
-	    FatalError (XGL_SW_FAILURE_STRING);			 \
-	break;							 \
-    }								 \
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable)
-
-static const GCFuncs xglGCFuncs = {
-    xglValidateGC,
-    miChangeGC,
-    miCopyGC,
-    xglDestroyGC,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip
-};
-
-static const GCOps xglGCOps = {
-    xglFillSpans,
-    xglSetSpans,
-    xglPutImage,
-    xglCopyArea,
-    xglCopyPlane,
-    xglPolyPoint,
-    xglPolylines,
-    xglPolySegment,
-    miPolyRectangle,
-    xglPolyArc,
-    miFillPolygon,
-    xglPolyFillRect,
-    xglPolyFillArc,
-    miPolyText8,
-    miPolyText16,
-    miImageText8,
-    miImageText16,
-    xglImageGlyphBlt,
-    xglPolyGlyphBlt,
-    xglPushPixels
-};
-
-void
-xglFillSpans (DrawablePtr pDrawable,
-	      GCPtr	  pGC,
-	      int	  nspans,
-	      DDXPointPtr ppt,
-	      int	  *pwidth,
-	      int	  fSorted)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (pGCPriv->flags || pGC->fillStyle == FillStippled)
-    {
-	XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->FillSpans) (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    }
-    else
-    {
-	/* xglFillSpan handles fall-back */
-	xglFillSpan (pDrawable, pGC, nspans, ppt, pwidth);
-    }
-}
-
-void
-xglSetSpans (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     char	 *psrc,
-	     DDXPointPtr ppt,
-	     int	 *pwidth,
-	     int	 nspans,
-	     int	 fSorted)
-{
-    XGL_GC_PRIV (pGC);
-
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPutImage (DrawablePtr pDrawable,
-	     GCPtr	 pGC,
-	     int	 depth,
-	     int	 x,
-	     int	 y,
-	     int	 w,
-	     int	 h,
-	     int	 leftPad,
-	     int	 format,
-	     char	 *bits)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (pGC->alu != GXcopy || (pGCPriv->flags & xglGCPlaneMaskFlag))
-    {
-	XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->PutImage) (pDrawable, pGC, depth,
-			       x, y, w, h, leftPad, format, bits);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    }
-    else
-    {
-	RegionPtr pClip = pGC->pCompositeClip;
-	RegionRec region;
-	BoxRec	  box;
-
-	XGL_DRAWABLE_PIXMAP (pDrawable);
-
-	if (!xglMapPixmapBits (pPixmap))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	XGL_GC_UNWRAP (funcs);
-	XGL_GC_UNWRAP (ops);
-
-	(*pGC->ops->PutImage) (pDrawable, pGC, depth,
-			       x, y, w, h, leftPad, format, bits);
-
-	XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
-	XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
-	box.x1 = pDrawable->x + x;
-	box.y1 = pDrawable->y + y;
-	box.x2 = box.x1 + w;
-	box.y2 = box.y1 + h;
-
-	REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-	REGION_INTERSECT (pDrawable->pScreen, &region, pClip, &region);
-
-	xglAddSurfaceDamage (pDrawable, &region);
-
-	REGION_UNINIT (pDrawable->pScreen, &region);
-    }
-}
-
-RegionPtr
-xglCopyArea (DrawablePtr pSrc,
-	     DrawablePtr pDst,
-	     GCPtr	 pGC,
-	     int	 srcX,
-	     int	 srcY,
-	     int	 w,
-	     int	 h,
-	     int	 dstX,
-	     int	 dstY)
-{
-    RegionPtr pRegion;
-    BoxRec    box;
-
-    XGL_GC_PRIV (pGC);
-
-    box.x1 = pSrc->x + srcX;
-    box.y1 = pSrc->y + srcY;
-    box.x2 = box.x1 + w;
-    box.y2 = box.y1 + h;
-
-    if (pGC->alu != GXcopy || pGCPriv->flags)
-    {
-	if (!xglSyncBits (pSrc, &box))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
-	pRegion = (*pGC->ops->CopyArea) (pSrc, pDst, pGC,
-					 srcX, srcY, w, h, dstX, dstY);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
-    }
-    else
-    {
-	/* xglCopyProc handles fall-back */
-	pRegion = fbDoCopy (pSrc, pDst, pGC,
-			    srcX, srcY,
-			    w, h,
-			    dstX, dstY,
-			    xglCopyProc, 0,
-			    (void *) &box);
-    }
-
-    return pRegion;
-}
-
-RegionPtr
-xglCopyPlane (DrawablePtr   pSrc,
-	      DrawablePtr   pDst,
-	      GCPtr	    pGC,
-	      int	    srcX,
-	      int	    srcY,
-	      int	    w,
-	      int	    h,
-	      int	    dstX,
-	      int	    dstY,
-	      unsigned long bitPlane)
-{
-    RegionPtr pRegion;
-    BoxRec    box;
-
-    XGL_GC_PRIV (pGC);
-
-    box.x1 = pSrc->x + srcX;
-    box.y1 = pSrc->y + srcY;
-    box.x2 = box.x1 + w;
-    box.y2 = box.y1 + h;
-
-    if (!xglSyncBits (pSrc, &box))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDst);
-    pRegion = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC,
-				      srcX, srcY, w, h, dstX, dstY,
-				      bitPlane);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDst);
-
-    return pRegion;
-}
-
-void
-xglPolyPoint (DrawablePtr pDrawable,
-	      GCPtr       pGC,
-	      int	  mode,
-	      int	  npt,
-	      DDXPointPtr pptInit)
-{
-    XGL_GC_PRIV (pGC);
-
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolylines (DrawablePtr pDrawable,
-	      GCPtr       pGC,
-	      int	  mode,
-	      int	  npt,
-	      DDXPointPtr ppt)
-{
-    if (pGC->lineWidth == 0)
-    {
-	XGL_GC_PRIV (pGC);
-
-	if (!pGCPriv->flags)
-	{
-	    if (pGC->lineStyle == LineSolid)
-	    {
-		if (xglFillLine (pDrawable, pGC, mode, npt, ppt))
-		    return;
-	    }
-	}
-
-	XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    }
-    else
-    {
-	if (pGC->lineStyle != LineSolid)
-	    miWideDash (pDrawable, pGC, mode, npt, ppt);
-	else
-	    miWideLine (pDrawable, pGC, mode, npt, ppt);
-    }
-}
-
-void
-xglPolySegment (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    nsegInit,
-		xSegment    *pSegInit)
-{
-    if (pGC->lineWidth == 0)
-    {
-	XGL_GC_PRIV (pGC);
-
-	if (!pGCPriv->flags)
-	{
-	    if (pGC->lineStyle == LineSolid)
-	    {
-		if (xglFillSegment (pDrawable, pGC, nsegInit, pSegInit))
-		    return;
-	    }
-	}
-
-	XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->PolySegment) (pDrawable, pGC, nsegInit, pSegInit);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    } else
-	miPolySegment (pDrawable, pGC, nsegInit, pSegInit);
-}
-
-void
-xglPolyArc (DrawablePtr pDrawable,
-	    GCPtr	pGC,
-	    int		narcs,
-	    xArc	*pArcs)
-{
-    if (pGC->lineWidth == 0)
-    {
-	XGL_GC_PRIV (pGC);
-
-	XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->PolyArc) (pDrawable, pGC, narcs, pArcs);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    } else
-	miPolyArc (pDrawable, pGC, narcs, pArcs);
-}
-
-void
-xglPolyFillRect (DrawablePtr pDrawable,
-		 GCPtr	     pGC,
-		 int	     nrect,
-		 xRectangle  *prect)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (pGC->fillStyle == FillStippled || pGCPriv->flags)
-    {
-	XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-	(*pGC->ops->PolyFillRect) (pDrawable, pGC, nrect, prect);
-	XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-    }
-    else
-    {
-	/* xglFillRect handles fall-back */
-	xglFillRect (pDrawable, pGC, nrect, prect);
-    }
-}
-
-void
-xglPolyFillArc (DrawablePtr pDrawable,
-		GCPtr	    pGC,
-		int	    narcs,
-		xArc	    *pArcs)
-{
-    XGL_GC_PRIV (pGC);
-
-    XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, pArcs);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglImageGlyphBlt (DrawablePtr  pDrawable,
-		  GCPtr	       pGC,
-		  int	       x,
-		  int	       y,
-		  unsigned int nglyph,
-		  CharInfoPtr  *ppci,
-		  pointer      pglyphBase)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (!pGCPriv->flags)
-    {
-	if (xglSolidGlyph (pDrawable,
-			   pGC,
-			   x,
-			   y,
-			   nglyph,
-			   ppci,
-			   pglyphBase))
-	    return;
-    }
-
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,
-				pglyphBase);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPolyGlyphBlt (DrawablePtr  pDrawable,
-		 GCPtr	      pGC,
-		 int	      x,
-		 int	      y,
-		 unsigned int nglyph,
-		 CharInfoPtr  *ppci,
-		 pointer      pglyphBase)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (!pGCPriv->flags)
-    {
-	if (xglFillGlyph (pDrawable,
-			  pGC,
-			  x,
-			  y,
-			  nglyph,
-			  ppci,
-			  pglyphBase))
-	    return;
-    }
-
-    XGL_GC_FILL_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-void
-xglPushPixels (GCPtr	   pGC,
-	       PixmapPtr   pBitmap,
-	       DrawablePtr pDrawable,
-	       int	   w,
-	       int	   h,
-	       int	   x,
-	       int	   y)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (!xglSyncBits (&pBitmap->drawable, NullBox))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    XGL_GC_OP_FALLBACK_PROLOGUE (pDrawable);
-    (*pGC->ops->PushPixels) (pGC, pBitmap, pDrawable, w, h, x, y);
-    XGL_GC_OP_FALLBACK_EPILOGUE (pDrawable);
-}
-
-Bool
-xglCreateGC (GCPtr pGC)
-{
-    ScreenPtr pScreen = pGC->pScreen;
-    Bool      ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_GC_PRIV (pGC);
-
-    XGL_SCREEN_UNWRAP (CreateGC);
-    ret = (*pScreen->CreateGC) (pGC);
-    XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
-
-    XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
-    XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
-    pGCPriv->flags = 0;
-    pGCPriv->op = GLITZ_OPERATOR_SRC;
-
-    pGCPriv->fg = NULL;
-    pGCPriv->bg = NULL;
-    pGCPriv->id = ~0;
-
-    return ret;
-}
-
-void
-xglDestroyGC (GCPtr pGC)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (pGCPriv->fg)
-	glitz_surface_destroy (pGCPriv->fg);
-
-    if (pGCPriv->bg)
-	glitz_surface_destroy (pGCPriv->bg);
-
-    XGL_GC_UNWRAP (funcs);
-    XGL_GC_UNWRAP (ops);
-    (*pGC->funcs->DestroyGC) (pGC);
-    XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
-    XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-}
-
-void
-xglValidateGC (GCPtr	     pGC,
-	       unsigned long changes,
-	       DrawablePtr   pDrawable)
-{
-    XGL_GC_PRIV (pGC);
-
-    if (changes & GCTile)
-    {
-	if (!pGC->tileIsPixel &&
-	    FbEvenTile (pGC->tile.pixmap->drawable.width *
-			pDrawable->bitsPerPixel))
-	    xglSyncBits (&pGC->tile.pixmap->drawable, NULL);
-    }
-
-    if (changes & GCStipple)
-    {
-	if (pGC->stipple)
-	    xglSyncBits (&pGC->stipple->drawable, NULL);
-    }
-
-    XGL_GC_UNWRAP (funcs);
-    XGL_GC_UNWRAP (ops);
-    (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable);
-    XGL_GC_WRAP (funcs, (GCFuncs *) &xglGCFuncs);
-    XGL_GC_WRAP (ops, (GCOps *) &xglGCOps);
-
-    if (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
-    {
-	XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-	if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
-	{
-	    glitz_format_t *format;
-
-	    format = pPixmapPriv->pVisual->format.surface;
-	    if (format->id != pGCPriv->id)
-	    {
-		XGL_SCREEN_PRIV (pDrawable->pScreen);
-
-		pGCPriv->flags |= xglGCSoftwareDrawableFlag;
-
-		if (pGCPriv->fg)
-		    glitz_surface_destroy (pGCPriv->fg);
-
-		pGCPriv->fg = glitz_surface_create (pScreenPriv->drawable,
-						    format, 1, 1, 0, NULL);
-		if (pGCPriv->fg)
-		    glitz_surface_set_fill (pGCPriv->fg, GLITZ_FILL_REPEAT);
-
-		if (pGCPriv->bg)
-		    glitz_surface_destroy (pGCPriv->bg);
-
-		pGCPriv->bg = glitz_surface_create (pScreenPriv->drawable,
-						    format, 1, 1, 0, NULL);
-		if (pGCPriv->bg)
-		    glitz_surface_set_fill (pGCPriv->bg, GLITZ_FILL_REPEAT);
-
-		pGCPriv->id = format->id;
-
-		if (pGCPriv->fg && pGCPriv->bg)
-		{
-		    changes |= (GCForeground | GCBackground);
-		    pGCPriv->flags &= ~xglGCSoftwareDrawableFlag;
-		}
-	    }
-	}
-	else
-	    pGCPriv->flags |= xglGCSoftwareDrawableFlag;
-    }
-
-    if (changes & GCFunction)
-    {
-	switch (pGC->alu) {
-	case GXclear:
-	    pGCPriv->op = GLITZ_OPERATOR_CLEAR;
-	    pGCPriv->flags &= ~xglGCBadFunctionFlag;
-	    break;
-	case GXcopy:
-	    pGCPriv->op = GLITZ_OPERATOR_SRC;
-	    pGCPriv->flags &= ~xglGCBadFunctionFlag;
-	    break;
-	case GXnoop:
-	    pGCPriv->op = GLITZ_OPERATOR_DST;
-	    pGCPriv->flags &= ~xglGCBadFunctionFlag;
-	    break;
-	default:
-	    pGCPriv->flags |= xglGCBadFunctionFlag;
-	    break;
-	}
-    }
-
-    if (changes & GCPlaneMask)
-    {
-	FbBits mask;
-
-	mask = FbFullMask (pDrawable->depth);
-
-	if ((pGC->planemask & mask) != mask)
-	    pGCPriv->flags |= xglGCPlaneMaskFlag;
-	else
-	    pGCPriv->flags &= ~xglGCPlaneMaskFlag;
-    }
-
-    if (!(pGCPriv->flags & xglGCSoftwareDrawableFlag))
-    {
-	if (changes & (GCForeground | GCBackground))
-	{
-	    glitz_pixel_format_t format;
-	    glitz_buffer_t	 *buffer;
-	    CARD32		 pixel;
-
-	    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-	    format.fourcc	  = GLITZ_FOURCC_RGB;
-	    format.masks	  = pPixmapPriv->pVisual->pPixel->masks;
-	    format.xoffset	  = 0;
-	    format.skip_lines     = 0;
-	    format.bytes_per_line = sizeof (CARD32);
-	    format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-
-	    buffer = glitz_buffer_create_for_data (&pixel);
-
-	    if (changes & GCForeground)
-	    {
-		pixel = pGC->fgPixel;
-		glitz_set_pixels (pGCPriv->fg, 0, 0, 1, 1, &format, buffer);
-	    }
-
-	    if (changes & GCBackground)
-	    {
-		pixel = pGC->bgPixel;
-		glitz_set_pixels (pGCPriv->bg, 0, 0, 1, 1, &format, buffer);
-	    }
-
-	    glitz_buffer_destroy (buffer);
-	}
-    }
-}
diff --git a/hw/xgl/xglgeometry.c b/hw/xgl/xglgeometry.c
deleted file mode 100644
index 7ab1ba4..0000000
--- a/hw/xgl/xglgeometry.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-
-xglDataTypeInfoRec xglGeometryDataTypes[2] = {
-    { GLITZ_DATA_TYPE_SHORT, sizeof (glitz_short_t) },
-    { GLITZ_DATA_TYPE_FLOAT, sizeof (glitz_float_t) }
-};
-
-glitz_buffer_hint_t usageTypes[] = {
-    GLITZ_BUFFER_HINT_STREAM_DRAW,
-    GLITZ_BUFFER_HINT_STATIC_DRAW,
-    GLITZ_BUFFER_HINT_DYNAMIC_DRAW
-};
-
-void
-xglGeometryResize (ScreenPtr	  pScreen,
-		   xglGeometryPtr pGeometry,
-		   int		  size)
-{
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (size == pGeometry->size)
-	return;
-
-    if (pGeometry->broken)
-	return;
-
-    if (pGeometry->usage == GEOMETRY_USAGE_SYSMEM)
-    {
-	pGeometry->data = xrealloc (pGeometry->data, size);
-
-	if (pGeometry->buffer)
-	    glitz_buffer_destroy (pGeometry->buffer);
-
-	pGeometry->buffer = NULL;
-
-	if (pGeometry->data)
-	{
-	    pGeometry->buffer = glitz_buffer_create_for_data (pGeometry->data);
-	    if (!pGeometry->buffer)
-	    {
-		pGeometry->broken = TRUE;
-		return;
-	    }
-	}
-	else if (size)
-	{
-	    pGeometry->broken = TRUE;
-	    return;
-	}
-    }
-    else
-    {
-	glitz_buffer_t *newBuffer;
-
-	if (size)
-	{
-	    newBuffer =
-		glitz_vertex_buffer_create (pScreenPriv->drawable, NULL, size,
-					    usageTypes[pGeometry->usage]);
-	    if (!newBuffer)
-	    {
-		pGeometry->broken = TRUE;
-		return;
-	    }
-	} else
-	    newBuffer = NULL;
-
-	if (pGeometry->buffer && newBuffer)
-	{
-	    void *oldData, *newData;
-
-	    oldData = glitz_buffer_map (pGeometry->buffer,
-					GLITZ_BUFFER_ACCESS_READ_ONLY);
-	    newData = glitz_buffer_map (newBuffer,
-					GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
-	    if (oldData && newData)
-		memcpy (newData, oldData, MIN (size, pGeometry->size));
-
-	    glitz_buffer_unmap (pGeometry->buffer);
-	    glitz_buffer_unmap (newBuffer);
-
-	    glitz_buffer_destroy (pGeometry->buffer);
-	}
-	pGeometry->buffer = newBuffer;
-    }
-
-    pGeometry->size = size;
-
-    if (pGeometry->endOffset > size)
-	pGeometry->endOffset = size;
-}
-
-#define MAP_GEOMETRY(pScreen, pGeometry, offset, units, ptr, _size)	  \
-    if ((pGeometry)->broken)						  \
-	return;								  \
-    (_size) = (units) * xglGeometryDataTypes[(pGeometry)->dataType].size; \
-    if (((pGeometry)->size - (offset)) < (_size))			  \
-    {									  \
-	xglGeometryResize (pScreen, pGeometry,				  \
-			   (pGeometry)->endOffset + (_size) + 500);	  \
-	if ((pGeometry)->broken)					  \
-	    return;							  \
-    }									  \
-    (ptr) = glitz_buffer_map ((pGeometry)->buffer,			  \
-			      GLITZ_BUFFER_ACCESS_WRITE_ONLY);		  \
-    if (!(ptr))								  \
-    {									  \
-	(pGeometry)->broken = TRUE;					  \
-	return;								  \
-    }									  \
-    (ptr) += (offset)
-
-#define UNMAP_GEOMETRY(pGeometry, offset, _size)			   \
-    if (glitz_buffer_unmap ((pGeometry)->buffer))			   \
-    {									   \
-	(pGeometry)->broken = TRUE;					   \
-	return;								   \
-    }									   \
-    if (((offset) + (_size)) > (pGeometry)->endOffset)			   \
-    {									   \
-	(pGeometry)->endOffset = (offset) + (_size);			   \
-	(pGeometry)->count = (pGeometry)->endOffset /			   \
-	    (2 * xglGeometryDataTypes[(pGeometry)->dataType].size);	   \
-    }
-
-/*
- * Adds a number of boxes as GL_QUAD primitives
- */
-void
-xglGeometryAddBox (ScreenPtr	  pScreen,
-		   xglGeometryPtr pGeometry,
-		   BoxPtr	  pBox,
-		   int		  nBox,
-		   int		  offset)
-{
-    int  size;
-    char *ptr;
-
-    if (nBox < 1)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, nBox * 8, ptr, size);
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-    {
-	glitz_short_t *data = (glitz_short_t *) ptr;
-
-	while (nBox--)
-	{
-	    *data++ = (glitz_short_t) pBox->x1;
-	    *data++ = (glitz_short_t) pBox->y1;
-	    *data++ = (glitz_short_t) pBox->x2;
-	    *data++ = (glitz_short_t) pBox->y1;
-	    *data++ = (glitz_short_t) pBox->x2;
-	    *data++ = (glitz_short_t) pBox->y2;
-	    *data++ = (glitz_short_t) pBox->x1;
-	    *data++ = (glitz_short_t) pBox->y2;
-
-	    pBox++;
-	}
-    } break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-
-	while (nBox--)
-	{
-	    *data++ = (glitz_float_t) pBox->x1;
-	    *data++ = (glitz_float_t) pBox->y1;
-	    *data++ = (glitz_float_t) pBox->x2;
-	    *data++ = (glitz_float_t) pBox->y1;
-	    *data++ = (glitz_float_t) pBox->x2;
-	    *data++ = (glitz_float_t) pBox->y2;
-	    *data++ = (glitz_float_t) pBox->x1;
-	    *data++ = (glitz_float_t) pBox->y2;
-
-	    pBox++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of spans as GL_LINE primitives
- */
-void
-xglGeometryAddSpan (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    DDXPointPtr	   ppt,
-		    int		   *pwidth,
-		    int		   n,
-		    int		   offset)
-{
-    int  size;
-    char *ptr;
-
-    if (n < 1)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, n * 4, ptr, size);
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-    {
-	glitz_short_t *data = (glitz_short_t *) ptr;
-
-	while (n--)
-	{
-	    *data++ = (glitz_short_t) ppt->x;
-	    *data++ = (glitz_short_t) ppt->y;
-	    *data++ = (glitz_short_t) (ppt->x + *pwidth);
-	    *data++ = (glitz_short_t) ppt->y;
-
-	    ppt++;
-	    pwidth++;
-	}
-    } break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-
-	while (n--)
-	{
-	    *data++ = (glitz_float_t) ppt->x;
-	    *data++ = (glitz_float_t) ppt->y;
-	    *data++ = (glitz_float_t) (ppt->x + *pwidth);
-	    *data++ = (glitz_float_t) ppt->y;
-
-	    ppt++;
-	    pwidth++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * This macro is needed for end pixels to be rasterized correctly using
- * OpenGL as OpenGL line segments are half-opened.
- */
-#define ADJUST_END_POINT(start, end, isPoint) \
-    (((end) > (start)) ? (end) + 1:	      \
-     ((end) < (start)) ? (end) - 1:	      \
-     (isPoint)	       ? (end) + 1:	      \
-     (end))
-
-/*
- * Adds a number of connected lines as GL_LINE_STRIP primitives
- */
-void
-xglGeometryAddLine (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    int		   loop,
-		    int		   mode,
-		    int		   npt,
-		    DDXPointPtr    ppt,
-		    int		   offset)
-{
-    DDXPointRec pt;
-    int		size;
-    char	*ptr;
-
-    if (npt < 2)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, npt * 2, ptr, size);
-
-    pt.x = 0;
-    pt.y = 0;
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-    {
-	glitz_short_t *data = (glitz_short_t *) ptr;
-
-	while (npt--)
-	{
-	    if (mode == CoordModePrevious)
-	    {
-		pt.x += ppt->x;
-		pt.y += ppt->y;
-	    }
-	    else
-	    {
-		pt.x = ppt->x;
-		pt.y = ppt->y;
-	    }
-
-	    if (npt || loop)
-	    {
-		*data++ = (glitz_short_t) pt.x;
-		*data++ = (glitz_short_t) pt.y;
-	    }
-	    else
-	    {
-		ppt--;
-		*data++ = (glitz_short_t)
-		    ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
-		*data++ = (glitz_short_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
-	    }
-
-	    ppt++;
-	}
-    } break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-
-	while (npt--)
-	{
-	    if (mode == CoordModePrevious)
-	    {
-		pt.x += ppt->x;
-		pt.y += ppt->y;
-	    }
-	    else
-	    {
-		pt.x = ppt->x;
-		pt.y = ppt->y;
-	    }
-
-	    if (npt || loop)
-	    {
-		*data++ = (glitz_float_t) pt.x;
-		*data++ = (glitz_float_t) pt.y;
-	    }
-	    else
-	    {
-		ppt--;
-		*data++ = (glitz_float_t)
-		    ADJUST_END_POINT (ppt->x, pt.x, ppt->y == pt.y);
-		*data++ = (glitz_float_t) ADJUST_END_POINT (ppt->y, pt.y, 0);
-	    }
-
-	    ppt++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of line segments as GL_LINE primitives
- */
-void
-xglGeometryAddSegment (ScreenPtr      pScreen,
-		       xglGeometryPtr pGeometry,
-		       int	      nsegInit,
-		       xSegment       *pSegInit,
-		       int	      offset)
-{
-    int  size;
-    char *ptr;
-
-    if (nsegInit < 1)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, nsegInit * 4, ptr, size);
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-    {
-	glitz_short_t *data = (glitz_short_t *) ptr;
-
-	while (nsegInit--)
-	{
-	    *data++ = (glitz_short_t) pSegInit->x1;
-	    *data++ = (glitz_short_t) pSegInit->y1;
-	    *data++ = (glitz_short_t)
-		ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
-				  pSegInit->y1 == pSegInit->y2);
-	    *data++ = (glitz_short_t)
-		ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
-	    pSegInit++;
-	}
-    } break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-
-	while (nsegInit--)
-	{
-	    *data++ = (glitz_float_t) pSegInit->x1;
-	    *data++ = (glitz_float_t) pSegInit->y1;
-	    *data++ = (glitz_float_t)
-		ADJUST_END_POINT (pSegInit->x1, pSegInit->x2,
-				  pSegInit->y1 == pSegInit->y2);
-	    *data++ = (glitz_float_t)
-		ADJUST_END_POINT (pSegInit->y1, pSegInit->y2, 0);
-
-	    pSegInit++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-void
-xglGeometryForGlyph (ScreenPtr	    pScreen,
-		     xglGeometryPtr pGeometry,
-		     unsigned int   nGlyph,
-		     CharInfoPtr    *ppciInit,
-		     pointer	    pglyphBase)
-{
-    CharInfoPtr		*ppci;
-    CharInfoPtr		pci;
-    unsigned char	*glyphbase = (pointer) ~0;
-    unsigned char	*pglyph;
-    int			x = 0;
-    int			gx, gy;
-    int			gWidth, gHeight;
-    int			n, lastX = 0, lastY = 0;
-    glitz_multi_array_t *array;
-    glitz_buffer_t	*buffer;
-
-    ppci = ppciInit;
-    n = nGlyph;
-
-    while (n--)
-    {
-	pglyph = FONTGLYPHBITS (pglyphBase, *ppci++);
-	if (pglyph < glyphbase)
-	    glyphbase = pglyph;
-    }
-
-    buffer = glitz_buffer_create_for_data (glyphbase);
-    if (!buffer)
-    {
-	pGeometry->broken = TRUE;
-	return;
-    }
-
-    GEOMETRY_SET_BUFFER (pGeometry, buffer);
-
-    array = glitz_multi_array_create (nGlyph);
-    if (!array)
-    {
-	pGeometry->broken = TRUE;
-	return;
-    }
-
-    GEOMETRY_SET_MULTI_ARRAY (pGeometry, array);
-
-    ppci = ppciInit;
-    while (nGlyph--)
-    {
-	pci = *ppci++;
-	pglyph = FONTGLYPHBITS (pglyphBase, pci);
-	gWidth = GLYPHWIDTHPIXELS (pci);
-	gHeight = GLYPHHEIGHTPIXELS (pci);
-
-	if (gWidth && gHeight)
-	{
-	    gx = x + pci->metrics.leftSideBearing;
-	    gy = -pci->metrics.ascent;
-
-	    glitz_multi_array_add (array,
-				   (pglyph - glyphbase) * 8,
-				   gWidth, gHeight,
-				   (gx - lastX) << 16, (gy - lastY) << 16);
-	    lastX = gx;
-	    lastY = gy;
-	}
-	x += pci->metrics.characterWidth;
-    }
-
-    glitz_buffer_destroy (buffer);
-    glitz_multi_array_destroy (array);
-}
-
-#define FIXED_LINE_X_TO_FLOAT(line, v)		  \
-    (((glitz_float_t)				  \
-	((line).p1.x + (xFixed_16_16)		  \
-	 (((xFixed_32_32) ((v) - (line).p1.y) *   \
-	   ((line).p2.x - (line).p1.x)) /	  \
-	  ((line).p2.y - (line).p1.y)))) / 65536)
-
-#define FIXED_LINE_X_CEIL_TO_FLOAT(line, v)	\
-  (((glitz_float_t)				\
-      ((line).p1.x + (xFixed_16_16)		\
-       (((((line).p2.y - (line).p1.y) - 1) +	\
-	 ((xFixed_32_32) ((v) - (line).p1.y) *	\
-	  ((line).p2.x - (line).p1.x))) /	\
-	((line).p2.y - (line).p1.y)))) / 65536)
-
-/*
- * Adds a number of trapezoids as GL_QUAD primitives
- */
-void
-xglGeometryAddTrapezoid (ScreenPtr	pScreen,
-			 xglGeometryPtr pGeometry,
-			 xTrapezoid	*pTrap,
-			 int		nTrap,
-			 int		offset)
-{
-    int  size;
-    char *ptr;
-
-    if (nTrap < 1)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-	/* not supported */
-	pGeometry->broken = TRUE;
-	break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-	glitz_float_t top, bottom;
-
-	while (nTrap--)
-	{
-	    top    = FIXED_TO_FLOAT (pTrap->top);
-	    bottom = FIXED_TO_FLOAT (pTrap->bottom);
-
-	    *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->top);
-	    *data++ = top;
-	    *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->top);
-	    *data++ = top;
-	    *data++ = FIXED_LINE_X_CEIL_TO_FLOAT (pTrap->right, pTrap->bottom);
-	    *data++ = bottom;
-	    *data++ = FIXED_LINE_X_TO_FLOAT (pTrap->left, pTrap->bottom);
-	    *data++ = bottom;
-
-	    pTrap++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/*
- * Adds a number of traps as GL_QUAD primitives
- */
-void
-xglGeometryAddTrap (ScreenPtr	   pScreen,
-		    xglGeometryPtr pGeometry,
-		    xTrap	   *pTrap,
-		    int		   nTrap,
-		    int		   offset)
-{
-    int  size;
-    char *ptr;
-
-    if (nTrap < 1)
-	return;
-
-    MAP_GEOMETRY (pScreen, pGeometry, offset, nTrap * 8, ptr, size);
-
-    switch (pGeometry->dataType) {
-    case GEOMETRY_DATA_TYPE_SHORT:
-	/* not supported */
-	pGeometry->broken = TRUE;
-	break;
-    case GEOMETRY_DATA_TYPE_FLOAT:
-    {
-	glitz_float_t *data = (glitz_float_t *) ptr;
-	glitz_float_t top, bottom;
-
-	while (nTrap--)
-	{
-	    top    = FIXED_TO_FLOAT (pTrap->top.y);
-	    bottom = FIXED_TO_FLOAT (pTrap->bot.y);
-
-	    *data++ = FIXED_TO_FLOAT (pTrap->top.l);
-	    *data++ = top;
-	    *data++ = FIXED_TO_FLOAT (pTrap->top.r);
-	    *data++ = top;
-	    *data++ = FIXED_TO_FLOAT (pTrap->bot.r);
-	    *data++ = bottom;
-	    *data++ = FIXED_TO_FLOAT (pTrap->bot.l);
-	    *data++ = bottom;
-
-	    pTrap++;
-	}
-    } break;
-    }
-
-    UNMAP_GEOMETRY (pGeometry, offset, size);
-}
-
-/* XXX: scratch geometry size never shrinks, it just gets larger when
-   required. this is not acceptable. */
-xglGeometryPtr
-xglGetScratchGeometryWithSize (ScreenPtr pScreen,
-			       int	 size)
-{
-    xglGeometryPtr pGeometry;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    pGeometry = &pScreenPriv->scratchGeometry;
-
-    if (pGeometry->broken || pGeometry->size < size)
-    {
-	GEOMETRY_UNINIT (pGeometry);
-	GEOMETRY_INIT (pScreen, pGeometry, pGeometry->type,
-		       pScreenPriv->geometryUsage, size);
-    }
-    else
-    {
-	if (pGeometry->array)
-	{
-	    glitz_multi_array_destroy (pGeometry->array);
-	    pGeometry->array = NULL;
-	}
-	pGeometry->endOffset = 0;
-	pGeometry->xOff      = 0;
-	pGeometry->yOff      = 0;
-	pGeometry->first     = 0;
-	pGeometry->count     = 0;
-	pGeometry->width     = 2;
-    }
-
-    return pGeometry;
-}
-
-xglGeometryPtr
-xglGetScratchVertexGeometryWithType (ScreenPtr pScreen,
-				     int       type,
-				     int       count)
-{
-    xglGeometryPtr pGeometry;
-    int		   stride;
-
-    stride = 2 * xglGeometryDataTypes[type].size;
-
-    pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
-
-    pGeometry->type	= GLITZ_GEOMETRY_TYPE_VERTEX;
-    pGeometry->dataType	= type;
-
-    pGeometry->f.vertex.primitive	 = GLITZ_PRIMITIVE_QUADS;
-    pGeometry->f.vertex.type		 = xglGeometryDataTypes[type].type;
-    pGeometry->f.vertex.bytes_per_vertex = stride;
-    pGeometry->f.vertex.attributes       = 0;
-
-    return pGeometry;
-}
-
-xglGeometryPtr
-xglGetScratchVertexGeometry (ScreenPtr pScreen,
-			     int	 count)
-{
-    xglGeometryPtr pGeometry;
-    int		   type, stride;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    type   = pScreenPriv->geometryDataType;
-    stride = 2 * xglGeometryDataTypes[type].size;
-
-    pGeometry = xglGetScratchGeometryWithSize (pScreen, count * stride);
-
-    pGeometry->type	= GLITZ_GEOMETRY_TYPE_VERTEX;
-    pGeometry->dataType	= type;
-
-    pGeometry->f.vertex.primitive	 = GLITZ_PRIMITIVE_QUADS;
-    pGeometry->f.vertex.type		 = xglGeometryDataTypes[type].type;
-    pGeometry->f.vertex.bytes_per_vertex = stride;
-    pGeometry->f.vertex.attributes       = 0;
-
-    return pGeometry;
-}
-
-Bool
-xglSetGeometry (xglGeometryPtr	pGeometry,
-		glitz_surface_t *surface)
-{
-    if (pGeometry->broken)
-	return FALSE;
-
-    glitz_set_geometry (surface, pGeometry->type, &pGeometry->f,
-			pGeometry->buffer);
-
-    if (pGeometry->array)
-	glitz_set_multi_array (surface, pGeometry->array,
-			       pGeometry->xOff, pGeometry->yOff);
-    else
-	glitz_set_array (surface,
-			 pGeometry->first, pGeometry->width, pGeometry->count,
-			 pGeometry->xOff, pGeometry->yOff);
-
-    return TRUE;
-}
diff --git a/hw/xgl/xglget.c b/hw/xgl/xglget.c
deleted file mode 100644
index 87bcb05..0000000
--- a/hw/xgl/xglget.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-void
-xglGetImage (DrawablePtr   pDrawable,
-	     int	   x,
-	     int	   y,
-	     int	   w,
-	     int	   h,
-	     unsigned int  format,
-	     unsigned long planeMask,
-	     char	   *d)
-{
-    ScreenPtr	    pScreen = pDrawable->pScreen;
-    glitz_surface_t *surface;
-    int             xOff, yOff;
-    BoxRec	    box;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    /* Many apps use GetImage to sync with the visible frame buffer */
-    if (pDrawable->type == DRAWABLE_WINDOW)
-    {
-	if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	glitz_surface_flush (pScreenPriv->surface);
-	glitz_drawable_finish (pScreenPriv->drawable);
-    }
-
-    XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
-    box.x1 = pDrawable->x + xOff + x;
-    box.y1 = pDrawable->y + yOff + y;
-    box.x2 = box.x1 + w;
-    box.y2 = box.y1 + h;
-
-    if (!xglSyncBits (pDrawable, &box))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    XGL_SCREEN_UNWRAP (GetImage);
-    (*pScreen->GetImage) (pDrawable, x, y, w, h, format, planeMask, d);
-    XGL_SCREEN_WRAP (GetImage, xglGetImage);
-}
-
-void
-xglGetSpans (DrawablePtr pDrawable,
-	     int	 wMax,
-	     DDXPointPtr ppt,
-	     int	 *pwidth,
-	     int	 nspans,
-	     char	 *pchardstStart)
-{
-    ScreenPtr pScreen = pDrawable->pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (!xglSyncBits (pDrawable, NullBox))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    XGL_SCREEN_UNWRAP (GetSpans);
-    (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
-    XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
-}
diff --git a/hw/xgl/xglglx.c b/hw/xgl/xglglx.c
deleted file mode 100644
index d92f965..0000000
--- a/hw/xgl/xglglx.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xglglx.h"
-
-#ifdef GLXEXT
-
-#ifdef XGL_MODULAR
-#include <dlfcn.h>
-#endif
-
-xglGLXFuncRec __xglGLXFunc;
-
-#ifndef NGLXEXTLOG
-FILE *__xglGLXLogFp;
-#endif
-
-static void *glXHandle = 0;
-static void *glCoreHandle = 0;
-
-#define SYM(ptr, name) { (void **) &(ptr), (name) }
-
-__GLXextensionInfo *__xglExtensionInfo;
-__GLXscreenInfo *__xglScreenInfoPtr;
-
-void
-GlxSetVisualConfigs (int	       nconfigs,
-		     __GLXvisualConfig *configs,
-		     void              **privates)
-{
-    if (glXHandle && glCoreHandle)
-	(*__xglGLXFunc.setVisualConfigs) (nconfigs, configs, privates);
-}
-
-void
-GlxExtensionInit (void)
-{
-    if (glXHandle && glCoreHandle)
-	(*__xglGLXFunc.extensionInit) ();
-}
-
-void
-GlxWrapInitVisuals (miInitVisualsProcPtr *initVisuals)
-{
-    if (glXHandle && glCoreHandle)
-	(*__xglGLXFunc.wrapInitVisuals) (initVisuals);
-}
-
-int
-GlxInitVisuals (VisualPtr     *visualp,
-		DepthPtr      *depthp,
-		int	      *nvisualp,
-		int	      *ndepthp,
-		int	      *rootDepthp,
-		VisualID      *defaultVisp,
-		unsigned long sizes,
-		int	      bitsPerRGB,
-		int	      preferredVis)
-{
-    if (glXHandle && glCoreHandle)
-	return (*__xglGLXFunc.initVisuals) (visualp, depthp, nvisualp, ndepthp,
-					    rootDepthp, defaultVisp, sizes,
-					    bitsPerRGB, preferredVis);
-
-    return 0;
-}
-
-void
-GlxFlushContextCache (void)
-{
-    (*__xglGLXFunc.flushContextCache) ();
-}
-
-void
-GlxSetRenderTables (struct _glapi_table *table)
-{
-  (*__xglGLXFunc.setRenderTables) (table);
-}
-
-struct _glapi_table *_mglapi_Dispatch;
-
-void *(*__glcore_DDXScreenInfo)(void);
-
-void *__glXglDDXScreenInfo(void)
-{
-  return __xglScreenInfoPtr;
-}
-
-void *(*__glcore_DDXExtensionInfo)(void);
-
-void *__glXglDDXExtensionInfo(void)
-{
-  return __xglExtensionInfo;
-}	
-
-void _gl_copy_visual_to_context_mode( __GLcontextModes * mode,
-                                 const __GLXvisualConfig * config )
-{
-	(*__xglGLXFunc.copy_visual_to_context_mode)(mode, config);
-}
-
-__GLcontextModes *_gl_context_modes_create( unsigned count, size_t minimum_size )
-{
-	return (*__xglGLXFunc.context_modes_create)(count, minimum_size);
-}
-
-void _gl_context_modes_destroy( __GLcontextModes * modes )
-{
-	(*__xglGLXFunc.context_modes_destroy)(modes);
-}
-
-GLint _gl_convert_from_x_visual_type( int visualType )
-{
-	return (*__xglGLXFunc.convert_from_x_visual_type)(visualType);
-}
-
-GLint _gl_convert_to_x_visual_type( int visualType )
-{
-	return (*__xglGLXFunc.convert_to_x_visual_type)(visualType);
-}
-
-
-
-Bool
-xglLoadGLXModules (void)
-{
-
-#ifdef XGL_MODULAR
-    if (!glXHandle)
-    {
-	xglSymbolRec sym[] = {
-	    SYM (__xglGLXFunc.extensionInit,     "GlxExtensionInit"),
-	    SYM (__xglGLXFunc.setVisualConfigs,  "GlxSetVisualConfigs"),
-	    SYM (__xglGLXFunc.wrapInitVisuals,   "GlxWrapInitVisuals"),
-	    SYM (__xglGLXFunc.initVisuals,	 "GlxInitVisuals"),
-	    SYM (__xglGLXFunc.flushContextCache, "__glXFlushContextCache"),
-	    SYM (__xglGLXFunc.setRenderTables,   "GlxSetRenderTables"),
-	    SYM (__xglGLXFunc.copy_visual_to_context_mode, "_gl_copy_visual_to_context_mode"),
-	    SYM (__xglGLXFunc.context_modes_create, "_gl_context_modes_create"),
-	    SYM (__xglGLXFunc.context_modes_destroy, "_gl_context_modes_destroy"),
-	    SYM (__xglGLXFunc.convert_from_x_visual_type, "_gl_convert_from_x_visual_type"),
-	    SYM (__xglGLXFunc.convert_to_x_visual_type, "_gl_convert_to_x_visual_type"),
-	};
-
-	glXHandle = xglLoadModule ("glx", RTLD_NOW | RTLD_LOCAL);
-	if (!glXHandle)
-	    return FALSE;
-
-	if (!xglLookupSymbols (glXHandle, sym, sizeof (sym) / sizeof (sym[0])))
-	{
-	    xglUnloadModule (glXHandle);
-	    glXHandle = 0;
-
-	    return FALSE;
-	}
-    }
-
-    if (!glCoreHandle)
-    {
-        xglSymbolRec ddxsym[] = {
-	    SYM (__glcore_DDXExtensionInfo, "__glXglDDXExtensionInfo"),
-	    SYM (__glcore_DDXScreenInfo, "__glXglDDXScreenInfo")
-        };	
-
-	glCoreHandle = xglLoadModule ("glcore", RTLD_NOW | RTLD_LOCAL);
-	if (!glCoreHandle)
-	    return FALSE;
-
-	if (!xglLookupSymbols (glCoreHandle, ddxsym,
-			       sizeof (ddxsym) / sizeof(ddxsym[0])))
-	{
-	  xglUnloadModule (glCoreHandle);
-	  glCoreHandle = 0;
-	  
-	  return FALSE;
-	}
-
-	__xglScreenInfoPtr = __glcore_DDXScreenInfo();
-	__xglExtensionInfo = __glcore_DDXExtensionInfo();
-	{
-	  xglSymbolRec sym[] = {
-	      SYM (__xglScreenInfoPtr->screenProbe,    "__MESA_screenProbe"),
-  	    SYM (__xglScreenInfoPtr->createContext,  "__MESA_createContext"),
-	    SYM (__xglScreenInfoPtr->createBuffer,   "__MESA_createBuffer"),
-	    SYM (__xglExtensionInfo->resetExtension,
-		 "__MESA_resetExtension"),
-	    SYM (__xglExtensionInfo->initVisuals, "__MESA_initVisuals"),
-	    SYM (__xglExtensionInfo->setVisualConfigs,
-		 "__MESA_setVisualConfigs"),
-
-	  };
-
-
-	  if (!xglLookupSymbols (glCoreHandle, sym,
-				 sizeof (sym) / sizeof (sym[0])))
-	  {
-	    xglUnloadModule (glCoreHandle);
-	    glCoreHandle = 0;
-	    
-	    return FALSE;
-	  }
-	}
-
-	if (!xglLoadHashFuncs (glCoreHandle))
-	{
-	    xglUnloadModule (glCoreHandle);
-	    glCoreHandle = 0;
-	}
-    }
-
-    return TRUE;
-#else
-    return FALSE;
-#endif
-
-}
-
-void
-xglUnloadGLXModules (void)
-{
-
-#ifdef XGL_MODULAR
-    if (glXHandle)
-    {
-	xglUnloadModule (glXHandle);
-	glXHandle = 0;
-    }
-
-    if (glCoreHandle)
-    {
-	xglUnloadModule (glCoreHandle);
-	glCoreHandle = 0;
-    }
-#endif
-
-}
-
-#endif
diff --git a/hw/xgl/xglglx.h b/hw/xgl/xglglx.h
deleted file mode 100644
index d895f42..0000000
--- a/hw/xgl/xglglx.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef GLXEXT
-
-#include "glxserver.h"
-#include "glxscreens.h"
-#include "glxext.h"
-#include "glapitable.h"
-
-
-typedef struct _xglGLXFunc {
-    void (*extensionInit)     (void);
-    void (*setVisualConfigs)  (int		    nconfigs,
-			       __GLXvisualConfig    *configs,
-			       void                 **privates);
-    void (*wrapInitVisuals)   (miInitVisualsProcPtr *initVisuals);
-    int  (*initVisuals)	      (VisualPtr	    *visualp,
-			       DepthPtr		    *depthp,
-			       int		    *nvisualp,
-			       int		    *ndepthp,
-			       int		    *rootDepthp,
-			       VisualID		    *defaultVisp,
-			       unsigned long	    sizes,
-			       int		    bitsPerRGB,
-			       int		    preferredVis);
-
-    void (*flushContextCache) (void);
-    void *(*DDXExtensionInfo) (void);
-    void *(*DDXScreenInfo) (void);
-  void (*setRenderTables)   (struct _glapi_table	*table);
-    void (*copy_visual_to_context_mode)( __GLcontextModes *mode, const __GLXvisualConfig *config );
-    __GLcontextModes *(*context_modes_create)( unsigned count, size_t minimum_size );
-    void (*context_modes_destroy)( __GLcontextModes * modes );
-    GLint (*convert_from_x_visual_type)( int visualType );
-    GLint (*convert_to_x_visual_type)( int visualType );
-} xglGLXFuncRec, *xglGLXFuncPtr;
-
-extern xglGLXFuncRec __xglGLXFunc;
-
-#ifndef NGLXEXTLOG
-
-extern FILE *__xglGLXLogFp;
-
-#endif
-
-/* xglglx.c */
-
-Bool
-xglLoadGLXModules (void);
-
-void
-xglUnloadGLXModules (void);
-
-#endif
diff --git a/hw/xgl/xglglyph.c b/hw/xgl/xglglyph.c
deleted file mode 100644
index c1a484a..0000000
--- a/hw/xgl/xglglyph.c
+++ /dev/null
@@ -1,1170 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-#ifdef RENDER
-#include "gcstruct.h"
-#include "picturestr.h"
-
-#define BITMAP_CACHE_SIZE      256000
-#define BITMAP_CACHE_MAX_LEVEL ~0
-#define BITMAP_CACHE_MAX_SIZE  512
-
-#define TEXTURE_CACHE_SIZE	 512
-#define TEXTURE_CACHE_MAX_LEVEL	 64
-#define TEXTURE_CACHE_MAX_HEIGHT 72
-#define TEXTURE_CACHE_MAX_WIDTH  72
-
-#define NEXT_GLYPH_SERIAL_NUMBER ((++glyphSerialNumber) > MAX_SERIAL_NUM ? \
-	    (glyphSerialNumber = 1): glyphSerialNumber)
-
-#define GLYPH_GET_AREA_PRIV(pArea)		\
-    ((xglGlyphAreaPtr) (pArea)->devPrivate.ptr)
-
-#define GLYPH_AREA_PRIV(pArea)				    \
-    xglGlyphAreaPtr pAreaPriv = GLYPH_GET_AREA_PRIV (pArea)
-
-#define NEEDS_COMPONENT(f) (PICT_FORMAT_A (f) != 0 && PICT_FORMAT_RGB (f) != 0)
-
-#define WRITE_VEC2(ptr, _x, _y) \
-    *(ptr)++ = (_x);		\
-    *(ptr)++ = (_y)
-
-#define WRITE_BOX(ptr, _vx1, _vy1, _vx2, _vy2, box) \
-    WRITE_VEC2 (ptr, _vx1, _vy1);		    \
-    WRITE_VEC2 (ptr, (box).x1, (box).y2);	    \
-    WRITE_VEC2 (ptr, _vx2, _vy1);		    \
-    WRITE_VEC2 (ptr, (box).x2, (box).y2);	    \
-    WRITE_VEC2 (ptr, _vx2, _vy2);		    \
-    WRITE_VEC2 (ptr, (box).x2, (box).y1);	    \
-    WRITE_VEC2 (ptr, _vx1, _vy2);		    \
-    WRITE_VEC2 (ptr, (box).x1, (box).y1)
-
-typedef union _xglGlyphList {
-    glitz_short_t *s;
-    glitz_float_t *f;
-} xglGlyphListRec, *xglGlyphListPtr;
-
-typedef struct _xglGlyphArray {
-    int	lastX, lastY;
-} xglGlyphArrayRec, *xglGlyphArrayPtr;
-
-typedef union _xglGlyphVertexData {
-    xglGlyphArrayRec array;
-    xglGlyphListRec  list;
-} xglGlyphVertexDataRec, *xglGlyphVertexDataPtr;
-
-typedef struct _xglGlyphOp {
-    GlyphListPtr pLists;
-    int		 listLen;
-    GlyphPtr	 *ppGlyphs;
-    int		 nGlyphs;
-    int		 xOff;
-    int		 yOff;
-    Bool	 noCache;
-} xglGlyphOpRec, *xglGlyphOpPtr;
-
-unsigned long glyphSerialNumber = 0;
-
-xglAreaRec zeroSizeArea = {
-    0, 0,
-    0, 0,
-    0, 0,
-    { NULL, NULL, NULL, NULL }, NULL,
-    (pointer) 0,
-    { 0 }
-};
-
-static Bool
-xglGlyphCreate (xglAreaPtr pArea)
-{
-    return TRUE;
-}
-
-static Bool
-xglGlyphMoveIn (xglAreaPtr pArea,
-		pointer    closure)
-{
-    xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
-    GlyphPtr	     pGlyph = (GlyphPtr) closure;
-
-    XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
-
-    pGlyphPriv->pArea = pArea;
-
-    return TRUE;
-}
-
-static void
-xglGlyphMoveOut (xglAreaPtr pArea,
-		 pointer    closure)
-{
-    xglGlyphCachePtr pCache = (xglGlyphCachePtr) pArea->pRoot->closure;
-    GlyphPtr	     pGlyph = (GlyphPtr) closure;
-
-    XGL_GLYPH_PRIV (pCache->pScreen, pGlyph);
-
-    pGlyphPriv->pArea = NULL;
-}
-
-static int
-xglGlyphCompareScore (xglAreaPtr pArea,
-		      pointer	 closure1,
-		      pointer	 closure2)
-{
-    GLYPH_AREA_PRIV (pArea);
-
-    if (pAreaPriv->serial == glyphSerialNumber)
-	return 1;
-
-    return -1;
-}
-
-static const xglAreaFuncsRec xglGlyphAreaFuncs = {
-    xglGlyphCreate,
-    xglGlyphMoveIn,
-    xglGlyphMoveOut,
-    xglGlyphCompareScore
-};
-
-Bool
-xglRealizeGlyph (ScreenPtr pScreen,
-		 GlyphPtr  pGlyph)
-{
-    PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
-    Bool	     ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_GLYPH_PRIV (pScreen, pGlyph);
-
-    XGL_PICTURE_SCREEN_UNWRAP (RealizeGlyph);
-    ret = (*pPictureScreen->RealizeGlyph) (pScreen, pGlyph);
-    XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
-
-    pGlyphPriv->pArea = NULL;
-
-    return ret;
-}
-
-void
-xglUnrealizeGlyph (ScreenPtr pScreen,
-		   GlyphPtr  pGlyph)
-{
-    PictureScreenPtr pPictureScreen = GetPictureScreen (pScreen);
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_GLYPH_PRIV (pScreen, pGlyph);
-
-    XGL_PICTURE_SCREEN_UNWRAP (UnrealizeGlyph);
-    (*pPictureScreen->UnrealizeGlyph) (pScreen, pGlyph);
-    XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
-
-    if (pGlyphPriv->pArea && pGlyphPriv->pArea->width)
-	xglWithdrawArea (pGlyphPriv->pArea);
-}
-
-Bool
-xglInitGlyphCache (xglGlyphCachePtr pCache,
-		   ScreenPtr	    pScreen,
-		   PictFormatPtr    format)
-{
-    XGL_SCREEN_PRIV (pScreen);
-
-    pCache->depth = format->depth;
-
-    if (!pScreenPriv->pSolidAlpha)
-    {
-	xglCreateSolidAlphaPicture (pScreen);
-	if (!pScreenPriv->pSolidAlpha)
-	    return FALSE;
-    }
-
-    if (pCache->depth == 1)
-    {
-	int stride;
-
-	GEOMETRY_INIT (pScreen, &pCache->u.geometry,
-		       GLITZ_GEOMETRY_TYPE_VERTEX,
-		       GEOMETRY_USAGE_STATIC, BITMAP_CACHE_SIZE);
-	GEOMETRY_SET_VERTEX_DATA_TYPE (&pCache->u.geometry,
-				       pScreenPriv->geometryDataType);
-
-	stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
-	if (!xglRootAreaInit (&pCache->rootArea,
-			      BITMAP_CACHE_MAX_LEVEL,
-			      BITMAP_CACHE_SIZE / (stride * 4),
-			      0, sizeof (xglGlyphAreaRec),
-			      (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
-			      (pointer) pCache))
-	{
-	    GEOMETRY_UNINIT (&pCache->u.geometry);
-	    return FALSE;
-	}
-    }
-    else
-    {
-
-	xglGlyphTexturePtr	   pTexture = &pCache->u.texture;
-	glitz_surface_t		   *mask;
-	glitz_surface_attributes_t attr;
-	glitz_vertex_format_t	   *vertex;
-	xglVisualPtr		   pVisual;
-
-	pVisual = xglFindVisualWithDepth (pScreen, format->depth);
-	if (!pVisual)
-	    return FALSE;
-
-	if (!xglRootAreaInit (&pCache->rootArea,
-			      TEXTURE_CACHE_MAX_LEVEL,
-			      TEXTURE_CACHE_SIZE, TEXTURE_CACHE_SIZE,
-			      sizeof (xglGlyphAreaRec),
-			      (xglAreaFuncsPtr) &xglGlyphAreaFuncs,
-			      (pointer) pCache))
-	    return FALSE;
-
-	if (pScreenPriv->geometryDataType == GEOMETRY_DATA_TYPE_SHORT)
-	{
-	    attr.unnormalized = 1;
-	    mask = glitz_surface_create (pScreenPriv->drawable,
-					 pVisual->format.surface,
-					 TEXTURE_CACHE_SIZE,
-					 TEXTURE_CACHE_SIZE,
-					 GLITZ_SURFACE_UNNORMALIZED_MASK,
-					 &attr);
-	}
-	else
-	    mask = NULL;
-
-	if (!mask)
-	{
-	    mask = glitz_surface_create (pScreenPriv->drawable,
-					 pVisual->format.surface,
-					 TEXTURE_CACHE_SIZE,
-					 TEXTURE_CACHE_SIZE,
-					 0, NULL);
-	    if (!mask)
-		return FALSE;
-
-	    pTexture->geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
-	}
-	else
-	    pTexture->geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
-
-	if (NEEDS_COMPONENT (format->format))
-	    glitz_surface_set_component_alpha (mask, 1);
-
-	pTexture->pMask = xglCreateDevicePicture (mask);
-	if (!pTexture->pMask)
-	    return FALSE;
-
-	vertex = &pCache->u.texture.format.vertex;
-	vertex->primitive  = GLITZ_PRIMITIVE_QUADS;
-	vertex->mask.size  = GLITZ_COORDINATE_SIZE_XY;
-	vertex->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
-
-	if (pTexture->geometryDataType == GEOMETRY_DATA_TYPE_FLOAT)
-	{
-	    vertex->type	     = GLITZ_DATA_TYPE_FLOAT;
-	    vertex->bytes_per_vertex = sizeof (glitz_float_t) * 4;
-	    vertex->mask.offset	     = sizeof (glitz_float_t) * 2;
-	    vertex->mask.type	     = GLITZ_DATA_TYPE_FLOAT;
-	}
-	else
-	{
-	    vertex->type	     = GLITZ_DATA_TYPE_SHORT;
-	    vertex->bytes_per_vertex = sizeof (glitz_short_t) * 4;
-	    vertex->mask.offset	     = sizeof (glitz_short_t) * 2;
-	    vertex->mask.type	     = GLITZ_DATA_TYPE_SHORT;
-	}
-
-	pTexture->pixel.fourcc	       = GLITZ_FOURCC_RGB;
-	pTexture->pixel.masks	       = pVisual->pPixel->masks;
-	pTexture->pixel.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-	pTexture->pixel.bytes_per_line = 0;
-	pTexture->pixel.xoffset	       = 0;
-	pTexture->pixel.skip_lines     = 0;
-    }
-
-    pCache->pScreen = pScreen;
-
-    return TRUE;
-}
-
-void
-xglFiniGlyphCache (xglGlyphCachePtr pCache)
-{
-    if (pCache->pScreen)
-    {
-	xglRootAreaFini (&pCache->rootArea);
-
-	if (pCache->depth == 1)
-	{
-	    GEOMETRY_UNINIT (&pCache->u.geometry);
-	}
-	else
-	{
-	    if (pCache->u.texture.pMask)
-		FreePicture ((pointer) pCache->u.texture.pMask, 0);
-	}
-
-	pCache->pScreen = NULL;
-    }
-}
-
-static xglAreaPtr
-xglCacheGlyph (xglGlyphCachePtr pCache,
-	       GlyphPtr		pGlyph)
-{
-    ScreenPtr pScreen = pCache->pScreen;
-
-    XGL_GLYPH_PRIV (pScreen, pGlyph);
-
-    if (pCache->depth == 1)
-    {
-	PixmapPtr pPixmap;
-	RegionPtr pRegion;
-	int	  nBox;
-
-	pPixmap = GetScratchPixmapHeader (pScreen,
-					  pGlyph->info.width,
-					  pGlyph->info.height,
-					  pCache->depth, pCache->depth, 0,
-					  (pointer) (pGlyph + 1));
-	if (!pPixmap)
-	    return NULL;
-
-	(*pScreen->ModifyPixmapHeader) (pPixmap,
-					pGlyph->info.width,
-					pGlyph->info.height,
-					0, 0, -1, (pointer) (pGlyph + 1));
-
-	pRegion = (*pScreen->BitmapToRegion) (pPixmap);
-	FreeScratchPixmapHeader (pPixmap);
-
-	if (!pRegion)
-	    return NULL;
-
-	nBox = REGION_NUM_RECTS (pRegion);
-	if (nBox > BITMAP_CACHE_MAX_SIZE)
-	{
-	    REGION_DESTROY (pScreen, pRegion);
-	    return NULL;
-	}
-
-	if (nBox > 0)
-	{
-	    /* Find available area */
-	    if (!xglFindArea (pCache->rootArea.pArea, nBox, 0,
-			      FALSE, (pointer) pGlyph))
-	    {
-		/* Kicking out area with lower score */
-		xglFindArea (pCache->rootArea.pArea, nBox, 0,
-			     TRUE, (pointer) pGlyph);
-	    }
-
-	    if (pGlyphPriv->pArea)
-	    {
-		int stride;
-
-		GLYPH_AREA_PRIV (pGlyphPriv->pArea);
-
-		pAreaPriv->serial = glyphSerialNumber;
-		pAreaPriv->u.range.first = pGlyphPriv->pArea->x * 4;
-		pAreaPriv->u.range.count = nBox * 4;
-
-		stride = pCache->u.geometry.f.vertex.bytes_per_vertex;
-		GEOMETRY_ADD_REGION_AT (pScreen, &pCache->u.geometry, pRegion,
-					pGlyphPriv->pArea->x * stride * 4);
-	    }
-	} else
-	    pGlyphPriv->pArea = &zeroSizeArea;
-
-	REGION_DESTROY (pScreen, pRegion);
-    }
-    else
-    {
-	xglGlyphTexturePtr pTexture = &pCache->u.texture;
-
-	if (pGlyph->info.width  > TEXTURE_CACHE_MAX_WIDTH ||
-	    pGlyph->info.height > TEXTURE_CACHE_MAX_HEIGHT)
-	    return NULL;
-
-	if (pGlyph->info.width > 0 && pGlyph->info.height > 0)
-	{
-	    glitz_buffer_t *buffer;
-
-	    buffer = glitz_buffer_create_for_data (pGlyph + 1);
-	    if (!buffer)
-		return NULL;
-
-	    /* Find available area */
-	    if (!xglFindArea (pCache->rootArea.pArea,
-			      pGlyph->info.width, pGlyph->info.height,
-			      FALSE, (pointer) pGlyph))
-	    {
-		/* Kicking out area with lower score */
-		xglFindArea (pCache->rootArea.pArea,
-			     pGlyph->info.width, pGlyph->info.height,
-			     TRUE, (pointer) pGlyph);
-	    }
-
-	    if (pGlyphPriv->pArea)
-	    {
-		glitz_surface_t	     *surface;
-		glitz_point_fixed_t  p1, p2;
-		glitz_pixel_format_t pixel;
-
-		GLYPH_AREA_PRIV (pGlyphPriv->pArea);
-
-		pixel = pTexture->pixel;
-		pixel.bytes_per_line =
-		    PixmapBytePad (pGlyph->info.width, pCache->depth);
-
-		surface = pTexture->pMask->pSourcePict->source.devPrivate.ptr;
-
-		glitz_set_pixels (surface,
-				  pGlyphPriv->pArea->x,
-				  pGlyphPriv->pArea->y,
-				  pGlyph->info.width,
-				  pGlyph->info.height,
-				  &pixel,
-				  buffer);
-
-		p1.x = pGlyphPriv->pArea->x << 16;
-		p1.y = pGlyphPriv->pArea->y << 16;
-		p2.x = (pGlyphPriv->pArea->x + pGlyph->info.width)  << 16;
-		p2.y = (pGlyphPriv->pArea->y + pGlyph->info.height) << 16;
-
-		glitz_surface_translate_point (surface, &p1, &p1);
-		glitz_surface_translate_point (surface, &p2, &p2);
-
-		pAreaPriv->serial = glyphSerialNumber;
-		if (pTexture->geometryDataType)
-		{
-		    pAreaPriv->u.box.fBox.x1 = FIXED_TO_FLOAT (p1.x);
-		    pAreaPriv->u.box.fBox.y1 = FIXED_TO_FLOAT (p1.y);
-		    pAreaPriv->u.box.fBox.x2 = FIXED_TO_FLOAT (p2.x);
-		    pAreaPriv->u.box.fBox.y2 = FIXED_TO_FLOAT (p2.y);
-		}
-		else
-		{
-		    pAreaPriv->u.box.sBox.x1 = p1.x >> 16;
-		    pAreaPriv->u.box.sBox.y1 = p1.y >> 16;
-		    pAreaPriv->u.box.sBox.x2 = p2.x >> 16;
-		    pAreaPriv->u.box.sBox.y2 = p2.y >> 16;
-		}
-	    }
-	    glitz_buffer_destroy (buffer);
-	} else
-	    pGlyphPriv->pArea = &zeroSizeArea;
-    }
-
-    return pGlyphPriv->pArea;
-}
-
-static void
-xglUncachedGlyphs (CARD8	 op,
-		   PicturePtr    pSrc,
-		   PicturePtr    pDst,
-		   INT16	 xSrc,
-		   INT16	 ySrc,
-		   xglGlyphOpPtr pOp)
-{
-    ScreenPtr	     pScreen = pDst->pDrawable->pScreen;
-    PicturePtr	     pPicture = NULL;
-    PixmapPtr	     pPixmap = NULL;
-    xglGlyphCachePtr pCache;
-    int		     depth = pOp->pLists->format->depth;
-    GlyphPtr	     glyph;
-    INT16	     xOff, yOff;
-    xglGlyphPtr	     pGlyphPriv;
-    xglAreaPtr	     pArea;
-    Bool	     usingCache = !pOp->noCache;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    pCache = &pScreenPriv->glyphCache[depth];
-    if (usingCache)
-    {
-	if (!pCache->pScreen)
-	{
-	    if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
-		usingCache = FALSE;
-	}
-    }
-
-    while (pOp->nGlyphs)
-    {
-	glyph = *pOp->ppGlyphs;
-
-	if (!pOp->listLen)
-	{
-	    pOp->pLists++;
-	    pOp->listLen = pOp->pLists->len;
-	    pOp->xOff   += pOp->pLists->xOff;
-	    pOp->yOff   += pOp->pLists->yOff;
-	}
-
-	xOff = pOp->xOff;
-	yOff = pOp->yOff;
-
-	if (usingCache)
-	{
-	    pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
-	    pArea = pGlyphPriv->pArea;
-	    if (pSrc)
-	    {
-		if (!pArea)
-		    pArea = xglCacheGlyph (pCache, glyph);
-
-		if (pArea)
-		    break;
-	    }
-	} else
-	    pArea = NULL;
-
-	pOp->listLen--;
-	pOp->nGlyphs--;
-	pOp->ppGlyphs++;
-
-	pOp->xOff += glyph->info.xOff;
-	pOp->yOff += glyph->info.yOff;
-
-	if (pArea)
-	    continue;
-
-	if (!pPicture)
-	{
-	    XID componentAlpha;
-	    int	error;
-
-	    pPixmap = GetScratchPixmapHeader (pScreen,
-					      glyph->info.width,
-					      glyph->info.height,
-					      depth, depth,
-					      0, (pointer) (glyph + 1));
-	    if (!pPixmap)
-		return;
-
-	    componentAlpha = NEEDS_COMPONENT (pOp->pLists->format->format);
-	    pPicture = CreatePicture (0, &pPixmap->drawable,
-				      pOp->pLists->format,
-				      CPComponentAlpha, &componentAlpha,
-				      serverClient, &error);
-	    if (!pPicture)
-	    {
-		FreeScratchPixmapHeader (pPixmap);
-		return;
-	    }
-	}
-
-	(*pScreen->ModifyPixmapHeader) (pPixmap,
-					glyph->info.width, glyph->info.height,
-					0, 0, -1, (pointer) (glyph + 1));
-	pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
-	if (pSrc)
-	    CompositePicture (op,
-			      pSrc,
-			      pPicture,
-			      pDst,
-			      xSrc + (xOff - glyph->info.x),
-			      ySrc + (yOff - glyph->info.y),
-			      0, 0,
-			      xOff - glyph->info.x,
-			      yOff - glyph->info.y,
-			      glyph->info.width,
-			      glyph->info.height);
-	else
-	    CompositePicture (PictOpAdd,
-			      pPicture,
-			      NULL,
-			      pDst,
-			      0, 0,
-			      0, 0,
-			      xOff - glyph->info.x,
-			      yOff - glyph->info.y,
-			      glyph->info.width,
-			      glyph->info.height);
-    }
-
-    if (pPicture)
-    {
-	FreeScratchPixmapHeader (pPixmap);
-	FreePicture ((pointer) pPicture, 0);
-    }
-}
-
-static Bool
-xglCachedGlyphs (CARD8	       op,
-		 PicturePtr    pSrc,
-		 PicturePtr    pDst,
-		 INT16	       xSrc,
-		 INT16	       ySrc,
-		 xglGlyphOpPtr pOp)
-{
-    ScreenPtr		  pScreen = pDst->pDrawable->pScreen;
-    xglGlyphOpRec	  opSave = *pOp;
-    xglGlyphCachePtr	  pCache;
-    xglGlyphVertexDataRec vData;
-    xglGeometryPtr	  pGeometry;
-    GlyphPtr		  glyph;
-    xglGlyphPtr		  pGlyphPriv;
-    xglAreaPtr		  pArea;
-    xglGlyphAreaPtr	  pGlyphArea;
-    BoxRec		  extents;
-    INT16		  xOff, yOff, x1, x2, y1, y2;
-    int			  depth = pOp->pLists->format->depth;
-    int			  i, remaining = pOp->nGlyphs;
-    int			  nGlyph = 0;
-    PicturePtr		  pMaskPicture = NULL;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    pCache = &pScreenPriv->glyphCache[depth];
-    if (!pCache->pScreen)
-    {
-	if (!xglInitGlyphCache (pCache, pScreen, pOp->pLists->format))
-	{
-	    pOp->noCache = TRUE;
-	    return 1;
-	}
-    }
-
-    /* update serial number for all glyphs already in cache so that
-       we don't accidentally replace one. */
-    for (i = 0; i < pOp->nGlyphs; i++)
-    {
-	pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
-	pArea = pGlyphPriv->pArea;
-	if (pArea && pArea->width)
-	    GLYPH_GET_AREA_PRIV (pArea)->serial = glyphSerialNumber;
-    }
-
-    for (i = 0; i < pOp->nGlyphs; i++)
-    {
-	pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pOp->ppGlyphs[i]);
-	pArea = pGlyphPriv->pArea;
-	if (!pArea)
-	    pArea = xglCacheGlyph (pCache, pOp->ppGlyphs[i]);
-
-	if (pArea)
-	{
-	    if (pArea->width)
-		nGlyph++;
-	}
-	else if (pSrc)
-	    break;
-    }
-
-    if (nGlyph)
-    {
-	if (depth == 1)
-	{
-	    glitz_multi_array_t *multiArray;
-
-	    pGeometry = &pCache->u.geometry;
-	    pGeometry->xOff = pGeometry->yOff = 0;
-
-	    multiArray = glitz_multi_array_create (nGlyph);
-	    if (!multiArray)
-		return 1;
-
-	    GEOMETRY_SET_MULTI_ARRAY (pGeometry, multiArray);
-	    glitz_multi_array_destroy (multiArray);
-
-	    vData.array.lastX = 0;
-	    vData.array.lastY = 0;
-	}
-	else
-	{
-	    i = 4 * pCache->u.texture.format.vertex.bytes_per_vertex * nGlyph;
-	    pGeometry = xglGetScratchGeometryWithSize (pScreen, i);
-
-	    pGeometry->f = pCache->u.texture.format;
-	    pGeometry->type = GLITZ_GEOMETRY_TYPE_VERTEX;
-	    pMaskPicture = pCache->u.texture.pMask;
-
-	    vData.list.s = glitz_buffer_map (pGeometry->buffer,
-					     GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-	}
-    } else
-	pGeometry = NULL;
-
-    extents.x1 = MAXSHORT;
-    extents.y1 = MAXSHORT;
-    extents.x2 = MINSHORT;
-    extents.y2 = MINSHORT;
-
-    while (pOp->nGlyphs)
-    {
-	glyph = *pOp->ppGlyphs;
-
-	if (!pOp->listLen)
-	{
-	    pOp->pLists++;
-	    pOp->listLen = pOp->pLists->len;
-	    pOp->xOff   += pOp->pLists->xOff;
-	    pOp->yOff   += pOp->pLists->yOff;
-	}
-
-	xOff = pOp->xOff;
-	yOff = pOp->yOff;
-
-	pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, glyph);
-	pArea = pGlyphPriv->pArea;
-	if (!pArea && pSrc)
-	    break;
-
-	pOp->listLen--;
-	pOp->nGlyphs--;
-	pOp->ppGlyphs++;
-
-	pOp->xOff += glyph->info.xOff;
-	pOp->yOff += glyph->info.yOff;
-
-	if (!pArea)
-	    continue;
-
-	x1 = xOff - glyph->info.x;
-	x2 = x1 + glyph->info.width;
-	if (x1 < extents.x1)
-	    extents.x1 = x1;
-	if (x2 > extents.x2)
-	    extents.x2 = x2;
-
-	y1 = yOff - glyph->info.y;
-	y2 = y1 + glyph->info.height;
-	if (y1 < extents.y1)
-	    extents.y1 = y1;
-	if (y2 > extents.y2)
-	    extents.y2 = y2;
-
-	if (pArea->width)
-	{
-	    pGlyphArea = GLYPH_GET_AREA_PRIV (pArea);
-	    if (depth == 1)
-	    {
-		glitz_multi_array_add (pGeometry->array,
-				       pGlyphArea->u.range.first, 2,
-				       pGlyphArea->u.range.count,
-				       (x1 - vData.array.lastX) << 16,
-				       (y1 - vData.array.lastY) << 16);
-		vData.array.lastX = x1;
-		vData.array.lastY = y1;
-	    }
-	    else
-	    {
-		if (pCache->u.texture.geometryDataType)
-		{
-		    WRITE_BOX (vData.list.f, x1, y1, x2, y2,
-			       pGlyphArea->u.box.fBox);
-		}
-		else
-		{
-		    WRITE_BOX (vData.list.s, x1, y1, x2, y2,
-			       pGlyphArea->u.box.sBox);
-		}
-	    }
-	}
-	remaining--;
-    }
-
-    NEXT_GLYPH_SERIAL_NUMBER;
-
-    if (nGlyph)
-    {
-	if (depth != 1)
-	{
-	    glitz_buffer_unmap (pGeometry->buffer);
-	    pGeometry->count = nGlyph * 4;
-	}
-
-	xSrc += extents.x1;
-	ySrc += extents.y1;
-
-	if (!pSrc)
-	{
-	    op = PictOpAdd;
-	    pSrc = pScreenPriv->pSolidAlpha;
-
-	    if (remaining)
-		*pOp = opSave;
-	}
-
-	GEOMETRY_TRANSLATE (pGeometry,
-			    pDst->pDrawable->x,
-			    pDst->pDrawable->y);
-
-	if (xglCompositeGeneral (op,
-				 pSrc,
-				 pMaskPicture,
-				 pDst,
-				 pGeometry,
-				 xSrc, ySrc,
-				 0, 0,
-				 pDst->pDrawable->x + extents.x1,
-				 pDst->pDrawable->y + extents.y1,
-				 extents.x2 - extents.x1,
-				 extents.y2 - extents.y1))
-	{
-	    xglAddCurrentBitDamage (pDst->pDrawable);
-	    return remaining;
-	}
-
-	remaining = ~0;
-	*pOp = opSave;
-	pOp->noCache = TRUE;
-    }
-    else
-    {
-	if (remaining)
-	{
-	    *pOp = opSave;
-	    pOp->noCache = TRUE;
-	}
-    }
-
-    return remaining;
-}
-
-static Bool
-xglGlyphExtents (PicturePtr   pDst,
-		 int	      nlist,
-		 GlyphListPtr list,
-		 GlyphPtr     *glyphs,
-		 BoxPtr	      extents)
-{
-    GlyphPtr glyph;
-    BoxRec   line;
-    int	     x1, x2, y1, y2;
-    int	     n;
-    int	     x;
-    int	     y;
-    Bool     overlap = FALSE;
-
-    x = 0;
-    y = 0;
-
-    extents->x1 = MAXSHORT;
-    extents->x2 = MINSHORT;
-    extents->y1 = MAXSHORT;
-    extents->y2 = MINSHORT;
-
-    while (!list->len)
-    {
-	if (--nlist)
-	{
-	    x += list->xOff;
-	    y += list->yOff;
-	    list++;
-	}
-	else
-	{
-	    return FALSE;
-	}
-    }
-
-    glyph = *glyphs;
-    x1 = (x + list->xOff) - glyph->info.x;
-    if (x1 < MINSHORT)
-	x1 = MINSHORT;
-    y1 = (y  + list->yOff) - glyph->info.y;
-    if (y1 < MINSHORT)
-	y1 = MINSHORT;
-
-    line.x1 = x1;
-    line.x2 = x1;
-    line.y1 = y1;
-    line.y2 = y1;
-
-    while (nlist--)
-    {
-	x += list->xOff;
-	y += list->yOff;
-	n = list->len;
-	list++;
-
-	while (n--)
-	{
-	    glyph = *glyphs++;
-	    x1 = x - glyph->info.x;
-	    if (x1 < MINSHORT)
-		x1 = MINSHORT;
-	    y1 = y - glyph->info.y;
-	    if (y1 < MINSHORT)
-		y1 = MINSHORT;
-	    x2 = x1 + glyph->info.width;
-	    if (x2 > MAXSHORT)
-		x2 = MAXSHORT;
-	    y2 = y1 + glyph->info.height;
-	    if (y2 > MAXSHORT)
-		y2 = MAXSHORT;
-
-	    if (x1 >= line.x2)
-	    {
-		line.x2 = x2;
-		if (y1 < line.y1)
-		    line.y1 = y1;
-		if (y2 > line.y2)
-		    line.y2 = y2;
-	    }
-	    else if (x2 <= line.x1)
-	    {
-		line.x1 = x1;
-		if (y1 < line.y1)
-		    line.y1 = y1;
-		if (y2 > line.y2)
-		    line.y2 = y2;
-	    }
-	    else
-	    {
-		if (line.y1 >= extents->y2)
-		{
-		    extents->y2 = line.y2;
-		    if (line.y1 < extents->y1)
-			extents->y1 = line.y1;
-		}
-		else if (line.y2 <= extents->y1)
-		{
-		    extents->y1 = line.y1;
-		    if (line.y2 > extents->y2)
-			extents->y2 = line.y2;
-		}
-		else
-		{
-		    if (line.y1 < extents->y1)
-			extents->y1 = line.y1;
-		    if (line.y2 > extents->y2)
-			extents->y2 = line.y2;
-
-		    overlap = TRUE;
-		}
-
-		if (line.x1 < extents->x1)
-		    extents->x1 = line.x1;
-		if (line.x2 > extents->x2)
-		    extents->x2 = line.x2;
-
-		line.x1 = x1;
-		line.y1 = y1;
-		line.x2 = x2;
-		line.y2 = y2;
-	    }
-
-	    x += glyph->info.xOff;
-	    y += glyph->info.yOff;
-	}
-    }
-
-    if (line.y1 >= extents->y2)
-    {
-	extents->y2 = line.y2;
-	if (line.y1 < extents->y1)
-	    extents->y1 = line.y1;
-    }
-    else if (line.y2 <= extents->y1)
-    {
-	extents->y1 = line.y1;
-	if (line.y2 > extents->y2)
-	    extents->y2 = line.y2;
-    }
-    else
-    {
-	if (line.y1 < extents->y1)
-	    extents->y1 = line.y1;
-	if (line.y2 > extents->y2)
-	    extents->y2 = line.y2;
-
-	overlap = TRUE;
-    }
-
-    if (line.x1 < extents->x1)
-	extents->x1 = line.x1;
-    if (line.x2 > extents->x2)
-	extents->x2 = line.x2;
-
-    xglPictureClipExtents (pDst, extents);
-
-    return overlap;
-}
-
-/* returns 0 if all glyph lists don't have the same format */
-static CARD32
-xglGlyphListFormatId (GlyphListPtr list,
-		      int	   nlist)
-{
-    CARD32 id = list->format->id;
-
-    nlist--;
-    list++;
-
-    while (nlist--)
-    {
-	if (list->format->id != id)
-	    return 0;
-
-	list++;
-    }
-
-    return id;
-}
-
-void
-xglGlyphs (CARD8	 op,
-	   PicturePtr	 pSrc,
-	   PicturePtr	 pDst,
-	   PictFormatPtr maskFormat,
-	   INT16	 xSrc,
-	   INT16	 ySrc,
-	   int		 nlist,
-	   GlyphListPtr	 list,
-	   GlyphPtr	 *glyphs)
-{
-    ScreenPtr	  pScreen = pDst->pDrawable->pScreen;
-    PicturePtr	  pMask = NULL, pSrcPicture, pDstPicture;
-    BoxRec	  extents;
-    xglGlyphOpRec glyphOp;
-    int		  xDst = list->xOff, yDst = list->yOff;
-    int		  overlap;
-    int		  target;
-
-    overlap = xglGlyphExtents (pDst, nlist, list, glyphs, &extents);
-    if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
-	return;
-
-    target = xglPrepareTarget (pDst->pDrawable);
-
-    if (op != PictOpAdd && maskFormat &&
-	(!target || overlap || op != PictOpOver ||
-	 xglGlyphListFormatId (list, nlist) != maskFormat->id))
-    {
-	PixmapPtr  pPixmap;
-	XID	   componentAlpha;
-	GCPtr	   pGC;
-	xRectangle rect;
-	int	   error;
-
-	rect.x = 0;
-	rect.y = 0;
-	rect.width = extents.x2 - extents.x1;
-	rect.height = extents.y2 - extents.y1;
-
-	pPixmap = (*pScreen->CreatePixmap) (pScreen,
-					    rect.width, rect.height,
-					    maskFormat->depth,
-					    CREATE_PIXMAP_USAGE_SCRATCH);
-	if (!pPixmap)
-	    return;
-
-	componentAlpha = NEEDS_COMPONENT (maskFormat->format);
-	pMask = CreatePicture (0, &pPixmap->drawable,
-			       maskFormat, CPComponentAlpha, &componentAlpha,
-			       serverClient, &error);
-	if (!pMask)
-	{
-	    (*pScreen->DestroyPixmap) (pPixmap);
-	    return;
-	}
-
-	if (!target)
-	{
-	    /* make sure we don't do accelerated drawing to mask */
-	    xglSetPixmapVisual (pPixmap, NULL);
-	}
-
-	ValidatePicture (pMask);
-	pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
-	ValidateGC (&pPixmap->drawable, pGC);
-	(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
-	FreeScratchGC (pGC);
-
-	(*pScreen->DestroyPixmap) (pPixmap);
-
-	target = xglPrepareTarget (pMask->pDrawable);
-
-	glyphOp.xOff = -extents.x1;
-	glyphOp.yOff = -extents.y1;
-	pSrcPicture = NULL;
-	pDstPicture = pMask;
-    }
-    else
-    {
-	glyphOp.xOff = 0;
-	glyphOp.yOff = 0;
-	pSrcPicture = pSrc;
-	pDstPicture = pDst;
-    }
-
-    glyphOp.ppGlyphs = glyphs;
-    glyphOp.noCache  = !target;
-
-    while (nlist--)
-    {
-	glyphOp.xOff   += list->xOff;
-	glyphOp.yOff   += list->yOff;
-	glyphOp.listLen = list->len;
-	glyphOp.nGlyphs = list->len;
-	glyphOp.pLists  = list++;
-
-	for (; nlist; nlist--, list++)
-	{
-	    if (list->format->id != glyphOp.pLists->format->id)
-		break;
-
-	    glyphOp.nGlyphs += list->len;
-	}
-
-	while (glyphOp.nGlyphs)
-	{
-	    if (glyphOp.noCache || xglCachedGlyphs (op,
-						    pSrcPicture,
-						    pDstPicture,
-						    xSrc - xDst, ySrc - yDst,
-						    &glyphOp))
-		xglUncachedGlyphs (op,
-				   pSrcPicture,
-				   pDstPicture,
-				   xSrc - xDst, ySrc - yDst,
-				   &glyphOp);
-	}
-    }
-
-    if (pMask)
-    {
-	CompositePicture (op, pSrc, pMask, pDst,
-			  xSrc + extents.x1 - xDst,
-			  ySrc + extents.y1 - yDst,
-			  0, 0,
-			  extents.x1, extents.y1,
-			  extents.x2 - extents.x1,
-			  extents.y2 - extents.y1);
-
-	FreePicture ((pointer) pMask, (XID) 0);
-    }
-}
-
-#endif
diff --git a/hw/xgl/xglhash.c b/hw/xgl/xglhash.c
deleted file mode 100644
index c6c22ad..0000000
--- a/hw/xgl/xglhash.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-#define SYM(ptr, name) { (void **) &(ptr), (name) }
-
-typedef struct _xglHashFunc {
-    xglHashTablePtr (*NewHashTable)	    (void);
-    void	    (*DeleteHashTable)      (xglHashTablePtr	   pTable);
-    void	    *(*HashLookup)	    (const xglHashTablePtr pTable,
-					     unsigned int	   key);
-    void	    (*HashInsert)	    (xglHashTablePtr	   pTable,
-					     unsigned int	   key,
-					     void		   *data);
-    void	    (*HashRemove)	    (xglHashTablePtr	   pTable,
-					     unsigned int	   key);
-    unsigned int    (*HashFirstEntry)       (xglHashTablePtr	   pTable);
-    unsigned int    (*HashNextEntry)	    (const xglHashTablePtr pTable,
-					     unsigned int	   key);
-    unsigned int    (*HashFindFreeKeyBlock) (xglHashTablePtr	   pTable,
-					     unsigned int	   numKeys);
-} xglHashFuncRec;
-
-static xglHashFuncRec __hashFunc;
-
-static void *hashHandle = 0;
-
-Bool
-xglLoadHashFuncs (void *handle)
-{
-
-#ifdef XGL_MODULAR
-    xglSymbolRec sym[] = {
-	SYM (__hashFunc.NewHashTable,	      "_mesa_NewHashTable"),
-	SYM (__hashFunc.DeleteHashTable,      "_mesa_DeleteHashTable"),
-	SYM (__hashFunc.HashLookup,	      "_mesa_HashLookup"),
-	SYM (__hashFunc.HashInsert,	      "_mesa_HashInsert"),
-	SYM (__hashFunc.HashRemove,	      "_mesa_HashRemove"),
-	SYM (__hashFunc.HashFirstEntry,	      "_mesa_HashFirstEntry"),
-	SYM (__hashFunc.HashNextEntry,	      "_mesa_HashNextEntry"),
-	SYM (__hashFunc.HashFindFreeKeyBlock, "_mesa_HashFindFreeKeyBlock")
-    };
-
-    if (!xglLookupSymbols (handle, sym, sizeof (sym) / sizeof (sym[0])))
-	return FALSE;
-
-    hashHandle = handle;
-
-    return TRUE;
-#else
-    return FALSE;
-#endif
-
-}
-
-xglHashTablePtr
-xglNewHashTable (void)
-{
-    if (!hashHandle)
-	return 0;
-
-    return (*__hashFunc.NewHashTable) ();
-}
-
-void
-xglDeleteHashTable (xglHashTablePtr pTable)
-{
-    (*__hashFunc.DeleteHashTable) (pTable);
-}
-
-void *
-xglHashLookup (const xglHashTablePtr pTable,
-	       unsigned int	     key)
-{
-    return (*__hashFunc.HashLookup) (pTable, key);
-}
-
-void
-xglHashInsert (xglHashTablePtr pTable,
-	       unsigned int    key,
-	       void	       *data)
-{
-    (*__hashFunc.HashInsert) (pTable, key, data);
-}
-
-void
-xglHashRemove (xglHashTablePtr pTable,
-	       unsigned int    key)
-{
-    (*__hashFunc.HashRemove) (pTable, key);
-}
-
-unsigned int
-xglHashFirstEntry (xglHashTablePtr pTable)
-{
-    return (*__hashFunc.HashFirstEntry) (pTable);
-}
-
-unsigned int
-xglHashNextEntry (const xglHashTablePtr pTable,
-		  unsigned int		key)
-{
-    return (*__hashFunc.HashNextEntry) (pTable, key);
-}
-
-unsigned int
-xglHashFindFreeKeyBlock (xglHashTablePtr pTable,
-			 unsigned int	 numKeys)
-{
-    return (*__hashFunc.HashFindFreeKeyBlock) (pTable, numKeys);
-}
diff --git a/hw/xgl/xglinit.c b/hw/xgl/xglinit.c
deleted file mode 100644
index f170e92..0000000
--- a/hw/xgl/xglinit.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "xglglx.h"
-#include "micmap.h"
-#include "mipointer.h"
-#include "fb.h"
-
-#ifdef XGL_MODULAR
-#include <dlfcn.h>
-#endif
-
-#define DEFAULT_DDX_MODULE_NAME "xglx"
-
-static char *ddxModuleName = DEFAULT_DDX_MODULE_NAME;
-
-xglScreenInfoRec xglScreenInfo = {
-    NULL, 0, 0, 0, 0, 0,
-    DEFAULT_GEOMETRY_DATA_TYPE,
-    DEFAULT_GEOMETRY_USAGE,
-    FALSE,
-    XGL_DEFAULT_PBO_MASK,
-    FALSE,
-    {
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } },
-	{ FALSE, FALSE, { 0, 0, 0, 0 } }
-    }
-};
-
-#ifdef GLXEXT
-static Bool loadGlx = TRUE;
-
-#ifndef NGLXEXTLOG
-static char *glxExtLogFile = 0;
-#endif
-
-#endif
-
-typedef struct _xglDDXFunc {
-    void (*initOutput)	       (ScreenInfo   *pScreenInfo,
-				int	     argc,
-				char	     **argv);
-    void (*initInput)	       (int	     argc,
-				char	     **argv);
-    Bool (*legalModifier)      (unsigned int key,
-				DevicePtr    pDev);
-    void (*processInputEvents) (void);
-    void (*useMsg)	       (void);
-    int  (*processArgument)    (int	     argc,
-				char	     **argv,
-				int	     i);
-    void (*abort)	       (void);
-    void (*giveUp)	       (void);
-    void (*osVendorInit)       (void);
-} xglDDXFuncRec;
-
-static xglDDXFuncRec __ddxFunc;
-
-#define SYMFUNC(name) ((void *) (name))
-#define SYMVAR(name)  ((void *) &(name))
-
-/*
- * The following table is used to make sure that all symbols required by
- * dynamically loaded modules are present in the main program. Add more symbols
- * as needed.
- */
-
-void *symTab[] = {
-    SYMFUNC (xglKbdCtrl),
-    SYMFUNC (xglSetPixmapFormats),
-    SYMVAR  (xglVisuals),
-
-    SYMFUNC (mieqEnqueue),
-    SYMFUNC (mieqInit),
-    SYMFUNC (mieqProcessInputEvents),
-    SYMFUNC (miPointerAbsoluteCursor),
-    SYMFUNC (miRegisterPointerDevice),
-    SYMFUNC (miPointerWarpCursor),
-    SYMFUNC (miDCInitialize),
-    SYMFUNC (miPointerAbsoluteCursor),
-    SYMFUNC (miPointerUpdate),
-    SYMFUNC (miRegisterRedirectBorderClipProc)
-};
-
-#define SYM(ptr, name) { (void **) &(ptr), (name) }
-
-static Bool
-xglEnsureDDXModule (void)
-{
-
-#ifdef XGL_MODULAR
-    static void *ddxHandle = 0;
-    static Bool status = TRUE;
-
-    if (!status)
-	return FALSE;
-
-#ifdef GLXEXT
-    /* GLX and GLcore modules must be loaded with RTLD_NOW and RTLD_LOCAL
-       flags before DDX module which is linked to libGL and should be
-       loaded with RTLD_GLOBAL. */
-    if (loadGlx)
-    {
-	if (!xglLoadGLXModules ())
-	    FatalError ("No GLX modules loaded");
-
-#ifndef NGLXEXTLOG
-	if (glxExtLogFile)
-	{
-	    __xglGLXLogFp = fopen (glxExtLogFile, "w");
-	    if (!__xglGLXLogFp)
-		perror ("InitOutput");
-	}
-	else
-	    __xglGLXLogFp = 0;
-#endif
-
-    }
-#endif
-
-    if (!ddxHandle)
-    {
-	xglSymbolRec sym[] = {
-	    SYM (__ddxFunc.initOutput,	       "InitOutput"),
-	    SYM (__ddxFunc.initInput,	       "InitInput"),
-	    SYM (__ddxFunc.legalModifier,      "LegalModifier"),
-	    SYM (__ddxFunc.processInputEvents, "ProcessInputEvents"),
-	    SYM (__ddxFunc.useMsg,	       "ddxUseMsg"),
-	    SYM (__ddxFunc.processArgument,    "ddxProcessArgument"),
-	    SYM (__ddxFunc.abort,	       "AbortDDX"),
-	    SYM (__ddxFunc.giveUp,	       "ddxGiveUp"),
-	    SYM (__ddxFunc.osVendorInit,       "OsVendorInit")
-	};
-
-	ddxHandle = xglLoadModule (ddxModuleName, RTLD_NOW | RTLD_GLOBAL);
-	if (!ddxHandle)
-	    return (status = FALSE);
-
-	if (!xglLookupSymbols (ddxHandle, sym, sizeof (sym) / sizeof (sym[0])))
-	{
-	    xglUnloadModule (ddxHandle);
-	    ddxHandle = 0;
-
-	    return (status = FALSE);
-	}
-    }
-
-    return TRUE;
-#else
-    return FALSE;
-#endif
-
-}
-
-void
-InitOutput (ScreenInfo *pScreenInfo,
-	    int	       argc,
-	    char       **argv)
-{
-    (void) symTab;
-
-    if (!xglEnsureDDXModule ())
-	FatalError ("No DDX module loaded");
-
-    (*__ddxFunc.initOutput) (pScreenInfo, argc, argv);
-}
-
-Bool
-LegalModifier (unsigned int key,
-	       DeviceIntPtr    pDev)
-{
-    return (*__ddxFunc.legalModifier) (key, pDev);
-}
-
-void
-ProcessInputEvents (void)
-{
-    (*__ddxFunc.processInputEvents) ();
-}
-
-void
-InitInput (int  argc,
-	   char **argv)
-{
-    if (!xglEnsureDDXModule ())
-	FatalError ("No DDX module loaded");
-
-    (*__ddxFunc.initInput) (argc, argv);
-}
-
-void
-ddxUseMsg (void)
-{
-    ErrorF ("\nXgl usage:\n");
-    ErrorF ("-ddx module            specify ddx module\n");
-
-#ifdef GLXEXT
-    ErrorF ("-noglx                 don't load glx extension\n");
-
-#ifndef NGLXEXTLOG
-    ErrorF ("-glxlog file           glx extension log file\n");
-#endif
-
-#endif
-
-    xglUseMsg ();
-
-    if (xglEnsureDDXModule ())
-	(*__ddxFunc.useMsg) ();
-}
-
-int
-ddxProcessArgument (int  argc,
-		    char **argv,
-		    int  i)
-{
-    static Bool checkDDX = FALSE;
-    int		skip;
-
-    if (!checkDDX)
-    {
-	int j;
-
-	for (j = i; j < argc; j++)
-	{
-	    if (!strcmp (argv[j], "-ddx"))
-	    {
-		if (++j < argc)
-		    ddxModuleName = argv[j];
-	    }
-
-#ifdef GLXEXT
-	    else if (!strcmp (argv[j], "-noglx"))
-	    {
-		loadGlx = FALSE;
-	    }
-
-#ifndef NGLXEXTLOG
-	    else if (!strcmp (argv[j], "-glxlog"))
-	    {
-		if (++j < argc)
-		    glxExtLogFile = argv[j];
-	    }
-#endif
-
-#endif
-
-	}
-	checkDDX = TRUE;
-    }
-
-    if (!strcmp (argv[i], "-ddx"))
-    {
-	if ((i + 1) < argc)
-	    return 2;
-
-	return 1;
-    }
-
-#ifdef GLXEXT
-    else if (!strcmp (argv[i], "-noglx"))
-    {
-	return 1;
-    }
-
-#ifndef NGLXEXTLOG
-    else if (!strcmp (argv[i], "-glxlog"))
-    {
-	if ((i + 1) < argc)
-	    return 2;
-
-	return 1;
-    }
-#endif
-
-#endif
-
-    skip = xglProcessArgument (argc, argv, i);
-    if (skip)
-	return skip;
-
-    if (xglEnsureDDXModule ())
-	return (*__ddxFunc.processArgument) (argc, argv, i);
-
-    return 0;
-}
-
-void
-AbortDDX (void)
-{
-    if (xglEnsureDDXModule ())
-	(*__ddxFunc.abort) ();
-}
-
-void
-ddxGiveUp (void)
-{
-    if (xglEnsureDDXModule ())
-	(*__ddxFunc.giveUp) ();
-}
-
-void
-OsVendorInit (void)
-{
-    if (xglEnsureDDXModule ())
-	(*__ddxFunc.osVendorInit) ();
-}
diff --git a/hw/xgl/xglinput.c b/hw/xgl/xglinput.c
deleted file mode 100644
index 9499fcf..0000000
--- a/hw/xgl/xglinput.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "inputstr.h"
-#include "mipointer.h"
-
-#define XK_PUBLISHING
-#include <X11/keysym.h>
-#if HAVE_X11_XF86KEYSYM_H
-#include <X11/XF86keysym.h>
-#endif
-
-#define NUM_BUTTONS 7
-
-int
-xglMouseProc (DeviceIntPtr pDevice,
-	      int	   onoff)
-{
-    BYTE      map[NUM_BUTTONS + 1];
-    DevicePtr pDev = (DevicePtr) pDevice;
-    int       i;
-
-    switch (onoff) {
-    case DEVICE_INIT:
-	for (i = 1; i <= NUM_BUTTONS; i++)
-	    map[i] = i;
-
-	InitPointerDeviceStruct (pDev,
-				 map,
-				 NUM_BUTTONS,
-				 miPointerGetMotionEvents,
-				 (PtrCtrlProcPtr) NoopDDA,
-				 miPointerGetMotionBufferSize ());
-	break;
-    case DEVICE_ON:
-	pDev->on = TRUE;
-	break;
-    case DEVICE_OFF:
-    case DEVICE_CLOSE:
-	pDev->on = FALSE;
-	break;
-    }
-
-    return Success;
-}
-
-void
-xglBell (int	      volume,
-	 DeviceIntPtr pDev,
-	 pointer      ctrl,
-	 int	      something)
-{
-}
-
-void
-xglKbdCtrl (DeviceIntPtr pDevice,
-	    KeybdCtrl	 *ctrl)
-{
-}
-
-#define XGL_KEYMAP_WIDTH    2
-
-KeySym xglKeymap[] = {
-/*      1     8 */	 XK_Escape, NoSymbol,
-/*      2     9 */	 XK_1,	XK_exclam,
-/*      3    10 */	 XK_2,	XK_at,
-/*      4    11 */	 XK_3,	XK_numbersign,
-/*      5    12 */	 XK_4,	XK_dollar,
-/*      6    13 */	 XK_5,	XK_percent,
-/*      7    14 */	 XK_6,	XK_asciicircum,
-/*      8    15 */	 XK_7,	XK_ampersand,
-/*      9    16 */	 XK_8,	XK_asterisk,
-/*     10    17 */	 XK_9,	XK_parenleft,
-/*     11    18 */	 XK_0,	XK_parenright,
-/*     12    19 */	 XK_minus,	XK_underscore,
-/*     13    20 */	 XK_equal,	XK_plus,
-/*     14    21 */	 XK_BackSpace,	NoSymbol,
-/*     15    22 */	 XK_Tab,	NoSymbol,
-/*     16    23 */	 XK_Q,	NoSymbol,
-/*     17    24 */	 XK_W,	NoSymbol,
-/*     18    25 */	 XK_E,	NoSymbol,
-/*     19    26 */	 XK_R,	NoSymbol,
-/*     20    27 */	 XK_T,	NoSymbol,
-/*     21    28 */	 XK_Y,	NoSymbol,
-/*     22    29 */	 XK_U,	NoSymbol,
-/*     23    30 */	 XK_I,	NoSymbol,
-/*     24    31 */	 XK_O,	NoSymbol,
-/*     25    32 */	 XK_P,	NoSymbol,
-/*     26    33 */	 XK_bracketleft,	XK_braceleft,
-/*     27    34 */	 XK_bracketright,	XK_braceright,
-/*     28    35 */	 XK_Return,	NoSymbol,
-/*     29    36 */	 XK_Control_L,	NoSymbol,
-/*     30    37 */	 XK_A,	NoSymbol,
-/*     31    38 */	 XK_S,	NoSymbol,
-/*     32    39 */	 XK_D,	NoSymbol,
-/*     33    40 */	 XK_F,	NoSymbol,
-/*     34    41 */	 XK_G,	NoSymbol,
-/*     35    42 */	 XK_H,	NoSymbol,
-/*     36    43 */	 XK_J,	NoSymbol,
-/*     37    44 */	 XK_K,	NoSymbol,
-/*     38    45 */	 XK_L,	NoSymbol,
-/*     39    46 */	 XK_semicolon,	XK_colon,
-/*     40    47 */	 XK_apostrophe,	XK_quotedbl,
-/*     41    48 */	 XK_grave,	XK_asciitilde,
-/*     42    49 */	 XK_Shift_L,	NoSymbol,
-/*     43    50 */	 XK_backslash,	XK_bar,
-/*     44    51 */	 XK_Z,	NoSymbol,
-/*     45    52 */	 XK_X,	NoSymbol,
-/*     46    53 */	 XK_C,	NoSymbol,
-/*     47    54 */	 XK_V,	NoSymbol,
-/*     48    55 */	 XK_B,	NoSymbol,
-/*     49    56 */	 XK_N,	NoSymbol,
-/*     50    57 */	 XK_M,	NoSymbol,
-/*     51    58 */	 XK_comma,	XK_less,
-/*     52    59 */	 XK_period,	XK_greater,
-/*     53    60 */	 XK_slash,	XK_question,
-/*     54    61 */	 XK_Shift_R,	NoSymbol,
-/*     55    62 */	 XK_KP_Multiply,	NoSymbol,
-/*     56    63 */	 XK_Alt_L,	XK_Meta_L,
-/*     57    64 */	 XK_space,	NoSymbol,
-/*     58    65 */	 XK_Caps_Lock,	NoSymbol,
-/*     59    66 */	 XK_F1,	NoSymbol,
-/*     60    67 */	 XK_F2,	NoSymbol,
-/*     61    68 */	 XK_F3,	NoSymbol,
-/*     62    69 */	 XK_F4,	NoSymbol,
-/*     63    70 */	 XK_F5,	NoSymbol,
-/*     64    71 */	 XK_F6,	NoSymbol,
-/*     65    72 */	 XK_F7,	NoSymbol,
-/*     66    73 */	 XK_F8,	NoSymbol,
-/*     67    74 */	 XK_F9,	NoSymbol,
-/*     68    75 */	 XK_F10,	NoSymbol,
-/*     69    76 */	 XK_Break,	XK_Pause,
-/*     70    77 */	 XK_Scroll_Lock,	NoSymbol,
-/*     71    78 */	 XK_KP_Home,	XK_KP_7,
-/*     72    79 */	 XK_KP_Up,	XK_KP_8,
-/*     73    80 */	 XK_KP_Page_Up,	XK_KP_9,
-/*     74    81 */	 XK_KP_Subtract,	NoSymbol,
-/*     75    82 */	 XK_KP_Left,	XK_KP_4,
-/*     76    83 */	 XK_KP_5,	NoSymbol,
-/*     77    84 */	 XK_KP_Right,	XK_KP_6,
-/*     78    85 */	 XK_KP_Add,	NoSymbol,
-/*     79    86 */	 XK_KP_End,	XK_KP_1,
-/*     80    87 */	 XK_KP_Down,	XK_KP_2,
-/*     81    88 */	 XK_KP_Page_Down,	XK_KP_3,
-/*     82    89 */	 XK_KP_Insert,	XK_KP_0,
-/*     83    90 */	 XK_KP_Delete,	XK_KP_Decimal,
-/*     84    91 */     NoSymbol,	NoSymbol,
-/*     85    92 */     NoSymbol,	NoSymbol,
-/*     86    93 */     NoSymbol,	NoSymbol,
-/*     87    94 */	 XK_F11,	NoSymbol,
-/*     88    95 */	 XK_F12,	NoSymbol,
-/*     89    96 */	 XK_Control_R,	NoSymbol,
-/*     90    97 */	 XK_KP_Enter,	NoSymbol,
-/*     91    98 */	 XK_KP_Divide,	NoSymbol,
-/*     92    99 */	 XK_Sys_Req,	XK_Print,
-/*     93   100 */	 XK_Alt_R,	XK_Meta_R,
-/*     94   101 */	 XK_Num_Lock,	NoSymbol,
-/*     95   102 */	 XK_Home,	NoSymbol,
-/*     96   103 */	 XK_Up,		NoSymbol,
-/*     97   104 */	 XK_Page_Up,	NoSymbol,
-/*     98   105 */	 XK_Left,	NoSymbol,
-/*     99   106 */	 XK_Right,	NoSymbol,
-/*    100   107 */	 XK_End,	NoSymbol,
-/*    101   108 */	 XK_Down,	NoSymbol,
-/*    102   109 */	 XK_Page_Down,	NoSymbol,
-/*    103   110 */	 XK_Insert,	NoSymbol,
-/*    104   111 */	 XK_Delete,	NoSymbol,
-/*    105   112 */	 XK_Super_L,	NoSymbol,
-/*    106   113 */	 XK_Super_R,	NoSymbol,
-/*    107   114 */	 XK_Menu,	NoSymbol,
-
-/*    108   115 */	 XK_Next,	NoSymbol,   /* right button on side */
-/*    109   116 */	 XK_Prior,	NoSymbol,   /* left button on side */
-/*    110   117 */	 XK_Up,		NoSymbol,   /* joypad */
-/*    111   118 */	 XK_Down,	NoSymbol,
-/*    112   119 */	 XK_Left,	NoSymbol,
-/*    113   120 */	 XK_Right,	NoSymbol,
-/*    114   121 */	 NoSymbol,	NoSymbol,   /* left near speaker */
-/*    115   122 */	 NoSymbol,	NoSymbol,   /* right near speaker */
-/*    116   123 */	 NoSymbol,	NoSymbol,   /* tiny button */
-};
-
-CARD8 xglModMap[MAP_LENGTH];
-
-KeySymsRec xglKeySyms = {
-    xglKeymap,
-    8,
-    8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1,
-    XGL_KEYMAP_WIDTH
-};
-
-int
-xglKeybdProc (DeviceIntPtr pDevice,
-	      int	   onoff)
-{
-    Bool      ret;
-    DevicePtr pDev = (DevicePtr) pDevice;
-
-    if (!pDev)
-	return BadImplementation;
-
-    switch (onoff) {
-    case DEVICE_INIT:
-	if (pDev != (DevicePtr)inputInfo.keyboard)
-	    return !Success;
-
-	ret = InitKeyboardDeviceStruct (pDev,
-					&xglKeySyms,
-					xglModMap,
-					xglBell,
-					xglKbdCtrl);
-	if (!ret)
-	    return BadImplementation;
-	break;
-    case DEVICE_ON:
-	pDev->on = TRUE;
-	break;
-    case DEVICE_OFF:
-    case DEVICE_CLOSE:
-	pDev->on = FALSE;
-	break;
-    }
-
-    return Success;
-}
-
-void
-xglInitInput (int argc, char **argv)
-{
-    DeviceIntPtr pKeyboard, pPointer;
-
-    pPointer  = AddInputDevice (xglMouseProc, TRUE);
-    pKeyboard = AddInputDevice (xglKeybdProc, TRUE);
-
-    RegisterPointerDevice (pPointer);
-    RegisterKeyboardDevice (pKeyboard);
-
-    miRegisterPointerDevice (screenInfo.screens[0], pPointer);
-    mieqInit (&pKeyboard->public, &pPointer->public);
-}
diff --git a/hw/xgl/xglloader.c b/hw/xgl/xglloader.c
deleted file mode 100644
index f64acf1..0000000
--- a/hw/xgl/xglloader.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "xglmodule.h"
-
-#ifdef XGL_MODULAR
-
-#include <dlfcn.h>
-
-#define SYM(ptr, name) { (void **) &(ptr), (name) }
-
-void *
-xglLoadModule (const char *name,
-	       int	  flag)
-{
-    ModuleVersionProcPtr moduleVersion;
-    ModuleInitProcPtr    moduleInit;
-    void	         *handle = 0;
-    char	         *module;
-    xglSymbolRec         mSym[] = {
-	SYM (moduleVersion, "moduleVersion"),
-	SYM (moduleInit,    "moduleInit")
-    };
-
-    module = malloc (strlen (XGL_MODULE_PATH "/lib.so") + strlen (name) + 1);
-    if (!module)
-	return 0;
-
-    sprintf (module, XGL_MODULE_PATH "/lib%s.so", name);
-
-    handle = dlopen (module, flag);
-    if (handle)
-    {
-	if (xglLookupSymbols (handle, mSym, sizeof (mSym) / sizeof (mSym[0])))
-	{
-	    const char *version;
-
-	    version = (*moduleVersion) ();
-	    if (strcmp (VERSION, version) == 0)
-	    {
-		if (!(*moduleInit) (module))
-		{
-		    dlclose (handle);
-		    handle = 0;
-		}
-	    }
-	    else
-	    {
-		ErrorF ("Module version mismatch. "
-			"%s is %s Xserver is" VERSION "\n",
-			module, version);
-
-		dlclose (handle);
-		handle = 0;
-	    }
-	}
-	else
-	{
-	    dlclose (handle);
-	    handle = 0;
-	}
-    }
-    else
-	ErrorF ("dlopen: %s\n", dlerror ());
-
-    free (module);
-
-    return handle;
-}
-
-void
-xglUnloadModule (void *handle)
-{
-    dlclose (handle);
-}
-
-Bool
-xglLookupSymbols (void         *handle,
-		  xglSymbolPtr sym,
-		  int	       nSym)
-{
-    void *symbol;
-    char *error;
-    int  i;
-
-    /* avoid previous error */
-    dlerror ();
-
-    for (i = 0; i < nSym; i++)
-    {
-	symbol = dlsym (handle, sym[i].name);
-	if (!symbol)
-	{
-	    error = dlerror ();
-	    if (error != 0)
-		ErrorF ("dlsym: %s: %s\n", sym[i].name, error);
-
-	    return FALSE;
-	}
-
-	*(sym[i].ptr) = symbol;
-    }
-
-    return TRUE;
-}
-
-#endif
diff --git a/hw/xgl/xglmodule.h b/hw/xgl/xglmodule.h
deleted file mode 100644
index da868e9..0000000
--- a/hw/xgl/xglmodule.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#ifndef _XGL_MODULE_H_
-#define _XGL_MODULE_H_
-
-#include <xgl-config.h>
-
-#include <X11/Xdefs.h>
-#include "misc.h"
-
-#define VERSION "0.0.1"
-
-typedef const char *(*ModuleVersionProcPtr) (void);
-typedef Bool	   (*ModuleInitProcPtr)	    (const char *module);
-
-char *
-moduleVersion (void);
-
-Bool
-moduleInit (const char *module);
-
-#endif /* _XGL_MODULE_H_ */
diff --git a/hw/xgl/xgloutput.c b/hw/xgl/xgloutput.c
deleted file mode 100644
index 76903a8..0000000
--- a/hw/xgl/xgloutput.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-#include <mivalidate.h>
-#include <dixstruct.h>
-
-typedef struct _xglDepth {
-    CARD8 depth;
-    CARD8 bpp;
-} xglDepthRec, *xglDepthPtr;
-
-static xglDepthRec xglDepths[] = {
-    {  1,  1 },
-    {  4,  4 },
-    {  8,  8 },
-    { 15, 16 },
-    { 16, 16 },
-    { 24, 32 },
-    { 32, 32 }
-};
-
-#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0]))
-
-void
-xglSetPixmapFormats (ScreenInfo *pScreenInfo)
-{
-    int i;
-
-    pScreenInfo->imageByteOrder	    = IMAGE_BYTE_ORDER;
-    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
-    pScreenInfo->bitmapScanlinePad  = BITMAP_SCANLINE_PAD;
-    pScreenInfo->bitmapBitOrder	    = BITMAP_BIT_ORDER;
-    pScreenInfo->numPixmapFormats   = 0;
-
-    for (i = 0; i < NUM_XGL_DEPTHS; i++)
-    {
-	PixmapFormatRec *format;
-
-	format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
-
-	format->depth	     = xglDepths[i].depth;
-	format->bitsPerPixel = xglDepths[i].bpp;
-	format->scanlinePad  = BITMAP_SCANLINE_PAD;
-    }
-}
-
-void
-xglSetRootClip (ScreenPtr pScreen,
-		Bool	  enable)
-{
-    WindowPtr	pWin = WindowTable[pScreen->myNum];
-    WindowPtr	pChild;
-    Bool	wasViewable;
-    Bool	anyMarked = FALSE;
-    RegionPtr	pOldClip = 0;
-
-#ifdef DO_SAVE_UNDERS
-    Bool	dosave = FALSE;
-#endif
-
-    WindowPtr   pLayerWin;
-    BoxRec	box;
-
-    if (!pWin)
-	return;
-
-    wasViewable = (Bool) (pWin->viewable);
-    if (wasViewable)
-    {
-	for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
-	{
-	    (void) (*pScreen->MarkOverlappedWindows) (pChild,
-						      pChild,
-						      &pLayerWin);
-	}
-
-	(*pScreen->MarkWindow) (pWin);
-	anyMarked = TRUE;
-
-	if (pWin->valdata)
-	{
-	    if (HasBorder (pWin))
-	    {
-		RegionPtr borderVisible;
-
-		borderVisible = REGION_CREATE (pScreen, NullBox, 1);
-		REGION_SUBTRACT (pScreen, borderVisible,
-				 &pWin->borderClip, &pWin->winSize);
-		pWin->valdata->before.borderVisible = borderVisible;
-	    }
-	    pWin->valdata->before.resized = TRUE;
-	}
-    }
-
-    if (enable)
-    {
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = pScreen->width;
-	box.y2 = pScreen->height;
-
-	pWin->drawable.width  = pScreen->width;
-	pWin->drawable.height = pScreen->height;
-
-	REGION_INIT (pScreen, &pWin->winSize, &box, 1);
-	REGION_INIT (pScreen, &pWin->borderSize, &box, 1);
-	REGION_RESET (pScreen, &pWin->borderClip, &box);
-	REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
-    }
-    else
-    {
-	REGION_EMPTY (pScreen, &pWin->borderClip);
-	REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
-    }
-
-    ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
-    if (wasViewable)
-    {
-	if (pWin->firstChild)
-	{
-	    anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild,
-							    pWin->firstChild,
-							    (WindowPtr *) 0);
-	}
-	else
-	{
-	    (*pScreen->MarkWindow) (pWin);
-	    anyMarked = TRUE;
-	}
-
-#ifdef DO_SAVE_UNDERS
-	if (DO_SAVE_UNDERS (pWin))
-	    dosave = (*pScreen->ChangeSaveUnder) (pLayerWin, pLayerWin);
-#endif
-
-	if (anyMarked)
-	    (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
-    }
-
-    if (wasViewable)
-    {
-	if (anyMarked)
-	    (*pScreen->HandleExposures) (pWin);
-
-#ifdef DO_SAVE_UNDERS
-	if (dosave)
-	    (*pScreen->PostChangeSaveUnder) (pLayerWin, pLayerWin);
-#endif
-
-	if (anyMarked && pScreen->PostValidateTree)
-	    (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther);
-    }
-
-    if (pWin->realized)
-	WindowsRestructured ();
-}
diff --git a/hw/xgl/xglparse.c b/hw/xgl/xglparse.c
deleted file mode 100644
index 5292692..0000000
--- a/hw/xgl/xglparse.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-char *
-xglParseFindNext (char *cur,
-		  char *delim,
-		  char *save,
-		  char *last)
-{
-    while (*cur && !strchr (delim, *cur))
-	*save++ = *cur++;
-
-    *save = 0;
-    *last = *cur;
-
-    if (*cur)
-	cur++;
-
-    return cur;
-}
-
-void
-xglParseScreen (char *arg)
-{
-    char delim;
-    char save[1024];
-    int	 i, pixels, mm;
-
-    xglScreenInfo.width    = 0;
-    xglScreenInfo.height   = 0;
-    xglScreenInfo.widthMm  = 0;
-    xglScreenInfo.heightMm = 0;
-
-    if (!arg)
-	return;
-
-    if (strlen (arg) >= sizeof (save))
-	return;
-
-    for (i = 0; i < 2; i++)
-    {
-	arg = xglParseFindNext (arg, "x/", save, &delim);
-	if (!save[0])
-	    return;
-
-	pixels = atoi (save);
-	mm = 0;
-
-	if (delim == '/')
-	{
-	    arg = xglParseFindNext (arg, "x", save, &delim);
-	    if (!save[0])
-		return;
-
-	    mm = atoi (save);
-	}
-
-	if (i == 0)
-	{
-	    xglScreenInfo.width   = pixels;
-	    xglScreenInfo.widthMm = mm;
-	}
-	else
-	{
-	    xglScreenInfo.height   = pixels;
-	    xglScreenInfo.heightMm = mm;
-	}
-
-	if (delim != 'x')
-	    return;
-    }
-}
-
-static void
-xglParseAccel (char *arg)
-{
-    xglAccelInfoPtr pAccel;
-    char	    delim;
-    char	    save[1024];
-
-    if (!arg)
-	return;
-
-    if (strlen (arg) >= sizeof (save))
-	return;
-
-    arg = xglParseFindNext (arg, "@:", save, &delim);
-    if (!save[0])
-	return;
-
-    if (strcasecmp (save, "pixmap") == 0)
-	pAccel = &xglScreenInfo.accel.pixmap;
-    else if (strcasecmp (save, "window") == 0)
-	pAccel = &xglScreenInfo.accel.window;
-    else if (strcasecmp (save, "glx") == 0)
-	pAccel = &xglScreenInfo.accel.glx;
-    else if (strcasecmp (save, "xv") == 0)
-	pAccel = &xglScreenInfo.accel.xv;
-    else
-	return;
-
-    if (delim == '@')
-    {
-	arg = xglParseFindNext (arg, "/x:", save, &delim);
-	if (!save[0])
-	    return;
-
-	pAccel->size.aboveWidth = pAccel->size.minWidth = atoi (save);
-
-	if (delim == '/')
-	{
-	    arg = xglParseFindNext (arg, "x:", save, &delim);
-	    if (!save[0])
-		return;
-
-	    pAccel->size.aboveWidth = atoi (save);
-	}
-
-	if (delim == 'x')
-	{
-	    arg = xglParseFindNext (arg, "/:", save, &delim);
-	    if (!save[0])
-		return;
-
-	    pAccel->size.aboveHeight = pAccel->size.minHeight = atoi (save);
-
-	    if (delim == '/')
-	    {
-		arg = xglParseFindNext (arg, ":", save, &delim);
-		if (!save[0])
-		    return;
-
-		pAccel->size.aboveHeight = atoi (save);
-	    }
-	}
-    }
-
-    pAccel->enabled = TRUE;
-    pAccel->pbuffer = FALSE;
-
-    if (delim == ':')
-    {
-	if (strcasecmp (arg, "fbo") == 0)
-	    ;
-	else if (strcasecmp  (arg, "off")  == 0 ||
-		 strncasecmp (arg, "0", 1) == 0 ||
-		 strncasecmp (arg, "f", 1) == 0 ||
-		 strncasecmp (arg, "n", 1) == 0)
-	{
-	    pAccel->enabled = FALSE;
-	    pAccel->pbuffer = FALSE;
-	}
-	else if (strcasecmp (arg, "pbuffer") == 0)
-	{
-	    pAccel->pbuffer = TRUE;
-	}
-    }
-}
-
-void
-xglUseMsg (void)
-{
-    ErrorF ("-vertextype [short|float] set vertex data type\n");
-    ErrorF ("-yinverted             Y is upside-down\n");
-    ErrorF ("-lines                 "
-	    "accelerate lines that are not vertical or horizontal\n");
-    ErrorF ("-vbo                   "
-	    "use vertex buffer objects for streaming of vertex data\n");
-    ErrorF ("-pbomask [1|4|8|16|32] "
-	    "set bpp's to use with pixel buffer objects\n");
-    ErrorF ("-accel TYPE[@WIDTH[/MIN]xHEIGHT[/MIN]][:METHOD] "
-	    "offscreen acceleration\n");
-}
-
-int
-xglProcessArgument (int	 argc,
-		    char **argv,
-		    int	 i)
-{
-    if (!strcmp (argv[i], "-vertextype"))
-    {
-	if ((i + 1) < argc)
-	{
-	    if (!strcasecmp (argv[i + 1], "short"))
-		xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_SHORT;
-	    else if (!strcasecmp (argv[i + 1], "float"))
-		xglScreenInfo.geometryDataType = GEOMETRY_DATA_TYPE_FLOAT;
-	}
-	else
-	    return 1;
-
-	return 2;
-    }
-    else if (!strcmp (argv[i], "-yinverted"))
-    {
-	xglScreenInfo.yInverted = TRUE;
-	return 1;
-    }
-    else if (!strcmp (argv[i], "-lines"))
-    {
-	xglScreenInfo.lines = TRUE;
-	return 1;
-    }
-    else if (!strcmp (argv[i], "-vbo"))
-    {
-	xglScreenInfo.geometryUsage = GEOMETRY_USAGE_STREAM;
-	return 1;
-    }
-    else if (!strcmp (argv[i], "-pbomask"))
-    {
-	if ((i + 1) < argc)
-	{
-	    xglScreenInfo.pboMask = atoi (argv[i + 1]);
-	}
-	else
-	    return 1;
-
-	return 2;
-    }
-    else if (!strcmp (argv[i], "-accel"))
-    {
-	if ((i + 1) < argc)
-	{
-	    xglParseAccel (argv[i + 1]);
-	}
-	else
-	    return 1;
-
-	return 2;
-    }
-
-    return 0;
-}
diff --git a/hw/xgl/xglpict.c b/hw/xgl/xglpict.c
deleted file mode 100644
index fee2431..0000000
--- a/hw/xgl/xglpict.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-#ifdef RENDER
-
-#include "fbpict.h"
-
-#define XGL_PICTURE_FALLBACK_PROLOGUE(pPicture, func) \
-    xglSyncDamageBoxBits (pPicture->pDrawable);	      \
-    XGL_PICTURE_SCREEN_UNWRAP (func)
-
-#define XGL_PICTURE_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
-    XGL_PICTURE_SCREEN_WRAP (func, xglfunc);		       \
-    xglAddCurrentSurfaceDamage (pPicture->pDrawable)
-
-void
-xglComposite (CARD8	 op,
-	      PicturePtr pSrc,
-	      PicturePtr pMask,
-	      PicturePtr pDst,
-	      INT16	 xSrc,
-	      INT16	 ySrc,
-	      INT16	 xMask,
-	      INT16	 yMask,
-	      INT16	 xDst,
-	      INT16	 yDst,
-	      CARD16	 width,
-	      CARD16	 height)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pDst->pDrawable->pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (xglCompositeGeneral (op,
-			     pSrc, pMask, pDst, NULL,
-			     xSrc, ySrc,
-			     xMask, yMask,
-			     xDst + pDst->pDrawable->x,
-			     yDst + pDst->pDrawable->y,
-			     width, height))
-    {
-	xglAddCurrentBitDamage (pDst->pDrawable);
-	return;
-    }
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    if (pSrc->pDrawable)
-    {
-	if (!xglSyncBits (pSrc->pDrawable, NullBox))
-	    FatalError (XGL_SW_FAILURE_STRING);
-    }
-
-    if (pMask && pMask->pDrawable)
-    {
-	if (!xglSyncBits (pMask->pDrawable, NullBox))
-	    FatalError (XGL_SW_FAILURE_STRING);
-    }
-
-    if (op == PictOpSrc)
-    {
-	XGL_DRAWABLE_PIXMAP (pDst->pDrawable);
-
-	if (!xglMapPixmapBits (pPixmap))
-	    FatalError (XGL_SW_FAILURE_STRING);
-    } else
-	xglSyncDamageBoxBits (pDst->pDrawable);
-
-    XGL_PICTURE_SCREEN_UNWRAP (Composite);
-    (*pPictureScreen->Composite) (op, pSrc, pMask, pDst,
-				  xSrc, ySrc, xMask, yMask, xDst, yDst,
-				  width, height);
-    XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
-
-    if (op == PictOpSrc)
-    {
-	RegionRec region;
-
-	xDst += pDst->pDrawable->x;
-	yDst += pDst->pDrawable->y;
-
-	if (pSrc->pDrawable)
-	{
-	    xSrc += pSrc->pDrawable->x;
-	    ySrc += pSrc->pDrawable->y;
-	}
-
-	if (pMask && pMask->pDrawable)
-	{
-	    xMask += pMask->pDrawable->x;
-	    yMask += pMask->pDrawable->y;
-	}
-
-	if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
-				       xSrc, ySrc, xMask, yMask, xDst, yDst,
-				       width, height))
-	    return;
-
-	xglAddSurfaceDamage (pDst->pDrawable, &region);
-	REGION_UNINIT (pDst->pDrawable->pScreen, &region);
-    } else
-	xglAddCurrentSurfaceDamage (pDst->pDrawable);
-}
-
-void
-xglAddTriangles (PicturePtr pDst,
-		 INT16	    xOff,
-		 INT16	    yOff,
-		 int	    ntri,
-		 xTriangle  *tris)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pDst->pDrawable->pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    pPixmapPriv->damageBox.x1 = 0;
-    pPixmapPriv->damageBox.y1 = 0;
-    pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
-    pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
-
-    XGL_PICTURE_FALLBACK_PROLOGUE (pDst, AddTriangles);
-    (*pPictureScreen->AddTriangles) (pDst, xOff, yOff, ntri, tris);
-    XGL_PICTURE_FALLBACK_EPILOGUE (pDst, AddTriangles, xglAddTriangles);
-}
-
-
-void
-xglChangePicture (PicturePtr pPicture,
-		  Mask	     mask)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pPicture->pDrawable->pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    if (pPicture->stateChanges & CPRepeat)
-	pPixmapPriv->pictureMask |= xglPCFillMask;
-
-    if (pPicture->stateChanges & CPComponentAlpha)
-	pPixmapPriv->pictureMask |= xglPCComponentAlphaMask;
-
-    if (pPicture->stateChanges & CPDither)
-	pPixmapPriv->pictureMask |= xglPCDitherMask;
-
-    XGL_PICTURE_SCREEN_UNWRAP (ChangePicture);
-    (*pPictureScreen->ChangePicture) (pPicture, mask);
-    XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
-}
-
-int
-xglChangePictureTransform (PicturePtr    pPicture,
-			   PictTransform *transform)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pPicture->pDrawable->pScreen;
-    int		     ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    if (transform != pPicture->transform ||
-	(transform && memcmp (transform, &pPicture->transform,
-			      sizeof (PictTransform))))
-	pPixmapPriv->pictureMask |= xglPCTransformMask;
-
-    XGL_PICTURE_SCREEN_UNWRAP (ChangePictureTransform);
-    ret = (*pPictureScreen->ChangePictureTransform) (pPicture, transform);
-    XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
-			     xglChangePictureTransform);
-
-    return ret;
-}
-
-int
-xglChangePictureFilter (PicturePtr pPicture,
-			int	   filter,
-			xFixed	   *params,
-			int	   nparams)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pPicture->pDrawable->pScreen;
-    int		     ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    pPixmapPriv->pictureMask |= xglPCFilterMask;
-
-    XGL_PICTURE_SCREEN_UNWRAP (ChangePictureFilter);
-    ret = (*pPictureScreen->ChangePictureFilter) (pPicture, filter,
-						  params, nparams);
-    XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
-
-    return ret;
-}
-
-static void
-xglDestroyDevicePicture (PicturePtr pPicture)
-{
-    if (pPicture->pSourcePict->source.devPrivate.ptr)
-	glitz_surface_destroy (pPicture->pSourcePict->source.devPrivate.ptr);
-}
-
-PicturePtr
-xglCreateDevicePicture (pointer data)
-{
-    PicturePtr pPicture;
-    int	       error;
-
-    pPicture = CreateDevicePicture (0, &error);
-    if (!pPicture)
-	return 0;
-
-    pPicture->pSourcePict->source.devPrivate.ptr = data;
-    pPicture->pSourcePict->source.Destroy	 = xglDestroyDevicePicture;
-
-    return pPicture;
-}
-
-static int fillMode[] = {
-    GLITZ_FILL_TRANSPARENT, /* RepeatNone    */
-    GLITZ_FILL_REPEAT,      /* RepeatNormal  */
-    GLITZ_FILL_NEAREST,     /* RepeatPad     */
-    GLITZ_FILL_REFLECT      /* RepeatReflect */
-};
-
-static void
-xglUpdatePicture (PicturePtr pPicture)
-{
-    glitz_surface_t *surface;
-
-    XGL_DRAWABLE_PIXMAP_PRIV (pPicture->pDrawable);
-
-    surface = pPixmapPriv->surface;
-
-    if (pPixmapPriv->pictureMask & xglPCFillMask)
-    {
-	glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
-    }
-
-    if (pPixmapPriv->pictureMask & xglPCFilterMask)
-    {
-	switch (pPicture->filter) {
-	case PictFilterNearest:
-	case PictFilterFast:
-	    glitz_surface_set_filter (surface, GLITZ_FILTER_NEAREST, NULL, 0);
-	    break;
-	case PictFilterGood:
-	case PictFilterBest:
-	case PictFilterBilinear:
-	    glitz_surface_set_filter (surface, GLITZ_FILTER_BILINEAR, NULL, 0);
-	    break;
-	case PictFilterConvolution:
-	    glitz_surface_set_filter (surface, GLITZ_FILTER_CONVOLUTION,
-				      (glitz_fixed16_16_t *)
-				      pPicture->filter_params,
-				      pPicture->filter_nparams);
-	    break;
-	}
-    }
-
-    if (pPixmapPriv->pictureMask & xglPCTransformMask)
-    {
-	glitz_surface_set_transform (surface, (glitz_transform_t *)
-				     pPicture->transform);
-    }
-
-    if (pPixmapPriv->pictureMask & xglPCComponentAlphaMask)
-    {
-	glitz_surface_set_component_alpha (surface, pPicture->componentAlpha);
-    }
-
-    if (pPixmapPriv->pictureMask & xglPCDitherMask)
-    {
-	glitz_surface_set_dither (surface, pPicture->dither);
-    }
-
-    pPixmapPriv->pictureMask &= ~XGL_PICTURE_CHANGES (~0);
-}
-
-#define N_STACK_PARAM 256
-
-static int gradientNParam[] = {
-    0, /* SourcePictTypeSolidFill */
-    4, /* SourcePictTypeLinear    */
-    6, /* SourcePictTypeRadial    */
-    4, /* SourcePictTypeConical   */
-};
-
-Bool
-xglSyncPicture (ScreenPtr  pScreen,
-		PicturePtr pPicture,
-		INT16	   x,
-		INT16	   y,
-		CARD16	   width,
-		CARD16	   height,
-		INT16	   *xOff,
-		INT16	   *yOff)
-{
-    xglPixmapPtr pPixmapPriv;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    *xOff = *yOff = 0;
-
-    if (pPicture->pSourcePict)
-    {
-	if (pPicture->pSourcePict->source.devPrivate.ptr)
-	    return TRUE;
-
-	if (pPicture->pDrawable)
-	{
-	    (*pScreen->DestroyPixmap) ((PixmapPtr) pPicture->pDrawable);
-	    pPicture->pDrawable = (DrawablePtr) 0;
-	}
-
-	switch (pPicture->pSourcePict->source.type) {
-	case SourcePictTypeSolidFill:
-	    x = y = 0;
-	    width = height = 1;
-	    break;
-	case SourcePictTypeLinear:
-	case SourcePictTypeRadial: {
-	    glitz_fixed16_16_t		stackParam[N_STACK_PARAM];
-	    glitz_fixed16_16_t		*param;
-	    int				nParam, nStop, size, i;
-	    CARD32			*pixel;
-	    PictGradientStopPtr		pStop;
-	    glitz_buffer_t		*buffer;
-	    glitz_format_t		*format;
-	    glitz_surface_t		*surface;
-	    static glitz_pixel_format_t pixelFormat = {
-		GLITZ_FOURCC_RGB,
-		{
-		    32,
-		    0xff000000,
-		    0x00ff0000,
-		    0x0000ff00,
-		    0x000000ff
-		},
-		0, 0, 0,
-		GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
-	    };
-
-	    if (!(pScreenPriv->features & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK))
-		break;
-
-	    format = glitz_find_standard_format (pScreenPriv->drawable,
-						 GLITZ_STANDARD_ARGB32);
-	    if (!format)
-		break;
-
-	    nParam = gradientNParam[pPicture->pSourcePict->gradient.type];
-	    pStop  = pPicture->pSourcePict->gradient.stops;
-	    nStop  = pPicture->pSourcePict->gradient.nstops;
-
-	    size = nParam + nStop * 4;
-	    if (size > N_STACK_PARAM)
-	    {
-		param = malloc (sizeof (xFixed) * size);
-		if (!param)
-		    break;
-	    }
-	    else
-	    {
-		param = stackParam;
-	    }
-
-	    pixel = (CARD32 *) (param + nParam + nStop * 3);
-
-	    buffer = glitz_buffer_create_for_data (pixel);
-	    if (!buffer)
-	    {
-		if (size > N_STACK_PARAM)
-		    free (param);
-
-		break;
-	    }
-
-	    surface = glitz_surface_create (pScreenPriv->drawable,
-					    format, nStop, 1, 0, NULL);
-	    if (!surface)
-	    {
-		glitz_buffer_destroy (buffer);
-		if (size > N_STACK_PARAM)
-		    free (param);
-
-		break;
-	    }
-
-	    for (i = 0; i < nStop; i++)
-	    {
-		pixel[i] = pStop[i].color;
-
-		param[nParam + 3 * i + 0] = pStop[i].x;
-		param[nParam + 3 * i + 1] = i << 16;
-		param[nParam + 3 * i + 2] = 0;
-	    }
-
-	    glitz_set_pixels (surface, 0, 0, nStop, 1, &pixelFormat, buffer);
-
-	    glitz_buffer_destroy (buffer);
-
-	    switch (pPicture->pSourcePict->source.type) {
-	    case SourcePictTypeLinear:
-		param[0] = pPicture->pSourcePict->linear.p1.x;
-		param[1] = pPicture->pSourcePict->linear.p1.y;
-		param[2] = pPicture->pSourcePict->linear.p2.x;
-		param[3] = pPicture->pSourcePict->linear.p2.y;
-
-		glitz_surface_set_filter (surface,
-					  GLITZ_FILTER_LINEAR_GRADIENT,
-					  param, nParam + nStop * 3);
-		break;
-	    case SourcePictTypeRadial:
-		param[0] = pPicture->pSourcePict->radial.inner.x;
-		param[1] = pPicture->pSourcePict->radial.inner.y;
-		param[2] = pPicture->pSourcePict->radial.inner_radius;
-		param[3] = pPicture->pSourcePict->radial.outer.x;
-		param[4] = pPicture->pSourcePict->radial.outer.y;
-		param[5] = pPicture->pSourcePict->radial.outer_radius;
-
-		glitz_surface_set_filter (surface,
-					  GLITZ_FILTER_RADIAL_GRADIENT,
-					  param, nParam + nStop * 3);
-		break;
-	    }
-
-	    glitz_surface_set_fill (surface, fillMode[pPicture->repeat]);
-	    glitz_surface_set_transform (surface, (glitz_transform_t *)
-					 pPicture->transform);
-
-	    pPicture->pSourcePict->gradient.devPrivate.ptr = surface;
-	    pPicture->pSourcePict->gradient.Destroy = xglDestroyDevicePicture;
-
-	    if (size > N_STACK_PARAM)
-		free (param);
-
-	    return TRUE;
-	} break;
-	case SourcePictTypeConical:
-	default:
-	    break;
-	}
-
-	if (!pPicture->pDrawable)
-	{
-	    PictFormatPtr pFormat;
-	    PixmapPtr	  pPixmap;
-	    PicturePtr	  pTmp;
-	    RegionRec	  region;
-	    BoxRec	  box;
-	    int		  error;
-
-	    pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
-	    if (!pFormat)
-		return FALSE;
-
-	    pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
-						pFormat->depth, 0);
-	    if (!pPixmap)
-		return FALSE;
-
-	    pTmp = CreatePicture (0, &pPixmap->drawable, pFormat, 0, NULL,
-				  serverClient, &error);
-	    if (!pTmp)
-	    {
-		(*pScreen->DestroyPixmap) (pPixmap);
-		return FALSE;
-	    }
-
-	    ValidatePicture (pTmp);
-
-	    if (!xglSyncBits (pTmp->pDrawable, NullBox))
-		FatalError (XGL_SW_FAILURE_STRING);
-
-	    fbCompositeGeneral (PictOpSrc,
-				pPicture, 0, pTmp,
-				x, y, 0, 0, 0, 0,
-				width, height);
-
-	    FreePicture ((pointer) pTmp, (XID) 0);
-
-	    box.x1 = 0;
-	    box.y1 = 0;
-	    box.x2 = width;
-	    box.y2 = height;
-
-	    REGION_INIT (pScreen, &region, &box, 1);
-	    xglAddSurfaceDamage (&pPixmap->drawable, &region);
-	    REGION_UNINIT (pDrawable->pScreen, &region);
-
-	    pPicture->pDrawable = &pPixmap->drawable;
-
-	    *xOff = x;
-	    *yOff = y;
-
-	    XGL_GET_PIXMAP_PRIV (pPixmap)->pictureMask &=
-		~(xglPCFillMask | xglPCFilterMask | xglPCTransformMask);
-	}
-    }
-
-#ifdef XV
-    switch (pPicture->format) {
-    case PICT_yuy2:
-	xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
-			    &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YUY2]);
-	break;
-    case PICT_yv12:
-	xglSetPixmapVisual ((PixmapPtr) pPicture->pDrawable,
-			    &pScreenPriv->pXvVisual[XGL_XV_FORMAT_YV12]);
-    default:
-	break;
-    }
-#endif
-
-    if (!xglSyncSurface (pPicture->pDrawable))
-	return FALSE;
-
-    pPixmapPriv = XGL_GET_PIXMAP_PRIV ((PixmapPtr) pPicture->pDrawable);
-    if (XGL_PICTURE_CHANGES (pPixmapPriv->pictureMask))
-	xglUpdatePicture (pPicture);
-
-    return TRUE;
-}
-
-static int
-xglVisualDepth (ScreenPtr pScreen, VisualPtr pVisual)
-{
-    DepthPtr pDepth;
-    int	     d, v;
-
-    for (d = 0; d < pScreen->numDepths; d++)
-    {
-	pDepth = &pScreen->allowedDepths[d];
-	for (v = 0; v < pDepth->numVids; v++)
-	    if (pDepth->vids[v] == pVisual->vid)
-		return pDepth->depth;
-    }
-
-    return 0;
-}
-
-typedef struct _xglformatInit {
-    CARD32 format;
-    CARD8  depth;
-} xglFormatInitRec, *xglFormatInitPtr;
-
-static int
-xglAddFormat (xglFormatInitPtr formats,
-	      int	       nformat,
-	      CARD32	       format,
-	      CARD8	       depth)
-{
-    int	n;
-
-    for (n = 0; n < nformat; n++)
-	if (formats[n].format == format && formats[n].depth == depth)
-	    return nformat;
-
-    formats[nformat].format = format;
-    formats[nformat].depth = depth;
-
-    return ++nformat;
-}
-
-#define Mask(n)	((n) == 32 ? 0xffffffff : ((1 << (n)) - 1))
-
-Bool
-xglPictureInit (ScreenPtr pScreen)
-{
-    int		     f, nformats = 0;
-    PictFormatPtr    pFormats;
-    xglFormatInitRec formats[64];
-    CARD32	     format;
-    CARD8	     depth;
-    VisualPtr	     pVisual;
-    int		     v;
-    int		     bpp;
-    int		     r, g, b;
-    int		     d;
-    DepthPtr	     pDepth;
-
-    /* formats required by protocol */
-    formats[nformats].format = PICT_a1;
-    formats[nformats].depth = 1;
-    nformats++;
-    formats[nformats].format = PICT_a4;
-    formats[nformats].depth = 4;
-    nformats++;
-    formats[nformats].format = PICT_a8;
-    formats[nformats].depth = 8;
-    nformats++;
-    formats[nformats].format = PICT_a8r8g8b8;
-    formats[nformats].depth = 32;
-    nformats++;
-
-    /* now look through the depths and visuals adding other formats */
-    for (v = 0; v < pScreen->numVisuals; v++)
-    {
-	pVisual = &pScreen->visuals[v];
-	depth = xglVisualDepth (pScreen, pVisual);
-	if (!depth)
-	    continue;
-
-	bpp = BitsPerPixel (depth);
-	switch (pVisual->class) {
-	case DirectColor:
-	case TrueColor:
-	    r = Ones (pVisual->redMask);
-	    g = Ones (pVisual->greenMask);
-	    b = Ones (pVisual->blueMask);
-	    if (pVisual->offsetBlue == 0 &&
-		pVisual->offsetGreen == b &&
-		pVisual->offsetRed == b + g)
-	    {
-		format = PICT_FORMAT (bpp, PICT_TYPE_ARGB, 0, r, g, b);
-		nformats = xglAddFormat (formats, nformats, format, depth);
-	    }
-	    break;
-	case StaticColor:
-	case PseudoColor:
-	case StaticGray:
-	case GrayScale:
-	    break;
-	}
-    }
-
-    /* walk supported depths and add missing Direct formats */
-    for (d = 0; d < pScreen->numDepths; d++)
-    {
-	pDepth = &pScreen->allowedDepths[d];
-	bpp = BitsPerPixel (pDepth->depth);
-	format = 0;
-	switch (bpp) {
-	case 16:
-	    if (pDepth->depth == 15)
-		nformats = xglAddFormat (formats, nformats,
-					 PICT_x1r5g5b5, pDepth->depth);
-	    if (pDepth->depth == 16)
-		nformats = xglAddFormat (formats, nformats,
-					 PICT_r5g6b5, pDepth->depth);
-	    break;
-	case 24:
-	    if (pDepth->depth == 24)
-		nformats = xglAddFormat (formats, nformats,
-					 PICT_r8g8b8, pDepth->depth);
-	    break;
-	case 32:
-	    if (pDepth->depth == 24)
-		nformats = xglAddFormat (formats, nformats,
-					 PICT_x8r8g8b8, pDepth->depth);
-	    break;
-	}
-    }
-
-    /* add YUV formats */
-    nformats = xglAddFormat (formats, nformats, PICT_yuy2, 16);
-    nformats = xglAddFormat (formats, nformats, PICT_yv12, 12);
-
-    pFormats = (PictFormatPtr) xalloc (nformats * sizeof (PictFormatRec));
-    if (!pFormats)
-	return 0;
-
-    memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
-    for (f = 0; f < nformats; f++)
-    {
-	pFormats[f].id = FakeClientID (0);
-	pFormats[f].depth = formats[f].depth;
-	format = formats[f].format;
-	pFormats[f].format = format;
-	switch (PICT_FORMAT_TYPE (format)) {
-	case PICT_TYPE_ARGB:
-	    pFormats[f].type = PictTypeDirect;
-	    pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
-	    if (pFormats[f].direct.alphaMask)
-		pFormats[f].direct.alpha = (PICT_FORMAT_R (format) +
-					    PICT_FORMAT_G (format) +
-					    PICT_FORMAT_B (format));
-
-	    pFormats[f].direct.redMask = Mask (PICT_FORMAT_R (format));
-	    pFormats[f].direct.red = (PICT_FORMAT_G (format) +
-				      PICT_FORMAT_B (format));
-
-	    pFormats[f].direct.greenMask = Mask (PICT_FORMAT_G (format));
-	    pFormats[f].direct.green = PICT_FORMAT_B (format);
-
-	    pFormats[f].direct.blueMask = Mask (PICT_FORMAT_B (format));
-	    pFormats[f].direct.blue = 0;
-	    break;
-	case PICT_TYPE_A:
-	    pFormats[f].type = PictTypeDirect;
-	    pFormats[f].direct.alpha = 0;
-	    pFormats[f].direct.alphaMask = Mask (PICT_FORMAT_A (format));
-	    break;
-	case PICT_TYPE_COLOR:
-	case PICT_TYPE_GRAY:
-	    pFormats[f].type = PictTypeDirect;
-	    break;
-	case PICT_TYPE_YUY2:
-	case PICT_TYPE_YV12:
-	    pFormats[f].type = PictTypeOther;
-	    break;
-	}
-    }
-
-    if (!fbPictureInit (pScreen, pFormats, nformats))
-	return FALSE;
-
-    return TRUE;
-}
-
-void
-xglPictureClipExtents (PicturePtr pPicture,
-		       BoxPtr     extents)
-{
-    if (pPicture->clientClipType != CT_NONE)
-    {
-	BoxPtr clip = REGION_EXTENTS (pPicture->pDrawable->pScreen,
-				      (RegionPtr) pPicture->clientClip);
-
-	if (extents->x1 < pPicture->clipOrigin.x + clip->x1)
-	    extents->x1 = pPicture->clipOrigin.x + clip->x1;
-
-	if (extents->y1 < pPicture->clipOrigin.y + clip->y1)
-	    extents->y1 = pPicture->clipOrigin.y + clip->y1;
-
-	if (extents->x2 > pPicture->clipOrigin.x + clip->x2)
-	    extents->x2 = pPicture->clipOrigin.x + clip->x2;
-
-	if (extents->y2 > pPicture->clipOrigin.y + clip->y2)
-	    extents->y2 = pPicture->clipOrigin.y + clip->y2;
-    }
-    else
-    {
-	if (extents->x1 < 0)
-	    extents->x1 = 0;
-
-	if (extents->y1 < 0)
-	    extents->y1 = 0;
-
-	if (extents->x2 > pPicture->pDrawable->width)
-	    extents->x2 = pPicture->pDrawable->width;
-
-	if (extents->y2 > pPicture->pDrawable->height)
-	    extents->y2 = pPicture->pDrawable->height;
-    }
-}
-
-#endif
diff --git a/hw/xgl/xglpixmap.c b/hw/xgl/xglpixmap.c
deleted file mode 100644
index 8e602ce..0000000
--- a/hw/xgl/xglpixmap.c
+++ /dev/null
@@ -1,744 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-static glitz_buffer_hint_t xglPixmapUsageHints[] = {
-    (glitz_buffer_hint_t) 0,	    /* reserved for system memory */
-    GLITZ_BUFFER_HINT_STREAM_DRAW,
-    GLITZ_BUFFER_HINT_STREAM_READ,
-    GLITZ_BUFFER_HINT_STREAM_COPY,
-    GLITZ_BUFFER_HINT_STATIC_DRAW,
-    GLITZ_BUFFER_HINT_STATIC_READ,
-    GLITZ_BUFFER_HINT_STATIC_COPY,
-    GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
-    GLITZ_BUFFER_HINT_DYNAMIC_READ,
-    GLITZ_BUFFER_HINT_DYNAMIC_COPY
-};
-
-#define NUM_XGL_PIXMAP_USAGE_HINTS				     \
-    (sizeof (xglPixmapUsageHints) / sizeof (xglPixmapUsageHints[0]))
-
-#define XGL_PIXMAP_USAGE_HINT(hint) (xglPixmapUsageHints[hint])
-
-static void
-xglPixmapDamageReport (DamagePtr pDamage,
-		       RegionPtr pRegion,
-		       void	 *closure)
-{
-    PixmapPtr pPixmap = (PixmapPtr) closure;
-    BoxPtr    pExt;
-
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    pExt = REGION_EXTENTS (pPixmap->drawable.pScreen, pRegion);
-
-    if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
-    {
-	if (pExt->x1 < pPixmapPriv->damageBox.x1)
-	    pPixmapPriv->damageBox.x1 = pExt->x1;
-
-	if (pExt->y1 < pPixmapPriv->damageBox.y1)
-	    pPixmapPriv->damageBox.y1 = pExt->y1;
-
-	if (pExt->x2 > pPixmapPriv->damageBox.x2)
-	    pPixmapPriv->damageBox.x2 = pExt->x2;
-
-	if (pExt->y2 > pPixmapPriv->damageBox.y2)
-	    pPixmapPriv->damageBox.y2 = pExt->y2;
-    }
-    else
-	pPixmapPriv->damageBox = *pExt;
-}
-
-
-static Bool
-xglPixmapCreateDamage (PixmapPtr pPixmap)
-{
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    pPixmapPriv->pDamage =
-	DamageCreate (xglPixmapDamageReport, (DamageDestroyFunc) 0,
-		      DamageReportRawRegion, TRUE,
-		      pPixmap->drawable.pScreen,
-		      (void *) pPixmap);
-    if (!pPixmapPriv->pDamage)
-	return FALSE;
-
-    DamageRegister (&pPixmap->drawable, pPixmapPriv->pDamage);
-
-    return TRUE;
-}
-
-void
-xglSetPixmapVisual (PixmapPtr    pPixmap,
-		    xglVisualPtr pVisual)
-{
-    xglVisualPtr pOldVisual;
-
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    pOldVisual = pPixmapPriv->pVisual;
-    if (pOldVisual && pVisual)
-    {
-	glitz_surface_t *surface;
-
-	if (pOldVisual->vid != pVisual->vid)
-	{
-	    surface = pPixmapPriv->surface;
-	    if (surface)
-	    {
-		glitz_drawable_t *drawable;
-
-		drawable = glitz_surface_get_attached_drawable (surface);
-		if (drawable)
-		{
-		    if (pOldVisual->format.drawable->id !=
-			pVisual->format.drawable->id)
-		    {
-			glitz_surface_detach (pPixmapPriv->surface);
-			pPixmapPriv->target = xglPixmapTargetOut;
-		    }
-		}
-
-		if (pOldVisual->format.surface->id != pVisual->format.surface->id)
-		{
-		    xglSyncBits (&pPixmap->drawable, NULL);
-		    glitz_surface_destroy (pPixmapPriv->surface);
-		    pPixmapPriv->surface = 0;
-		}
-	    }
-	}
-    }
-    else if (pOldVisual)
-    {
-	if (pPixmapPriv->surface)
-	{
-	    xglSyncBits (&pPixmap->drawable, NULL);
-	    glitz_surface_destroy (pPixmapPriv->surface);
-	    pPixmapPriv->surface = 0;
-	}
-	pPixmapPriv->target = xglPixmapTargetNo;
-    }
-
-    pPixmapPriv->pVisual = pVisual;
-
-    if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
-    {
-	if (!pPixmapPriv->pDamage)
-	{
-	    if (!xglPixmapCreateDamage (pPixmap))
-		FatalError (XGL_SW_FAILURE_STRING);
-	}
-    }
-}
-
-static Bool
-xglPixmapSurfaceInit (PixmapPtr	    pPixmap,
-		      unsigned long features,
-		      int	    width,
-		      int	    height)
-{
-    BoxRec box;
-
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    pPixmapPriv->surface = NULL;
-    pPixmapPriv->drawable = NULL;
-    pPixmapPriv->acceleratedTile = FALSE;
-    pPixmapPriv->pictureMask = ~0;
-    pPixmapPriv->target = xglPixmapTargetNo;
-
-    box.x1 = 0;
-    box.y1 = 0;
-    box.x2 = width;
-    box.y2 = height;
-
-    REGION_INIT (pScreen, &pPixmapPriv->bitRegion, &box, 1);
-
-    pPixmapPriv->pVisual = xglFindVisualWithDepth (pPixmap->drawable.pScreen,
-						   pPixmap->drawable.depth);
-    if (pPixmapPriv->pVisual)
-    {
-	XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
-	/* general pixmap acceleration */
-	if (pPixmapPriv->pVisual->format.drawable &&
-	    pScreenPriv->accel.pixmap.enabled &&
-	    xglCheckPixmapSize (pPixmap, &pScreenPriv->accel.pixmap.size))
-	    pPixmapPriv->target = xglPixmapTargetOut;
-    }
-
-    if (pPixmapPriv->pVisual && pPixmapPriv->pVisual->format.surface)
-    {
-	if (!pPixmapPriv->pDamage)
-	{
-	    if (!xglPixmapCreateDamage (pPixmap))
-		FatalError (XGL_SW_FAILURE_STRING);
-	}
-
-	if (width && height)
-	{
-	    if (width == 1 && height == 1)
-	    {
-		pPixmapPriv->acceleratedTile = TRUE;
-	    }
-	    else if (features & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
-	    {
-		if ((features & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
-		    (POWER_OF_TWO (width) && POWER_OF_TWO (height)))
-		    pPixmapPriv->acceleratedTile = TRUE;
-	    }
-	}
-    }
-
-    return TRUE;
-}
-
-PixmapPtr
-xglCreatePixmap (ScreenPtr  pScreen,
-		 int	    width,
-		 int	    height,
-		 int	    depth,
-		 unsigned   usage_hint)
-{
-    xglPixmapPtr pPixmapPriv;
-    PixmapPtr	 pPixmap;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    pPixmap = AllocatePixmap (pScreen, 0);
-    if (!pPixmap)
-	return NullPixmap;
-
-    pPixmap->drawable.type = DRAWABLE_PIXMAP;
-    pPixmap->drawable.class = 0;
-    pPixmap->drawable.pScreen = pScreen;
-    pPixmap->drawable.depth = depth;
-    pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
-    pPixmap->drawable.id = 0;
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    pPixmap->drawable.x = 0;
-    pPixmap->drawable.y = 0;
-    pPixmap->drawable.width = width;
-    pPixmap->drawable.height = height;
-
-#ifdef COMPOSITE
-    pPixmap->screen_x = 0;
-    pPixmap->screen_y = 0;
-#endif
-
-    pPixmap->devKind = 0;
-    pPixmap->refcnt = 1;
-    pPixmap->devPrivate.ptr = 0;
-    pPixmap->usage_hint = usage_hint;
-
-    pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
-
-    pPixmapPriv->pVisual = NULL;
-    pPixmapPriv->pDamage = NULL;
-
-    if (!xglPixmapSurfaceInit (pPixmap, pScreenPriv->features, width, height))
-	return NullPixmap;
-
-    pPixmapPriv->buffer = NULL;
-    pPixmapPriv->bits = (pointer) 0;
-    pPixmapPriv->stride = 0;
-    pPixmapPriv->pGeometry = NULL;
-    pPixmapPriv->allBits = TRUE;
-
-    pPixmapPriv->damageBox = miEmptyBox;
-
-    return pPixmap;
-}
-
-void
-xglFiniPixmap (PixmapPtr pPixmap)
-{
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (pPixmap->devPrivate.ptr)
-    {
-	if (pPixmapPriv->buffer)
-	    glitz_buffer_unmap (pPixmapPriv->buffer);
-    }
-
-    if (pPixmapPriv->pGeometry)
-	GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
-
-    if (pPixmapPriv->buffer)
-	glitz_buffer_destroy (pPixmapPriv->buffer);
-
-    if (pPixmapPriv->bits)
-	xfree (pPixmapPriv->bits);
-
-    REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
-
-    if (pPixmapPriv->drawable)
-	glitz_drawable_destroy (pPixmapPriv->drawable);
-
-    if (pPixmapPriv->surface)
-	glitz_surface_destroy (pPixmapPriv->surface);
-}
-
-Bool
-xglDestroyPixmap (PixmapPtr pPixmap)
-{
-    if (--pPixmap->refcnt)
-	return TRUE;
-
-    xglFiniPixmap (pPixmap);
-
-    dixFreePrivates(pPixmap->devPrivates);
-    xfree (pPixmap);
-
-    return TRUE;
-}
-
-Bool
-xglModifyPixmapHeader (PixmapPtr pPixmap,
-		       int	 width,
-		       int	 height,
-		       int	 depth,
-		       int	 bitsPerPixel,
-		       int	 devKind,
-		       pointer	 pPixData)
-{
-    xglScreenPtr pScreenPriv;
-    xglPixmapPtr pPixmapPriv;
-    int		 oldWidth, oldHeight;
-
-    if (!pPixmap)
-	return FALSE;
-
-    pScreenPriv = XGL_GET_SCREEN_PRIV (pPixmap->drawable.pScreen);
-    pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap);
-
-    oldWidth  = pPixmap->drawable.width;
-    oldHeight = pPixmap->drawable.height;
-
-    if ((width > 0) && (height > 0) && (depth > 0) && (bitsPerPixel > 0) &&
-	(devKind > 0) && pPixData)
-    {
-	pPixmap->drawable.depth = depth;
-	pPixmap->drawable.bitsPerPixel = bitsPerPixel;
-	pPixmap->drawable.id = 0;
-	pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-	pPixmap->drawable.x = 0;
-	pPixmap->drawable.y = 0;
-	pPixmap->drawable.width = width;
-	pPixmap->drawable.height = height;
-	pPixmapPriv->stride = devKind;
-	pPixmap->refcnt = 1;
-    }
-    else
-    {
-	if (width > 0)
-	    pPixmap->drawable.width = width;
-
-	if (height > 0)
-	    pPixmap->drawable.height = height;
-
-	if (depth > 0)
-	    pPixmap->drawable.depth = depth;
-
-	if (bitsPerPixel > 0)
-	    pPixmap->drawable.bitsPerPixel = bitsPerPixel;
-	else if ((bitsPerPixel < 0) && (depth > 0))
-	    pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
-
-	if (devKind > 0)
-	    pPixmapPriv->stride = devKind;
-	else if ((devKind < 0) && ((width > 0) || (depth > 0)))
-	    pPixmapPriv->stride = PixmapBytePad (pPixmap->drawable.width,
-						 pPixmap->drawable.depth);
-    }
-
-    if (pPixmap->drawable.width  != oldWidth ||
-	pPixmap->drawable.height != oldHeight)
-    {
-	pPixmapPriv->pVisual = NULL;
-	pPixmapPriv->target  = xglPixmapTargetNo;
-
-	if (pPixmapPriv->drawable)
-	    glitz_drawable_destroy (pPixmapPriv->drawable);
-
-	if (pPixmapPriv->surface)
-	    glitz_surface_destroy (pPixmapPriv->surface);
-
-	REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
-
-	if (!xglPixmapSurfaceInit (pPixmap,
-				   pScreenPriv->features,
-				   pPixmap->drawable.width,
-				   pPixmap->drawable.height))
-	    return FALSE;
-    }
-
-    if (pPixData)
-    {
-	BoxRec box;
-
-	if (pPixmap->devPrivate.ptr)
-	{
-	    if (pPixmapPriv->buffer)
-		glitz_buffer_unmap (pPixmapPriv->buffer);
-
-	    pPixmap->devPrivate.ptr = 0;
-	}
-
-	if (pPixmapPriv->pGeometry)
-	{
-	    GEOMETRY_UNINIT (pPixmapPriv->pGeometry);
-	    pPixmapPriv->pGeometry = NULL;
-	}
-
-	if (pPixmapPriv->buffer)
-	    glitz_buffer_destroy (pPixmapPriv->buffer);
-
-	if (pPixmapPriv->bits)
-	    xfree (pPixmapPriv->bits);
-
-	pPixmapPriv->bits = (pointer) 0;
-	pPixmapPriv->buffer = glitz_buffer_create_for_data (pPixData);
-	if (!pPixmapPriv->buffer)
-	    return FALSE;
-
-	pPixmapPriv->allBits = TRUE;
-
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = pPixmap->drawable.width;
-	box.y2 = pPixmap->drawable.height;
-
-	REGION_UNINIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion);
-	REGION_INIT (pPixmap->drawable.pScreen, &pPixmapPriv->bitRegion,
-		     &box, 1);
-
-	if (pPixmapPriv->pDamage)
-	{
-	    RegionPtr pRegion;
-
-	    pRegion = DamageRegion (pPixmapPriv->pDamage);
-
-	    REGION_UNINIT (pPixmap->drawable.pScreen, pRegion);
-	    REGION_INIT (pPixmap->drawable.pScreen, pRegion, NullBox, 0);
-	    REGION_SUBTRACT (pPixmap->drawable.pScreen, pRegion,
-			     &pPixmapPriv->bitRegion, pRegion);
-
-	}
-    }
-
-    /*
-     * Screen pixmap
-     */
-    if (!pScreenPriv->pScreenPixmap || pScreenPriv->pScreenPixmap == pPixmap)
-    {
-	if (!pPixmapPriv->drawable)
-	{
-	    glitz_drawable_reference (pScreenPriv->drawable);
-	    pPixmapPriv->drawable = pScreenPriv->drawable;
-	}
-
-	if (!pPixmapPriv->surface)
-	{
-	    glitz_surface_reference (pScreenPriv->surface);
-	    pPixmapPriv->surface = pScreenPriv->surface;
-	}
-
-	pPixmapPriv->pVisual = pScreenPriv->rootVisual;
-	pPixmapPriv->target  = xglPixmapTargetIn;
-
-	if (!pScreenPriv->pScreenPixmap)
-	    pScreenPriv->pScreenPixmap = pPixmap;
-    }
-
-    return TRUE;
-}
-
-RegionPtr
-xglPixmapToRegion (PixmapPtr pPixmap)
-{
-    ScreenPtr pScreen = pPixmap->drawable.pScreen;
-    RegionPtr pRegion;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (!xglSyncBits (&pPixmap->drawable, NullBox))
-	FatalError (XGL_SW_FAILURE_STRING);
-
-    XGL_SCREEN_UNWRAP (BitmapToRegion);
-    pRegion = (*pScreen->BitmapToRegion) (pPixmap);
-    XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
-
-    return pRegion;
-}
-
-xglGeometryPtr
-xglPixmapToGeometry (PixmapPtr pPixmap,
-		     int       xOff,
-		     int       yOff)
-{
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (pPixmap->devPrivate.ptr)
-	xglUnmapPixmapBits (pPixmap);
-
-    if (!pPixmapPriv->pGeometry)
-    {
-	xglGeometryPtr pGeometry;
-
-	if (!pPixmapPriv->buffer)
-	{
-	    if (!xglAllocatePixmapBits (pPixmap,
-					XGL_PIXMAP_USAGE_HINT_DEFAULT))
-		return NULL;
-	}
-
-	pGeometry = xalloc (sizeof (xglGeometryRec));
-	if (!pGeometry)
-	    return NULL;
-
-	GEOMETRY_INIT (pPixmap->drawable.pScreen, pGeometry,
-		       GLITZ_GEOMETRY_TYPE_BITMAP,
-		       GEOMETRY_USAGE_DYNAMIC, 0);
-
-	GEOMETRY_SET_BUFFER (pGeometry, pPixmapPriv->buffer);
-
-	if (pPixmapPriv->stride < 0)
-	{
-	    pGeometry->f.bitmap.bytes_per_line = -pPixmapPriv->stride;
-	    pGeometry->f.bitmap.scanline_order =
-		GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-	}
-	else
-	{
-	    pGeometry->f.bitmap.bytes_per_line = pPixmapPriv->stride;
-	    pGeometry->f.bitmap.scanline_order =
-		GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
-	}
-
-	pGeometry->f.bitmap.pad = ((1 + FB_MASK) >> FB_SHIFT) *
-	    sizeof (FbBits);
-	pGeometry->width = pPixmap->drawable.width;
-	pGeometry->count = pPixmap->drawable.height;
-
-	pPixmapPriv->pGeometry = pGeometry;
-    }
-
-    pPixmapPriv->pGeometry->xOff = xOff << 16;
-    pPixmapPriv->pGeometry->yOff = yOff << 16;
-
-    return pPixmapPriv->pGeometry;
-}
-
-Bool
-xglCreatePixmapSurface (PixmapPtr pPixmap)
-{
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (!pPixmapPriv->surface)
-    {
-	XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
-	if (!pPixmapPriv->pVisual || !pPixmapPriv->pVisual->format.surface)
-	    return FALSE;
-
-	pPixmapPriv->surface =
-	    glitz_surface_create (pScreenPriv->drawable,
-				  pPixmapPriv->pVisual->format.surface,
-				  pPixmap->drawable.width,
-				  pPixmap->drawable.height,
-				  0, NULL);
-	if (!pPixmapPriv->surface)
-	{
-	    pPixmapPriv->pVisual = NULL;
-	    pPixmapPriv->target  = xglPixmapTargetNo;
-
-	    return FALSE;
-	}
-    }
-
-    return TRUE;
-}
-
-Bool
-xglAllocatePixmapBits (PixmapPtr pPixmap, int hint)
-{
-    int width, height, bpp, stride;
-
-    XGL_PIXMAP_PRIV (pPixmap);
-    XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-
-    width  = pPixmap->drawable.width;
-    height = pPixmap->drawable.height;
-    bpp    = pPixmap->drawable.bitsPerPixel;
-
-    stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
-
-    if (stride)
-    {
-	glitz_buffer_t *buffer;
-
-	if ((pScreenPriv->pboMask & bpp) && hint)
-	{
-	    buffer = glitz_pixel_buffer_create (pScreenPriv->drawable,
-						NULL, height * stride,
-						XGL_PIXMAP_USAGE_HINT (hint));
-	}
-	else
-	{
-	    pPixmapPriv->bits = xalloc (height * stride);
-	    if (!pPixmapPriv->bits)
-		return FALSE;
-
-	    buffer = glitz_buffer_create_for_data (pPixmapPriv->bits);
-	}
-
-	if (!buffer)
-	{
-	    if (pPixmapPriv->bits)
-		xfree (pPixmapPriv->bits);
-	    pPixmapPriv->bits = NULL;
-	    return FALSE;
-	}
-	pPixmapPriv->buffer = buffer;
-    }
-
-    if (pScreenPriv->yInverted)
-	pPixmapPriv->stride = stride;
-    else
-	pPixmapPriv->stride = -stride;
-
-    return TRUE;
-}
-
-Bool
-xglMapPixmapBits (PixmapPtr pPixmap)
-{
-    if (!pPixmap->devPrivate.ptr)
-    {
-	CARD8 *bits;
-
-	XGL_PIXMAP_PRIV (pPixmap);
-
-	if (!pPixmapPriv->buffer)
-	    if (!xglAllocatePixmapBits (pPixmap,
-					XGL_PIXMAP_USAGE_HINT_DEFAULT))
-		return FALSE;
-
-	bits = glitz_buffer_map (pPixmapPriv->buffer,
-				 GLITZ_BUFFER_ACCESS_READ_WRITE);
-	if (!bits)
-	    return FALSE;
-
-	pPixmap->devKind = pPixmapPriv->stride;
-	if (pPixmapPriv->stride < 0)
-	{
-	    pPixmap->devPrivate.ptr = bits +
-		(pPixmap->drawable.height - 1) * -pPixmapPriv->stride;
-	}
-	else
-	{
-	    pPixmap->devPrivate.ptr = bits;
-	}
-    }
-
-    return TRUE;
-}
-
-Bool
-xglUnmapPixmapBits (PixmapPtr pPixmap)
-{
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    pPixmap->devKind = 0;
-    pPixmap->devPrivate.ptr = 0;
-
-    if (pPixmapPriv->buffer)
-	if (glitz_buffer_unmap (pPixmapPriv->buffer))
-	    return FALSE;
-
-    return TRUE;
-}
-
-Bool
-xglCheckPixmapSize (PixmapPtr		 pPixmap,
-		    xglSizeConstraintPtr pSize)
-{
-    if (pPixmap->drawable.width  < pSize->minWidth ||
-	pPixmap->drawable.height < pSize->minHeight)
-	return FALSE;
-
-    if (pPixmap->drawable.width  > pSize->aboveWidth ||
-	pPixmap->drawable.height > pSize->aboveHeight)
-	return TRUE;
-
-    return FALSE;
-}
-
-void
-xglEnablePixmapAccel (PixmapPtr	      pPixmap,
-		      xglAccelInfoPtr pAccel)
-{
-    XGL_SCREEN_PRIV (pPixmap->drawable.pScreen);
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (pAccel->enabled && xglCheckPixmapSize (pPixmap, &pAccel->size))
-    {
-	xglVisualPtr v;
-
-	if (pAccel->pbuffer)
-	{
-	    for (v = pScreenPriv->pVisual; v; v = v->next)
-	    {
-		if (v->pPixel->depth != pPixmap->drawable.depth)
-		    continue;
-
-		if (v->format.drawable && v->pbuffer)
-		    break;
-	    }
-	}
-	else
-	{
-	    for (v = pScreenPriv->pVisual; v; v = v->next)
-	    {
-		if (v->pPixel->depth != pPixmap->drawable.depth)
-		    continue;
-
-		if (v->format.drawable && !v->pbuffer)
-		    break;
-	    }
-	}
-
-	if (v)
-	{
-	    xglSetPixmapVisual (pPixmap, v);
-	    if (!pPixmapPriv->target)
-		pPixmapPriv->target = xglPixmapTargetOut;
-	}
-    }
-}
diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c
deleted file mode 100644
index 47ed345..0000000
--- a/hw/xgl/xglscreen.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "inputstr.h"
-#include "mipointer.h"
-#include "damage.h"
-#include "fb.h"
-#ifdef MITSHM
-#include "shmint.h"
-static ShmFuncs shmFuncs = { NULL, xglShmPutImage };
-#endif
-#ifdef RENDER
-#include "glyphstr.h"
-#endif
-#ifdef COMPOSITE
-#include "compint.h"
-#endif
-
-int xglScreenGeneration = -1;
-int xglScreenPrivateIndex;
-int xglGCPrivateIndex;
-int xglPixmapPrivateIndex;
-int xglWinPrivateIndex;
-
-#ifdef RENDER
-int xglGlyphPrivateIndex;
-#endif
-
-#define xglQueryBestSize	  (void *) NoopDDA
-#define xglSaveScreen		  (void *) NoopDDA
-
-#define xglConstrainCursor	  (void *) NoopDDA
-#define xglCursorLimits		  (void *) NoopDDA
-#define xglDisplayCursor	  (void *) NoopDDA
-#define xglRealizeCursor	  (void *) NoopDDA
-#define xglUnrealizeCursor	  (void *) NoopDDA
-#define xglRecolorCursor	  (void *) NoopDDA
-#define xglSetCursorPosition	  (void *) NoopDDA
-
-static Bool
-xglAllocatePrivates (ScreenPtr pScreen)
-{
-    xglScreenPtr pScreenPriv;
-
-    if (xglScreenGeneration != serverGeneration)
-    {
-	xglScreenPrivateIndex = AllocateScreenPrivateIndex ();
-	if (xglScreenPrivateIndex < 0)
-	    return FALSE;
-
-	xglGCPrivateIndex = AllocateGCPrivateIndex ();
-	if (xglGCPrivateIndex < 0)
-	    return FALSE;
-
-	xglPixmapPrivateIndex = AllocatePixmapPrivateIndex ();
-	if (xglPixmapPrivateIndex < 0)
-	    return FALSE;
-
-	xglWinPrivateIndex = AllocateWindowPrivateIndex ();
-	if (xglWinPrivateIndex < 0)
-	    return FALSE;
-
-#ifdef RENDER
-	xglGlyphPrivateIndex = AllocateGlyphPrivateIndex ();
-	if (xglGlyphPrivateIndex < 0)
-	    return FALSE;
-#endif
-
-	xglScreenGeneration = serverGeneration;
-    }
-
-    if (!AllocateGCPrivate (pScreen, xglGCPrivateIndex, sizeof (xglGCRec)))
-	return FALSE;
-
-    if (!AllocatePixmapPrivate (pScreen, xglPixmapPrivateIndex,
-				sizeof (xglPixmapRec)))
-	return FALSE;
-
-    if (!AllocateWindowPrivate (pScreen, xglWinPrivateIndex,
-				sizeof (xglWinRec)))
-	return FALSE;
-
-    pScreenPriv = xalloc (sizeof (xglScreenRec));
-    if (!pScreenPriv)
-	return FALSE;
-
-    XGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
-
-    return TRUE;
-}
-
-Bool
-xglScreenInit (ScreenPtr pScreen)
-{
-    xglScreenPtr pScreenPriv;
-    xglVisualPtr v;
-    int		 i, depth, bpp = 0;
-
-#ifdef RENDER
-    PictureScreenPtr pPictureScreen;
-#endif
-
-    depth = xglScreenInfo.depth;
-
-    for (v = xglVisuals; v; v = v->next)
-    {
-	if (v->pPixel->depth == depth)
-	{
-	    bpp = v->pPixel->masks.bpp;
-	    break;
-	}
-    }
-
-    if (!bpp)
-	return FALSE;
-
-    if (!xglAllocatePrivates (pScreen))
-	return FALSE;
-
-    pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen);
-
-    pScreenPriv->pScreenPixmap = NULL;
-
-    /* Add any unlisted depths from the pixmap formats */
-    for (i = 0; i < screenInfo.numPixmapFormats; i++)
-    {
-	if (!xglHasVisualTypes (xglVisuals, screenInfo.formats[i].depth))
-	    xglSetVisualTypes (screenInfo.formats[i].depth, 0, 0, 0, 0);
-    }
-
-    pScreenPriv->pVisual = 0;
-
-#ifdef GLXEXT
-    pScreenPriv->pGlxVisual = 0;
-#endif
-
-    pScreenPriv->rootVisual = 0;
-
-    pScreenPriv->drawable = xglScreenInfo.drawable;
-    pScreenPriv->features =
-	glitz_drawable_get_features (xglScreenInfo.drawable);
-
-    GEOMETRY_INIT (pScreen, &pScreenPriv->scratchGeometry,
-		   GLITZ_GEOMETRY_TYPE_VERTEX,
-		   pScreenPriv->geometryUsage, 0);
-
-    pScreenPriv->geometryDataType = xglScreenInfo.geometryDataType;
-    pScreenPriv->geometryUsage    = xglScreenInfo.geometryUsage;
-    pScreenPriv->yInverted	  = xglScreenInfo.yInverted;
-    pScreenPriv->pboMask	  = xglScreenInfo.pboMask;
-    pScreenPriv->lines		  = xglScreenInfo.lines;
-    pScreenPriv->accel		  = xglScreenInfo.accel;
-
-    if (monitorResolution == 0)
-	monitorResolution = XGL_DEFAULT_DPI;
-
-    if (!fbSetupScreen (pScreen, NULL,
-			xglScreenInfo.width, xglScreenInfo.height,
-			monitorResolution, monitorResolution,
-			xglScreenInfo.width, bpp))
-	return FALSE;
-
-    pScreen->SaveScreen = xglSaveScreen;
-
-    pScreen->CreatePixmap  = xglCreatePixmap;
-    pScreen->DestroyPixmap = xglDestroyPixmap;
-
-    if (!fbFinishScreenInit (pScreen, NULL,
-			     xglScreenInfo.width, xglScreenInfo.height,
-			     monitorResolution, monitorResolution,
-			     xglScreenInfo.width, bpp))
-	return FALSE;
-
-#ifdef MITSHM
-    ShmRegisterFuncs (pScreen, &shmFuncs);
-#endif
-
-#ifdef RENDER
-    if (!xglPictureInit (pScreen))
-	return FALSE;
-#endif
-
-    XGL_SCREEN_WRAP (GetImage, xglGetImage);
-    XGL_SCREEN_WRAP (GetSpans, xglGetSpans);
-
-    XGL_SCREEN_WRAP (CopyWindow, xglCopyWindow);
-    XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
-    XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
-    XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
-
-    XGL_SCREEN_WRAP (CreateGC, xglCreateGC);
-
-    pScreen->ConstrainCursor   = xglConstrainCursor;
-    pScreen->CursorLimits      = xglCursorLimits;
-    pScreen->DisplayCursor     = xglDisplayCursor;
-    pScreen->RealizeCursor     = xglRealizeCursor;
-    pScreen->UnrealizeCursor   = xglUnrealizeCursor;
-    pScreen->RecolorCursor     = xglRecolorCursor;
-    pScreen->SetCursorPosition = xglSetCursorPosition;
-
-    pScreen->ModifyPixmapHeader = xglModifyPixmapHeader;
-
-    XGL_SCREEN_WRAP (BitmapToRegion, xglPixmapToRegion);
-
-    pScreen->GetWindowPixmap = xglGetWindowPixmap;
-
-    XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
-
-#ifdef RENDER
-    pPictureScreen = GetPictureScreenIfSet (pScreen);
-    if (pPictureScreen)
-    {
-	if (!AllocateGlyphPrivate (pScreen, xglGlyphPrivateIndex,
-				   sizeof (xglGlyphRec)))
-	    return FALSE;
-
-	XGL_PICTURE_SCREEN_WRAP (RealizeGlyph, xglRealizeGlyph);
-	XGL_PICTURE_SCREEN_WRAP (UnrealizeGlyph, xglUnrealizeGlyph);
-	XGL_PICTURE_SCREEN_WRAP (Composite, xglComposite);
-	XGL_PICTURE_SCREEN_WRAP (Glyphs, xglGlyphs);
-	XGL_PICTURE_SCREEN_WRAP (Trapezoids, xglTrapezoids);
-	XGL_PICTURE_SCREEN_WRAP (AddTraps, xglAddTraps);
-	XGL_PICTURE_SCREEN_WRAP (AddTriangles, xglAddTriangles);
-	XGL_PICTURE_SCREEN_WRAP (ChangePicture, xglChangePicture);
-	XGL_PICTURE_SCREEN_WRAP (ChangePictureTransform,
-				 xglChangePictureTransform);
-	XGL_PICTURE_SCREEN_WRAP (ChangePictureFilter, xglChangePictureFilter);
-    }
-#endif
-
-    if (!fbCreateDefColormap (pScreen))
-	return FALSE;
-
-#ifdef COMPOSITE
-#warning "composite building"
-    if (!compScreenInit (pScreen))
-	return FALSE;
-#endif
-
-    /* Damage is required */
-    DamageSetup (pScreen);
-
-    XGL_SCREEN_WRAP (CloseScreen, xglCloseScreen);
-
-    return TRUE;
-}
-
-Bool
-xglFinishScreenInit (ScreenPtr pScreen)
-{
-    xglVisualPtr v;
-
-#ifdef RENDER
-    glitz_vertex_format_t *format;
-    static glitz_color_t  clearBlack = { 0x0, 0x0, 0x0, 0x0 };
-    static glitz_color_t  solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
-    int			  i;
-#endif
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    xglInitVisuals (pScreen);
-
-    for (v = pScreenPriv->pVisual; v; v = v->next)
-    {
-	if (v->vid == pScreen->rootVisual)
-	    pScreenPriv->rootVisual = v;
-    }
-
-    if (!pScreenPriv->rootVisual || !pScreenPriv->rootVisual->format.surface)
-	return FALSE;
-
-    pScreenPriv->surface =
-	glitz_surface_create (pScreenPriv->drawable,
-			      pScreenPriv->rootVisual->format.surface,
-			      xglScreenInfo.width, xglScreenInfo.height,
-			      0, NULL);
-    if (!pScreenPriv->surface)
-	return FALSE;
-
-    glitz_surface_attach (pScreenPriv->surface,
-			  pScreenPriv->drawable,
-			  GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
-
-#ifdef RENDER
-    for (i = 0; i < 33; i++)
-	pScreenPriv->glyphCache[i].pScreen = NULL;
-
-    for (v = pScreenPriv->pVisual; v; v = v->next)
-    {
-	if (v->pPixel->depth == 8)
-	    break;
-    }
-
-    pScreenPriv->pSolidAlpha    = 0;
-    pScreenPriv->trapInfo.pMask = 0;
-
-    /* An accelerated alpha only Xgl visual is required for trapezoid
-       acceleration */
-    if (v && v->format.surface)
-    {
-	glitz_surface_t *mask;
-
-	mask = glitz_surface_create (pScreenPriv->drawable,
-				     v->format.surface,
-				     2, 1, 0, NULL);
-	if (mask)
-	{
-	    glitz_set_rectangle (mask, &clearBlack, 0, 0, 1, 1);
-	    glitz_set_rectangle (mask, &solidWhite, 1, 0, 1, 1);
-
-	    glitz_surface_set_fill (mask, GLITZ_FILL_NEAREST);
-	    glitz_surface_set_filter (mask, GLITZ_FILTER_BILINEAR, NULL, 0);
-
-	    pScreenPriv->trapInfo.pMask = xglCreateDevicePicture (mask);
-	    if (!pScreenPriv->trapInfo.pMask)
-		return FALSE;
-	}
-    }
-
-    format = &pScreenPriv->trapInfo.format.vertex;
-    format->primitive  = GLITZ_PRIMITIVE_QUADS;
-    format->attributes = GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK;
-
-    format->mask.type	     = GLITZ_DATA_TYPE_FLOAT;
-    format->mask.size	     = GLITZ_COORDINATE_SIZE_X;
-    format->bytes_per_vertex = sizeof (glitz_float_t);
-
-    if (pScreenPriv->geometryDataType)
-    {
-	format->type		  = GLITZ_DATA_TYPE_FLOAT;
-	format->bytes_per_vertex += 2 * sizeof (glitz_float_t);
-	format->mask.offset	  = 2 * sizeof (glitz_float_t);
-    }
-    else
-    {
-	format->type		  = GLITZ_DATA_TYPE_SHORT;
-	format->bytes_per_vertex += 2 * sizeof (glitz_short_t);
-	format->mask.offset	  = 2 * sizeof (glitz_short_t);
-    }
-#endif
-
-#ifdef XV
-    if (!xglXvScreenInit (pScreen))
-       return FALSE;
-#endif
-
-    return TRUE;
-}
-
-Bool
-xglCloseScreen (int	  index,
-		ScreenPtr pScreen)
-{
-    xglVisualPtr v;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_PIXMAP_PRIV (pScreenPriv->pScreenPixmap);
-
-#ifdef RENDER
-    int i;
-
-    for (i = 0; i < 33; i++)
-	xglFiniGlyphCache (&pScreenPriv->glyphCache[i]);
-
-    if (pScreenPriv->pSolidAlpha)
-	FreePicture ((pointer) pScreenPriv->pSolidAlpha, 0);
-
-    if (pScreenPriv->trapInfo.pMask)
-	FreePicture ((pointer) pScreenPriv->trapInfo.pMask, 0);
-#endif
-
-    xglFiniPixmap (pScreenPriv->pScreenPixmap);
-    if (pPixmapPriv->pDamage)
-	DamageDestroy (pPixmapPriv->pDamage);
-
-    if (pScreenPriv->surface)
-	glitz_surface_destroy (pScreenPriv->surface);
-
-    GEOMETRY_UNINIT (&pScreenPriv->scratchGeometry);
-
-    while (pScreenPriv->pVisual)
-    {
-	v = pScreenPriv->pVisual;
-	pScreenPriv->pVisual = v->next;
-	xfree (v);
-    }
-
-#ifdef GLXEXT
-    while (pScreenPriv->pGlxVisual)
-    {
-	v = pScreenPriv->pGlxVisual;
-	pScreenPriv->pGlxVisual = v->next;
-	xfree (v);
-    }
-#endif
-
-    XGL_SCREEN_UNWRAP (CloseScreen);
-    xfree (pScreenPriv);
-
-    return (*pScreen->CloseScreen) (index, pScreen);
-}
-
-#ifdef RENDER
-void
-xglCreateSolidAlphaPicture (ScreenPtr pScreen)
-{
-    static xRenderColor	solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff };
-    static xRectangle	one = { 0, 0, 1, 1 };
-    PixmapPtr		pPixmap;
-    PictFormatPtr	pFormat;
-    int			error;
-    Pixel		pixel;
-    GCPtr		pGC;
-    XID			tmpval[2];
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
-    if (!pFormat)
-	return;
-
-    pGC = GetScratchGC (pFormat->depth, pScreen);
-    if (!pGC)
-	return;
-
-    pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth, 0);
-    if (!pPixmap)
-	return;
-
-    miRenderColorToPixel (pFormat, &solidWhite, &pixel);
-
-    tmpval[0] = GXcopy;
-    tmpval[1] = pixel;
-
-    ChangeGC (pGC, GCFunction | GCForeground, tmpval);
-    ValidateGC (&pPixmap->drawable, pGC);
-    (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);
-    FreeScratchGC (pGC);
-
-    tmpval[0] = xTrue;
-    pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat,
-					      CPRepeat, tmpval,
-					      serverClient, &error);
-    (*pScreen->DestroyPixmap) (pPixmap);
-
-    if (pScreenPriv->pSolidAlpha)
-	ValidatePicture (pScreenPriv->pSolidAlpha);
-}
-#endif
diff --git a/hw/xgl/xglshm.c b/hw/xgl/xglshm.c
deleted file mode 100644
index 567daa9..0000000
--- a/hw/xgl/xglshm.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-
-#ifdef MITSHM
-
-void
-xglShmPutImage (DrawablePtr  pDrawable,
-		GCPtr	     pGC,
-		int	     depth,
-		unsigned int format,
-		int	     w,
-		int	     h,
-		int	     sx,
-		int	     sy,
-		int	     sw,
-		int	     sh,
-		int	     dx,
-		int	     dy,
-		char	     *data)
-{
-    ScreenPtr pScreen = pDrawable->pScreen;
-    PixmapPtr pPixmapHeader = NULL;
-    PixmapPtr pPixmap;
-    int	      saveTarget;
-
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    if ((format == ZPixmap) || (depth == 1))
-    {
-	pPixmap = pPixmapHeader =
-	    GetScratchPixmapHeader (pScreen, w, h, depth,
-				    BitsPerPixel (depth),
-				    PixmapBytePad (w, depth),
-				    (pointer) data);
-
-	/* disable any possible acceleration of this pixmap */
-	if (pPixmap)
-	    xglSetPixmapVisual (pPixmap, 0);
-    }
-    else
-    {
-	pPixmap = (*pScreen->CreatePixmap) (pScreen, sw, sh, depth,
-					    CREATE_PIXMAP_USAGE_SCRATCH);
-	if (pPixmap)
-	{
-	    GCPtr pScratchGC;
-
-	    if (!xglAllocatePixmapBits (pPixmap,
-					XGL_PIXMAP_USAGE_HINT_DEFAULT))
-	    {
-		(*pScreen->DestroyPixmap) (pPixmap);
-		return;
-	    }
-
-	    xglSetPixmapVisual (pPixmap, 0);
-
-	    pScratchGC = GetScratchGC (depth, pScreen);
-	    if (!pScratchGC)
-	    {
-		(*pScreen->DestroyPixmap) (pPixmap);
-		return;
-	    }
-
-	    ValidateGC ((DrawablePtr) pPixmap, pScratchGC);
-	    (*pGC->ops->PutImage) ((DrawablePtr) pPixmap, pScratchGC, depth,
-				   -sx, -sy, w, h, 0,
-				   (format == XYPixmap) ? XYPixmap : ZPixmap,
-				   data);
-
-	    FreeScratchGC (pScratchGC);
-
-	    sx = sy = 0;
-	}
-    }
-
-    if (!pPixmap)
-	return;
-
-    /* CopyArea should always be done in software */
-    saveTarget = pPixmapPriv->target;
-    pPixmapPriv->target = xglPixmapTargetNo;
-
-    if (format == XYBitmap)
-	(*pGC->ops->CopyPlane) ((DrawablePtr) pPixmap, pDrawable, pGC,
-				sx, sy, sw, sh, dx, dy, 1L);
-    else
-	(*pGC->ops->CopyArea) ((DrawablePtr) pPixmap, pDrawable, pGC,
-			       sx, sy, sw, sh, dx, dy);
-
-    pPixmapPriv->target = saveTarget;
-
-    if (pPixmapHeader)
-	FreeScratchPixmapHeader (pPixmapHeader);
-    else
-	(*pScreen->DestroyPixmap) (pPixmap);
-}
-
-#endif
diff --git a/hw/xgl/xglsolid.c b/hw/xgl/xglsolid.c
deleted file mode 100644
index 8657a9a..0000000
--- a/hw/xgl/xglsolid.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
-
-Bool
-xglSolid (DrawablePtr	   pDrawable,
-	  glitz_operator_t op,
-	  glitz_surface_t  *solid,
-	  xglGeometryPtr   pGeometry,
-	  int		   x,
-	  int		   y,
-	  int		   width,
-	  int		   height,
-	  BoxPtr	   pBox,
-	  int		   nBox)
-{
-    glitz_surface_t *surface;
-    int		    xOff, yOff;
-
-    if (nBox < 1)
-	return TRUE;
-
-    if (!xglPrepareTarget (pDrawable))
-	return FALSE;
-
-    XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
-    if (pGeometry)
-    {
-	glitz_surface_set_clip_region (surface, xOff, yOff,
-				       (glitz_box_t *) pBox, nBox);
-    }
-    else
-    {
-	pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen, 4 * nBox);
-	GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
-    }
-
-    GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
-    if (!GEOMETRY_ENABLE (pGeometry, surface))
-	return FALSE;
-
-    glitz_composite (op,
-		     solid, NULL, surface,
-		     0, 0,
-		     0, 0,
-		     x + xOff,
-		     y + yOff,
-		     width, height);
-
-    glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
-    if (glitz_surface_get_status (surface))
-	return FALSE;
-
-    return TRUE;
-}
-
-Bool
-xglSolidGlyph (DrawablePtr  pDrawable,
-	       GCPtr	    pGC,
-	       int	    x,
-	       int	    y,
-	       unsigned int nGlyph,
-	       CharInfoPtr  *ppci,
-	       pointer      pglyphBase)
-{
-    xglGeometryRec geometry;
-    int		   xBack, widthBack;
-    int		   yBack, heightBack;
-
-    XGL_GC_PRIV (pGC);
-
-    x += pDrawable->x;
-    y += pDrawable->y;
-
-    GEOMETRY_INIT (pDrawable->pScreen, &geometry,
-		   GLITZ_GEOMETRY_TYPE_BITMAP,
-		   GEOMETRY_USAGE_SYSMEM, 0);
-
-    GEOMETRY_FOR_GLYPH (pDrawable->pScreen,
-			&geometry,
-			nGlyph,
-			ppci,
-			pglyphBase);
-
-    GEOMETRY_TRANSLATE (&geometry, x, y);
-
-    widthBack = 0;
-    while (nGlyph--)
-	widthBack += (*ppci++)->metrics.characterWidth;
-
-    xBack = x;
-    if (widthBack < 0)
-    {
-	xBack += widthBack;
-	widthBack = -widthBack;
-    }
-    yBack = y - FONTASCENT (pGC->font);
-    heightBack = FONTASCENT (pGC->font) + FONTDESCENT (pGC->font);
-
-    if (xglSolid (pDrawable,
-		  pGCPriv->op,
-		  pGCPriv->bg,
-		  NULL,
-		  xBack,
-		  yBack,
-		  widthBack,
-		  heightBack,
-		  REGION_RECTS (pGC->pCompositeClip),
-		  REGION_NUM_RECTS (pGC->pCompositeClip)))
-    {
-	if (xglSolid (pDrawable,
-		      pGCPriv->op,
-		      pGCPriv->fg,
-		      &geometry,
-		      xBack,
-		      yBack,
-		      widthBack,
-		      heightBack,
-		      REGION_RECTS (pGC->pCompositeClip),
-		      REGION_NUM_RECTS (pGC->pCompositeClip)))
-	{
-	    GEOMETRY_UNINIT (&geometry);
-	    xglAddCurrentBitDamage (pDrawable);
-	    return TRUE;
-	}
-    }
-
-    GEOMETRY_UNINIT (&geometry);
-    return FALSE;
-}
diff --git a/hw/xgl/xglsync.c b/hw/xgl/xglsync.c
deleted file mode 100644
index 6b5c00b..0000000
--- a/hw/xgl/xglsync.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-Bool
-xglSyncBits (DrawablePtr pDrawable,
-	     BoxPtr	 pExtents)
-{
-    RegionRec region;
-    BoxRec    box;
-
-    XGL_DRAWABLE_PIXMAP (pDrawable);
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (pPixmapPriv->allBits)
-	return xglMapPixmapBits (pPixmap);
-
-    if (pPixmapPriv->target == xglPixmapTargetIn && pExtents)
-    {
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = pPixmap->drawable.width;
-	box.y2 = pPixmap->drawable.height;
-	if (pExtents->x1 > box.x1)
-	    box.x1 = pExtents->x1;
-	if (pExtents->y1 > box.y1)
-	    box.y1 = pExtents->y1;
-	if (pExtents->x2 < box.x2)
-	    box.x2 = pExtents->x2;
-	if (pExtents->y2 < box.y2)
-	    box.y2 = pExtents->y2;
-
-	if (box.x2 <= box.x1 || box.y2 <= box.y1)
-	    return xglMapPixmapBits (pPixmap);
-
-	if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
-	{
-	    switch (RECT_IN_REGION (pDrawable->pScreen,
-				    &pPixmapPriv->bitRegion,
-				    &box)) {
-	    case rgnIN:
-		REGION_INIT (pDrawable->pScreen, &region, NullBox, 0);
-		break;
-	    case rgnOUT:
-		REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-		REGION_UNION (pDrawable->pScreen,
-			      &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
-			      &region);
-		break;
-	    case rgnPART:
-		REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-		REGION_SUBTRACT (pDrawable->pScreen, &region, &region,
-				 &pPixmapPriv->bitRegion);
-		REGION_UNION (pDrawable->pScreen,
-			      &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
-			      &region);
-		break;
-	    }
-	}
-	else
-	{
-	    REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-	    REGION_SUBTRACT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
-			     &region, &pPixmapPriv->bitRegion);
-	}
-
-	if (REGION_NUM_RECTS (&pPixmapPriv->bitRegion) == 1)
-	{
-	    BoxPtr pBox;
-
-	    pBox = REGION_RECTS (&pPixmapPriv->bitRegion);
-
-	    if (pBox->x1 <= 0			    &&
-		pBox->y1 <= 0			    &&
-		pBox->x2 >= pPixmap->drawable.width &&
-		pBox->y2 >= pPixmap->drawable.height)
-		pPixmapPriv->allBits = TRUE;
-	}
-    }
-    else
-    {
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = pPixmap->drawable.width;
-	box.y2 = pPixmap->drawable.height;
-
-	REGION_INIT (pDrawable->pScreen, &region, &box, 1);
-	REGION_SUBTRACT (pDrawable->pScreen, &region, &region,
-			 &pPixmapPriv->bitRegion);
-
-	pPixmapPriv->allBits = TRUE;
-    }
-
-    if (!pPixmapPriv->buffer)
-	if (!xglAllocatePixmapBits (pPixmap, XGL_PIXMAP_USAGE_HINT_DEFAULT))
-	    return FALSE;
-
-    if (REGION_NOTEMPTY (pDrawable->pScreen, &region) && pPixmapPriv->surface)
-    {
-	glitz_pixel_format_t format;
-	BoxPtr		     pBox;
-	BoxPtr		     pExt;
-	int		     nBox;
-
-	if (!xglSyncSurface (pDrawable))
-	    FatalError (XGL_SW_FAILURE_STRING);
-
-	xglUnmapPixmapBits (pPixmap);
-
-	pBox = REGION_RECTS (&region);
-	nBox = REGION_NUM_RECTS (&region);
-	pExt = REGION_EXTENTS (pDrawable->pScreen, &region);
-
-	format.fourcc  = GLITZ_FOURCC_RGB;
-	format.masks   = pPixmapPriv->pVisual->pPixel->masks;
-	format.xoffset = pExt->x1;
-
-	if (pPixmapPriv->stride < 0)
-	{
-	    format.skip_lines	  = pPixmap->drawable.height - pExt->y2;
-	    format.bytes_per_line = -pPixmapPriv->stride;
-	    format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-	}
-	else
-	{
-	    format.skip_lines	  = pExt->y1;
-	    format.bytes_per_line = pPixmapPriv->stride;
-	    format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
-	}
-
-	glitz_surface_set_clip_region (pPixmapPriv->surface,
-				       0, 0, (glitz_box_t *) pBox, nBox);
-
-	glitz_get_pixels (pPixmapPriv->surface,
-			  pExt->x1,
-			  pExt->y1,
-			  pExt->x2 - pExt->x1,
-			  pExt->y2 - pExt->y1,
-			  &format,
-			  pPixmapPriv->buffer);
-
-	glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
-    }
-
-    REGION_UNINIT (pDrawable->pScreen, &region);
-
-    if (pPixmapPriv->allBits)
-    {
-	box.x1 = 0;
-	box.y1 = 0;
-	box.x2 = pPixmap->drawable.width;
-	box.y2 = pPixmap->drawable.height;
-
-	REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
-	REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion, &box, 1);
-    }
-
-    return xglMapPixmapBits (pPixmap);
-}
-
-void
-xglSyncDamageBoxBits (DrawablePtr pDrawable)
-{
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    if (!xglSyncBits (pDrawable, &pPixmapPriv->damageBox))
-	FatalError (XGL_SW_FAILURE_STRING);
-}
-
-Bool
-xglSyncSurface (DrawablePtr pDrawable)
-{
-    RegionPtr pRegion;
-
-    XGL_DRAWABLE_PIXMAP (pDrawable);
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    if (!pPixmapPriv->surface)
-    {
-	if (!xglCreatePixmapSurface (pPixmap))
-	    return FALSE;
-    }
-
-    pRegion = DamageRegion (pPixmapPriv->pDamage);
-
-    if (REGION_NOTEMPTY (pDrawable->pScreen, pRegion))
-    {
-	glitz_pixel_format_t format;
-	BoxPtr		     pBox;
-	BoxPtr		     pExt;
-	int		     nBox;
-
-	xglUnmapPixmapBits (pPixmap);
-
-	nBox = REGION_NUM_RECTS (pRegion);
-	pBox = REGION_RECTS (pRegion);
-	pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
-
-	format.fourcc  = pPixmapPriv->pVisual->format.surface->color.fourcc;
-	format.masks   = pPixmapPriv->pVisual->pPixel->masks;
-	format.xoffset = pExt->x1;
-
-	if (pPixmapPriv->stride < 0)
-	{
-	    format.skip_lines	  = pPixmap->drawable.height - pExt->y2;
-	    format.bytes_per_line = -pPixmapPriv->stride;
-	    format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
-	}
-	else
-	{
-	    format.skip_lines	  = pExt->y1;
-	    format.bytes_per_line = pPixmapPriv->stride;
-	    format.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
-	}
-
-	glitz_surface_set_clip_region (pPixmapPriv->surface,
-				       0, 0, (glitz_box_t *) pBox, nBox);
-
-	glitz_set_pixels (pPixmapPriv->surface,
-			  pExt->x1,
-			  pExt->y1,
-			  pExt->x2 - pExt->x1,
-			  pExt->y2 - pExt->y1,
-			  &format,
-			  pPixmapPriv->buffer);
-
-	glitz_surface_set_clip_region (pPixmapPriv->surface, 0, 0, NULL, 0);
-
-	REGION_EMPTY (pDrawable->pScreen, pRegion);
-    }
-
-    return TRUE;
-}
-
-Bool
-xglPrepareTarget (DrawablePtr pDrawable)
-{
-    XGL_DRAWABLE_PIXMAP (pDrawable);
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    switch (pPixmapPriv->target) {
-    case xglPixmapTargetNo:
-	break;
-    case xglPixmapTargetOut:
-	if (xglSyncSurface (pDrawable))
-	{
-	    glitz_drawable_format_t *format;
-
-	    XGL_SCREEN_PRIV (pDrawable->pScreen);
-
-	    if (!pPixmapPriv->drawable)
-	    {
-		unsigned int width, height;
-
-		format = pPixmapPriv->pVisual->format.drawable;
-		width  = pPixmap->drawable.width;
-		height = pPixmap->drawable.height;
-
-		if (pPixmapPriv->pVisual->pbuffer)
-		{
-		    pPixmapPriv->drawable =
-			glitz_create_pbuffer_drawable (pScreenPriv->drawable,
-						       format, width, height);
-		}
-		else
-		{
-		    pPixmapPriv->drawable =
-			glitz_create_drawable (pScreenPriv->drawable,
-					       format, width, height);
-		}
-	    }
-
-	    if (pPixmapPriv->drawable)
-	    {
-		glitz_surface_attach (pPixmapPriv->surface,
-				      pPixmapPriv->drawable,
-				      GLITZ_DRAWABLE_BUFFER_FRONT_COLOR);
-
-		pPixmapPriv->target = xglPixmapTargetIn;
-
-		return TRUE;
-	    }
-	}
-	pPixmapPriv->target = xglPixmapTargetNo;
-	break;
-    case xglPixmapTargetIn:
-	if (xglSyncSurface (pDrawable))
-	    return TRUE;
-	break;
-    }
-
-    return FALSE;
-}
-
-void
-xglAddSurfaceDamage (DrawablePtr pDrawable,
-		     RegionPtr   pRegion)
-{
-    glitz_surface_t *surface;
-    int		    xOff, yOff;
-
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    pPixmapPriv->damageBox = miEmptyBox;
-
-    XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
-    if (xOff || yOff)
-	REGION_TRANSLATE (pDrawable->pScreen, pRegion, xOff, yOff);
-
-    if (pPixmapPriv->pDamage)
-    {
-	RegionPtr pDamageRegion;
-
-	pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
-	REGION_UNION (pDrawable->pScreen,
-		      pDamageRegion, pDamageRegion,
-		      pRegion);
-    }
-
-    REGION_UNION (pDrawable->pScreen,
-		  &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
-		  pRegion);
-
-    if (xOff || yOff)
-	REGION_TRANSLATE (pDrawable->pScreen, pRegion, -xOff, -yOff);
-}
-
-void
-xglAddCurrentSurfaceDamage (DrawablePtr pDrawable)
-{
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    if (BOX_NOTEMPTY (&pPixmapPriv->damageBox))
-    {
-	RegionRec region;
-
-	REGION_INIT (pDrawable->pScreen, &region, &pPixmapPriv->damageBox, 1);
-
-	if (pPixmapPriv->pDamage)
-	{
-	    RegionPtr pDamageRegion;
-
-	    pDamageRegion = DamageRegion (pPixmapPriv->pDamage);
-
-	    REGION_UNION (pDrawable->pScreen,
-			  pDamageRegion, pDamageRegion,
-			  &region);
-	}
-
-	REGION_UNION (pDrawable->pScreen,
-		      &pPixmapPriv->bitRegion, &pPixmapPriv->bitRegion,
-		      &region);
-
-	REGION_UNINIT (pDrawable->pScreen, &region);
-
-	pPixmapPriv->damageBox = miEmptyBox;
-    }
-}
-
-void
-xglAddBitDamage (DrawablePtr pDrawable,
-		 RegionPtr   pRegion)
-{
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
-    {
-	BoxPtr pBox;
-	BoxPtr pExt, pBitExt;
-	int    nBox;
-
-	pBox = REGION_RECTS (pRegion);
-	pExt = REGION_EXTENTS (pDrawable->pScreen, pRegion);
-	nBox = REGION_NUM_RECTS (pRegion);
-
-	pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
-
-	if (pExt->x1 < pBitExt->x2 &&
-	    pExt->y1 < pBitExt->y2 &&
-	    pExt->x2 > pBitExt->x1 &&
-	    pExt->y2 > pBitExt->y1)
-	{
-	    while (nBox--)
-	    {
-		if (pBox->x1 < pBitExt->x2 &&
-		    pBox->y1 < pBitExt->y2 &&
-		    pBox->x2 > pBitExt->x1 &&
-		    pBox->y2 > pBitExt->y1)
-		{
-		    REGION_UNINIT (pDrawable->pScreen,
-				   &pPixmapPriv->bitRegion);
-		    REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
-				 NullBox, 0);
-		    pPixmapPriv->allBits = FALSE;
-		    return;
-		}
-
-		pBox++;
-	    }
-	}
-    }
-}
-
-void
-xglAddCurrentBitDamage (DrawablePtr pDrawable)
-{
-    XGL_DRAWABLE_PIXMAP_PRIV (pDrawable);
-
-    if (REGION_NOTEMPTY (pDrawable->pScreen, &pPixmapPriv->bitRegion))
-    {
-	BoxPtr pBitExt;
-
-	pBitExt = REGION_EXTENTS (pDrawable->pScreen, &pPixmapPriv->bitRegion);
-
-	if (pPixmapPriv->damageBox.x1 < pBitExt->x2 &&
-	    pPixmapPriv->damageBox.y1 < pBitExt->y2 &&
-	    pPixmapPriv->damageBox.x2 > pBitExt->x1 &&
-	    pPixmapPriv->damageBox.y2 > pBitExt->y1)
-	{
-	    REGION_UNINIT (pDrawable->pScreen, &pPixmapPriv->bitRegion);
-	    REGION_INIT (pDrawable->pScreen, &pPixmapPriv->bitRegion,
-			 NullBox, 0);
-	    pPixmapPriv->allBits = FALSE;
-	}
-    }
-
-    pPixmapPriv->damageBox = miEmptyBox;
-}
diff --git a/hw/xgl/xgltile.c b/hw/xgl/xgltile.c
deleted file mode 100644
index 25b78c3..0000000
--- a/hw/xgl/xgltile.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-
-static glitz_geometry_format_t tileGeometryFormat = {
-    {
-	GLITZ_PRIMITIVE_QUADS,
-	GLITZ_DATA_TYPE_FLOAT,
-	sizeof (glitz_float_t) * 4,
-	GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK, {
-	    GLITZ_DATA_TYPE_FLOAT,
-	    GLITZ_COORDINATE_SIZE_XY,
-	    sizeof (glitz_float_t) * 2,
-	}, {
-	    0, 0, 0
-	}
-    }
-};
-
-xglGeometryPtr
-xglTiledBoxGeometry (PixmapPtr pTile,
-		     int       tileX,
-		     int       tileY,
-		     BoxPtr    pBox,
-		     int       nBox)
-{
-    ScreenPtr		pScreen = pTile->drawable.pScreen;
-    glitz_point_fixed_t p1, p2;
-    xglGeometryPtr	pGeometry;
-    glitz_float_t	x1, x2, y1, y2;
-    int			x, y, width, height, i;
-    int			xTile, yTile;
-    int			widthTile, heightTile;
-    int			widthTmp, xTmp, yTmp, xTileTmp;
-    int			tileWidth, tileHeight;
-    int			size = 0;
-    glitz_float_t	*data;
-
-    XGL_PIXMAP_PRIV (pTile);
-
-    tileWidth  = pTile->drawable.width;
-    tileHeight = pTile->drawable.height;
-
-    for (i = 0; i < nBox; i++)
-	size +=
-	    (((pBox[i].x2 - pBox[i].x1) / tileWidth) + 2) *
-	    (((pBox[i].y2 - pBox[i].y1) / tileHeight) + 2);
-
-    pGeometry = xglGetScratchVertexGeometryWithType (pScreen,
-						     GEOMETRY_DATA_TYPE_FLOAT,
-						     8 * size);
-
-    data = glitz_buffer_map (pGeometry->buffer,
-			     GLITZ_BUFFER_ACCESS_WRITE_ONLY);
-
-    while (nBox--)
-    {
-	x = pBox->x1;
-	y = pBox->y1;
-	width = pBox->x2 - pBox->x1;
-	height = pBox->y2 - pBox->y1;
-
-	xTile = MOD (tileX + x, tileWidth);
-	yTile = MOD (tileY + y, tileHeight);
-
-	yTmp = y;
-
-	while (height)
-	{
-	    heightTile = MIN (tileHeight - yTile, height);
-
-	    xTileTmp = xTile;
-	    widthTmp = width;
-	    xTmp     = x;
-
-	    while (widthTmp)
-	    {
-		widthTile = MIN (tileWidth - xTileTmp, widthTmp);
-
-		p1.x = xTileTmp << 16;
-		p1.y = yTile << 16;
-		p2.x = (xTileTmp + widthTile) << 16;
-		p2.y = (yTile + heightTile) << 16;
-
-		glitz_surface_translate_point (pPixmapPriv->surface, &p1, &p1);
-		glitz_surface_translate_point (pPixmapPriv->surface, &p2, &p2);
-
-		x1 = FIXED_TO_FLOAT (p1.x);
-		y1 = FIXED_TO_FLOAT (p1.y);
-		x2 = FIXED_TO_FLOAT (p2.x);
-		y2 = FIXED_TO_FLOAT (p2.y);
-
-		*data++ = (glitz_float_t) xTmp;
-		*data++ = (glitz_float_t) yTmp;
-		*data++ = x1;
-		*data++ = y1;
-
-		*data++ = (glitz_float_t) (xTmp + widthTile);
-		*data++ = (glitz_float_t) yTmp;
-		*data++ = x2;
-		*data++ = y1;
-
-		*data++ = (glitz_float_t) (xTmp + widthTile);
-		*data++ = (glitz_float_t) (yTmp + heightTile);
-		*data++ = x2;
-		*data++ = y2;
-
-		*data++ = (glitz_float_t) xTmp;
-		*data++ = (glitz_float_t) (yTmp + heightTile);
-		*data++ = x1;
-		*data++ = y2;
-
-		pGeometry->endOffset += sizeof (glitz_float_t) * 16;
-
-		xTileTmp  = 0;
-		xTmp     += widthTile;
-		widthTmp -= widthTile;
-	    }
-
-	    yTile   = 0;
-	    yTmp   += heightTile;
-	    height -= heightTile;
-	}
-
-	pBox++;
-    }
-
-    if (glitz_buffer_unmap (pGeometry->buffer))
-	return NULL;
-
-    pGeometry->f     = tileGeometryFormat;
-    pGeometry->count =
-	pGeometry->endOffset / tileGeometryFormat.vertex.bytes_per_vertex;
-
-    pPixmapPriv->pictureMask |= xglPCFillMask;
-    glitz_surface_set_fill (pPixmapPriv->surface, GLITZ_FILL_TRANSPARENT);
-
-    return pGeometry;
-}
-
-Bool
-xglTile (DrawablePtr	  pDrawable,
-	 glitz_operator_t op,
-	 PixmapPtr	  pTile,
-	 int		  tileX,
-	 int		  tileY,
-	 xglGeometryPtr	  pGeometry,
-	 int		  x,
-	 int		  y,
-	 int		  width,
-	 int		  height,
-	 BoxPtr		  pBox,
-	 int		  nBox)
-{
-    xglPixmapPtr    pTilePriv;
-    glitz_surface_t *surface;
-    int		    xOff, yOff;
-
-    if (nBox < 1)
-	return TRUE;
-
-    if (!xglPrepareTarget (pDrawable))
-	return FALSE;
-
-    if (!xglSyncSurface (&pTile->drawable))
-	return FALSE;
-
-    XGL_GET_DRAWABLE (pDrawable, surface, xOff, yOff);
-
-    pTilePriv = XGL_GET_PIXMAP_PRIV (pTile);
-
-    pTilePriv->pictureMask |= xglPCFilterMask | xglPCTransformMask;
-    glitz_surface_set_filter (pTilePriv->surface,
-			      GLITZ_FILTER_NEAREST,
-			      NULL, 0);
-    glitz_surface_set_transform (pTilePriv->surface, NULL);
-
-    if (pTilePriv->acceleratedTile)
-    {
-	if (pGeometry)
-	{
-	    glitz_surface_set_clip_region (surface, xOff, yOff,
-					   (glitz_box_t *) pBox, nBox);
-	    nBox = 0;
-	}
-	else
-	{
-	    pGeometry = xglGetScratchVertexGeometry (pDrawable->pScreen,
-						     4 * nBox);
-	    GEOMETRY_ADD_BOX (pDrawable->pScreen, pGeometry, pBox, nBox);
-	}
-
-	GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
-	if (!GEOMETRY_ENABLE (pGeometry, surface))
-	    return FALSE;
-
-	pTilePriv->pictureMask |= xglPCFillMask;
-	glitz_surface_set_fill (pTilePriv->surface, GLITZ_FILL_REPEAT);
-
-	glitz_composite (op,
-			 pTilePriv->surface, NULL, surface,
-			 x + tileX,
-			 y + tileY,
-			 0, 0,
-			 x + xOff,
-			 y + yOff,
-			 width, height);
-
-	glitz_surface_set_clip_region (surface, 0, 0, NULL, 0);
-
-	if (!glitz_surface_get_status (surface))
-	    return TRUE;
-
-	if (!nBox)
-	    return FALSE;
-    }
-    else
-    {
-	if (pGeometry)
-	    return FALSE;
-    }
-
-    pGeometry = xglTiledBoxGeometry (pTile, tileX, tileY, pBox, nBox);
-    if (!pGeometry)
-	return FALSE;
-
-    GEOMETRY_TRANSLATE (pGeometry, xOff, yOff);
-
-    if (!GEOMETRY_ENABLE (pGeometry, surface))
-	return FALSE;
-
-    glitz_composite (op,
-		     pTilePriv->surface, NULL, surface,
-		     0, 0,
-		     0, 0,
-		     x + xOff,
-		     y + yOff,
-		     width, height);
-
-    if (glitz_surface_get_status (surface))
-	return FALSE;
-
-    return TRUE;
-}
diff --git a/hw/xgl/xgltrap.c b/hw/xgl/xgltrap.c
deleted file mode 100644
index 6e7a508..0000000
--- a/hw/xgl/xgltrap.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "gcstruct.h"
-#include "damage.h"
-
-#ifdef RENDER
-
-#define XGL_TRAP_FALLBACK_PROLOGUE(pPicture, func) \
-    xglSyncDamageBoxBits (pPicture->pDrawable);	   \
-    XGL_PICTURE_SCREEN_UNWRAP (func)
-
-#define XGL_TRAP_FALLBACK_EPILOGUE(pPicture, func, xglfunc) \
-    XGL_PICTURE_SCREEN_WRAP (func, xglfunc);		    \
-    xglAddCurrentSurfaceDamage (pPicture->pDrawable)
-
-/* just a guess */
-#define SMOOTH_TRAPS_ESTIMATE_RECTS(nTrap) (30 * nTrap)
-
-#define LINE_FIXED_X(l, _y, v)			 \
-    dx = (l)->p2.x - (l)->p1.x;			 \
-    ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx; \
-    dy = (l)->p2.y - (l)->p1.y;			 \
-    (v) = (l)->p1.x + (xFixed) (ex / dy)
-
-#define LINE_FIXED_X_CEIL(l, _y, v)		      \
-    dx = (l)->p2.x - (l)->p1.x;			      \
-    ex = (xFixed_32_32) ((_y) - (l)->p1.y) * dx;      \
-    dy = (l)->p2.y - (l)->p1.y;			      \
-    (v) = (l)->p1.x + (xFixed) ((ex + (dy - 1)) / dy)
-
-static Bool
-xglTrapezoidExtents (PicturePtr pDst,
-		     int        ntrap,
-		     xTrapezoid *traps,
-		     BoxPtr     extents)
-{
-    Bool	 x_overlap, overlap = FALSE;
-    xFixed	 dx, dy, top, bottom;
-    xFixed_32_32 ex;
-
-    if (!ntrap)
-    {
-	extents->x1 = MAXSHORT;
-	extents->x2 = MINSHORT;
-	extents->y1 = MAXSHORT;
-	extents->y2 = MINSHORT;
-
-	return FALSE;
-    }
-
-    extents->y1 = xFixedToInt (traps->top);
-    extents->y2 = xFixedToInt (xFixedCeil (traps->bottom));
-
-    LINE_FIXED_X (&traps->left, traps->top, top);
-    LINE_FIXED_X (&traps->left, traps->bottom, bottom);
-    extents->x1 = xFixedToInt (MIN (top, bottom));
-
-    LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
-    LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
-    extents->x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
-
-    ntrap--;
-    traps++;
-
-    for (; ntrap; ntrap--, traps++)
-    {
-	INT16 x1, y1, x2, y2;
-
-	if (!xTrapezoidValid (traps))
-	    continue;
-
-	y1 = xFixedToInt (traps->top);
-	y2 = xFixedToInt (xFixedCeil (traps->bottom));
-
-	LINE_FIXED_X (&traps->left, traps->top, top);
-	LINE_FIXED_X (&traps->left, traps->bottom, bottom);
-	x1 = xFixedToInt (MIN (top, bottom));
-
-	LINE_FIXED_X_CEIL (&traps->right, traps->top, top);
-	LINE_FIXED_X_CEIL (&traps->right, traps->bottom, bottom);
-	x2 = xFixedToInt (xFixedCeil (MAX (top, bottom)));
-
-	x_overlap = FALSE;
-	if (x1 >= extents->x2)
-	    extents->x2 = x2;
-	else if (x2 <= extents->x1)
-	    extents->x1 = x1;
-	else
-	{
-	    x_overlap = TRUE;
-	    if (x1 < extents->x1)
-		extents->x1 = x1;
-	    if (x2 > extents->x2)
-		extents->x2 = x2;
-	}
-
-	if (y1 >= extents->y2)
-	    extents->y2 = y2;
-	else if (y2 <= extents->y1)
-	    extents->y1 = y1;
-	else
-	{
-	    if (y1 < extents->y1)
-		extents->y1 = y1;
-	    if (y2 > extents->y2)
-		extents->y2 = y2;
-
-	    if (x_overlap)
-		overlap = TRUE;
-	}
-    }
-
-    xglPictureClipExtents (pDst, extents);
-
-    return overlap;
-}
-
-void
-xglTrapezoids (CARD8	     op,
-	       PicturePtr    pSrc,
-	       PicturePtr    pDst,
-	       PictFormatPtr maskFormat,
-	       INT16	     xSrc,
-	       INT16	     ySrc,
-	       int	     nTrap,
-	       xTrapezoid    *traps)
-{
-    ScreenPtr	    pScreen = pDst->pDrawable->pScreen;
-    PicturePtr	    pMask = NULL, pSrcPicture, pDstPicture;
-    PicturePtr	    pMaskPicture = NULL;
-    xglGeometryPtr  pGeometry = NULL;
-    unsigned int    polyEdge = pDst->polyEdge;
-    INT16	    xDst, yDst;
-    INT16	    xOff, yOff;
-    BoxRec	    extents;
-    Bool	    overlap;
-    Bool	    target;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    xDst = traps[0].left.p1.x >> 16;
-    yDst = traps[0].left.p1.y >> 16;
-
-    overlap = xglTrapezoidExtents (pDst, nTrap, traps, &extents);
-    if (extents.y1 >= extents.y2 || extents.x1 >= extents.x2)
-	return;
-
-    target = xglPrepareTarget (pDst->pDrawable);
-
-    if (nTrap > 1 && op != PictOpAdd && maskFormat &&
-	(!target || overlap || op != PictOpOver))
-    {
-	PixmapPtr  pPixmap;
-	GCPtr	   pGC;
-	xRectangle rect;
-	int	   error;
-	int	   area;
-
-	if (!pScreenPriv->pSolidAlpha)
-	{
-	    xglCreateSolidAlphaPicture (pScreen);
-	    if (!pScreenPriv->pSolidAlpha)
-		return;
-	}
-
-	rect.x = 0;
-	rect.y = 0;
-	rect.width = extents.x2 - extents.x1;
-	rect.height = extents.y2 - extents.y1;
-
-	pPixmap = (*pScreen->CreatePixmap) (pScreen,
-					    rect.width, rect.height,
-					    maskFormat->depth,
-					    CREATE_PIXMAP_USAGE_SCRATCH);
-	if (!pPixmap)
-	    return;
-
-	pMask = CreatePicture (0, &pPixmap->drawable, maskFormat,
-			       0, 0, serverClient, &error);
-	if (!pMask)
-	{
-	    (*pScreen->DestroyPixmap) (pPixmap);
-	    return;
-	}
-
-	if (!target)
-	{
-	    /* make sure we don't do accelerated drawing to mask */
-	    xglSetPixmapVisual (pPixmap, NULL);
-	}
-
-	area = rect.width * rect.height;
-	if ((SMOOTH_TRAPS_ESTIMATE_RECTS (nTrap) * 4) > area)
-	    XGL_GET_PIXMAP_PRIV (pPixmap)->target = xglPixmapTargetNo;
-
-	ValidatePicture (pMask);
-	pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
-	ValidateGC (&pPixmap->drawable, pGC);
-	(*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &rect);
-	FreeScratchGC (pGC);
-
-	(*pScreen->DestroyPixmap) (pPixmap);
-
-	target = xglPrepareTarget (pMask->pDrawable);
-
-	xOff = -extents.x1;
-	yOff = -extents.y1;
-	pSrcPicture = pScreenPriv->pSolidAlpha;
-	pDstPicture = pMask;
-    }
-    else
-    {
-	if (maskFormat)
-	{
-	    if (maskFormat->depth == 1)
-		polyEdge = PolyEdgeSharp;
-	    else
-		polyEdge = PolyEdgeSmooth;
-	}
-
-	xOff = 0;
-	yOff = 0;
-	pSrcPicture = pSrc;
-	pDstPicture = pDst;
-    }
-
-    if (target)
-    {
-	if (maskFormat || polyEdge == PolyEdgeSmooth)
-	{
-	    glitz_vertex_format_t *format;
-	    glitz_surface_t	  *mask;
-	    xTrapezoid		  *pTrap = traps;
-	    int			  nAddedTrap, n = nTrap;
-	    int			  offset = 0;
-	    int			  size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
-
-	    pMaskPicture = pScreenPriv->trapInfo.pMask;
-	    format = &pScreenPriv->trapInfo.format.vertex;
-	    mask = pMaskPicture->pSourcePict->source.devPrivate.ptr;
-
-	    size *= format->bytes_per_vertex;
-	    pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
-
-	    while (n)
-	    {
-		if (pGeometry->size < size)
-		    GEOMETRY_RESIZE (pScreen, pGeometry, size);
-
-		if (!pGeometry->buffer)
-		{
-		    if (pMask)
-			FreePicture (pMask, 0);
-
-		    return;
-		}
-
-		offset +=
-		    glitz_add_trapezoids (pGeometry->buffer,
-					  offset, size - offset, format->type,
-					  mask, (glitz_trapezoid_t *) pTrap, n,
-					  &nAddedTrap);
-
-		n     -= nAddedTrap;
-		pTrap += nAddedTrap;
-		size  *= 2;
-	    }
-
-	    pGeometry->f     = pScreenPriv->trapInfo.format;
-	    pGeometry->count = offset / format->bytes_per_vertex;
-	}
-	else
-	{
-	    pGeometry =
-		xglGetScratchVertexGeometryWithType (pScreen,
-						     GEOMETRY_DATA_TYPE_FLOAT,
-						     4 * nTrap);
-	    if (!pGeometry->buffer)
-	    {
-		if (pMask)
-		    FreePicture (pMask, 0);
-
-		return;
-	    }
-
-	    GEOMETRY_ADD_TRAPEZOID (pScreen, pGeometry, traps, nTrap);
-	}
-
-	GEOMETRY_TRANSLATE (pGeometry,
-			    pDstPicture->pDrawable->x + xOff,
-			    pDstPicture->pDrawable->y + yOff);
-    }
-
-    if (pGeometry &&
-	xglCompositeGeneral (pMask ? PictOpAdd : op,
-			     pSrcPicture,
-			     pMaskPicture,
-			     pDstPicture,
-			     pGeometry,
-			     extents.x1 + xOff + xSrc - xDst,
-			     extents.y1 + yOff + ySrc - yDst,
-			     0, 0,
-			     pDstPicture->pDrawable->x + extents.x1 + xOff,
-			     pDstPicture->pDrawable->y + extents.y1 + yOff,
-			     extents.x2 - extents.x1,
-			     extents.y2 - extents.y1))
-    {
-	/* no intermediate mask? we need to register damage from here as
-	   CompositePicture will never be called. */
-	if (!pMask)
-	{
-	    RegionRec region;
-
-	    REGION_INIT (pScreen, &region, &extents, 1);
-	    REGION_TRANSLATE (pScreen, &region,
-			      pDst->pDrawable->x, pDst->pDrawable->y);
-
-	    DamageDamageRegion (pDst->pDrawable, &region);
-
-	    REGION_UNINIT (pScreen, &region);
-	}
-
-	xglAddCurrentBitDamage (pDstPicture->pDrawable);
-    }
-    else
-    {
-	XGL_DRAWABLE_PIXMAP_PRIV (pDstPicture->pDrawable);
-
-	pPixmapPriv->damageBox.x1 = extents.x1 + xOff;
-	pPixmapPriv->damageBox.y1 = extents.y1 + yOff;
-	pPixmapPriv->damageBox.x2 = extents.x2 + xOff;
-	pPixmapPriv->damageBox.y2 = extents.y2 + yOff;
-
-	xglSyncDamageBoxBits (pDstPicture->pDrawable);
-
-	if (pMask || (polyEdge == PolyEdgeSmooth &&
-		      op == PictOpAdd && miIsSolidAlpha (pSrc)))
-	{
-	    PictureScreenPtr ps = GetPictureScreen (pScreen);
-
-	    for (; nTrap; nTrap--, traps++)
-		(*ps->RasterizeTrapezoid) (pDstPicture, traps, xOff, yOff);
-
-	    xglAddCurrentSurfaceDamage (pDstPicture->pDrawable);
-	}
-	else
-	    miTrapezoids (op, pSrc, pDstPicture, maskFormat,
-			  xSrc, ySrc, nTrap, traps);
-    }
-
-    if (pMask)
-    {
-	CompositePicture (op, pSrc, pMask, pDst,
-			  extents.x1 + xSrc - xDst,
-			  extents.y1 + ySrc - yDst,
-			  0, 0,
-			  extents.x1, extents.y1,
-			  extents.x2 - extents.x1,
-			  extents.y2 - extents.y1);
-
-	FreePicture (pMask, 0);
-    }
-}
-
-void
-xglAddTraps (PicturePtr pDst,
-	     INT16	xOff,
-	     INT16	yOff,
-	     int	nTrap,
-	     xTrap	*traps)
-{
-    PictureScreenPtr pPictureScreen;
-    ScreenPtr	     pScreen = pDst->pDrawable->pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_DRAWABLE_PIXMAP_PRIV (pDst->pDrawable);
-
-    if (!pScreenPriv->pSolidAlpha)
-    {
-	xglCreateSolidAlphaPicture (pScreen);
-	if (!pScreenPriv->pSolidAlpha)
-	    return;
-    }
-
-    pPixmapPriv->damageBox.x1 = 0;
-    pPixmapPriv->damageBox.y1 = 0;
-    pPixmapPriv->damageBox.x2 = pDst->pDrawable->width;
-    pPixmapPriv->damageBox.y2 = pDst->pDrawable->height;
-
-    if (xglPrepareTarget (pDst->pDrawable))
-    {
-	PicturePtr	      pMask;
-	glitz_vertex_format_t *format;
-	glitz_surface_t	      *mask;
-	xglGeometryPtr	      pGeometry;
-	xTrap		      *pTrap = traps;
-	int		      nAddedTrap, n = nTrap;
-	int		      offset = 0;
-	int		      size = SMOOTH_TRAPS_ESTIMATE_RECTS (n);
-
-	pMask = pScreenPriv->trapInfo.pMask;
-	format = &pScreenPriv->trapInfo.format.vertex;
-	mask = pMask->pSourcePict->source.devPrivate.ptr;
-
-	size *= format->bytes_per_vertex;
-	pGeometry = xglGetScratchGeometryWithSize (pScreen, size);
-
-	while (n)
-	{
-	    if (pGeometry->size < size)
-		GEOMETRY_RESIZE (pScreen, pGeometry, size);
-
-	    if (!pGeometry->buffer)
-		return;
-
-	    offset +=
-		glitz_add_traps (pGeometry->buffer,
-				 offset, size - offset, format->type, mask,
-				 (glitz_trap_t *) pTrap, n,
-				 &nAddedTrap);
-
-	    n     -= nAddedTrap;
-	    pTrap += nAddedTrap;
-	    size  *= 2;
-	}
-
-	pGeometry->f     = pScreenPriv->trapInfo.format;
-	pGeometry->count = offset / format->bytes_per_vertex;
-
-	GEOMETRY_TRANSLATE (pGeometry,
-			    pDst->pDrawable->x + xOff,
-			    pDst->pDrawable->y + yOff);
-
-	if (xglCompositeGeneral (PictOpAdd,
-				 pScreenPriv->pSolidAlpha,
-				 pMask,
-				 pDst,
-				 pGeometry,
-				 0, 0,
-				 0, 0,
-				 pDst->pDrawable->x, pDst->pDrawable->y,
-				 pDst->pDrawable->width,
-				 pDst->pDrawable->height))
-	{
-	    xglAddCurrentBitDamage (pDst->pDrawable);
-	    return;
-	}
-    }
-
-    pPictureScreen = GetPictureScreen (pScreen);
-
-    XGL_TRAP_FALLBACK_PROLOGUE (pDst, AddTraps);
-    (*pPictureScreen->AddTraps) (pDst, xOff, yOff, nTrap, traps);
-    XGL_TRAP_FALLBACK_EPILOGUE (pDst, AddTraps, xglAddTraps);
-}
-
-#endif
diff --git a/hw/xgl/xglwindow.c b/hw/xgl/xglwindow.c
deleted file mode 100644
index 393f01d..0000000
--- a/hw/xgl/xglwindow.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr at novell.com>
- */
-
-#include "xgl.h"
-#include "fb.h"
-
-#define XGL_WINDOW_FALLBACK_PROLOGUE(pWin, func)		       \
-    if (!xglMapPixmapBits (XGL_GET_DRAWABLE_PIXMAP (&pWin->drawable))) \
-	FatalError (XGL_SW_FAILURE_STRING);			       \
-    XGL_SCREEN_UNWRAP (func)
-
-#define XGL_WINDOW_FALLBACK_EPILOGUE(pWin, pRegion, func, xglfunc) \
-    XGL_SCREEN_WRAP (func, xglfunc);				   \
-    xglAddSurfaceDamage (&pWin->drawable, pRegion)
-
-Bool
-xglCreateWindow (WindowPtr pWin)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    Bool      ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_WINDOW_PRIV (pWin);
-
-    XGL_SCREEN_UNWRAP (CreateWindow);
-    ret = (*pScreen->CreateWindow) (pWin);
-    XGL_SCREEN_WRAP (CreateWindow, xglCreateWindow);
-
-    pWinPriv->pPixmap = pWin->drawable.pScreen->devPrivate;
-
-    return ret;
-}
-
-Bool
-xglDestroyWindow (WindowPtr pWin)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    Bool      ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    XGL_SCREEN_UNWRAP (DestroyWindow);
-    ret = (*pScreen->DestroyWindow) (pWin);
-    XGL_SCREEN_WRAP (DestroyWindow, xglDestroyWindow);
-
-    return ret;
-}
-
-Bool
-xglChangeWindowAttributes (WindowPtr	 pWin,
-			   unsigned long mask)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-    PixmapPtr pPixmap;
-    Bool      ret;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    if (mask & CWBackPixmap)
-    {
-	if (pWin->backgroundState == BackgroundPixmap)
-	{
-	    pPixmap = pWin->background.pixmap;
-
-	    if (FbEvenTile (pPixmap->drawable.width *
-			    pPixmap->drawable.bitsPerPixel))
-		xglSyncBits (&pPixmap->drawable, NULL);
-	}
-    }
-
-    if (mask & CWBorderPixmap)
-    {
-	if (pWin->borderIsPixel == FALSE)
-	{
-	    pPixmap = pWin->border.pixmap;
-
-	    if (FbEvenTile (pPixmap->drawable.width *
-			    pPixmap->drawable.bitsPerPixel))
-		xglSyncBits (&pPixmap->drawable, NULL);
-	}
-    }
-
-    XGL_SCREEN_UNWRAP (ChangeWindowAttributes);
-    ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
-    XGL_SCREEN_WRAP (ChangeWindowAttributes, xglChangeWindowAttributes);
-
-    return ret;
-}
-
-void
-xglCopyWindow (WindowPtr   pWin,
-	       DDXPointRec ptOldOrg,
-	       RegionPtr   prgnSrc)
-{
-    PixmapPtr pPixmap;
-    RegionRec rgnDst;
-    int	      dx, dy;
-    BoxPtr    pExtent = REGION_EXTENTS (pWin->drawable.pScreen, prgnSrc);
-    BoxRec    box;
-
-    pPixmap = XGL_GET_WINDOW_PIXMAP (pWin);
-
-    box.x1 = pExtent->x1;
-    box.y1 = pExtent->y1;
-    box.x2 = pExtent->x2;
-    box.y2 = pExtent->y2;
-
-    dx = ptOldOrg.x - pWin->drawable.x;
-    dy = ptOldOrg.y - pWin->drawable.y;
-
-    REGION_TRANSLATE (pWin->drawable.pScreen, prgnSrc, -dx, -dy);
-    REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0);
-    REGION_INTERSECT (pWin->drawable.pScreen,
-		      &rgnDst, &pWin->borderClip, prgnSrc);
-
-    fbCopyRegion (&pWin->drawable, &pWin->drawable,
-		  0, &rgnDst, dx, dy, xglCopyProc, 0, (void *) &box);
-
-    REGION_UNINIT (pWin->drawable.pScreen, &rgnDst);
-}
-
-PixmapPtr
-xglGetWindowPixmap (WindowPtr pWin)
-{
-    return XGL_GET_WINDOW_PIXMAP (pWin);
-}
-
-void
-xglSetWindowPixmap (WindowPtr pWin,
-		    PixmapPtr pPixmap)
-{
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    XGL_SCREEN_UNWRAP (SetWindowPixmap);
-    (*pScreen->SetWindowPixmap) (pWin, pPixmap);
-    XGL_SCREEN_WRAP (SetWindowPixmap, xglSetWindowPixmap);
-
-    XGL_GET_WINDOW_PRIV (pWin)->pPixmap = pPixmap;
-
-    if (pPixmap != pScreenPriv->pScreenPixmap)
-	xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.window);
-}
diff --git a/hw/xgl/xglxv.c b/hw/xgl/xglxv.c
deleted file mode 100644
index 353f9b3..0000000
--- a/hw/xgl/xglxv.c
+++ /dev/null
@@ -1,634 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: David Reveman <davidr at novell.com>
- *          Matthias Hopf <mhopf at suse.de>
- */
-
-#include "xgl.h"
-
-#ifdef XV
-
-#include "xvdix.h"
-#include "gcstruct.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-
-static DevPrivateKey xglXvScreenKey;
-static unsigned long portResource = 0;
-
-#define XGL_GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
-    dixLookupPrivate(&(pScreen)->devPrivates, xglXvScreenKey))
-
-#define XGL_XV_SCREEN(pScreen)				\
-    XvScreenPtr pXvScreen = XGL_GET_XV_SCREEN (pScreen)
-
-#define XGL_GET_XV_SCREEN_PRIV(pScreen)			      \
-    ((xglXvScreenPtr) (GET_XV_SCREEN (pScreen)->devPriv.ptr))
-
-#define XGL_XV_SCREEN_PRIV(pScreen)				    \
-    xglXvScreenPtr pXvScreenPriv = XGL_GET_XV_SCREEN_PRIV (pScreen)
-
-#define XGL_GET_XV_PORT_PRIV(pPort)	    \
-    ((xglXvPortPtr) ((pPort)->devPriv.ptr))
-
-#define XGL_XV_PORT_PRIV(pPort)				  \
-    xglXvPortPtr pPortPriv = XGL_GET_XV_PORT_PRIV (pPort)
-
-#define XGL_XV_NUM_PORTS 32
-
-#define XGL_XV_IMAGE_MAX_WIDTH  2048
-#define XGL_XV_IMAGE_MAX_HEIGHT 2048
-
-static XvImageRec xvImages[] = {
-    {
-	GLITZ_FOURCC_YUY2, XvYUV, BITMAP_BIT_ORDER,
-	{
-	    'Y','U','Y','2',
-	    0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
-	    0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
-	},
-	16, XvPacked, 1,
-	0, 0, 0, 0,
-	8, 8, 8,  1, 2, 2,  1, 1, 1,
-	{
-	    'Y', 'U', 'Y', 'V',
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	},
-	XvTopToBottom
-    }, {
-	GLITZ_FOURCC_YV12, XvYUV, BITMAP_BIT_ORDER,
-	{
-	    'Y', 'V', '1', '2',
-	    0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
-	    0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
-	},
-	12, XvPlanar, 3,
-	0, 0, 0, 0,
-	8, 8, 8,  1, 2, 2,  1, 2, 2,
-	{
-	    'Y', 'V', 'U', 0,
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	},
-	XvTopToBottom
-    }, {
-	GLITZ_FOURCC_RGB, XvRGB, BITMAP_BIT_ORDER,
-	{
-	    0x03, 0x00, 0x00, 0x00,
-	    0x00, 0x00, 0x00, 0x10, 0x80, 0x00,
-	    0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71
-	},
-	32, XvPacked, 1,
-	24, 0xff0000, 0xff00, 0xff,
-	0, 0, 0,  0, 0, 0,  0, 0, 0,
-	{
-	    0, 0, 0, 0,
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-	},
-	XvTopToBottom
-    }
-};
-
-static struct _xglXvFormat {
-    CARD32	      format;
-    glitz_fourcc_t    fourcc;
-    xglPixelFormatRec pixel;
-} xglXvFormat[XGL_XV_FORMAT_NUM] = {
-    {
-	PICT_yuy2,
-	GLITZ_FOURCC_YUY2,
-	{
-	    16, 6,
-	    {
-		16,
-		0x00000000,
-		0x00000000,
-		0x00000000,
-		0x00000000,
-	    }
-	}
-    }, {
-	PICT_yv12,
-	GLITZ_FOURCC_YV12,
-	{
-	    12, 4,
-	    {
-		12,
-		0x00000000,
-		0x00000000,
-		0x00000000,
-		0x00000000,
-	    }
-	}
-    }, {
-	PICT_x8r8g8b8,
-	GLITZ_FOURCC_RGB,
-	{
-	    24, 8,
-	    {
-		32,
-		0x00000000,
-		0x00ff0000,
-		0x0000ff00,
-		0x000000ff,
-	    }
-	}
-    }
-};
-
-static int
-xglXvQueryAdaptors (ScreenPtr	 pScreen,
-		    XvAdaptorPtr *pAdaptors,
-		    int		 *nAdaptors)
-{
-    XGL_XV_SCREEN (pScreen);
-
-    *nAdaptors = pXvScreen->nAdaptors;
-    *pAdaptors = pXvScreen->pAdaptors;
-
-    return Success;
-}
-
-static int
-xglXvAllocatePort (unsigned long port,
-		   XvPortPtr	 pPort,
-		   XvPortPtr	 *ppPort)
-{
-    *ppPort = pPort;
-
-    return Success;
-}
-
-static int
-xglXvFreePort (XvPortPtr pPort)
-{
-    XGL_XV_PORT_PRIV (pPort);
-
-    if (pPortPriv->pDst)
-    {
-	FreePicture ((pointer) pPortPriv->pDst, 0);
-	pPortPriv->pDst = (PicturePtr) 0;
-    }
-
-    if (pPortPriv->pSrc)
-    {
-	FreePicture ((pointer) pPortPriv->pSrc, 0);
-	pPortPriv->pSrc = (PicturePtr) 0;
-    }
-
-    if (pPortPriv->pPixmap)
-    {
-	ScreenPtr pScreen;
-
-	pScreen = pPortPriv->pPixmap->drawable.pScreen;
-	(*pScreen->DestroyPixmap) (pPortPriv->pPixmap);
-	pPortPriv->pPixmap = (PixmapPtr) 0;
-    }
-
-    return Success;
-}
-
-static int
-xglXvQueryBestSize (ClientPtr	 client,
-		    XvPortPtr	 pPort,
-		    CARD8	 motion,
-		    CARD16	 srcWidth,
-		    CARD16	 srcHeight,
-		    CARD16	 dstWidth,
-		    CARD16	 dstHeight,
-		    unsigned int *pWidth,
-		    unsigned int *pHeight)
-{
-    *pWidth  = dstWidth;
-    *pHeight = dstHeight;
-
-    return Success;
-}
-
-static int
-xglXvStopVideo (ClientPtr   client,
-		XvPortPtr   pPort,
-		DrawablePtr pDrawable)
-{
-    xglXvFreePort (pPort);
-
-    return Success;
-}
-
-static int
-xglXvPutImage (ClientPtr     client,
-	       DrawablePtr   pDrawable,
-	       XvPortPtr     pPort,
-	       GCPtr	     pGC,
-	       INT16	     srcX,
-	       INT16	     srcY,
-	       CARD16	     srcWidth,
-	       CARD16	     srcHeight,
-	       INT16	     dstX,
-	       INT16	     dstY,
-	       CARD16	     dstWidth,
-	       CARD16	     dstHeight,
-	       XvImagePtr    pImage,
-	       unsigned char *data,
-	       Bool	     sync,
-	       CARD16	     width,
-	       CARD16	     height)
-{
-    ScreenPtr	  pScreen = pDrawable->pScreen;
-    PictTransform transform;
-    int		  depth, bpp;
-    CARD32	  format;
-
-    XGL_SCREEN_PRIV (pScreen);
-    XGL_XV_PORT_PRIV (pPort);
-    XGL_DRAWABLE_PIXMAP (pDrawable);
-    XGL_PIXMAP_PRIV (pPixmap);
-
-    switch (pImage->id) {
-    case GLITZ_FOURCC_YUY2:
-	bpp = depth = 16;
-	format = PICT_yuy2;
-	break;
-    case GLITZ_FOURCC_YV12:
-	depth = bpp = 12;
-	format = PICT_yv12;
-	break;
-    case GLITZ_FOURCC_RGB:
-	depth = 24;
-	bpp = 32;
-	format = PICT_x8r8g8b8;
-	break;
-    default:
-	return BadImplementation;
-    }
-
-    pPort->pDraw = pDrawable;
-
-    if (!pPortPriv->pPixmap)
-    {
-	pPortPriv->pPixmap = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, 0);
-	if (!pPortPriv->pPixmap)
-	    return BadAlloc;
-    }
-
-    (*pScreen->ModifyPixmapHeader) (pPortPriv->pPixmap,
-				    srcWidth, srcHeight,
-				    depth, bpp, -1, (pointer) data);
-
-    XGL_GET_PIXMAP_PRIV (pPortPriv->pPixmap)->stride = -srcWidth;
-
-    pPortPriv->pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
-    if (!pPortPriv->pSrc || pPortPriv->pSrc->format != format)
-    {
-	PictFormatPtr pFormat;
-	int	      error;
-	static XID    value = RepeatPad;
-
-	pFormat = PictureMatchFormat (pScreen, depth, format);
-	if (!pFormat)
-	    return BadImplementation;
-
-	if (pPortPriv->pSrc)
-	    FreePicture ((pointer) pPortPriv->pSrc, 0);
-
-	pPortPriv->pSrc = CreatePicture (0, &pPortPriv->pPixmap->drawable,
-					 pFormat, CPRepeat, &value,
-					 serverClient, &error);
-	if (!pPortPriv->pSrc)
-	{
-	    xglXvFreePort (pPort);
-	    return error;
-	}
-
-	SetPictureFilter (pPortPriv->pSrc,
-			  FilterBilinear, strlen (FilterBilinear),
-			  0, 0);
-    }
-
-    if (!pPortPriv->pDst || pPortPriv->pDst->pDrawable != pDrawable)
-    {
-	PictFormatPtr pFormat = 0;
-	int	      i, error;
-
-	for (i = 0; i < pScreen->numVisuals; i++)
-	{
-	    if (pScreen->visuals[i].nplanes == pDrawable->depth)
-	    {
-		pFormat = PictureMatchVisual (pScreen, pDrawable->depth,
-					      &pScreen->visuals[i]);
-		break;
-	    }
-	}
-
-	if (!pFormat)
-	    return BadImplementation;
-
-	if (pPortPriv->pDst)
-	    FreePicture ((pointer) pPortPriv->pDst, 0);
-
-	pPortPriv->pDst = CreatePicture (0, pDrawable,
-					 pFormat, 0, 0, serverClient,
-					 &error);
-	if (!pPortPriv->pDst)
-	{
-	    xglXvFreePort (pPort);
-	    return error;
-	}
-    }
-
-    transform.matrix[0][0] = ((srcWidth << 16) + (dstWidth >> 1))
-			     / dstWidth;
-    transform.matrix[0][1] = 0;
-    transform.matrix[0][2] = 0;
-
-    /* flip Y */
-    transform.matrix[1][0] = 0;
-    transform.matrix[1][1] = -((srcHeight << 16) + (dstHeight >> 1))
-			     / dstHeight;
-    transform.matrix[1][2] = (srcHeight << 16);
-
-    transform.matrix[2][0] = 0;
-    transform.matrix[2][1] = 0;
-    transform.matrix[2][2] = 1 << 16;
-
-    SetPictureTransform (pPortPriv->pSrc, &transform);
-
-    if (pPixmap != pScreenPriv->pScreenPixmap && !pPixmapPriv->target)
-	xglEnablePixmapAccel (pPixmap, &pScreenPriv->accel.xv);
-
-    CompositePicture (PictOpSrc,
-		      pPortPriv->pSrc,
-		      (PicturePtr) 0,
-		      pPortPriv->pDst,
-		      srcX, srcY,
-		      0, 0,
-		      dstX, dstY,
-		      dstWidth, dstHeight);
-
-    return Success;
-}
-
-static int
-xglXvQueryImageAttributes (ClientPtr  client,
-			   XvPortPtr  pPort,
-			   XvImagePtr pImage,
-			   CARD16     *width,
-			   CARD16     *height,
-			   int	      *pitches,
-			   int	      *offsets)
-{
-    if (*width > XGL_XV_IMAGE_MAX_WIDTH)
-	*width = XGL_XV_IMAGE_MAX_WIDTH;
-
-    if (*height > XGL_XV_IMAGE_MAX_HEIGHT)
-	*height = XGL_XV_IMAGE_MAX_HEIGHT;
-
-    *width = (*width + 7) & ~7;
-
-    switch (pImage->id) {
-    case GLITZ_FOURCC_YUY2:
-	if (offsets)
-	    offsets[0] = 0;
-
-	if (pitches)
-	    pitches[0] = *width * 2;
-
-	return *width * *height * 2;
-    case GLITZ_FOURCC_YV12:
-	*height = (*height + 1) & ~1;
-
-	if (offsets)
-	{
-	    offsets[0] = 0;
-	    offsets[1] = *width * *height;
-	    offsets[2] = *width * *height + (*width >> 1) * (*height >> 1);
-	}
-
-	if (pitches)
-	{
-	    pitches[0] = *width;
-	    pitches[1] = pitches[2] = *width >> 1;
-	}
-
-	return *width * *height + (*width >> 1) * *height;
-    case GLITZ_FOURCC_RGB:
-	if (offsets)
-	    offsets[0] = 0;
-
-	if (pitches)
-	    pitches[0] = *width * 4;
-
-	return *width * *height * 4;
-    default:
-	return 0;
-    }
-}
-
-static void
-xglXvFreeAdaptor (XvAdaptorPtr pAdaptor)
-{
-    xfree (pAdaptor->pEncodings);
-    xfree (pAdaptor->pFormats);
-
-    if (pAdaptor->pPorts)
-	xfree (pAdaptor->pPorts);
-}
-
-static Bool
-xglXvInitAdaptors (ScreenPtr pScreen)
-{
-    XvAdaptorPtr  pAdaptor;
-    xglXvPortPtr  pPortPriv;
-    XvPortPtr     pPort;
-    XvFormatPtr   pFormat;
-    XvEncodingPtr pEncoding;
-    int		  i;
-
-    XGL_XV_SCREEN (pScreen);
-
-    pXvScreen->nAdaptors = 0;
-    pXvScreen->pAdaptors = NULL;
-
-    pAdaptor = xcalloc (1, sizeof (XvAdaptorRec));
-    if (!pAdaptor)
-	return FALSE;
-
-    pAdaptor->type    = XvInputMask | XvImageMask;
-    pAdaptor->pScreen = pScreen;
-
-    pAdaptor->ddAllocatePort	     = xglXvAllocatePort;
-    pAdaptor->ddFreePort	     = xglXvFreePort;
-    pAdaptor->ddStopVideo	     = xglXvStopVideo;
-    pAdaptor->ddPutImage	     = xglXvPutImage;
-    pAdaptor->ddQueryBestSize	     = xglXvQueryBestSize;
-    pAdaptor->ddQueryImageAttributes = xglXvQueryImageAttributes;
-
-    pAdaptor->name = "Xgl Generic Texture Video";
-
-    pEncoding = xcalloc (1, sizeof (XvEncodingRec));
-    if (!pEncoding)
-	return FALSE;
-
-    pEncoding->id      = 0;
-    pEncoding->pScreen = pScreen;
-    pEncoding->name    = "XV_IMAGE";
-
-    pEncoding->width  = XGL_XV_IMAGE_MAX_WIDTH;
-    pEncoding->height = XGL_XV_IMAGE_MAX_HEIGHT;
-
-    pEncoding->rate.numerator	= 1;
-    pEncoding->rate.denominator = 1;
-
-    pAdaptor->nEncodings = 1;
-    pAdaptor->pEncodings = pEncoding;
-
-    pAdaptor->nImages = sizeof (xvImages) / sizeof (XvImageRec);
-    pAdaptor->pImages = xvImages;
-
-    /* TODO: Currently no attributes */
-    pAdaptor->nAttributes = 0;
-    pAdaptor->pAttributes = 0;
-
-    pFormat = xcalloc (pScreen->numVisuals, sizeof (XvFormatRec));
-    if (!pFormat)
-	return FALSE;
-
-    for (i = 0; i < pScreen->numVisuals; i++)
-    {
-	pFormat[i].depth  = pScreen->visuals[i].nplanes;
-	pFormat[i].visual = pScreen->visuals[i].vid;
-    }
-
-    /* All visuals allowed */
-    pAdaptor->nFormats = pScreen->numVisuals;
-    pAdaptor->pFormats = pFormat;
-
-    pPort = xcalloc (XGL_XV_NUM_PORTS,
-		     sizeof (XvPortRec) + sizeof (xglXvPortRec));
-    pPortPriv = (xglXvPortPtr) (pPort + XGL_XV_NUM_PORTS);
-    if (!pPort)
-	return FALSE;
-
-    for (i = 0; i < XGL_XV_NUM_PORTS; i++)
-    {
-	pPort[i].id = FakeClientID (0);
-	if (!pPort[i].id)
-	    return FALSE;
-
-	if (!AddResource (pPort[i].id, portResource, &pPort[i]))
-	    return FALSE;
-
-	pPort[i].pAdaptor    = pAdaptor;
-	pPort[i].pNotify     = (XvPortNotifyPtr) 0;
-	pPort[i].pDraw	     = (DrawablePtr) 0;
-	pPort[i].client      = (ClientPtr) 0;
-	pPort[i].grab.client = (ClientPtr) 0;
-	pPort[i].time	     = currentTime;
-	pPort[i].devPriv.ptr = pPortPriv + i;
-    }
-
-    pAdaptor->nPorts  = XGL_XV_NUM_PORTS;
-    pAdaptor->pPorts  = pPort;
-    pAdaptor->base_id = pPort->id;
-
-    pXvScreen->pAdaptors = pAdaptor;
-    pXvScreen->nAdaptors = 1;
-
-    return TRUE;
-}
-
-static Bool
-xglXvCloseScreen (int i, ScreenPtr pScreen)
-{
-    int	j;
-
-    XGL_XV_SCREEN (pScreen);
-
-    for (j = 0; j < pXvScreen->nAdaptors; j++)
-	xglXvFreeAdaptor (&pXvScreen->pAdaptors[j]);
-
-    if (pXvScreen->pAdaptors)
-	xfree (pXvScreen->pAdaptors);
-
-    return TRUE;
-}
-
-Bool
-xglXvScreenInit (ScreenPtr pScreen)
-{
-    XvScreenPtr  pXvScreen;
-    xglVisualPtr v;
-    int		 i, status, vid = 0;
-
-    XGL_SCREEN_PRIV (pScreen);
-
-    status = XvScreenInit (pScreen);
-    if (status != Success)
-	return FALSE;
-
-    xglXvScreenKey = XvGetScreenKey ();
-    portResource = XvGetRTPort ();
-
-    pXvScreen = XGL_GET_XV_SCREEN (pScreen);
-
-    /* Anyone initializing the Xv layer must provide these two.
-       The Xv di layer calls them without even checking if they exist! */
-    pXvScreen->ddCloseScreen   = xglXvCloseScreen;
-    pXvScreen->ddQueryAdaptors = xglXvQueryAdaptors;
-
-    pXvScreen->devPriv.ptr = (pointer) 0;
-
-    if (!xglXvInitAdaptors (pScreen))
-	return FALSE;
-
-    for (v = pScreenPriv->pVisual; v; v = v->next)
-    {
-	if (v->vid > vid)
-	    vid = v->vid;
-    }
-
-    memset (pScreenPriv->pXvVisual, 0, sizeof (pScreenPriv->pXvVisual));
-
-    for (i = 0; i < XGL_XV_FORMAT_NUM; i++)
-    {
-	glitz_format_t templ;
-
-	templ.color.fourcc = xglXvFormat[i].fourcc;
-
-	pScreenPriv->pXvVisual[i].vid = ++vid;
-	pScreenPriv->pXvVisual[i].pPixel = &xglXvFormat[i].pixel;
-	pScreenPriv->pXvVisual[i].format.surface =
-	    glitz_find_format (pScreenPriv->drawable,
-			       GLITZ_FORMAT_FOURCC_MASK,
-			       &templ, 0);
-    }
-
-    return TRUE;
-}
-
-#endif
diff --git a/include/xgl-config.h.in b/include/xgl-config.h.in
deleted file mode 100644
index 877d179..0000000
--- a/include/xgl-config.h.in
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * xgl-config.h.in
- *
- * This file has defines used in the xgl ddx
- *
- */
-
-#include <dix-config.h>
-
-/* Use loadable XGL modules. */
-#undef XGL_MODULAR
-
-/* Default XGL module search path */
-#undef XGL_MODULE_PATH
commit c37a93b4850866c713e3cbf39a08bbc9645e24d4
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jun 12 14:54:56 2008 +1000

    modes: make aspect choosing work on single output case.
    
    In the single output enabled case we never enter the loop and test
    never gets set and so we fail to match a good mode.
    
    This was causing my 2560x1600 to end up at 2048x1536.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7edd23c..fd72053 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1864,6 +1864,7 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
 
     nextEnabledOutput(config, enabled, &o);
     while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+	test = mode;
 	for (p = o; nextEnabledOutput(config, enabled, &p); ) {
 	    test = xf86OutputFindClosestMode(config->output[p], mode);
 	    if (!test)
commit 23e71ef71a178505494d4b410f9314acfff81524
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Jun 12 09:04:24 2008 +1000

    dbe: fix DoS reported by iDefense.
    
    This isn't a security problem just a user could DoS themselves for fun or profit.

diff --git a/dbe/dbe.c b/dbe/dbe.c
index 8175a35..d34708d 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -229,6 +229,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
     xDbeSwapAction		swapAction;
     VisualID			visual;
     int				status;
+    int				add_index;
 
 
     REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
@@ -299,14 +300,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
             return(BadAlloc);
 	bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
 
-        /* Make the window priv a DBE window priv resource. */
-        if (!AddResource(stuff->buffer, dbeWindowPrivResType,
-            (pointer)pDbeWindowPriv))
-        {
-            xfree(pDbeWindowPriv);
-            return(BadAlloc);
-        }
-
         /* Fill out window priv information. */
         pDbeWindowPriv->pWindow      = pWin;
         pDbeWindowPriv->width        = pWin->drawable.width;
@@ -321,14 +314,15 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
         /* Initialize the buffer ID list. */ 
         pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
         pDbeWindowPriv->IDs[0] = stuff->buffer;
-        for (i = 1; i < DBE_INIT_MAX_IDS; i++)
+
+        add_index = 0;
+        for (i = 0; i < DBE_INIT_MAX_IDS; i++)
         {
             pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
         }
 
-
         /* Actually connect the window priv to the window. */
-	dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
+        dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
 
     } /* if -- There is no buffer associated with the window. */
 
@@ -354,7 +348,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
             /* No more room in the ID array -- reallocate another array. */
             XID	*pIDs;
 
-
             /* Setup an array pointer for the realloc operation below. */
             if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
             {
@@ -391,16 +384,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
             pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS;
         }
 
-        /* Finally, record the buffer ID in the array. */
-        pDbeWindowPriv->IDs[i] = stuff->buffer;
-
-        /* Associate the new ID with an existing window priv. */
-        if (!AddResource(stuff->buffer, dbeWindowPrivResType,
-                         (pointer)pDbeWindowPriv))
-        {
-            pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
-            return(BadAlloc);
-        }
+	add_index = i;
 
     } /* else -- A buffer is already associated with the window. */
 
@@ -409,13 +393,26 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
     status = (*pDbeScreenPriv->AllocBackBufferName)(pWin, stuff->buffer,
                                                     stuff->swapAction);
 
-    if ((status != Success) && (pDbeWindowPriv->nBufferIDs == 0))
+    if (status == Success)
     {
+	pDbeWindowPriv->IDs[add_index] = stuff->buffer;
+        if (!AddResource(stuff->buffer, dbeWindowPrivResType,
+                         (pointer)pDbeWindowPriv))
+	{
+            pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
+
+            if (pDbeWindowPriv->nBufferIDs == 0) {
+                status = BadAlloc;
+                goto out_free;
+            }
+        }
+    } else {
         /* The DDX buffer allocation routine failed for the first buffer of
          * this window.
          */
-        xfree(pDbeWindowPriv);
-        return(status);
+        if (pDbeWindowPriv->nBufferIDs == 0) {
+            goto out_free;
+        }
     }
 
     /* Increment the number of buffers (XIDs) associated with this window. */
@@ -424,9 +421,13 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
     /* Set swap action on all calls. */
     pDbeWindowPriv->swapAction = stuff->swapAction;
 
-
     return(status);
 
+out_free:
+    dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
+    xfree(pDbeWindowPriv);
+    return (status);
+
 } /* ProcDbeAllocateBackBufferName() */
 
 
commit 390b155135a451fa728b73c8107aea91dfd56ed1
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Wed Jun 11 18:21:33 2008 -0300

    Welcome to hotplug era.
    
    `rm -rf xorg.conf` does not imply an error message. Maybe a warning.
    
    checkInput() is defined but not used.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 601b9bb..eb084a5 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2454,12 +2454,6 @@ addDefaultModes(MonPtr monitorp)
     return TRUE;
 }
 
-static void
-checkInput(serverLayoutPtr layout) {
-    if (!xf86Info.allowEmptyInput)
-        checkCoreInputDevices(layout, FALSE);
-}
-
 /*
  * load the config file and fill the global data structure
  */
@@ -2486,7 +2480,7 @@ xf86HandleConfigFile(Bool autoconfig)
 	    xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
 	    xf86ConfigFile = xnfstrdup(filename);
 	} else {
-	    xf86Msg(X_ERROR, "Unable to locate/open config file");
+	    xf86Msg(X_WARNING, "Unable to locate/open config file");
 	    if (xf86ConfigFile)
 		xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
 	    xf86ErrorFVerb(0, "\n");
commit 6e018f6a30dab1259b8fdc1ae4c84056b2acf362
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Wed Jun 11 18:10:55 2008 -0300

    No need for inputPending field in xf86Info.

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index f408fc9..a7f9578 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -236,8 +236,6 @@ ProcessInputEvents ()
     }
 #endif
 
-  xf86Info.inputPending = FALSE;
-
   mieqProcessInputEvents();
 
   /* FIXME: This is a problem if we have multiple pointers */
@@ -499,8 +497,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
     }
 
     if (xf86VTSwitchPending()) xf86VTSwitch();
-
-    if (xf86Info.inputPending) ProcessInputEvents();
 }
 
 
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 14bef39..19ed4e7 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -103,7 +103,6 @@ xf86InfoRec xf86Info = {
 	NULL,		/* mouseLocal */
 	-1,		/* lastEventTime */
 	FALSE,		/* vtRequestsPending */
-	FALSE,		/* inputPending */
 	FALSE,		/* dontVTSwitch */
 	FALSE,		/* dontZap */
 	FALSE,		/* dontZoom */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a2607e3..46c4a96 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1117,7 +1117,6 @@ InitInput(argc, argv)
     InputInfoPtr pInfo;
 
     xf86Info.vtRequestsPending = FALSE;
-    xf86Info.inputPending = FALSE;
 
     /* Call the PreInit function for each input device instance. */
     for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 318a59f..0601c0d 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -85,7 +85,6 @@ typedef struct {
     /* event handler part */
     int			lastEventTime;
     Bool		vtRequestsPending;
-    Bool		inputPending;
     Bool		dontVTSwitch;
     Bool		dontZap;
     Bool		dontZoom;
commit 881e551de92e5664f92ef1961092e35cd7a77b15
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Wed Jun 11 18:03:33 2008 -0300

    CopyGetMasterEvent() can be static.

diff --git a/include/input.h b/include/input.h
index a816385..59f4e7f 100644
--- a/include/input.h
+++ b/include/input.h
@@ -506,11 +506,6 @@ extern Bool RegisterPairingClient(ClientPtr client);
 extern DeviceIntPtr GuessFreePointerDevice(void);
 extern DeviceIntPtr NextFreePointerDevice(void);
 
-extern void CopyGetMasterEvent(DeviceIntPtr mdev,
-			       xEvent* original,
-			       xEvent** master,
-			       int count);
-
 extern int AllocMasterDevice(ClientPtr client,
                              char* name,
                              DeviceIntPtr* ptr,
diff --git a/mi/mieq.c b/mi/mieq.c
index 91b7a51..e7e16ab 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -268,7 +268,7 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
  * @param master The event after being copied
  * @param count Number of events in original.
  */
-void
+static void
 CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
                    xEvent** master, int count)
 {
commit 656949cbe24648a5b58f7df6ed49b25af0b47601
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Wed Jun 11 17:57:19 2008 -0300

    Remove more unused things.
    
        In function ‘miSpriteCloseScreen’:
        warning: unused variable ‘pDev’

diff --git a/mi/misprite.c b/mi/misprite.c
index b8df5eb..c1f64ce 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -268,7 +268,6 @@ static Bool
 miSpriteCloseScreen (int i, ScreenPtr pScreen)
 {
     miSpriteScreenPtr   pScreenPriv;
-    DeviceIntPtr        pDev;
 
     pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						      miSpriteScreenKey);
commit 84db8837d0faaac008be61df9f1261cd3028e923
Author: Tiago Vignatti <vignatti at c3sl.ufpr.br>
Date:   Wed Jun 11 17:47:00 2008 -0300

    Remove unused xf86DeviceCursorUndisplay() function.

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 7695962..ec9a358 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -28,7 +28,6 @@ static void xf86CursorSetCursor(DeviceIntPtr, ScreenPtr, CursorPtr, int, int);
 static void xf86CursorMoveCursor(DeviceIntPtr, ScreenPtr, int, int);
 static Bool xf86DeviceCursorInitialize(DeviceIntPtr, ScreenPtr);
 static void xf86DeviceCursorCleanup(DeviceIntPtr, ScreenPtr);
-static void xf86DeviceCursorUndisplay(DeviceIntPtr, ScreenPtr);
 
 static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
    xf86CursorRealizeCursor,
commit dba5455f06c439c7e7d399f30dc7067e98e6e50b
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Wed Jun 11 11:41:34 2008 -0400

    Un-K&R shm extension.

diff --git a/Xext/shm.c b/Xext/shm.c
index 3f51b9c..00e296d 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -188,13 +188,12 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
 static Bool badSysCall = FALSE;
 
 static void
-SigSysHandler(signo)
-int signo;
+SigSysHandler(int signo)
 {
     badSysCall = TRUE;
 }
 
-static Bool CheckForShmSyscall()
+static Bool CheckForShmSyscall(void)
 {
     void (*oldHandler)();
     int shmid = -1;
@@ -278,8 +277,7 @@ ShmExtensionInit(INITARGS)
 
 /*ARGSUSED*/
 static void
-ShmResetProc (extEntry)
-ExtensionEntry	*extEntry;
+ShmResetProc(ExtensionEntry *extEntry)
 {
     int i;
 
@@ -291,17 +289,13 @@ ExtensionEntry	*extEntry;
 }
 
 void
-ShmRegisterFuncs(
-    ScreenPtr pScreen,
-    ShmFuncsPtr funcs)
+ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
 {
     shmFuncs[pScreen->myNum] = funcs;
 }
 
 void
-ShmSetPixmapFormat(
-    ScreenPtr pScreen,
-    int format)
+ShmSetPixmapFormat(ScreenPtr pScreen, int format)
 {
     shmPixFormat[pScreen->myNum] = format;
 }
@@ -328,15 +322,13 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
 }
 
 void
-ShmRegisterFbFuncs(pScreen)
-    ScreenPtr pScreen;
+ShmRegisterFbFuncs(ScreenPtr pScreen)
 {
     shmFuncs[pScreen->myNum] = &fbFuncs;
 }
 
 static int
-ProcShmQueryVersion(client)
-    ClientPtr client;
+ProcShmQueryVersion(ClientPtr client)
 {
     xShmQueryVersionReply rep;
     int n;
@@ -430,8 +422,7 @@ shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
 }
 
 static int
-ProcShmAttach(client)
-    ClientPtr client;
+ProcShmAttach(ClientPtr client)
 {
     SHMSTAT_TYPE buf;
     ShmDescPtr shmdesc;
@@ -492,9 +483,8 @@ ProcShmAttach(client)
 
 /*ARGSUSED*/
 static int
-ShmDetachSegment(value, shmseg)
-    pointer value; /* must conform to DeleteType */
-    XID shmseg;
+ShmDetachSegment(pointer value, /* must conform to DeleteType */
+		 XID shmseg)
 {
     ShmDescPtr shmdesc = (ShmDescPtr)value;
     ShmDescPtr *prev;
@@ -510,8 +500,7 @@ ShmDetachSegment(value, shmseg)
 }
 
 static int
-ProcShmDetach(client)
-    ClientPtr client;
+ProcShmDetach(ClientPtr client)
 {
     ShmDescPtr shmdesc;
     REQUEST(xShmDetachReq);
@@ -523,12 +512,10 @@ ProcShmDetach(client)
 }
 
 static void
-miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
-    DrawablePtr dst;
-    GCPtr	pGC;
-    int		depth, w, h, sx, sy, sw, sh, dx, dy;
-    unsigned int format;
-    char 	*data;
+miShmPutImage(DrawablePtr dst, GCPtr pGC,
+	      int depth, unsigned int format,
+	      int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
+	      char *data)
 {
     PixmapPtr pmap;
     GCPtr putGC;
@@ -557,12 +544,10 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
 }
 
 _X_EXPORT void
-fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
-    DrawablePtr dst;
-    GCPtr	pGC;
-    int		depth, w, h, sx, sy, sw, sh, dx, dy;
-    unsigned int format;
-    char 	*data;
+fbShmPutImage(DrawablePtr dst, GCPtr pGC,
+	      int depth, unsigned int format,
+	      int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
+	      char *data)
 {
     if ((format == ZPixmap) || (depth == 1))
     {
@@ -747,8 +732,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
 }
 
 static int
-ProcPanoramiXShmCreatePixmap(
-    ClientPtr client)
+ProcPanoramiXShmCreatePixmap(ClientPtr client)
 {
     ScreenPtr pScreen = NULL;
     PixmapPtr pMap = NULL;
@@ -855,8 +839,7 @@ CreatePmap:
 #endif
 
 static int
-ProcShmPutImage(client)
-    ClientPtr client;
+ProcShmPutImage(ClientPtr client)
 {
     GCPtr pGC;
     DrawablePtr pDraw;
@@ -968,8 +951,7 @@ ProcShmPutImage(client)
 
 
 static int
-ProcShmGetImage(client)
-    ClientPtr client;
+ProcShmGetImage(ClientPtr client)
 {
     DrawablePtr		pDraw;
     long		lenPer = 0, length;
@@ -1081,12 +1063,8 @@ ProcShmGetImage(client)
 }
 
 static PixmapPtr
-fbShmCreatePixmap (pScreen, width, height, depth, addr)
-    ScreenPtr	pScreen;
-    int		width;
-    int		height;
-    int		depth;
-    char	*addr;
+fbShmCreatePixmap (ScreenPtr pScreen,
+		   int width, int height, int depth, char *addr)
 {
     PixmapPtr pPixmap;
 
@@ -1103,8 +1081,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
 }
 
 static int
-ProcShmCreatePixmap(client)
-    ClientPtr client;
+ProcShmCreatePixmap(ClientPtr client)
 {
     PixmapPtr pMap;
     DrawablePtr pDraw;
@@ -1185,8 +1162,7 @@ CreatePmap:
 }
 
 static int
-ProcShmDispatch (client)
-    ClientPtr	client;
+ProcShmDispatch (ClientPtr client)
 {
     REQUEST(xReq);
     switch (stuff->data)
@@ -1221,8 +1197,7 @@ ProcShmDispatch (client)
 }
 
 static void
-SShmCompletionEvent(from, to)
-    xShmCompletionEvent *from, *to;
+SShmCompletionEvent(xShmCompletionEvent *from, xShmCompletionEvent *to)
 {
     to->type = from->type;
     cpswaps(from->sequenceNumber, to->sequenceNumber);
@@ -1234,8 +1209,7 @@ SShmCompletionEvent(from, to)
 }
 
 static int
-SProcShmQueryVersion(client)
-    ClientPtr	client;
+SProcShmQueryVersion(ClientPtr client)
 {
     int n;
     REQUEST(xShmQueryVersionReq);
@@ -1245,8 +1219,7 @@ SProcShmQueryVersion(client)
 }
 
 static int
-SProcShmAttach(client)
-    ClientPtr client;
+SProcShmAttach(ClientPtr client)
 {
     int n;
     REQUEST(xShmAttachReq);
@@ -1258,8 +1231,7 @@ SProcShmAttach(client)
 }
 
 static int
-SProcShmDetach(client)
-    ClientPtr client;
+SProcShmDetach(ClientPtr client)
 {
     int n;
     REQUEST(xShmDetachReq);
@@ -1270,8 +1242,7 @@ SProcShmDetach(client)
 }
 
 static int
-SProcShmPutImage(client)
-    ClientPtr client;
+SProcShmPutImage(ClientPtr client)
 {
     int n;
     REQUEST(xShmPutImageReq);
@@ -1293,8 +1264,7 @@ SProcShmPutImage(client)
 }
 
 static int
-SProcShmGetImage(client)
-    ClientPtr client;
+SProcShmGetImage(ClientPtr client)
 {
     int n;
     REQUEST(xShmGetImageReq);
@@ -1312,8 +1282,7 @@ SProcShmGetImage(client)
 }
 
 static int
-SProcShmCreatePixmap(client)
-    ClientPtr client;
+SProcShmCreatePixmap(ClientPtr client)
 {
     int n;
     REQUEST(xShmCreatePixmapReq);
@@ -1329,8 +1298,7 @@ SProcShmCreatePixmap(client)
 }
 
 static int
-SProcShmDispatch (client)
-    ClientPtr	client;
+SProcShmDispatch (ClientPtr client)
 {
     REQUEST(xReq);
     switch (stuff->data)
commit 9171206db349a0c6fda719746be0b15049d57aaa
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Tue Jun 10 12:23:03 2008 -0600

    CVE-2008-2362 - RENDER Extension memory corruption
    
    Integer overflows can occur in the code validating the parameters for
    the SProcRenderCreateLinearGradient, SProcRenderCreateRadialGradient
    and SProcRenderCreateConicalGradient functions, leading to memory
    corruption by swapping bytes outside of the intended request
    parameters.

diff --git a/render/render.c b/render/render.c
index 7787e18..638aa46 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1996,6 +1996,8 @@ static int ProcRenderCreateLinearGradient (ClientPtr client)
     LEGAL_NEW_RESOURCE(stuff->pid, client);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
+    if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
+	return BadLength;
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
         return BadLength;
 
@@ -2584,18 +2586,18 @@ SProcRenderCreateSolidFill(ClientPtr client)
     return (*ProcRenderVector[stuff->renderReqType]) (client);
 }
 
-static void swapStops(void *stuff, int n)
+static void swapStops(void *stuff, int num)
 {
-    int i;
+    int i, n;
     CARD32 *stops;
     CARD16 *colors;
     stops = (CARD32 *)(stuff);
-    for (i = 0; i < n; ++i) {
+    for (i = 0; i < num; ++i) {
         swapl(stops, n);
         ++stops;
     }
     colors = (CARD16 *)(stops);
-    for (i = 0; i < 4*n; ++i) {
+    for (i = 0; i < 4*num; ++i) {
         swaps(stops, n);
         ++stops;
     }
@@ -2618,6 +2620,8 @@ SProcRenderCreateLinearGradient (ClientPtr client)
     swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateLinearGradientReq);
+    if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
+	return BadLength;
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
         return BadLength;
 
@@ -2645,6 +2649,8 @@ SProcRenderCreateRadialGradient (ClientPtr client)
     swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateRadialGradientReq);
+    if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
+	return BadLength;
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
         return BadLength;
 
@@ -2669,6 +2675,8 @@ SProcRenderCreateConicalGradient (ClientPtr client)
     swapl(&stuff->nStops, n);
 
     len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
+    if (stuff->nStops > UINT32_MAX/(sizeof(xFixed) + sizeof(xRenderColor)))
+	return BadLength;
     if (len != stuff->nStops*(sizeof(xFixed) + sizeof(xRenderColor)))
         return BadLength;
 
commit 5257a0f83d5f3d80d0cd44dd76d047bac3869592
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Tue Jun 10 12:22:30 2008 -0600

    CVE-2008-2361 - RENDER Extension crash
    
    An integer overflow may occur in the computation of the size of the
    glyph to be allocated by the ProcRenderCreateCursor() function which
    will cause less memory to be allocated than expected, leading later to
    dereferencing un-mapped memory, causing a crash of the X server.

diff --git a/render/render.c b/render/render.c
index 16b8eb3..7787e18 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1569,6 +1569,8 @@ ProcRenderCreateCursor (ClientPtr client)
     pScreen = pSrc->pDrawable->pScreen;
     width = pSrc->pDrawable->width;
     height = pSrc->pDrawable->height;
+    if (height && width > UINT32_MAX/(height*sizeof(CARD32)))
+	return BadAlloc;
     if ( stuff->x > width 
       || stuff->y > height )
 	return (BadMatch);
commit c5f69b297b1227cb802394fa90efdbe1de607f3c
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Tue Jun 10 12:21:26 2008 -0600

    CVE-2008-2360 - RENDER Extension heap buffer overflow
    
    An integer overflow may occur in the computation of the size of the
    glyph to be allocated by the AllocateGlyph() function which will cause
    less memory to be allocated than expected, leading to later heap
    overflow.

diff --git a/render/render.c b/render/render.c
index f03f54a..16b8eb3 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1117,9 +1117,16 @@ ProcRenderAddGlyphs (ClientPtr client)
     remain -= (sizeof (CARD32) + sizeof (xGlyphInfo)) * nglyphs;
     for (i = 0; i < nglyphs; i++)
     {
+	size_t padded_width;
 	glyph_new = &glyphs[i];
-	size = gi[i].height * PixmapBytePad (gi[i].width,
-					     glyphSet->format->depth);
+
+	padded_width = PixmapBytePad (gi[i].width,
+				      glyphSet->format->depth);
+
+	if (gi[i].height && padded_width > (UINT32_MAX - sizeof(GlyphRec))/gi[i].height)
+	    break;
+	
+	size = gi[i].height * padded_width;
 	if (remain < size)
 	    break;
 
commit 063f18ef6d7bf834225ddfd3527e58c078628f5f
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Tue Jun 10 12:20:43 2008 -0600

    CVE-2008-1379 - MIT-SHM arbitrary memory read
    
    An integer overflow in the validation of the parameters of the
    ShmPutImage() request makes it possible to trigger the copy of
    arbitrary server memory to a pixmap that can subsequently be read by
    the client, to read arbitrary parts of the X server memory space.

diff --git a/Xext/shm.c b/Xext/shm.c
index 80780bb..3f51b9c 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -894,8 +894,17 @@ ProcShmPutImage(client)
         return BadValue;
     }
 
-    VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
-		   client);
+    /* 
+     * There's a potential integer overflow in this check:
+     * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
+     *                client);
+     * the version below ought to avoid it
+     */
+    if (stuff->totalHeight != 0 && 
+	length > (shmdesc->size - stuff->offset)/stuff->totalHeight) {
+	client->errorValue = stuff->totalWidth;
+	return BadValue;
+    }
     if (stuff->srcX > stuff->totalWidth)
     {
 	client->errorValue = stuff->srcX;
commit 95d162c4389857d960da9b0158345c1714e91f31
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Tue Jun 10 12:20:00 2008 -0600

    CVE-2008-1377 - RECORD and Security extensions memory corruption
    
    Lack of validation of the parameters of the
    SProcSecurityGenerateAuthorization SProcRecordCreateContext
    functions makes it possible for a specially crafted request to trigger
    the swapping of bytes outside the parameter of these requests, causing
    memory corruption.

diff --git a/Xext/security.c b/Xext/security.c
index f28b10d..bd92600 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -676,15 +676,19 @@ SProcSecurityGenerateAuthorization(
     char	n;
     CARD32 *values;
     unsigned long nvalues;
+    int values_offset;
 
     swaps(&stuff->length, n);
     REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
     swaps(&stuff->nbytesAuthProto, n);
     swaps(&stuff->nbytesAuthData, n);
     swapl(&stuff->valueMask, n);
-    values = (CARD32 *)(&stuff[1]) +
-	((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
-	((stuff->nbytesAuthData + (unsigned)3) >> 2);
+    values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
+		    ((stuff->nbytesAuthData + (unsigned)3) >> 2);
+    if (values_offset > 
+	stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
+	return BadLength;
+    values = (CARD32 *)(&stuff[1]) + values_offset;
     nvalues = (((CARD32 *)stuff) + stuff->length) - values;
     SwapLongs(values, nvalues);
     return ProcSecurityGenerateAuthorization(client);
diff --git a/record/record.c b/record/record.c
index ec06ca9..d7314b1 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2658,7 +2658,7 @@ SProcRecordQueryVersion(ClientPtr client)
 } /* SProcRecordQueryVersion */
 
 
-static void
+static int
 SwapCreateRegister(xRecordRegisterClientsReq *stuff)
 {
     register char n;
@@ -2669,11 +2669,17 @@ SwapCreateRegister(xRecordRegisterClientsReq *stuff)
     swapl(&stuff->nClients, n);
     swapl(&stuff->nRanges, n);
     pClientID = (XID *)&stuff[1];
+    if (stuff->nClients > stuff->length - (sz_xRecordRegisterClientsReq >> 2))
+	return BadLength;
     for (i = 0; i < stuff->nClients; i++, pClientID++)
     {
 	swapl(pClientID, n);
     }
+    if (stuff->nRanges > stuff->length - (sz_xRecordRegisterClientsReq >> 2)
+	- stuff->nClients)
+	return BadLength;
     RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges);
+    return Success;
 } /* SwapCreateRegister */
 
 
@@ -2681,11 +2687,13 @@ static int
 SProcRecordCreateContext(ClientPtr client)
 {
     REQUEST(xRecordCreateContextReq);
+    int			status;
     register char 	n;
 
     swaps(&stuff->length, n);
     REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
-    SwapCreateRegister((pointer)stuff);
+    if ((status = SwapCreateRegister((pointer)stuff)) != Success)
+	return status;
     return ProcRecordCreateContext(client);
 } /* SProcRecordCreateContext */
 
@@ -2694,11 +2702,13 @@ static int
 SProcRecordRegisterClients(ClientPtr client)
 {
     REQUEST(xRecordRegisterClientsReq);
+    int			status;
     register char 	n;
 
     swaps(&stuff->length, n);
     REQUEST_AT_LEAST_SIZE(xRecordRegisterClientsReq);
-    SwapCreateRegister((pointer)stuff);
+    if ((status = SwapCreateRegister((pointer)stuff)) != Success)
+	return status;
     return ProcRecordRegisterClients(client);
 } /* SProcRecordRegisterClients */
 
commit 656d5d98855eb608ec6581f8c574f343a216ea32
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 11 17:32:59 2008 +0930

    kdrive: fix wrong use of &, should be | instead.
    
    Fallout from 26e7e69ab893d1f2b35213250ada40ec90944f62

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 3f81b65..8308752 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2107,7 +2107,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
     if (flags & KD_MOUSE_DELTA)
     {
         if (x || y || z)
-            dixflags = POINTER_RELATIVE & POINTER_ACCELERATE;
+            dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
     } else if (x != pi->dixdev->last.valuators[0] ||
                 y != pi->dixdev->last.valuators[1])
             dixflags = POINTER_ABSOLUTE;
commit 6528eb885dea0326aacdd026d44d82ab07f4a4fd
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 11 15:01:36 2008 +0930

    Xext: init firstValuator to zero, otherwise core XTest events may get lost.

diff --git a/Xext/xtest.c b/Xext/xtest.c
index ad70aa8..8e96f65 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -167,7 +167,7 @@ ProcXTestFakeInput(client)
     deviceValuator *dv = NULL;
     int valuators[MAX_VALUATORS] = {0};
     int numValuators = 0;
-    int firstValuator;
+    int firstValuator = 0;
     EventListPtr events;
     int nevents;
     int i;
commit 6ab311c92d036dc63ee92ab4bb231f5f61ebe69f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Jun 9 11:45:57 2008 +0930

    dix: Call RealizeCursor during InitializeSprite.
    
    RealizeCursor should be called when the cursor is allocated. However, when the
    root cursor is allocated, no devices exist yet, and thus RealizeCursor is
    never called. This may lead to segfaults lateron in DDXes like Xnest that
    actually need to do something for each cursor, and lateron rely on that
    DDX-specific data for each cursor has been initialized.

diff --git a/dix/events.c b/dix/events.c
index 79d9373..8191973 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2950,6 +2950,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
 
     if (pScreen)
     {
+        (*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current);
         (*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
                                    &pSprite->hotLimits, &pSprite->physLimits);
         pSprite->confined = FALSE;
commit e083b5a07507d53de0d1d365ef1565346284c997
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Jun 9 11:23:53 2008 +0930

    xnest: wrap the xnest cursor sprite funcs around the mi funcs.
    
    Modelled after the xfree86 code. Call miDCInitialize to init the SW rendering
    engine, then take the pointers, store it in a xnest-local variable, and put
    the xnest-specific sprite funcs in place. In the xnest sprite funcs, call
    through to the mi sprite funcs after doing xnest-specific stuff.

diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 3e676d1..12f47e7 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -25,6 +25,7 @@ is" without express or implied warranty.
 #include "cursorstr.h"
 #include "scrnintstr.h"
 #include "servermd.h"
+#include "mipointrst.h"
 
 #include "Xnest.h"
 
@@ -35,6 +36,8 @@ is" without express or implied warranty.
 #include "Keyboard.h"
 #include "Args.h"
 
+xnestCursorFuncRec xnestCursorFuncs = {NULL};
+
 Bool
 xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
 {
@@ -155,3 +158,26 @@ void
 xnestMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 {
 }
+
+Bool
+xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+    xnestCursorFuncPtr pScreenPriv;
+
+    pScreenPriv = (xnestCursorFuncPtr)
+            dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
+
+    pScreenPriv->spriteFuncs->DeviceCursorInitialize(pDev, pScreen);
+    return TRUE;
+}
+
+void
+xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+    xnestCursorFuncPtr pScreenPriv;
+
+    pScreenPriv = (xnestCursorFuncPtr)
+            dixLookupPrivate(&pScreen->devPrivates, xnestCursorScreenKey);
+
+    pScreenPriv->spriteFuncs->DeviceCursorCleanup(pDev, pScreen);
+}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 9d157a3..1c129e7 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -41,9 +41,11 @@ is" without express or implied warranty.
 #include "Init.h"
 #include "mipointer.h"
 #include "Args.h"
+#include "mipointrst.h"
 
 Window xnestDefaultWindows[MAXSCREENS];
 Window xnestScreenSaverWindows[MAXSCREENS];
+DevPrivateKey xnestCursorScreenKey = &xnestCursorScreenKey;
 
 ScreenPtr
 xnestScreen(Window window)
@@ -124,8 +126,8 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
     xnestUnrealizeCursor,
     xnestSetCursor,
     xnestMoveCursor,
-    NULL,
-    NULL
+    xnestDeviceCursorInitialize,
+    xnestDeviceCursorCleanup
 };
 
 Bool
@@ -141,6 +143,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
   XSizeHints sizeHints;
   VisualID defaultVisual;
   int rootDepth;
+  miPointerScreenPtr PointPriv;
 
   if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
       return False;
@@ -307,7 +310,11 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
   pScreen->blockData = NULL;
   pScreen->wakeupData = NULL;
 
-  miDCInitialize (pScreen, &xnestPointerCursorFuncs);
+  miDCInitialize(pScreen, &xnestPointerCursorFuncs); /* init SW rendering */
+  PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+  xnestCursorFuncs.spriteFuncs = PointPriv->spriteFuncs;
+  dixSetPrivate(&pScreen->devPrivates, xnestCursorScreenKey, &xnestCursorFuncs);
+  PointPriv->spriteFuncs = &xnestPointerSpriteFuncs;
 
   pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, 
 		       DefaultScreen(xnestDisplay)) / 
diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index 627be03..d993555 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -15,6 +15,15 @@ is" without express or implied warranty.
 #ifndef XNESTCURSOR_H
 #define XNESTCURSOR_H
 
+#include "mipointrst.h"
+
+typedef struct {
+    miPointerSpriteFuncPtr spriteFuncs;
+} xnestCursorFuncRec, *xnestCursorFuncPtr;
+
+extern DevPrivateKey xnestCursorScreenKey;
+extern xnestCursorFuncRec xnestCursorFuncs;
+
 typedef struct {
   Cursor cursor;
 } xnestPrivCursor;
@@ -44,5 +53,6 @@ void xnestSetCursor (DeviceIntPtr pDev,
 void xnestMoveCursor (DeviceIntPtr pDev,
                       ScreenPtr pScreen,
                       int x, int y);
-
+Bool xnestDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+void xnestDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
 #endif /* XNESTCURSOR_H */
commit ea6a02c048e8589e99ee3b459f3612eb3d041558
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Jun 9 11:22:33 2008 +0930

    mi: protect mipointrst.h against multiple includes.

diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index a80c52e..bd9c24a 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -29,6 +29,9 @@ used in advertising or otherwise to promote the sale, use or other dealings
 in this Software without prior written authorization from The Open Group.
 */
 
+#ifndef MIPOINTRST_H
+#define MIPOINTRST_H
+
 #include "mipointer.h"
 #include "scrnintstr.h"
 
@@ -50,3 +53,4 @@ typedef struct {
     Bool		    waitForUpdate;	/* don't move cursor in SIGIO */
     Bool		    showTransparent;	/* show empty cursors */
 } miPointerScreenRec, *miPointerScreenPtr;
+#endif /* MIPOINTRST_H */
commit a3a7c12fcf8e4ac1418f9ea53f76091f309a721b
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 23:38:45 2008 +0930

    xfree86: Fix up xf86ScaleAxis
    
    Some driver still call it, so we might as well work correctly. Always
    resetting X to the Sxhigh is sub-optimal.

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c6a4ef6..675ec9f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -785,9 +785,9 @@ xf86ScaleAxis(int	Cx,
 	ErrorF ("Divide by Zero in xf86ScaleAxis");
     }
     
-    if (X > Sxlow)
+    if (X > Sxhigh)
 	X = Sxlow;
-    if (X < Sxhigh)
+    if (X < Sxlow)
 	X = Sxhigh;
     
     return (X);
commit f8431a62d57ab3118a0b409bce977db8261e2930
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Jun 10 02:15:25 2008 -0700

    XQuartz: Under the new startup model, we no longer need to do the foreground/background dance.
    (cherry picked from commit 4505bae5d7341e1241be50c25cb3d1b941701de4)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 77d662f..be9ad1c 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -25,7 +25,6 @@ libXquartz_la_SOURCES = \
 	quartz.c \
 	quartzAudio.c \
 	quartzCocoa.m \
-	quartzForeground.c \
 	quartzKeyboard.c \
 	quartzPasteboard.c \
 	quartzStartup.c \
@@ -43,7 +42,6 @@ EXTRA_DIST = \
 	quartz.h \
 	quartzAudio.h \
 	quartzCommon.h \
-	quartzForeground.h \
 	quartzKeyboard.h \
 	quartzPasteboard.h \
 	sanitizedCarbon.h \
diff --git a/hw/xquartz/bundle/Info.plist b/hw/xquartz/bundle/Info.plist
index 30bb3c8..f06a30d 100644
--- a/hw/xquartz/bundle/Info.plist
+++ b/hw/xquartz/bundle/Info.plist
@@ -37,7 +37,5 @@ Copyright © 2003-2008, X.org Foundation, Inc.
 		<string>main</string>
 	<key>NSPrincipalClass</key>
 		<string>X11Application</string>
-	<key>LSBackgroundOnly</key>
-		<true/>
 </dict>
 </plist>
diff --git a/hw/xquartz/quartzForeground.c b/hw/xquartz/quartzForeground.c
deleted file mode 100644
index 80a04a1..0000000
--- a/hw/xquartz/quartzForeground.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* foreground.c - Push the current process into the foreground.
-
- This is in a separate file because of Quartz/X type conflicts.
-
- Copyright (c) 2007 Jeremy Huddleston
- 
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
- HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#include <ApplicationServices/ApplicationServices.h>
-#include <stdio.h>
-
-#include "quartzForeground.h"
-
-int QuartzMoveToForeground() {
-   ProcessSerialNumber psn = { 0, kCurrentProcess };
-   OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
-   if( returnCode == 0) {
-       /* fprintf(stderr, "TransformProcessType: Success\n"); */
-       SetFrontProcess(&psn);
-   } else {
-       fprintf(stderr, "TransformProcessType: Failure\n");
-   }
-   return (int)returnCode;
-}
diff --git a/hw/xquartz/quartzForeground.h b/hw/xquartz/quartzForeground.h
deleted file mode 100644
index b5422ff..0000000
--- a/hw/xquartz/quartzForeground.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* foreground.h - Push the current process into the foreground.
- 
- This is in a separate file because of Quartz/X type conflicts.
- 
- Copyright (c) 2007 Jeremy Huddleston
- 
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation files
- (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge,
- publish, distribute, sublicense, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
- 
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
- HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- 
- Except as contained in this notice, the name(s) of the above
- copyright holders shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software without
- prior written authorization. */
-
-#ifndef _QUARTZ_FOREGROUND_H_
-#define _QUARTZ_FOREGROUND_H_
-
-int QuartzMoveToForeground(void);
-
-#endif /* _QUARTZ_FOREGROUND_H_ */
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 43f1502..968cde8 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -121,7 +121,6 @@ int server_main(int argc, char **argv, char **envp) {
     /* Create the audio mutex */
     QuartzAudioInit();
 
-    QuartzMoveToForeground();
     X11ControllerMain(argc, argv, envp);
     exit(0);
 }
commit c180a52332385b98635068d63a8fe0bba4835be7
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Jun 10 10:47:37 2008 -0700

    XQuartz: Removed code path for old startup
    (cherry picked from commit a9ee6b0d00fab01a78408a85e6542e88c19fda7c)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 69778c1..77d662f 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -7,8 +7,7 @@ AM_CPPFLAGS = \
 	-DINXQUARTZ \
 	-DUSE_NEW_CLUT \
 	-DXFree86Server \
-	-I$(top_srcdir)/miext/rootless \
-	-DNEW_LAUNCH_METHOD
+	-I$(top_srcdir)/miext/rootless
 
 SUBDIRS = bundle . GL xpr mach-startup doc
 
diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 59018a9..2da3062 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -1,7 +1,6 @@
 AM_CPPFLAGS = \
 	-DBUILD_DATE=\"$(BUILD_DATE)\" \
-	-DXSERVER_VERSION=\"$(VERSION)\" \
-	-DNEW_LAUNCH_METHOD -DNEW_LAUNCH_METHOD_2
+	-DXSERVER_VERSION=\"$(VERSION)\"
 
 x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS
 x11app_PROGRAMS = X11
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d7b6c37..d2bc9d3 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -78,7 +78,6 @@ static pthread_t create_thread(void *func, void *arg) {
     return tid;
 }
 
-#ifdef NEW_LAUNCH_METHOD
 /*** Mach-O IPC Stuffs ***/
 
 union MaxMsgSize {
@@ -278,25 +277,13 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
 }
 
 int startup_trigger(int argc, char **argv, char **envp) {
-#else
-void *add_launchd_display_thread(void *data);
-    
-int main(int argc, char **argv, char **envp) {
-#endif
     Display *display;
     const char *s;
     
     size_t i;
-#ifndef NEW_LAUNCH_METHOD
-    fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
-    for(i=0; i < argc; i++) {
-        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
-    }
-#endif
     
     /* Take care of the case where we're called like a normal DDX */
     if(argc > 1 && argv[1][0] == ':') {
-#ifdef NEW_LAUNCH_METHOD
         kern_return_t kr;
         mach_port_t mp;
         string_array_t newenvp;
@@ -336,10 +323,6 @@ int main(int argc, char **argv, char **envp) {
             exit(EXIT_FAILURE);
         }
         exit(EXIT_SUCCESS);
-#else
-        create_thread(add_launchd_display_thread, NULL);
-        return server_main(argc, argv, envp);
-#endif
     }
 
     /* If we have a process serial number and it's our only arg, act as if
@@ -369,7 +352,6 @@ int main(int argc, char **argv, char **envp) {
     return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
 }
 
-#ifdef NEW_LAUNCH_METHOD
 /*** Main ***/
 int main(int argc, char **argv, char **envp) {
     Bool listenOnly = FALSE;
@@ -411,16 +393,6 @@ int main(int argc, char **argv, char **envp) {
     
     return EXIT_SUCCESS;
 }
-#else
-void *add_launchd_display_thread(void *data) {
-    /* Start listening on the launchd fd */
-    int launchd_fd = launchd_display_fd();
-    if(launchd_fd != -1) {
-        DarwinListenOnOpenFD(launchd_fd);
-    }
-    return NULL;
-}
-#endif
     
 static int execute(const char *command) {
     const char *newargv[7];
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 7d98752..d7b248b 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -113,7 +113,6 @@ static void set_x11_path() {
     }
 }
 
-#ifdef NEW_LAUNCH_METHOD
 static int create_socket(char *filename_out) {
     struct sockaddr_un servaddr_un;
     struct sockaddr *servaddr;
@@ -201,10 +200,8 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) {
     close(connected_fd);
     fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
 }
-#endif
 
 int main(int argc, char **argv, char **envp) {
-#ifdef NEW_LAUNCH_METHOD
     int envpc;
     kern_return_t kr;
     mach_port_t mp;
@@ -213,7 +210,6 @@ int main(int argc, char **argv, char **envp) {
     size_t i;
     int launchd_fd;
     string_t handoff_socket_filename;
-#endif
     sig_t handler;
 
     if(argc == 2 && !strcmp(argv[1], "-version")) {
@@ -232,7 +228,6 @@ int main(int argc, char **argv, char **envp) {
         kill(getppid(), SIGUSR1);
     signal(SIGUSR1, handler);
     
-#ifdef NEW_LAUNCH_METHOD
     /* Get the $DISPLAY FD */
     launchd_fd = launchd_display_fd();
 
@@ -313,10 +308,4 @@ int main(int argc, char **argv, char **envp) {
         return EXIT_FAILURE;
     }
     return EXIT_SUCCESS;
-    
-#else
-    set_x11_path();
-    argv[0] = x11_path;
-    return execvp(x11_path, argv);
-#endif
 }
commit 49751fee3b82ebc4917bfb168ec78aad7874f1f1
Author: Roland Scheidegger <sroland at tungstengraphics.com>
Date:   Tue Jun 10 15:40:48 2008 +0200

    glx: copy msaa visual capabilities

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index dcd8352..0ca0598 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -943,11 +943,11 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 	buf[p++] = modes->transparentAlpha;
 	buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
 	buf[p++] = modes->transparentIndex;
-	buf[p++] = 0;
-	buf[p++] = 0;
-	buf[p++] = 0;
-	buf[p++] = 0;
-	buf[p++] = 0;
+	buf[p++] = GLX_SAMPLES_SGIS;
+	buf[p++] = modes->samples;
+	buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+	buf[p++] = modes->sampleBuffers;
+	buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
 	buf[p++] = 0;
 
 	if (client->swapped) {
@@ -959,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
     return Success;
 }
 
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33)
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (35)
 #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
 /**
  * Send the set of GLXFBConfigs to the client.  There is not currently
@@ -1037,6 +1037,9 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
 	WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
 	WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
 	WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
+	WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
+	WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
+	/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
 	WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
 	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
 	WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
commit 5170c169db78cad3fe47dee4e438b48e67f0c7d1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Jun 10 01:39:15 2008 -0700

    XQuartz: Fixed the "laggy" startup under the new model.  This was caused by xinit blocking expecting SIGUSR1 and our stub never sending it.
    (cherry picked from commit ee92aced10d0743c4658e53b58b5d9f5a094a415)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 151aaa0..911aac7 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -350,6 +350,10 @@ Bool DarwinEQInit(void) {
     
     QuartzModeEQInit();
 
+    /* Note that this *could* cause a potential async issue, since we're checking
+     * darwinEvents without holding the lock, but darwinEvents is only ever set
+     * here, so I don't bother.
+     */
     if (!darwinEvents) {
         darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
         
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index d48ae74..7d98752 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -214,6 +214,7 @@ int main(int argc, char **argv, char **envp) {
     int launchd_fd;
     string_t handoff_socket_filename;
 #endif
+    sig_t handler;
 
     if(argc == 2 && !strcmp(argv[1], "-version")) {
         fprintf(stderr, "X.org Release 7.3\n");
@@ -222,6 +223,15 @@ int main(int argc, char **argv, char **envp) {
         return EXIT_SUCCESS;
     }
 
+    /* We don't have a mechanism in place to handle this interrupt driven
+     * server-start notification, so just send the signal now, so xinit doesn't
+     * time out waiting for it and will just poll for the server.
+     */
+    handler = signal(SIGUSR1, SIG_IGN);
+    if(handler == SIG_IGN)
+        kill(getppid(), SIGUSR1);
+    signal(SIGUSR1, handler);
+    
 #ifdef NEW_LAUNCH_METHOD
     /* Get the $DISPLAY FD */
     launchd_fd = launchd_display_fd();
commit 01ace5f3fd56bc789ad7448059fcf907ef19a1c8
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jun 4 18:28:20 2008 -0700

    XQuartz: Updated icon with more rsolutions and made it more dark-background friendly
    (cherry picked from commit d8cf5623faab952a0f1196c8fe10baa09d1fc089)

diff --git a/hw/xquartz/bundle/Resources/X11.icns b/hw/xquartz/bundle/Resources/X11.icns
index d19cc63..d9d2f76 100644
Binary files a/hw/xquartz/bundle/Resources/X11.icns and b/hw/xquartz/bundle/Resources/X11.icns differ
commit 607b0d09ea003f87cfb3331e59e13495a483832a
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Mon Jun 9 09:52:04 2008 -0700

    CreateColormap returns Success on success, not TRUE.
    
    Fixes a problem where enabling color index overlays disables the RENDER
    extension.

diff --git a/render/picture.c b/render/picture.c
index 35e2a28..2fbd09e 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -413,8 +413,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
 	    (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
     } else {
 	VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
-	if (!CreateColormap(FakeClientID (0), pScreen, pVisual,
-		    &format->index.pColormap, AllocNone, 0))
+	if (CreateColormap(FakeClientID (0), pScreen, pVisual,
+		    &format->index.pColormap, AllocNone, 0)
+		!= Success)
 	    return FALSE;
     }
     if (!ps->InitIndexed(pScreen, format))
commit 2854abd39d4deb79c9ee9bcc931fad969392cfc5
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 23:20:11 2008 +0930

    xnest: fix up sprite funcs to stop compiler warnings.

diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 1386980..3e676d1 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -36,7 +36,7 @@ is" without express or implied warranty.
 #include "Args.h"
 
 Bool
-xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
 {
   XImage *ximage;
   Pixmap source, mask;
@@ -116,7 +116,7 @@ xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 }
 
 Bool
-xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+xnestUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
 {
   XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
   xfree(xnestGetCursorPriv(pCursor, pScreen));
@@ -141,7 +141,7 @@ xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed)
 		 &fg_color, &bg_color);
 }
 
-void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+void xnestSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
 {
     if (pCursor)
     {
@@ -152,6 +152,6 @@ void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
 }
 
 void
-xnestMoveCursor (ScreenPtr pScreen, int x, int y)
+xnestMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 {
 }
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 11c180b..9d157a3 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -124,6 +124,8 @@ static miPointerSpriteFuncRec xnestPointerSpriteFuncs =
     xnestUnrealizeCursor,
     xnestSetCursor,
     xnestMoveCursor,
+    NULL,
+    NULL
 };
 
 Bool
diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index 9705f6b..627be03 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -28,10 +28,21 @@ typedef struct {
 #define xnestCursor(pCursor, pScreen) \
   (xnestGetCursorPriv(pCursor, pScreen)->cursor)
 
-Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed);
-void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y);
-void xnestMoveCursor (ScreenPtr pScreen, int x, int y);
+Bool xnestRealizeCursor(DeviceIntPtr pDev,
+                        ScreenPtr pScreen,
+                        CursorPtr pCursor);
+Bool xnestUnrealizeCursor(DeviceIntPtr pDev,
+                          ScreenPtr pScreen,
+                          CursorPtr pCursor);
+void xnestRecolorCursor(ScreenPtr pScreen,
+                        CursorPtr pCursor,
+                        Bool displayed);
+void xnestSetCursor (DeviceIntPtr pDev,
+                     ScreenPtr pScreen,
+                     CursorPtr pCursor,
+                     int x, int y);
+void xnestMoveCursor (DeviceIntPtr pDev,
+                      ScreenPtr pScreen,
+                      int x, int y);
 
 #endif /* XNESTCURSOR_H */
commit c68ca0c7b2c72df0501d26bf7f640029ff2d9568
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 23:14:20 2008 +0930

    xnest: switch to using EventList rather than xEvents.

diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index f7a551c..355b46f 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -43,7 +43,7 @@ is" without express or implied warranty.
 
 CARD32 lastEventTime = 0;
 
-extern xEvent *xnestEvents;
+extern EventList *xnestEvents;
 
 void
 ProcessInputEvents()
@@ -106,10 +106,11 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
 {
   int i, n;
 
+  GetEventList(&xnestEvents);
   lastEventTime = GetTimeInMillis();
   n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
   for (i = 0; i < n; i++)
-    mieqEnqueue(xnestKeyboardDevice, xnestEvents + i);
+    mieqEnqueue(xnestKeyboardDevice, (xnestEvents + i)->event);
 }
 
 void
@@ -119,6 +120,7 @@ xnestCollectEvents(void)
   xEvent x;
   int i, n, valuators[2];
   ScreenPtr pScreen;
+  GetEventList(&xnestEvents);
 
   while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
     switch (X.type) {
@@ -138,7 +140,7 @@ xnestCollectEvents(void)
       n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
                            X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
       for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+        mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
       break;
       
     case ButtonRelease:
@@ -147,7 +149,7 @@ xnestCollectEvents(void)
       n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
                            X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
       for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+        mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
       break;
       
     case MotionNotify:
@@ -157,7 +159,7 @@ xnestCollectEvents(void)
       n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
                            0, POINTER_ABSOLUTE, 0, 2, valuators);
       for (i = 0; i < n; i++)
-        mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+        mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
       break;
       
     case FocusIn:
@@ -190,7 +192,7 @@ xnestCollectEvents(void)
           n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
                                0, POINTER_ABSOLUTE, 0, 2, valuators);
           for (i = 0; i < n; i++)
-            mieqEnqueue(xnestPointerDevice, xnestEvents + i);
+            mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
 	  xnestDirectInstallColormaps(pScreen);
 	}
       }
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index de80cb5..f52445c 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -45,7 +45,7 @@ is" without express or implied warranty.
 
 Bool xnestDoFullGeneration = True;
 
-xEvent *xnestEvents = NULL;
+EventList *xnestEvents = NULL;
 
 void
 InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
@@ -92,10 +92,7 @@ InitInput(int argc, char *argv[])
   xnestPointerDevice = AddInputDevice(serverClient, xnestPointerProc, TRUE);
   xnestKeyboardDevice = AddInputDevice(serverClient, xnestKeyboardProc, TRUE);
 
-  if (!xnestEvents)
-      xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-  if (!xnestEvents)
-      FatalError("couldn't allocate room for events\n");
+  GetEventList(&xnestEvents);
 
   RegisterPointerDevice(xnestPointerDevice);
   RegisterKeyboardDevice(xnestKeyboardDevice);
commit 34429d16d319ef2709c22a5c22f45d0e82c78b20
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 23:08:34 2008 +0930

    xnest: call miDCInitialize rather than miPointerInitialize.
    
    This unfortunately gives us a lots of artefacts, so cursor rendering cannot be
    assumed complete. But it's better than crashing.

diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 61a325f..11c180b 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -305,8 +305,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
   pScreen->blockData = NULL;
   pScreen->wakeupData = NULL;
 
-  miPointerInitialize (pScreen, &xnestPointerSpriteFuncs, 
-		       &xnestPointerCursorFuncs, True);
+  miDCInitialize (pScreen, &xnestPointerCursorFuncs);
 
   pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, 
 		       DefaultScreen(xnestDisplay)) / 
commit a7d4bec884c24c0e1792fd7d6677cdd0a69978e3
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 23:03:20 2008 +0930

    mi: remove leftover old license comment.

diff --git a/mi/midispcur.c b/mi/midispcur.c
index d68050f..8755277 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -29,12 +29,6 @@ Except as contained in this notice, the name of The Open Group shall not be
 used in advertising or otherwise to promote the sale, use or other dealings
 in this Software without prior written authorization from The Open Group.
 */
-/* 
- * MPX additions:
- * Copyright © 2006 Peter Hutterer
- * Author: Peter Hutterer <peter at cs.unisa.edu.au>
- *
- */
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
commit 585125685b5f09245021c8ee15f57950fe6cdd20
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Sun Jun 8 22:43:47 2008 +0930

    ephyr: some whitespace changes.

diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 1ec98fc..1399d7a 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -64,7 +64,7 @@ InitInput (int argc, char **argv)
 {
   KdKeyboardInfo *ki;
   KdPointerInfo *pi;
-        
+
   KdAddKeyboardDriver(&EphyrKeyboardDriver);
 #ifdef linux
   KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
@@ -301,17 +301,17 @@ miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
 	ephyrUnrealizeCursor,
 	ephyrSetCursor,
 	ephyrMoveCursor,
-    ephyrDeviceCursorInitialize,
-        NULL
+	ephyrDeviceCursorInitialize,
+	NULL
 };
 
 
 Bool
 ephyrCursorInit(ScreenPtr pScreen)
 {
-  miPointerInitialize(pScreen, 
+  miPointerInitialize(pScreen,
 		      &EphyrPointerSpriteFuncs,
-		      &ephyrPointerScreenFuncs, 
+		      &ephyrPointerScreenFuncs,
 		      FALSE);
 
   return TRUE;
@@ -336,18 +336,18 @@ KdCardFuncs ephyrFuncs = {
     ephyrRestore,	    /* restore */
     ephyrScreenFini,	    /* scrfini */
     ephyrCardFini,	    /* cardfini */
-    
-    0,	                    /* initCursor */
-    0,          	    /* enableCursor */
+
+    0,			    /* initCursor */
+    0,			    /* enableCursor */
     0,			    /* disableCursor */
     0,			    /* finiCursor */
     0,			    /* recolorCursor */
-    
+
     0,			    /* initAccel */
     0,			    /* enableAccel */
     0,			    /* disableAccel */
     0,			    /* finiAccel */
-    
-    ephyrGetColors,    	    /* getColors */
+
+    ephyrGetColors,/* getColors */
     ephyrPutColors,	    /* putColors */
 };
commit 782394fe53220deafed06ad282b5f9ce42964c42
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Jun 6 12:10:35 2008 +0200

    mi: Fix typo in comments about deprecated functions

diff --git a/mi/mipointer.h b/mi/mipointer.h
index fccbfa0..d2e4455 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -122,7 +122,7 @@ extern int miPointerGetMotionEvents(
     ScreenPtr /*pScreen*/
 );
 
-/* Deprecated in favour of miSetPointerPosition. */
+/* Deprecated in favour of miPointerSetPosition. */
 extern void miPointerDeltaCursor(
     int /*dx*/,
     int /*dy*/,
@@ -134,7 +134,7 @@ extern void miPointerAbsoluteCursor(
     unsigned long /*time*/
 ) _X_DEPRECATED;
 
-/* Deprecated in favour of miGetPointerPosition. */
+/* Deprecated in favour of miPointerGetPosition. */
 extern void miPointerPosition(
     int * /*x*/,
     int * /*y*/
commit 6b96281100f2118fe9d99536c33d48298a5bce7b
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Fri Jun 6 11:01:03 2008 +0200

    EXA: Fix exaGetPixmapFirstPixel() crash if the driver has a CreatePixmap hook.
    
    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=16243

diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 5a25764..ee6b98e 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -362,6 +362,7 @@ ExaCheckComposite (CARD8      op,
 CARD32
 exaGetPixmapFirstPixel (PixmapPtr pPixmap)
 {
+    ExaScreenPriv(pPixmap->drawable.pScreen);
     CARD32 pixel;
     void *fb;
     Bool need_finish = FALSE;
@@ -376,7 +377,8 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
     fb = pExaPixmap->sys_ptr;
 
     /* Try to avoid framebuffer readbacks */
-    if ((!offscreen && !sys_valid && !damaged) ||
+    if (pExaScr->info->CreatePixmap ||
+	(!offscreen && !sys_valid && !damaged) ||
 	(offscreen && (!sys_valid || damaged)))
     {
 	box.x1 = 0;
commit d25ffcfbfcfe8e059f2889873c9dbe76a28ad00c
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jun 5 15:29:35 2008 +0930

    mi: protect against possible NULL-pointer dereference.

diff --git a/mi/misprite.c b/mi/misprite.c
index 25f6b6f..b8df5eb 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -460,7 +460,7 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
     pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, BlockHandler);
-    
+
     (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
 
     SCREEN_EPILOGUE(pScreen, BlockHandler);
@@ -470,8 +470,8 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
         if (DevHasCursor(pDev))
         {
             pCursorInfo = MISPRITE(pDev);
-            if (!pCursorInfo->isUp 
-                    && pCursorInfo->pScreen == pScreen 
+            if (pCursorInfo && !pCursorInfo->isUp
+                    && pCursorInfo->pScreen == pScreen
                     && pCursorInfo->shouldBeUp)
             {
                 SPRITE_DEBUG (("BlockHandler restore\n"));
@@ -484,8 +484,8 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
         if (DevHasCursor(pDev))
         {
             pCursorInfo = MISPRITE(pDev);
-            if (!pCursorInfo->isUp && 
-                    pCursorInfo->pScreen == pScreen && 
+            if (pCursorInfo && !pCursorInfo->isUp &&
+                    pCursorInfo->pScreen == pScreen &&
                     pCursorInfo->shouldBeUp)
             {
                 SPRITE_DEBUG (("BlockHandler restore\n"));
commit 874dcdb3bdb9320aae252d3c7927d412685059d5
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jun 5 15:38:48 2008 +0930

    dmx: remove a ifndef XINPUT, XINPUT is always defined now.

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 0b9335b..a0eb80f 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -1079,13 +1079,6 @@ void dmxInputInit(DMXInputInfo *dmxInput)
     
     for (i = 0; i < dmxInput->numDevs; i++) {
         DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
-#ifndef XINPUT
-        if (!dmxLocal->isCore)
-            dmxLog(dmxFatal,
-                   "This server was not compiled to support the XInput"
-                   " extension, but %s is not a core device.\n",
-                   dmxLocal->name);
-#endif
         dmxLocal->pDevice = dmxAddDevice(dmxLocal);
         if (dmxLocal->isCore) {
             if (dmxLocal->type == DMX_LOCAL_MOUSE)
commit 52752911ea8470dd8805f5e6c3febb9e1e1cc4b3
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 17:04:16 2008 +0930

    dmx: don't free event list after use.

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 1d0e872..4b51ffd 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -237,7 +237,6 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
                                POINTER_ABSOLUTE, 0, 2, valuators);
     for (i = 0; i < nevents; i++)
        mieqEnqueue(p, (events + i)->event);
-    xfree(events);
     return;
 }
 
@@ -709,7 +708,6 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
                                    valuators);
         for (i = 0; i < nevents; i++)
             mieqEnqueue(p, (events + i)->event);
-        xfree(events);
         return;
 
     case MotionNotify:
commit 5c5e58124581b845a6bfa7a2991a4e0ee7f7ebdb
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 16:58:31 2008 +0930

    dmx: add an XFlush.
    
    Beats me why we need it, but without it we get segfaults lateron.

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 6d466c4..760fccf 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -778,6 +778,8 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
 
 		/* Hand out the glx configs to glx extension */
 		GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs);
+
+                XFlush(dmxScreen->beDisplay);
 	    }
 	}
 #endif  /* GLXEXT */
commit 246c10441bbf62646b77993b55233d5ceb93a81f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 16:37:25 2008 +0930

    dmx: fix false memory allocation.
    
    beNumVisuals and the number of GLX Visuals can be significantly different.

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 366bd14..6d466c4 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -746,8 +746,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
 		nconfigs = dmxScreen->numGlxVisuals;
 	    }
 
-	    configprivs = xalloc(dmxScreen->beNumVisuals *
-				 sizeof(dmxGlxVisualPrivate*));
+	    configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
 
 	    if (configs != NULL && configprivs != NULL) {
 
commit 17cd26225749a1daf7460b44e52f43082399b265
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 16:05:36 2008 +0930

    dmx: don't dereference a nullpointer.

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 2a596a1..6218dc3 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -733,7 +733,7 @@ static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
 
     if (pCursor) {
 	dmxCursorPrivPtr  pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
-	if (dmxScreen->curCursor != pCursorPriv->cursor) {
+	if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
 	    if (dmxScreen->beDisplay)
 		XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
 			      pCursorPriv->cursor);
commit 75eb635e3543fcb731331d01f50e62b696967667
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 22:25:33 2008 +0930

    dmx: add stubs for DeviceCursorInitialize, DeviceCursorCleanup

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 3dcbc33..2a596a1 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -969,10 +969,21 @@ void dmxCheckCursor(void)
     DMXDBG2("   leave dmxCheckCursor %d %d\n", x, y);
 }
 
+static Bool dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+    return TRUE;
+}
+
+static void dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+}
+
 miPointerSpriteFuncRec dmxPointerSpriteFuncs =
 {
     dmxRealizeCursor,
     dmxUnrealizeCursor,
     dmxSetCursor,
     dmxMoveCursor,
+    dmxDeviceCursorInitialize,
+    dmxDeviceCursorCleanup
 };
commit 3ff2f3a00ef3c484d1d53569b6cbc1f25dc6bd35
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 22:17:14 2008 +0930

    dmx: for now, don't acknowledge SDs.

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 4713c1b..0b9335b 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -921,6 +921,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
                     }
                 }
                 break;
+#if 0
             case IsXExtensionDevice:
             case IsXExtensionKeyboard:
             case IsXExtensionPointer:
@@ -942,6 +943,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
                     }
                 }
                 break;
+#endif
             }
         }
         XFreeDeviceList(devices);
commit 5bcd9e8953dfb5f13e90baeebea1f6eac797644b
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 22:01:43 2008 +0930

    dmx: learn about the existence of IsXExtensionPointer and IsXExtensionKeyboard

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index da1e731..4713c1b 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -883,9 +883,11 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
         for (i = 0; i < num; i++) {
             const char *use = "Unknown";
             switch (devices[i].use) {
-            case IsXPointer:         use = "XPointer";         break;
-            case IsXKeyboard:        use = "XKeyboard";        break;
-            case IsXExtensionDevice: use = "XExtensionDevice"; break;
+            case IsXPointer:           use = "XPointer";         break;
+            case IsXKeyboard:          use = "XKeyboard";        break;
+            case IsXExtensionDevice:   use = "XExtensionDevice"; break;
+            case IsXExtensionPointer:  use = "XExtensionPointer"; break;
+            case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break;
             }
             dmxLogInput(dmxInput, "  %2d %-10.10s %-16.16s\n",
                         devices[i].id,
@@ -920,6 +922,8 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
                 }
                 break;
             case IsXExtensionDevice:
+            case IsXExtensionKeyboard:
+            case IsXExtensionPointer:
                 if (doXI) {
                     if (!dmxInput->numDevs) {
                         dmxLog(dmxWarning,
commit 8da8a0fec4b1b9d9208635dedb2f449dc99e0004
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 21:59:33 2008 +0930

    dmx: claim we support XI 2.
    
    We don't really, yet, but at least we get the full device list this way.

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 1adfb41..da1e731 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -865,7 +865,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
     
     /* Print out information about the XInput Extension. */
     handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
-    ext     = XGetExtensionVersion(display, INAME);
+    ext     = XQueryInputVersion(display, XI_2_Major, XI_2_Minor);
     XSetExtensionErrorHandler(handler);
     
     if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
commit 6f1d5147cb394b7c83c4c1447c78890fa2b40a45
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 21:36:03 2008 +0930

    dmx: fix a segfault caused by GC devPrivates never being initalised.

diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index ce1730c..eb21d3c 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -85,6 +85,8 @@ static GCOps dmxGCOps = {
 /** Initialize the GC on \a pScreen */
 Bool dmxInitGC(ScreenPtr pScreen)
 {
+    if (!dixRequestPrivate(dmxGCPrivateKey, sizeof(dmxGCPrivRec)))
+            return FALSE;
     return TRUE;
 }
 
commit d10ba4591a599a317093ffcbdd7cece11ab6de26
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Jun 3 21:28:26 2008 +0930

    dmx: some more build fixes.

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 277e164..1adfb41 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -476,15 +476,11 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
             break;
         }
         if (info.keyClass) {
-#if 00 /*BP*/
-            InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap);
-#else
             DevicePtr pDev = (DevicePtr) pDevice;
             InitKeyboardDeviceStruct(pDev,
                                      &info.keySyms,
                                      info.modMap,
                                      dmxBell, dmxKbdCtrl);
-#endif
         }
         if (info.buttonClass) {
             InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map);
@@ -492,13 +488,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
         if (info.valuatorClass) {
             if (info.numRelAxes && dmxLocal->sendsCore) {
                 InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
-#if 00 /*BP*/
-                                              miPointerGetMotionEvents,
-                                              miPointerGetMotionBufferSize(),
-#else
-                                              GetMotionHistory,
                                               GetMaximumEventsNum(),
-#endif
                                               Relative);
                 for (i = 0; i < info.numRelAxes; i++)
                     InitValuatorAxisStruct(pDevice, i, info.minval[0],
@@ -506,7 +496,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
                                            info.minres[0], info.maxres[0]);
             } else if (info.numRelAxes) {
                 InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
-                                              dmxPointerGetMotionEvents,
                                               dmxPointerGetMotionBufferSize(),
                                               Relative);
                 for (i = 0; i < info.numRelAxes; i++)
@@ -515,7 +504,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
                                            info.minres[0], info.maxres[0]);
             } else if (info.numAbsAxes) {
                 InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
-                                              dmxPointerGetMotionEvents,
                                               dmxPointerGetMotionBufferSize(),
                                               Absolute);
                 for (i = 0; i < info.numAbsAxes; i++)
diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c
index 692e647..97f4392 100644
--- a/hw/dmx/input/dmxxinput.c
+++ b/hw/dmx/input/dmxxinput.c
@@ -93,12 +93,9 @@ int ChangePointerDevice(DeviceIntPtr old_dev,
 
                                 /* Switch the motion history buffers */
     if (dmxLocalOld->savedMotionProc) {
-        old_dev->valuator->GetMotionProc   = dmxLocalOld->savedMotionProc;
         old_dev->valuator->numMotionEvents = dmxLocalOld->savedMotionEvents;
     }
-    dmxLocalNew->savedMotionProc       = new_dev->valuator->GetMotionProc;
     dmxLocalNew->savedMotionEvents     = new_dev->valuator->numMotionEvents;
-    new_dev->valuator->GetMotionProc   = GetMotionHistory;
     new_dev->valuator->numMotionEvents = GetMaximumEventsNum();
                                 /* Switch our notion of core pointer */
     dmxLocalOld->isCore         = 0;
commit 8d4d0b47a07a298a20ffae9fefe96c8c7ca9dccc
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Thu Jun 5 09:19:16 2008 +0930

    gl: include assert.h if we're compiling with DEBUG.
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>

diff --git a/glx/glapi.c b/glx/glapi.c
index c4d101a..94a8043 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -63,6 +63,9 @@
 
 #include <stdlib.h>
 #include <string.h>
+#ifdef DEBUG
+#include <assert.h>
+#endif
 
 #include "glapi.h"
 #include "glapioffsets.h"
commit 8644aa47177bf20f3aa85181032ce75c08270fc5
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Thu Jun 5 08:55:09 2008 +0930

    mi: minor build fix when compiling with debug enabled.
    
    Signed-off-by: Peter Hutterer <peter at cs.unisa.edu.au>

diff --git a/mi/mieq.c b/mi/mieq.c
index a1f9cc6..91b7a51 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -255,8 +255,8 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
             // do nothing or drink a beer. your choice.
         } else
             DebugF("[mi] Unknown generic event (%d/%d), cannot change id.\n",
-                    ((xGenericEvent*)ev)->extension,
-                    ((xGenericEvent*)ev)->evtype);
+                    ((xGenericEvent*)event)->extension,
+                    ((xGenericEvent*)event)->evtype);
     } else
         DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
 }
commit fbf4b5f16ac23359872361c8c95a617fe8c92292
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 11:10:46 2008 +0930

    dix: set dst->mapWidth when allocating a new map.

diff --git a/dix/devices.c b/dix/devices.c
index efdc0c9..c83f2fc 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1046,6 +1046,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
         if (!map)
             return FALSE;
         dst->map = map;
+        dst->mapWidth = src->mapWidth;
     }
     memmove((char *)&dst->map[rowDif * dst->mapWidth],
 	    (char *)src->map,
commit ff3adf3e564d94fea18e48f966de40a7ded1279e
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jun 4 11:10:11 2008 +0930

    xkb: reset xkb_cached_map on CloseDownDevices.
    
    Could lead to some invalid pointers in the second server generation.

diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 47ad553..0aaa037 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -292,6 +292,9 @@ XkbDeleteRulesDflts()
     XkbVariantDflt = NULL;
     _XkbFree(XkbOptionsDflt);
     XkbOptionsDflt = NULL;
+
+    XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, True);
+    xkb_cached_map = NULL;
 }
 
 /***====================================================================***/
commit 40855d8000b9b9f4e6c6b4317542378ecf516345
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jun 4 12:19:28 2008 -0700

    XQuartz: Removed async debugging sleep
    (cherry picked from commit 7812a8bdf9fab651ea5c07b852b2999547ec628d)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 1e79cd3..151aaa0 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -101,8 +101,10 @@ static inline void darwinEvents_lock(void) {
          * when darwinEvents == NULL
          *
          * TODO: Cleanup this race more elegantly.
+         *
+         * For some reason, xinitrc doesn't run until after this anyways... =/
+         * sleep(2);
          */
-        sleep(2);
     }
 }
 
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 1c32518..d7b6c37 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -160,9 +160,7 @@ static void accept_fd_handoff(int connected_fd) {
     if(launchd_fd == -1)
         fprintf(stderr, "Error receiving $DISPLAY file descriptor, no descriptor received? %d\n", launchd_fd);
         
-    fprintf(stderr, "Received new DISPLAY fd (1): %d\n", launchd_fd);
-    sleep(10);
-    fprintf(stderr, "Received new DISPLAY fd (2): %d\n", launchd_fd);
+    fprintf(stderr, "Received new DISPLAY fd: %d\n", launchd_fd);
     DarwinListenOnOpenFD(launchd_fd);
 }
 
@@ -354,6 +352,9 @@ int main(int argc, char **argv, char **envp) {
             /* Could open the display, start the launcher */
             XCloseDisplay(display);
             
+            /* TODO: Clean up this race better... givint xinitrc time to run. */
+            sleep(2);
+            
             return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
         }
     }
commit ee86b751192b690973ee2a1446a406bc721ce8eb
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jun 4 12:01:19 2008 -0700

    XQuartz: use a condition variable to signal when darwinEvents is ready rather than polling
    (cherry picked from commit ff1c443cadf11d12a7d939e51194f6105153870e)

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 0ecb064..1e79cd3 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -80,21 +80,36 @@ void QuartzModeEQInit(void);
 static int old_flags = 0;  // last known modifier state
 
 static xEvent *darwinEvents = NULL;
-static pthread_mutex_t darwinEvents_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
 
 static inline void darwinEvents_lock(void) {
     int err;
-    if((err = pthread_mutex_lock(&darwinEvents_mutex))) {
-        ErrorF("%s:%s:%d: Failed to lock darwinEvents_mutex: %d\n",
+    if((err = pthread_mutex_lock(&mieq_lock))) {
+        ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
                __FILE__, __FUNCTION__, __LINE__, err);
         spewCallStack();
     }
+    if(darwinEvents == NULL) {
+        pthread_cond_wait(&mieq_ready_cond, &mieq_lock);
+
+        /* We want to give xinit time to finish running xinitrc before we accept
+         * the launchd socket connection.
+         *
+         * Yes, we lock then immediately unlock because the lock does a cond_wait
+         * when darwinEvents == NULL
+         *
+         * TODO: Cleanup this race more elegantly.
+         */
+        sleep(2);
+    }
 }
 
 static inline void darwinEvents_unlock(void) {
     int err;
-    if((err = pthread_mutex_unlock(&darwinEvents_mutex))) {
-        ErrorF("%s:%s:%d: Failed to unlock darwinEvents_mutex: %d\n",
+    if((err = pthread_mutex_unlock(&mieq_lock))) {
+        ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
                __FILE__, __FUNCTION__, __LINE__, err);
         spewCallStack();
     }
@@ -333,11 +348,17 @@ Bool DarwinEQInit(void) {
     
     QuartzModeEQInit();
 
-    if (!darwinEvents)
+    if (!darwinEvents) {
         darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-    if (!darwinEvents)
-        FatalError("Couldn't allocate event buffer\n");
-    
+        
+        if (!darwinEvents)
+            FatalError("Couldn't allocate event buffer\n");
+        
+        darwinEvents_lock();
+        pthread_cond_broadcast(&mieq_ready_cond);
+        darwinEvents_unlock();
+    }
+
     return TRUE;
 }
 
@@ -453,7 +474,6 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
                                       POINTER_ABSOLUTE, 0, dev==darwinTablet?5:2, valuators);
         for(i=0; i<num_events; i++) mieqEnqueue (dev, &darwinEvents[i]);
         DarwinPokeEQ();
-
     } darwinEvents_unlock();
 }
 
@@ -578,13 +598,8 @@ void DarwinSendDDXEvent(int type, int argc, ...) {
         va_end (args);
     }
 
-    /* If we're called from something other than the X server thread, we need
-     * to wait for the X server to setup darwinEvents.
-     */
-    while(darwinEvents == NULL) {
-        usleep(250000);
-    }
-
-    mieqEnqueue(darwinPointer, &xe);
-    DarwinPokeEQ();
+    darwinEvents_lock(); {
+        mieqEnqueue(darwinPointer, &xe);
+        DarwinPokeEQ();
+    } darwinEvents_unlock();
 }
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 9a50668..1c32518 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -412,11 +412,6 @@ int main(int argc, char **argv, char **envp) {
 }
 #else
 void *add_launchd_display_thread(void *data) {
-    /* TODO: Really fix this race... we want xinitrc to finish before connections
-     *       are accepted on the launchd socket.
-     */
-    sleep(2);
-    
     /* Start listening on the launchd fd */
     int launchd_fd = launchd_display_fd();
     if(launchd_fd != -1) {
commit 38da26cd36957a45b2a47ef124282f7d863a9fd3
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jun 4 11:35:24 2008 -0700

    XQuartz: Don't forget to destroy the mutex and cond after we're done with them
    (cherry picked from commit c3558bb8cd889e5b957190e9f5d23afad1e17b72)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 67c338f..9a50668 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -203,15 +203,15 @@ static void socket_handoff_thread(void *arg) {
         fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno));
 
         data->retval = EXIT_FAILURE;
-        pthread_mutex_unlock(&data->lock);
         pthread_cond_broadcast(&data->cond);
+        pthread_mutex_unlock(&data->lock);
         return;
     }
 
     /* Let the dispatch thread now tell the caller that we're ready */
     data->retval = EXIT_SUCCESS;
-    pthread_mutex_unlock(&data->lock);
     pthread_cond_broadcast(&data->cond);
+    pthread_mutex_unlock(&data->lock);
     
     if(connect(handoff_fd, servaddr, servaddr_len) < 0) {
         fprintf(stderr, "Failed to connect to socket: %s - %s\n", filename, strerror(errno));
@@ -227,6 +227,7 @@ static void socket_handoff_thread(void *arg) {
 kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
     handoff_data_t handoff_data;
 
+    /* Initialize our data */
     pthread_mutex_init(&handoff_data.lock, NULL);
     pthread_cond_init(&handoff_data.cond, NULL);
     strlcpy(handoff_data.socket_filename, socket_filename, STRING_T_SIZE); 
@@ -234,9 +235,15 @@ kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
     pthread_mutex_lock(&handoff_data.lock);
     
     create_thread(socket_handoff_thread, &handoff_data);
-    
+
+    /* Wait for our return value */
     pthread_cond_wait(&handoff_data.cond, &handoff_data.lock);
+    pthread_mutex_unlock(&handoff_data.lock);
 
+    /* Cleanup */
+    pthread_cond_destroy(&handoff_data.cond);
+    pthread_mutex_destroy(&handoff_data.lock);
+    
     return handoff_data.retval;
 }
 
commit ea40fcf4344c6e918d3be34354528940b05a70f3
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Jun 4 11:18:52 2008 -0700

    XQuartz: Fork for trigger
    (cherry picked from commit dd0f8a0f59593d7831fe09a2a086fcd57c84910e)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 943ec54..67c338f 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -79,12 +79,6 @@ static pthread_t create_thread(void *func, void *arg) {
 }
 
 #ifdef NEW_LAUNCH_METHOD
-struct arg {
-    int argc;
-    char **argv;
-    char **envp;
-};
-
 /*** Mach-O IPC Stuffs ***/
 
 union MaxMsgSize {
@@ -368,12 +362,6 @@ int main(int argc, char **argv, char **envp) {
 }
 
 #ifdef NEW_LAUNCH_METHOD
-static void startup_trigger_thread(void *arg) {
-    struct arg args = *((struct arg *)arg);
-    free(arg);
-    startup_trigger(args.argc, args.argv, args.envp);
-}
-
 /*** Main ***/
 int main(int argc, char **argv, char **envp) {
     Bool listenOnly = FALSE;
@@ -400,21 +388,13 @@ int main(int argc, char **argv, char **envp) {
      * thread handle it.
      */
     if(!listenOnly) {
-        struct arg *args = (struct arg*)malloc(sizeof(struct arg));
-        if(!args) {
-            fprintf(stderr, "Memory allocation error.\n");
-            return EXIT_FAILURE;
+        if(fork() == 0) {
+            return startup_trigger(argc, argv, envp);
         }
-        
-        args->argc = argc;
-        args->argv = argv;
-        args->envp = envp;
-        
-        create_thread(startup_trigger_thread, args);
     }
     
     /* Main event loop */
-    fprintf(stderr, "Statrup coming...\n");
+    fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n");
     kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0);
     if (kr != KERN_SUCCESS) {
         fprintf(stderr, "org.x.X11(mp): %s\n", mach_error_string(kr));
commit 2393dae6ffff7db8281a7977039450e8754cc19f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Jun 3 00:06:26 2008 -0700

    XQuartz: Switched over to new startup path for testing.  Cleaned it up a bit.  Server still crashes when using the icon to launch =/
    (cherry picked from commit 7f840e9dc180421eaa9b0ea3ab993fdd5b2466e5)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index cc39c9d..69778c1 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -7,8 +7,8 @@ AM_CPPFLAGS = \
 	-DINXQUARTZ \
 	-DUSE_NEW_CLUT \
 	-DXFree86Server \
-	-I$(top_srcdir)/miext/rootless
-#	-DNEW_LAUNCH_METHOD
+	-I$(top_srcdir)/miext/rootless \
+	-DNEW_LAUNCH_METHOD
 
 SUBDIRS = bundle . GL xpr mach-startup doc
 
diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 11f6ba6..59018a9 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -1,18 +1,18 @@
 AM_CPPFLAGS = \
 	-DBUILD_DATE=\"$(BUILD_DATE)\" \
-	-DXSERVER_VERSION=\"$(VERSION)\"
-#	-DNEW_LAUNCH_METHOD -DNEW_LAUNCH_METHOD_2
+	-DXSERVER_VERSION=\"$(VERSION)\" \
+	-DNEW_LAUNCH_METHOD -DNEW_LAUNCH_METHOD_2
 
 x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS
 x11app_PROGRAMS = X11
 
 dist_X11_SOURCES = \
-	bundle-main.c \
-	launchd_fd.c
+	bundle-main.c
+#	launchd_fd.c
 
-#nodist_X11_SOURCES = \
-#	mach_startupServer.c \
-#	mach_startupUser.c
+nodist_X11_SOURCES = \
+	mach_startupServer.c \
+	mach_startupUser.c
 
 X11_LDADD = \
 	$(top_builddir)/hw/xquartz/libXquartz.la \
@@ -34,11 +34,11 @@ X11_LDFLAGS =  \
 bin_PROGRAMS = Xquartz
 
 dist_Xquartz_SOURCES = \
-	stub.c
-#	launchd_fd.c
+	stub.c \
+	launchd_fd.c
 
-#nodist_Xquartz_SOURCES = \
-#	mach_startupUser.c
+nodist_Xquartz_SOURCES = \
+	mach_startupUser.c
 
 Xquartz_LDFLAGS =  \
 	-Wl,-framework,CoreServices
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 0068e02..943ec54 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -48,9 +48,9 @@
 #include "mach_startupServer.h"
 
 #include "launchd_fd.h"
+/* From darwinEvents.c ... but don't want to pull in all the server cruft */
 void DarwinListenOnOpenFD(int fd);
 
-
 #define DEFAULT_CLIENT "/usr/X11/bin/xterm"
 #define DEFAULT_STARTX "/usr/X11/bin/startx"
 #define DEFAULT_SHELL  "/bin/sh"
@@ -124,9 +124,6 @@ static mach_port_t checkin_or_register(char *bname) {
 }
 
 /*** $DISPLAY handoff ***/
-/* From darwinEvents.c ... but don't want to pull in all the server cruft */
-void DarwinListenOnOpenFD(int fd);
-
 static void accept_fd_handoff(int connected_fd) {
     int launchd_fd;
     
@@ -169,7 +166,9 @@ static void accept_fd_handoff(int connected_fd) {
     if(launchd_fd == -1)
         fprintf(stderr, "Error receiving $DISPLAY file descriptor, no descriptor received? %d\n", launchd_fd);
         
-    fprintf(stderr, "Received new DISPLAY fd: %d\n", launchd_fd);
+    fprintf(stderr, "Received new DISPLAY fd (1): %d\n", launchd_fd);
+    sleep(10);
+    fprintf(stderr, "Received new DISPLAY fd (2): %d\n", launchd_fd);
     DarwinListenOnOpenFD(launchd_fd);
 }
 
@@ -189,7 +188,7 @@ static void socket_handoff_thread(void *arg) {
     struct sockaddr_un servaddr_un;
     struct sockaddr *servaddr;
     socklen_t servaddr_len;
-    int handoff_fd, connected_fd;
+    int handoff_fd;
 
     /* We need to save it since data dies after we pthread_cond_broadcast */
     strlcpy(filename, data->socket_filename, STRING_T_SIZE); 
@@ -208,40 +207,27 @@ static void socket_handoff_thread(void *arg) {
     handoff_fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if(handoff_fd == 0) {
         fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno));
+
         data->retval = EXIT_FAILURE;
-        return;
-    }
-    
-    if(bind(handoff_fd, servaddr, servaddr_len) != 0) {
-        fprintf(stderr, "Failed to bind socket: %s - %s\n", filename, strerror(errno));
-        data->retval = EXIT_FAILURE;
-        return;
-    }
-    
-    if(listen(handoff_fd, 10) != 0) {
-        fprintf(stderr, "Failed to listen to socket: %s - %s\n", filename, strerror(errno));
-        data->retval = EXIT_FAILURE;
+        pthread_mutex_unlock(&data->lock);
+        pthread_cond_broadcast(&data->cond);
         return;
     }
 
-    /* Let the dispatch thread now tell the caller that we're listening */
+    /* Let the dispatch thread now tell the caller that we're ready */
     data->retval = EXIT_SUCCESS;
     pthread_mutex_unlock(&data->lock);
     pthread_cond_broadcast(&data->cond);
     
-    connected_fd = accept(handoff_fd, NULL, NULL);
-    
-    if(connected_fd == -1) {
-        fprintf(stderr, "Failed to accept incoming connection on socket: %s - %s\n", filename, strerror(errno));
+    if(connect(handoff_fd, servaddr, servaddr_len) < 0) {
+        fprintf(stderr, "Failed to connect to socket: %s - %s\n", filename, strerror(errno));
         return;
     }
 
     /* Now actually get the passed file descriptor from this connection */
-    accept_fd_handoff(connected_fd);
+    accept_fd_handoff(handoff_fd);
 
-    close(connected_fd);
     close(handoff_fd);
-    unlink(filename);
 }
 
 kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
@@ -273,9 +259,11 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv,
     if(!_argv || !_envp) {
         return KERN_FAILURE;
     }
-    
+
+    fprintf(stderr, "X11.app: do_start_x11_server(): argc=%d\n", argvCnt);
     for(i=0; i < argvCnt; i++) {
         _argv[i] = argv[i];
+        fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
     }
     _argv[argvCnt] = NULL;
     
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 854b71c..d48ae74 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -113,9 +113,53 @@ static void set_x11_path() {
     }
 }
 
+#ifdef NEW_LAUNCH_METHOD
+static int create_socket(char *filename_out) {
+    struct sockaddr_un servaddr_un;
+    struct sockaddr *servaddr;
+    socklen_t servaddr_len;
+    int ret_fd;
+    size_t try, try_max;
+
+    for(try=0, try_max=5; try < try_max; try++) {
+        tmpnam(filename_out);
+
+        /* Setup servaddr_un */
+        memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
+        servaddr_un.sun_family = AF_UNIX;
+        strlcpy(servaddr_un.sun_path, filename_out, sizeof(servaddr_un.sun_path));
+        
+        servaddr = (struct sockaddr *) &servaddr_un;
+        servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out);
+        
+        ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
+        if(ret_fd == 0) {
+            fprintf(stderr, "Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
+            continue;
+        }
+        
+        if(bind(ret_fd, servaddr, servaddr_len) != 0) {
+            fprintf(stderr, "Failed to bind socket: %s - %s\n", filename_out, strerror(errno));
+            close(ret_fd);
+            return 0;
+        }
+
+        if(listen(ret_fd, 10) != 0) {
+            fprintf(stderr, "Failed to listen to socket: %s - %s\n", filename_out, strerror(errno));
+            close(ret_fd);
+            return 0;
+        }
+        
+        return ret_fd;
+    }
+    
+    return 0;
+}
+
 static void send_fd_handoff(int handoff_fd, int launchd_fd) {
     char databuf[] = "display";
     struct iovec iov[1];
+    int connected_fd;
     
     iov[0].iov_base = databuf;
     iov[0].iov_len  = sizeof(databuf);
@@ -143,44 +187,21 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) {
     
     *((int*)CMSG_DATA(cmsg)) = launchd_fd;
     
-    if (sendmsg(handoff_fd, &msg, 0) < 0) {
-        fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno));
+    connected_fd = accept(handoff_fd, NULL, NULL);
+    if(connected_fd == -1) {
+        fprintf(stderr, "Failed to accept incoming connection on socket: %s\n", strerror(errno));
         return;
     }
-
-    fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
-}
-
-static void handoff_fd(const char *filename, int launchd_fd) {
-    struct sockaddr_un servaddr_un;
-    struct sockaddr *servaddr;
-    socklen_t servaddr_len;
-    int handoff_fd;
-
-    /* Setup servaddr_un */
-    memset (&servaddr_un, 0, sizeof (struct sockaddr_un));
-    servaddr_un.sun_family = AF_UNIX;
-    strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path));
-
-    servaddr = (struct sockaddr *) &servaddr_un;
-    servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename);
-
-    handoff_fd = socket(PF_UNIX, SOCK_STREAM, 0);
-    if(handoff_fd == 0) {
-        fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno));
-        return;
-    }
-
-    if(connect(handoff_fd, servaddr, servaddr_len) < 0) {
-        fprintf(stderr, "Failed to establish connection on socket: %s - %s\n", filename, strerror(errno));
+    
+    if(sendmsg(connected_fd, &msg, 0) < 0) {
+        fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno));
         return;
     }
 
-    fprintf(stderr, "Socket: %s\n", filename);
-
-    send_fd_handoff(handoff_fd, launchd_fd);
-    close(handoff_fd);
+    close(connected_fd);
+    fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
 }
+#endif
 
 int main(int argc, char **argv, char **envp) {
 #ifdef NEW_LAUNCH_METHOD
@@ -191,7 +212,7 @@ int main(int argc, char **argv, char **envp) {
     string_array_t newargv;
     size_t i;
     int launchd_fd;
-    string_t handoff_socket;
+    string_t handoff_socket_filename;
 #endif
 
     if(argc == 2 && !strcmp(argv[1], "-version")) {
@@ -241,9 +262,15 @@ int main(int argc, char **argv, char **envp) {
     
     /* Handoff the $DISPLAY FD */
     if(launchd_fd != -1) {
-        tmpnam(handoff_socket);
-        if(prep_fd_handoff(mp, handoff_socket) == KERN_SUCCESS) {
-            handoff_fd(handoff_socket, launchd_fd);
+        int handoff_fd = create_socket(handoff_socket_filename);
+        
+        if((handoff_fd != 0) &&
+           (prep_fd_handoff(mp, handoff_socket_filename) == KERN_SUCCESS)) {
+            send_fd_handoff(handoff_fd, launchd_fd);
+            
+            // Cleanup
+            close(handoff_fd);
+            unlink(handoff_socket_filename);
         } else {
             fprintf(stderr, "Unable to hand of $DISPLAY file descriptor\n");
         }


More information about the xorg-commit mailing list