[X2Go-Commits] [vcxsrv] 07/13: libXft mesa xserver pixman xkeyboard-config git update 25 Oct 2014

git-admin at x2go.org git-admin at x2go.org
Mon Mar 9 05:11:41 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to annotated tag 1.16.2.0
in repository vcxsrv.

commit d6d5581d5fba846c8476ad4d593da662306765d7
Author: marha <marha at users.sourceforge.net>
Date:   Sat Oct 25 19:53:22 2014 +0200

    libXft mesa xserver pixman xkeyboard-config git update 25 Oct 2014
    
    xserver          commit 16a32c53f6e9ad1f3284d4596edfa33e9efb740e
    xkeyboard-config commit 0d4c3d9d891536aa1ec4f1fff5e3df51cfd2718d
    pixman           commit 594e6a6c93e92fcfb495e987aec5617f6c37f467
    libXft           commit e8a83226bc10afb587f6f34daac44d2ef809c85e
    mesa             commit 13862812dc910a4ef57cb72cb9fe777ce3c14515
---
 libXft/src/xftdpy.c                                |    4 +
 libXft/src/xftdraw.c                               |   71 +-
 libXft/src/xftint.h                                |    1 +
 mesalib/configure.ac                               |   12 +-
 mesalib/docs/GL3.txt                               |    2 +-
 mesalib/docs/index.html                            |    6 +
 mesalib/docs/relnotes.html                         |    1 +
 mesalib/docs/relnotes/10.3.2.html                  |  115 +++
 mesalib/docs/relnotes/10.4.html                    |    1 +
 mesalib/scons/llvm.py                              |   16 +-
 mesalib/src/gallium/auxiliary/util/u_blitter.c     |   77 +-
 mesalib/src/gallium/auxiliary/util/u_math.h        |    2 +-
 mesalib/src/glsl/ast_array_index.cpp               |    6 +-
 mesalib/src/glsl/ast_to_hir.cpp                    |  107 ++-
 mesalib/src/glsl/glsl_parser_extras.h              |    4 +-
 mesalib/src/glsl/ir_uniform.h                      |   11 -
 mesalib/src/glsl/linker.cpp                        |   18 +-
 mesalib/src/glsl/lower_offset_array.cpp            |   10 +-
 mesalib/src/glsl/main.cpp                          |    2 +
 mesalib/src/glsl/opt_array_splitting.cpp           |    2 +-
 mesalib/src/glsl/standalone_scaffolding.cpp        |   27 +
 mesalib/src/glsl/standalone_scaffolding.h          |    3 +
 mesalib/src/mapi/glapi/gen/ARB_clip_control.xml    |   25 +
 mesalib/src/mapi/glapi/gen/Makefile.am             |    1 +
 mesalib/src/mapi/glapi/gen/gl_API.xml              |    4 +-
 mesalib/src/mapi/glapi/gen/gl_gentable.py          |    4 +-
 mesalib/src/mesa/drivers/common/meta.c             |    9 +
 mesalib/src/mesa/drivers/common/meta.h             |    3 +
 mesalib/src/mesa/main/attrib.c                     |    1 +
 mesalib/src/mesa/main/bufferobj.c                  |    4 +-
 mesalib/src/mesa/main/context.c                    |   12 +
 mesalib/src/mesa/main/dd.h                         |    3 +-
 mesalib/src/mesa/main/dlist.c                      |   26 +
 mesalib/src/mesa/main/extensions.c                 |    1 +
 mesalib/src/mesa/main/ff_fragment_shader.cpp       |   14 +-
 mesalib/src/mesa/main/get.c                        |    1 +
 mesalib/src/mesa/main/get_hash_params.py           |    2 +
 mesalib/src/mesa/main/mtypes.h                     |    7 +-
 mesalib/src/mesa/main/polygon.c                    |    2 -
 mesalib/src/mesa/main/shaderapi.c                  |    2 +-
 mesalib/src/mesa/main/shaderapi.h                  |    9 -
 mesalib/src/mesa/main/shaderimage.c                |    2 +-
 mesalib/src/mesa/main/shaderobj.c                  |   28 +-
 mesalib/src/mesa/main/shaderobj.h                  |    6 +-
 mesalib/src/mesa/main/state.c                      |   25 +-
 mesalib/src/mesa/main/uniform_query.cpp            |   74 +-
 mesalib/src/mesa/main/uniforms.c                   |   22 +-
 mesalib/src/mesa/main/uniforms.h                   |    2 +-
 mesalib/src/mesa/main/version.c                    |    2 -
 mesalib/src/mesa/main/viewport.c                   |  122 ++-
 mesalib/src/mesa/main/viewport.h                   |    6 +
 mesalib/src/mesa/math/m_matrix.c                   |   17 +-
 mesalib/src/mesa/math/m_matrix.h                   |    4 +-
 mesalib/src/mesa/program/ir_to_mesa.cpp            |    2 +-
 .../src/mesa/state_tracker/st_atom_rasterizer.c    |   25 +-
 mesalib/src/mesa/state_tracker/st_atom_viewport.c  |   23 +-
 mesalib/src/mesa/state_tracker/st_cb_program.c     |    2 -
 mesalib/src/mesa/state_tracker/st_debug.c          |    1 +
 mesalib/src/mesa/state_tracker/st_debug.h          |    1 +
 mesalib/src/mesa/state_tracker/st_extensions.c     |    9 +-
 mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   47 +-
 mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h   |    5 -
 mesalib/src/util/macros.h                          |   14 +
 mesalib/src/util/register_allocate.c               |    2 +-
 pixman/pixman/pixman-mmx.c                         |    6 +
 xorg-server/Xext/panoramiXprocs.c                  |    2 +-
 xorg-server/configure.ac                           |    2 -
 xorg-server/fb/fbpict.c                            |    2 +-
 xorg-server/glx/glxdri2.c                          |    4 +-
 xorg-server/hw/kdrive/ephyr/ephyr.c                |   12 +-
 xorg-server/hw/kdrive/ephyr/ephyrinit.c            |    6 +
 xorg-server/hw/kdrive/ephyr/man/Xephyr.man         |    3 +
 xorg-server/hw/xwin/InitOutput.c                   |    6 -
 xorg-server/hw/xwin/Makefile.am                    |   21 -
 xorg-server/hw/xwin/man/XWin.man                   |    4 -
 xorg-server/hw/xwin/win.h                          |  182 -----
 xorg-server/hw/xwin/winclip.c                      |   42 -
 xorg-server/hw/xwin/wincreatewnd.c                 |   22 +-
 xorg-server/hw/xwin/winengine.c                    |   23 -
 xorg-server/hw/xwin/winfillsp.c                    |  842 --------------------
 xorg-server/hw/xwin/winfont.c                      |   82 --
 xorg-server/hw/xwin/wingc.c                        |  235 ------
 xorg-server/hw/xwin/wingetsp.c                     |  171 ----
 xorg-server/hw/xwin/winmisc.c                      |   63 --
 xorg-server/hw/xwin/winnativegdi.c                 |  491 ------------
 xorg-server/hw/xwin/winpfbdd.c                     |  620 --------------
 xorg-server/hw/xwin/winpixmap.c                    |  223 ------
 xorg-server/hw/xwin/winpolyline.c                  |   53 --
 xorg-server/hw/xwin/winrop.c                       |  142 ----
 xorg-server/hw/xwin/winscrinit.c                   |  139 ----
 xorg-server/hw/xwin/winsetsp.c                     |  175 ----
 xorg-server/hw/xwin/winwindow.c                    |  219 -----
 xorg-server/hw/xwin/winwndproc.c                   |   12 +-
 xorg-server/mi/mibitblt.c                          |   13 +-
 xorg-server/mi/mifillrct.c                         |    2 +-
 xorg-server/os/utils.c                             |    1 +
 xorg-server/render/mipict.c                        |   34 +-
 xorg-server/render/mirect.c                        |    2 +-
 xorg-server/render/picture.c                       |    1 -
 xorg-server/render/picturestr.h                    |    3 +-
 xorg-server/xfixes/region.c                        |   14 +-
 xorg-server/xkeyboard-config/rules/base.xml.in     |   12 +
 xorg-server/xkeyboard-config/symbols/keypad        |   49 +-
 .../xkeyboard-config/symbols/macintosh_vndr/ch     |    1 +
 .../xkeyboard-config/symbols/macintosh_vndr/dk     |    2 +-
 .../xkeyboard-config/symbols/macintosh_vndr/it     |    1 +
 .../xkeyboard-config/symbols/macintosh_vndr/us     |    4 +-
 xorg-server/xkeyboard-config/symbols/ru            |   71 ++
 108 files changed, 878 insertions(+), 4205 deletions(-)

diff --git a/libXft/src/xftdpy.c b/libXft/src/xftdpy.c
index c5b756e..62b1ccf 100644
--- a/libXft/src/xftdpy.c
+++ b/libXft/src/xftdpy.c
@@ -106,6 +106,10 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary)
 	if (major < 0 || (major == 0 && minor <= 2))
 	    info->use_free_glyphs = FcFalse;
 
+	info->hasSolid = FcFalse;
+	if (major > 0 || (major == 0 && minor >= 10))
+	    info->hasSolid = FcTrue;
+
 	pf.type = PictTypeDirect;
 	pf.depth = 32;
 	pf.direct.redMask = 0xff;
diff --git a/libXft/src/xftdraw.c b/libXft/src/xftdraw.c
index 186bcb8..dfa97fb 100644
--- a/libXft/src/xftdraw.c
+++ b/libXft/src/xftdraw.c
@@ -333,39 +333,52 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color)
      * Pick one to replace at random
      */
     i = (unsigned int) rand () % XFT_NUM_SOLID_COLOR;
-    /*
-     * Recreate if it was for the wrong screen
-     */
-    if (info->colors[i].screen != draw->screen && info->colors[i].pict)
-    {
-	XRenderFreePicture (dpy, info->colors[i].pict);
-	info->colors[i].pict = 0;
-    }
-    /*
-     * Create picture if necessary
-     */
-    if (!info->colors[i].pict)
-    {
-	Pixmap			    pix;
-        XRenderPictureAttributes    pa;
 
-	pix = XCreatePixmap (dpy, RootWindow (dpy, draw->screen), 1, 1,
-			     info->solidFormat->depth);
-	pa.repeat = True;
-	info->colors[i].pict = XRenderCreatePicture (draw->dpy,
-						     pix,
-						     info->solidFormat,
-						     CPRepeat, &pa);
-	XFreePixmap (dpy, pix);
+    if (info->hasSolid) {
+	/*
+	 * Free any existing entry
+	 */
+	if (info->colors[i].pict)
+	    XRenderFreePicture (dpy, info->colors[i].pict);
+	/*
+	 * Create picture
+	 */
+	info->colors[i].pict = XRenderCreateSolidFill (draw->dpy, &color->color);
+    } else {
+	if (info->colors[i].screen != draw->screen && info->colors[i].pict)
+	{
+	    XRenderFreePicture (dpy, info->colors[i].pict);
+	    info->colors[i].pict = 0;
+	}
+	/*
+	 * Create picture if necessary
+	 */
+	if (!info->colors[i].pict)
+	{
+	    Pixmap			    pix;
+	    XRenderPictureAttributes    pa;
+
+	    pix = XCreatePixmap (dpy, RootWindow (dpy, draw->screen), 1, 1,
+				 info->solidFormat->depth);
+	    pa.repeat = True;
+	    info->colors[i].pict = XRenderCreatePicture (draw->dpy,
+							 pix,
+							 info->solidFormat,
+							 CPRepeat, &pa);
+	    XFreePixmap (dpy, pix);
+	}
+	/*
+	 * Set to the new color
+	 */
+	info->colors[i].color = color->color;
+	info->colors[i].screen = draw->screen;
+	XRenderFillRectangle (dpy, PictOpSrc,
+			      info->colors[i].pict,
+			      &color->color, 0, 0, 1, 1);
     }
-    /*
-     * Set to the new color
-     */
     info->colors[i].color = color->color;
     info->colors[i].screen = draw->screen;
-    XRenderFillRectangle (dpy, PictOpSrc,
-			  info->colors[i].pict,
-			  &color->color, 0, 0, 1, 1);
+
     return info->colors[i].pict;
 }
 
diff --git a/libXft/src/xftint.h b/libXft/src/xftint.h
index 1658977..c06ac3c 100644
--- a/libXft/src/xftint.h
+++ b/libXft/src/xftint.h
@@ -245,6 +245,7 @@ typedef struct _XftDisplayInfo {
     XExtCodes		    *codes;
     FcPattern		    *defaults;
     FcBool		    hasRender;
+    FcBool		    hasSolid;
     XftFont		    *fonts;
     XRenderPictFormat	    *solidFormat;
     unsigned long	    glyph_memory;
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 0ed9325..03f1bca 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1465,6 +1465,7 @@ AC_ARG_WITH([clang-libdir],
    [CLANG_LIBDIR=''])
 
 PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
+AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf])
 
 if test "x$enable_opencl" = xyes; then
     if test -z "$with_gallium_drivers"; then
@@ -1495,6 +1496,10 @@ if test "x$enable_opencl" = xyes; then
     else
         OPENCL_LIBNAME="OpenCL"
     fi
+
+    if test "x$have_libelf" != xyes; then
+       AC_MSG_ERROR([Clover requires libelf])
+    fi
 fi
 AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
 AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
@@ -1714,7 +1719,7 @@ if test "x$enable_gallium_llvm" = xyes; then
         fi
 
         LLVM_REQUIRED_VERSION_MAJOR="3"
-        LLVM_REQUIRED_VERSION_MINOR="1"
+        LLVM_REQUIRED_VERSION_MINOR="3"
         if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
             AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
         fi
@@ -1870,8 +1875,9 @@ radeon_llvm_check() {
     fi
     LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo"
     NEED_RADEON_LLVM=yes
-    AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf],
-                                 [AC_MSG_ERROR([$1 requires libelf when using LLVM])])
+    if test "x$have_libelf" != xyes; then
+       AC_MSG_ERROR([$1 requires libelf when using llvm])
+    fi
 }
 
 dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 07d1d2c..6a988d5 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40:
 GL 4.5, GLSL 4.50:
 
   GL_ARB_ES3_1_compatibility                           not started
-  GL_ARB_clip_control                                  not started
+  GL_ARB_clip_control                                  DONE (llvmpipe, softpipe, r300, r600, radeonsi)
   GL_ARB_conditional_render_inverted                   DONE (i965, nvc0, llvmpipe, softpipe)
   GL_ARB_cull_distance                                 not started
   GL_ARB_derivative_control                            DONE (i965, nv50, nvc0, r600)
diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html
index 244a7a3..0a491a2 100644
--- a/mesalib/docs/index.html
+++ b/mesalib/docs/index.html
@@ -16,6 +16,12 @@
 
 <h1>News</h1>
 
+<h2>October 24, 2014</h2>
+<p>
+<a href="relnotes/10.3.2.html">Mesa 10.3.2</a> is released.
+This is a bug-fix release.
+</p>
+
 <h2>October 12, 2014</h2>
 <p>
 <a href="relnotes/10.2.9.html">Mesa 10.2.9</a>
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index d546e85..1c97edd 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -21,6 +21,7 @@ The release notes summarize what's new or changed in each Mesa release.
 </p>
 
 <ul>
+<li><a href="relnotes/10.3.2.html">10.3.2 release notes</a>
 <li><a href="relnotes/10.3.1.html">10.3.1 release notes</a>
 <li><a href="relnotes/10.2.9.html">10.2.9 release notes</a>
 <li><a href="relnotes/10.3.html">10.3 release notes</a>
diff --git a/mesalib/docs/relnotes/10.3.2.html b/mesalib/docs/relnotes/10.3.2.html
new file mode 100644
index 0000000..4c08f65
--- /dev/null
+++ b/mesalib/docs/relnotes/10.3.2.html
@@ -0,0 +1,115 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <title>Mesa Release Notes</title>
+  <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+  <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.3.2 Release Notes / October 24, 2014</h1>
+
+<p>
+Mesa 10.3.2 is a bug fix release which fixes bugs found since the 10.3 release.
+</p>
+<p>
+Mesa 10.3.2 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3.  OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts are not supported.
+</p>
+
+<h2>SHA256 checksums</h2>
+<pre>
+e65f8e691f06f111c1aeb3a376b13c9cc88cb162bee2709e0e7e6b0e6628ca75  MesaLib-10.3.2.tar.gz
+e9849bcb9aa9acd98a753d6d46d2e7d7238d3367036e11357a60efd16de8bea3  MesaLib-10.3.2.tar.bz2
+427dc0d670d38e713ebff2675665ec2fe4ff7d04ce227bd54de946999fc1d234  MesaLib-10.3.2.zip
+</pre>
+
+<h2>New features</h2>
+<p>None</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=54372">Bug 54372</a> - GLX_INTEL_swap_event crashes driver when swapping window buffers</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=81680">Bug 81680</a> - [r600g] Firefox crashes with hardware acceleration turned on</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84140">Bug 84140</a> - mplayer crashes playing some files using vdpau output</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=84662">Bug 84662</a> - Long pauses with Unreal demo Elemental on R9270X since : Always flush the HDP cache before submitting a CS to the GPU</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85267">Bug 85267</a> - vlc crashes with vdpau (Radeon 3850HD) [r600]</li>
+
+</ul>
+
+<h2>Changes</h2>
+
+<p>Brian Paul (3):</p>
+<ul>
+  <li>mesa: fix spurious wglGetProcAddress / GL_INVALID_OPERATION error</li>
+  <li>st/wgl: add WINAPI qualifiers on wgl function typedefs</li>
+  <li>glsl: fix several use-after-free bugs</li>
+</ul>
+
+<p>Daniel Manjarres (1):</p>
+<ul>
+  <li>glx: Fix glxUseXFont for glxWindow and glxPixmaps</li>
+</ul>
+
+<p>Dave Airlie (1):</p>
+<ul>
+  <li>mesa: fix GetTexImage for 1D array depth textures</li>
+</ul>
+
+<p>Emil Velikov (2):</p>
+<ul>
+  <li>docs: Add sha256 sums for the 10.3.1 release</li>
+  <li>Update VERSION to 10.3.2</li>
+</ul>
+
+<p>Ilia Mirkin (4):</p>
+<ul>
+  <li>gm107/ir: add dnz emission for fmul</li>
+  <li>gk110/ir: add dnz flag emission for fmul/fmad</li>
+  <li>nouveau: 3d textures are unsupported, limit 3d levels to 1</li>
+  <li>st/gbm: fix order of arguments passed to is_format_supported</li>
+</ul>
+
+<p>Kenneth Graunke (3):</p>
+<ul>
+  <li>i965: Add a BRW_MOCS_PTE #define.</li>
+  <li>i965: Use BDW_MOCS_PTE for renderbuffers.</li>
+  <li>i965: Fix register write checks.</li>
+</ul>
+
+<p>Marek Olšák (2):</p>
+<ul>
+  <li>st/mesa: use pipe_sampler_view_release for releasing sampler views</li>
+  <li>glsl_to_tgsi: fix the value of gl_FrontFacing with native integers</li>
+</ul>
+
+<p>Michel Dänzer (4):</p>
+<ul>
+  <li>radeonsi: Clear sampler view flags when binding a buffer</li>
+  <li>r600g,radeonsi: Always use GTT again for PIPE_USAGE_STREAM buffers</li>
+  <li>winsys/radeon: Use separate caching buffer manager for each set of flags</li>
+  <li>r600g: Drop references to destroyed blend state</li>
+</ul>
+
+</div>
+</body>
+</html>
diff --git a/mesalib/docs/relnotes/10.4.html b/mesalib/docs/relnotes/10.4.html
index 64cbfae..67c3087 100644
--- a/mesalib/docs/relnotes/10.4.html
+++ b/mesalib/docs/relnotes/10.4.html
@@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers.
 <ul>
 <li>GL_ARB_sample_shading on r600</li>
 <li>GL_ARB_texture_view on nv50, nvc0</li>
+<li>GL_ARB_clip_control on llvmpipe, softpipe, r300, r600, radeonsi</li>
 </ul>
 
 
diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py
index 288a080..1e312f9 100644
--- a/mesalib/scons/llvm.py
+++ b/mesalib/scons/llvm.py
@@ -37,7 +37,7 @@ import SCons.Errors
 import SCons.Util
 
 
-required_llvm_version = '3.1'
+required_llvm_version = '3.3'
 
 
 def generate(env):
@@ -98,7 +98,7 @@ def generate(env):
             'HAVE_STDINT_H',
         ])
         env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
-        if llvm_version >= distutils.version.LooseVersion('3.2'):
+        if True:
             # 3.2
             env.Prepend(LIBS = [
                 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
@@ -110,18 +110,6 @@ def generate(env):
                 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
                 'LLVMSupport', 'LLVMRuntimeDyld', 'LLVMObject'
             ])
-        else:
-            # 3.1
-            env.Prepend(LIBS = [
-                'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
-                'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
-                'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter',
-                'LLVMX86Utils', 'LLVMX86Info', 'LLVMMCJIT', 'LLVMJIT',
-                'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts',
-                'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
-                'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
-                'LLVMSupport'
-            ])
         env.Append(LIBS = [
             'imagehlp',
             'psapi',
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index f3fe949..e59fa04 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -134,6 +134,7 @@ struct blitter_context_priv
    boolean has_stream_out;
    boolean has_stencil_export;
    boolean has_texture_multisample;
+   boolean cached_all_shaders;
 
    /* The Draw module overrides these functions.
     * Always create the blitter before Draw. */
@@ -356,10 +357,11 @@ static void bind_fs_empty(struct blitter_context_priv *ctx)
    struct pipe_context *pipe = ctx->base.pipe;
 
    if (!ctx->fs_empty) {
+      assert(!ctx->cached_all_shaders);
       ctx->fs_empty = util_make_empty_fragment_shader(pipe);
    }
 
-   pipe->bind_fs_state(pipe, ctx->fs_empty);
+   ctx->bind_fs_state(pipe, ctx->fs_empty);
 }
 
 static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx)
@@ -367,12 +369,13 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx)
    struct pipe_context *pipe = ctx->base.pipe;
 
    if (!ctx->fs_write_one_cbuf) {
+      assert(!ctx->cached_all_shaders);
       ctx->fs_write_one_cbuf =
          util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
                                                TGSI_INTERPOLATE_CONSTANT, FALSE);
    }
 
-   pipe->bind_fs_state(pipe, ctx->fs_write_one_cbuf);
+   ctx->bind_fs_state(pipe, ctx->fs_write_one_cbuf);
 }
 
 static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx)
@@ -380,12 +383,13 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx)
    struct pipe_context *pipe = ctx->base.pipe;
 
    if (!ctx->fs_write_all_cbufs) {
+      assert(!ctx->cached_all_shaders);
       ctx->fs_write_all_cbufs =
          util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
                                                TGSI_INTERPOLATE_CONSTANT, TRUE);
    }
 
-   pipe->bind_fs_state(pipe, ctx->fs_write_all_cbufs);
+   ctx->bind_fs_state(pipe, ctx->fs_write_all_cbufs);
 }
 
 void util_blitter_destroy(struct blitter_context *blitter)
@@ -850,6 +854,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
             shader = &ctx->fs_resolve[target][index][filter];
 
          if (!*shader) {
+            assert(!ctx->cached_all_shaders);
             if (filter == PIPE_TEX_FILTER_LINEAR) {
                *shader = util_make_fs_msaa_resolve_bilinear(pipe, tgsi_tex,
                                                    src_nr_samples,
@@ -870,6 +875,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
 
          /* Create the fragment shader on-demand. */
          if (!*shader) {
+            assert(!ctx->cached_all_shaders);
             *shader = util_make_fs_blit_msaa_color(pipe, tgsi_tex);
          }
       }
@@ -880,6 +886,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
+         assert(!ctx->cached_all_shaders);
          *shader = util_make_fragment_tex_shader(pipe, tgsi_tex,
                                                  TGSI_INTERPOLATE_LINEAR);
       }
@@ -902,11 +909,10 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
-                                                       nr_samples);
-
-         *shader =
-            util_make_fs_blit_msaa_depth(pipe, tgsi_tex);
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+         *shader = util_make_fs_blit_msaa_depth(pipe, tgsi_tex);
       }
 
       return *shader;
@@ -915,8 +921,9 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
                                                      TGSI_INTERPOLATE_LINEAR);
@@ -940,11 +947,10 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
-                                                       nr_samples);
-
-         *shader =
-            util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex);
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+         *shader = util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex);
       }
 
       return *shader;
@@ -953,8 +959,9 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
                                                      TGSI_INTERPOLATE_LINEAR);
@@ -978,11 +985,10 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target,
-                                                       nr_samples);
-
-         *shader =
-            util_make_fs_blit_msaa_stencil(pipe, tgsi_tex);
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples);
+         *shader = util_make_fs_blit_msaa_stencil(pipe, tgsi_tex);
       }
 
       return *shader;
@@ -991,8 +997,9 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
 
       /* Create the fragment shader on-demand. */
       if (!*shader) {
-         unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
-
+         unsigned tgsi_tex;
+         assert(!ctx->cached_all_shaders);
+         tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0);
          *shader =
             util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
                                                        TGSI_INTERPOLATE_LINEAR);
@@ -1002,10 +1009,18 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
    }
 }
 
+
+/**
+ * Generate and save all fragment shaders that we will ever need for
+ * blitting.  Drivers which use the 'draw' fallbacks will typically use
+ * this to make sure we generate/use shaders that don't go through the
+ * draw module's wrapper functions.
+ */
 void util_blitter_cache_all_shaders(struct blitter_context *blitter)
 {
    struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
-   struct pipe_screen *screen = blitter->pipe->screen;
+   struct pipe_context *pipe = blitter->pipe;
+   struct pipe_screen *screen = pipe->screen;
    unsigned samples, j, f, target, max_samples;
    boolean has_arraytex, has_cubearraytex;
 
@@ -1065,6 +1080,18 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter)
          }
       }
    }
+
+   ctx->fs_empty = util_make_empty_fragment_shader(pipe);
+
+   ctx->fs_write_one_cbuf =
+      util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
+                                            TGSI_INTERPOLATE_CONSTANT, FALSE);
+
+   ctx->fs_write_all_cbufs =
+      util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC,
+                                            TGSI_INTERPOLATE_CONSTANT, TRUE);
+
+   ctx->cached_all_shaders = TRUE;
 }
 
 static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx,
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index f95c111..0113fb1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -799,7 +799,7 @@ util_bswap64(uint64_t n)
 #if defined(HAVE___BUILTIN_BSWAP64)
    return __builtin_bswap64(n);
 #else
-   return ((uint64_t)util_bswap32(n) << 32) |
+   return ((uint64_t)util_bswap32((uint32_t)n) << 32) |
           util_bswap32((n >> 32));
 #endif
 }
diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp
index 49a8574..ff0c757 100644
--- a/mesalib/src/glsl/ast_array_index.cpp
+++ b/mesalib/src/glsl/ast_array_index.cpp
@@ -49,12 +49,12 @@ ast_array_specifier::print(void) const
  * loc and state to report the error.
  */
 static void
-update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
+update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc,
                         struct _mesa_glsl_parse_state *state)
 {
    if (ir_dereference_variable *deref_var = ir->as_dereference_variable()) {
       ir_variable *var = deref_var->var;
-      if (idx > var->data.max_array_access) {
+      if (idx > (int)var->data.max_array_access) {
          var->data.max_array_access = idx;
 
          /* Check whether this access will, as a side effect, implicitly cause
@@ -94,7 +94,7 @@ update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
 
             assert(max_ifc_array_access != NULL);
 
-            if (idx > max_ifc_array_access[field_index]) {
+            if (idx > (int)max_ifc_array_access[field_index]) {
                max_ifc_array_access[field_index] = idx;
 
                /* Check whether this access will, as a side effect, implicitly
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 068af29..fe1e129 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3767,7 +3767,7 @@ ast_declarator_list::hir(exec_list *instructions,
              earlier->data.how_declared == ir_var_declared_in_block) {
             _mesa_glsl_error(&loc, state,
                              "`%s' has already been redeclared using "
-                             "gl_PerVertex", var->name);
+                             "gl_PerVertex", earlier->name);
          }
          earlier->data.how_declared = ir_var_declared_normally;
       }
@@ -4373,7 +4373,7 @@ ast_jump_statement::hir(exec_list *instructions,
           * loop.
           */
          if (state->loop_nesting_ast != NULL &&
-             mode == ast_continue) {
+             mode == ast_continue && !state->switch_state.is_switch_innermost) {
             if (state->loop_nesting_ast->rest_expression) {
                state->loop_nesting_ast->rest_expression->hir(instructions,
                                                              state);
@@ -4385,19 +4385,27 @@ ast_jump_statement::hir(exec_list *instructions,
          }
 
          if (state->switch_state.is_switch_innermost &&
+             mode == ast_continue) {
+            /* Set 'continue_inside' to true. */
+            ir_rvalue *const true_val = new (ctx) ir_constant(true);
+            ir_dereference_variable *deref_continue_inside_var =
+               new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+            instructions->push_tail(new(ctx) ir_assignment(deref_continue_inside_var,
+                                                           true_val));
+
+            /* Break out from the switch, continue for the loop will
+             * be called right after switch. */
+            ir_loop_jump *const jump =
+               new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+            instructions->push_tail(jump);
+
+         } else if (state->switch_state.is_switch_innermost &&
              mode == ast_break) {
-            /* Force break out of switch by setting is_break switch state.
-             */
-            ir_variable *const is_break_var = state->switch_state.is_break_var;
-            ir_dereference_variable *const deref_is_break_var =
-               new(ctx) ir_dereference_variable(is_break_var);
-            ir_constant *const true_val = new(ctx) ir_constant(true);
-            ir_assignment *const set_break_var =
-               new(ctx) ir_assignment(deref_is_break_var, true_val);
-	    
-            instructions->push_tail(set_break_var);
-         }
-         else {
+            /* Force break out of switch by inserting a break. */
+            ir_loop_jump *const jump =
+               new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+            instructions->push_tail(jump);
+         } else {
             ir_loop_jump *const jump =
                new(ctx) ir_loop_jump((mode == ast_break)
                   ? ir_loop_jump::jump_break
@@ -4509,19 +4517,19 @@ ast_switch_statement::hir(exec_list *instructions,
    instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
                                                   is_fallthru_val));
 
-   /* Initalize is_break state to false.
+   /* Initialize continue_inside state to false.
     */
-   ir_rvalue *const is_break_val = new (ctx) ir_constant(false);
-   state->switch_state.is_break_var =
+   state->switch_state.continue_inside =
       new(ctx) ir_variable(glsl_type::bool_type,
-                           "switch_is_break_tmp",
+                           "continue_inside_tmp",
                            ir_var_temporary);
-   instructions->push_tail(state->switch_state.is_break_var);
+   instructions->push_tail(state->switch_state.continue_inside);
 
-   ir_dereference_variable *deref_is_break_var =
-      new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
-   instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
-                                                  is_break_val));
+   ir_rvalue *const false_val = new (ctx) ir_constant(false);
+   ir_dereference_variable *deref_continue_inside_var =
+      new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+   instructions->push_tail(new(ctx) ir_assignment(deref_continue_inside_var,
+                                                  false_val));
 
    state->switch_state.run_default =
       new(ctx) ir_variable(glsl_type::bool_type,
@@ -4529,13 +4537,42 @@ ast_switch_statement::hir(exec_list *instructions,
                              ir_var_temporary);
    instructions->push_tail(state->switch_state.run_default);
 
+   /* Loop around the switch is used for flow control. */
+   ir_loop * loop = new(ctx) ir_loop();
+   instructions->push_tail(loop);
+
    /* Cache test expression.
     */
-   test_to_hir(instructions, state);
+   test_to_hir(&loop->body_instructions, state);
 
    /* Emit code for body of switch stmt.
     */
-   body->hir(instructions, state);
+   body->hir(&loop->body_instructions, state);
+
+   /* Insert a break at the end to exit loop. */
+   ir_loop_jump *jump = new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
+   loop->body_instructions.push_tail(jump);
+
+   /* If we are inside loop, check if continue got called inside switch. */
+   if (state->loop_nesting_ast != NULL) {
+      ir_dereference_variable *deref_continue_inside =
+         new(ctx) ir_dereference_variable(state->switch_state.continue_inside);
+      ir_if *irif = new(ctx) ir_if(deref_continue_inside);
+      ir_loop_jump *jump = new(ctx) ir_loop_jump(ir_loop_jump::jump_continue);
+
+      if (state->loop_nesting_ast != NULL) {
+         if (state->loop_nesting_ast->rest_expression) {
+            state->loop_nesting_ast->rest_expression->hir(&irif->then_instructions,
+                                                          state);
+         }
+         if (state->loop_nesting_ast->mode ==
+             ast_iteration_statement::ast_do_while) {
+            state->loop_nesting_ast->condition_to_hir(&irif->then_instructions, state);
+         }
+      }
+      irif->then_instructions.push_tail(jump);
+      instructions->push_tail(irif);
+   }
 
    hash_table_dtor(state->switch_state.labels_ht);
 
@@ -4659,18 +4696,6 @@ ast_case_statement::hir(exec_list *instructions,
 {
    labels->hir(instructions, state);
 
-   /* Conditionally set fallthru state based on break state. */
-   ir_constant *const false_val = new(state) ir_constant(false);
-   ir_dereference_variable *const deref_is_fallthru_var =
-      new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
-   ir_dereference_variable *const deref_is_break_var =
-      new(state) ir_dereference_variable(state->switch_state.is_break_var);
-   ir_assignment *const reset_fallthru_on_break =
-      new(state) ir_assignment(deref_is_fallthru_var,
-                               false_val,
-                               deref_is_break_var);
-   instructions->push_tail(reset_fallthru_on_break);
-
    /* Guard case statements depending on fallthru state. */
    ir_dereference_variable *const deref_fallthru_guard =
       new(state) ir_dereference_variable(state->switch_state.is_fallthru_var);
@@ -5681,17 +5706,21 @@ ast_interface_block::hir(exec_list *instructions,
 
          var->data.stream = this->layout.stream;
 
+         /* Examine var name here since var may get deleted in the next call */
+         bool var_is_gl_id = is_gl_identifier(var->name);
+
          if (redeclaring_per_vertex) {
             ir_variable *earlier =
                get_variable_being_redeclared(var, loc, state,
                                              true /* allow_all_redeclarations */);
-            if (!is_gl_identifier(var->name) || earlier == NULL) {
+            if (!var_is_gl_id || earlier == NULL) {
                _mesa_glsl_error(&loc, state,
                                 "redeclaration of gl_PerVertex can only "
                                 "include built-in variables");
             } else if (earlier->data.how_declared == ir_var_declared_normally) {
                _mesa_glsl_error(&loc, state,
-                                "`%s' has already been redeclared", var->name);
+                                "`%s' has already been redeclared",
+                                earlier->name);
             } else {
                earlier->data.how_declared = ir_var_declared_in_block;
                earlier->reinit_interface_type(block_type);
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index c8b9478..c14d74c 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -40,9 +40,11 @@ struct glsl_switch_state {
    /** Temporary variables needed for switch statement. */
    ir_variable *test_var;
    ir_variable *is_fallthru_var;
-   ir_variable *is_break_var;
    class ast_switch_statement *switch_nesting_ast;
 
+   /** Used to detect if 'continue' was called inside a switch. */
+   ir_variable *continue_inside;
+
    /** Used to set condition if 'default' label should be chosen. */
    ir_variable *run_default;
 
diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h
index 2f73528..b9ecf7c 100644
--- a/mesalib/src/glsl/ir_uniform.h
+++ b/mesalib/src/glsl/ir_uniform.h
@@ -45,17 +45,6 @@ extern "C" {
 enum PACKED gl_uniform_driver_format {
    uniform_native = 0,          /**< Store data in the native format. */
    uniform_int_float,           /**< Store integer data as floats. */
-   uniform_bool_float,          /**< Store boolean data as floats. */
-
-   /**
-    * Store boolean data as integer using 1 for \c true.
-    */
-   uniform_bool_int_0_1,
-
-   /**
-    * Store boolean data as integer using ~0 for \c true.
-    */
-   uniform_bool_int_0_not0
 };
 
 struct gl_uniform_driver_storage {
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 47a722d..2d31801 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -1679,7 +1679,7 @@ link_intrastage_shaders(void *mem_ctx,
 
    populate_symbol_table(linked);
 
-   /* The a pointer to the main function in the final linked shader (i.e., the
+   /* The pointer to the main function in the final linked shader (i.e., the
     * copy of the original shader that contained the main function).
     */
    ir_function_signature *const main_sig =
@@ -1882,7 +1882,7 @@ find_available_slots(unsigned used_mask, unsigned needed_count)
 
 
 /**
- * Assign locations for either VS inputs for FS outputs
+ * Assign locations for either VS inputs or FS outputs
  *
  * \param prog          Shader program whose variables need locations assigned
  * \param target_index  Selector for the program target to receive location
@@ -2484,20 +2484,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
    prog->Validated = false;
    prog->_Used = false;
 
-   ralloc_free(prog->InfoLog);
-   prog->InfoLog = ralloc_strdup(NULL, "");
-
-   ralloc_free(prog->UniformBlocks);
-   prog->UniformBlocks = NULL;
-   prog->NumUniformBlocks = 0;
-   for (int i = 0; i < MESA_SHADER_STAGES; i++) {
-      ralloc_free(prog->UniformBlockStageIndex[i]);
-      prog->UniformBlockStageIndex[i] = NULL;
-   }
-
-   ralloc_free(prog->AtomicBuffers);
-   prog->AtomicBuffers = NULL;
-   prog->NumAtomicBuffers = 0;
    prog->ARB_fragment_coord_conventions_enable = false;
 
    /* Separate the shaders into groups based on their type.
diff --git a/mesalib/src/glsl/lower_offset_array.cpp b/mesalib/src/glsl/lower_offset_array.cpp
index 5b48526..c30f801 100644
--- a/mesalib/src/glsl/lower_offset_array.cpp
+++ b/mesalib/src/glsl/lower_offset_array.cpp
@@ -22,7 +22,7 @@
  */
 
 /**
- * \file brw_lower_offset_array.cpp
+ * \file lower_offset_array.cpp
  *
  * IR lower pass to decompose ir_texture ir_tg4 with an array of offsets
  * into four ir_tg4s with a single ivec2 offset, select the .w component of each,
@@ -39,9 +39,9 @@
 
 using namespace ir_builder;
 
-class brw_lower_offset_array_visitor : public ir_rvalue_visitor {
+class lower_offset_array_visitor : public ir_rvalue_visitor {
 public:
-   brw_lower_offset_array_visitor()
+   lower_offset_array_visitor()
    {
       progress = false;
    }
@@ -52,7 +52,7 @@ public:
 };
 
 void
-brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
+lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
 {
    if (*rv == NULL || (*rv)->ir_type != ir_type_texture)
       return;
@@ -83,7 +83,7 @@ brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
 bool
 lower_offset_arrays(exec_list *instructions)
 {
-   brw_lower_offset_array_visitor v;
+   lower_offset_array_visitor v;
 
    visit_list_elements(&v, instructions);
 
diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp
index feed100..9b36a1f 100644
--- a/mesalib/src/glsl/main.cpp
+++ b/mesalib/src/glsl/main.cpp
@@ -403,6 +403,8 @@ main(int argc, char **argv)
    }
 
    if ((status == EXIT_SUCCESS) && do_link)  {
+      _mesa_clear_shader_program_data(whole_program);
+
       link_shaders(ctx, whole_program);
       status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
 
diff --git a/mesalib/src/glsl/opt_array_splitting.cpp b/mesalib/src/glsl/opt_array_splitting.cpp
index ebb076b..9e73f3c 100644
--- a/mesalib/src/glsl/opt_array_splitting.cpp
+++ b/mesalib/src/glsl/opt_array_splitting.cpp
@@ -295,7 +295,7 @@ ir_array_splitting_visitor::split_deref(ir_dereference **deref)
    ir_constant *constant = deref_array->array_index->as_constant();
    assert(constant);
 
-   if (constant->value.i[0] < (int)entry->size) {
+   if (constant->value.i[0] >= 0 && constant->value.i[0] < (int)entry->size) {
       *deref = new(entry->mem_ctx)
 	 ir_dereference_variable(entry->components[constant->value.i[0]]);
    } else {
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index 2b76dd1..67b0d0c 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -83,6 +83,33 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
    return shader;
 }
 
+void
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
+{
+   unsigned i;
+
+   shProg->NumUserUniformStorage = 0;
+   shProg->UniformStorage = NULL;
+   shProg->NumUniformRemapTable = 0;
+   shProg->UniformRemapTable = NULL;
+   shProg->UniformHash = NULL;
+
+   ralloc_free(shProg->InfoLog);
+   shProg->InfoLog = ralloc_strdup(shProg, "");
+
+   ralloc_free(shProg->UniformBlocks);
+   shProg->UniformBlocks = NULL;
+   shProg->NumUniformBlocks = 0;
+   for (i = 0; i < MESA_SHADER_STAGES; i++) {
+      ralloc_free(shProg->UniformBlockStageIndex[i]);
+      shProg->UniformBlockStageIndex[i] = NULL;
+   }
+
+   ralloc_free(shProg->AtomicBuffers);
+   shProg->AtomicBuffers = NULL;
+   shProg->NumAtomicBuffers = 0;
+}
+
 void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
 {
    memset(ctx, 0, sizeof(*ctx));
diff --git a/mesalib/src/glsl/standalone_scaffolding.h b/mesalib/src/glsl/standalone_scaffolding.h
index df783af..895dd27 100644
--- a/mesalib/src/glsl/standalone_scaffolding.h
+++ b/mesalib/src/glsl/standalone_scaffolding.h
@@ -45,6 +45,9 @@ extern "C" struct gl_shader *
 _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
 
 extern "C" void
+_mesa_clear_shader_program_data(struct gl_shader_program *);
+
+extern "C" void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
                    const char *msg, int len);
 
diff --git a/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml b/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml
new file mode 100644
index 0000000..ab1a388
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/ARB_clip_control.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_clip_control" number="160">
+
+    <enum name="LOWER_LEFT" value = "0x8CA1"/>
+    <enum name="UPPER_LEFT" value = "0x8CA2"/>
+
+    <enum name="NEGATIVE_ONE_TO_ONE" value = "0x935E"/>
+    <enum name="ZERO_TO_ONE" value = "0x935F"/>
+
+    <enum name="CLIP_ORIGIN" value = "0x935C"/>
+    <enum name="CLIP_DEPTH_MODE" value = "0x935D"/>
+
+    <function name="ClipControl" offset="assign">
+        <param name="origin" type="GLenum"/>
+        <param name="depth" type="GLenum"/>
+        <!-- <glx rop="1340"/> -->
+    </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 2fbc598..72e5095 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -113,6 +113,7 @@ API_XML = \
 	ARB_blend_func_extended.xml \
 	ARB_clear_buffer_object.xml \
 	ARB_clear_texture.xml \
+	ARB_clip_control.xml \
 	ARB_color_buffer_float.xml \
 	ARB_compressed_texture_pixel_storage.xml \
 	ARB_compute_shader.xml \
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 73f2f75..534e6a0 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -8364,7 +8364,9 @@
 
 <xi:include href="ARB_multi_bind.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
-<!-- ARB extensions 148 - 160 -->
+<!-- ARB extensions 148 - 159 -->
+
+<xi:include href="ARB_clip_control.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <category name="GL_ARB_conditional_render_inverted" number="161">
     <enum name="QUERY_WAIT_INVERTED"                      value="0x8E17"/>
diff --git a/mesalib/src/mapi/glapi/gen/gl_gentable.py b/mesalib/src/mapi/glapi/gen/gl_gentable.py
index deffcee..06a5ebf 100644
--- a/mesalib/src/mapi/glapi/gen/gl_gentable.py
+++ b/mesalib/src/mapi/glapi/gen/gl_gentable.py
@@ -100,7 +100,7 @@ static void
 __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
     GLuint entries = _glapi_get_dispatch_table_size();
     void **dispatch = (void **) disp;
-    int i;
+    unsigned i;
 
     /* ISO C is annoying sometimes */
     union {_glapi_proc p; void *v;} p;
@@ -147,7 +147,7 @@ class PrintCode(gl_XML.gl_print_base):
     def __init__(self):
         gl_XML.gl_print_base.__init__(self)
 
-        self.name = "gl_gen_table.py (from Mesa)"
+        self.name = "gl_gentable.py (from Mesa)"
         self.license = license.bsd_license_template % ( \
 """Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
 (C) Copyright IBM Corporation 2004, 2005
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 7a8e627..87532c1 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -680,6 +680,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
          _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
                      0.0, ctx->DrawBuffer->Height,
                      -1.0, 1.0);
+
+      if (ctx->Extensions.ARB_clip_control) {
+         save->ClipOrigin = ctx->Transform.ClipOrigin;
+         save->ClipDepthMode = ctx->Transform.ClipDepthMode;
+         _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
+      }
    }
 
    if (state & MESA_META_CLIP) {
@@ -1081,6 +1087,9 @@ _mesa_meta_end(struct gl_context *ctx)
       _mesa_LoadMatrixf(save->ProjectionMatrix);
 
       _mesa_MatrixMode(save->MatrixMode);
+
+      if (ctx->Extensions.ARB_clip_control)
+         _mesa_ClipControl(save->ClipOrigin, save->ClipDepthMode);
    }
 
    if (state & MESA_META_CLIP) {
diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h
index 2c9517b..6ecf3c0 100644
--- a/mesalib/src/mesa/drivers/common/meta.h
+++ b/mesalib/src/mesa/drivers/common/meta.h
@@ -136,6 +136,9 @@ struct save_state
    GLfloat ModelviewMatrix[16];
    GLfloat ProjectionMatrix[16];
    GLfloat TextureMatrix[16];
+   /** GL_ARB_clip_control */
+   GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+   GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
 
    /** MESA_META_CLIP */
    GLbitfield ClipPlanesEnabled;
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index d90e662..5345339 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -1345,6 +1345,7 @@ _mesa_PopAttrib(void)
                if (xform->DepthClamp != ctx->Transform.DepthClamp)
                   _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
                                    ctx->Transform.DepthClamp);
+               _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode);
             }
             break;
          case GL_TEXTURE_BIT:
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 0ee8856..2bae1bc 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2710,7 +2710,7 @@ bind_buffer_range_uniform_buffer(struct gl_context *ctx,
 
    if (offset & (ctx->Const.UniformBufferOffsetAlignment - 1)) {
       _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glBindBufferRange(offset misalgned %d/%d)", (int) offset,
+                  "glBindBufferRange(offset misaligned %d/%d)", (int) offset,
 		  ctx->Const.UniformBufferOffsetAlignment);
       return;
    }
@@ -2797,7 +2797,7 @@ bind_atomic_buffer(struct gl_context *ctx,
 
    if (offset & (ATOMIC_COUNTER_SIZE - 1)) {
       _mesa_error(ctx, GL_INVALID_VALUE,
-                  "%s(offset misalgned %d/%d)", name, (int) offset,
+                  "%s(offset misaligned %d/%d)", name, (int) offset,
                   ATOMIC_COUNTER_SIZE);
       return;
    }
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 5a8f718..25b9bfc 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -133,6 +133,7 @@
 #include "program/prog_print.h"
 #include "math/m_matrix.h"
 #include "main/dispatch.h" /* for _gloffset_COUNT */
+#include "uniforms.h"
 
 #ifdef USE_SPARC_ASM
 #include "sparc/sparc.h"
@@ -1949,6 +1950,17 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
       }
    }
 
+   /* If a program is active and SSO not in use, check if validation of
+    * samplers succeeded for the active program. */
+   if (ctx->_Shader->ActiveProgram && ctx->_Shader != ctx->Pipeline.Current) {
+      char errMsg[100];
+      if (!_mesa_sampler_uniforms_are_valid(ctx->_Shader->ActiveProgram,
+                                            errMsg, 100)) {
+         _mesa_error(ctx, GL_INVALID_OPERATION, "%s", errMsg);
+         return GL_FALSE;
+      }
+   }
+
    if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
       _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
                   "%s(incomplete framebuffer)", where);
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index c07e83a..2f40915 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -758,8 +758,7 @@ struct dd_function_table {
    struct gl_shader *(*NewShader)(struct gl_context *ctx,
                                   GLuint name, GLenum type);
    void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
-   struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx,
-                                                 GLuint name);
+   struct gl_shader_program *(*NewShaderProgram)(GLuint name);
    void (*DeleteShaderProgram)(struct gl_context *ctx,
                                struct gl_shader_program *shProg);
    void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 5c7160d..4b7b060 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -398,6 +398,9 @@ typedef enum
    OPCODE_PROGRAM_UNIFORM_MATRIX34F,
    OPCODE_PROGRAM_UNIFORM_MATRIX43F,
 
+   /* GL_ARB_clip_control */
+   OPCODE_CLIP_CONTROL,
+
    /* GL_ARB_color_buffer_float */
    OPCODE_CLAMP_COLOR,
 
@@ -7208,6 +7211,22 @@ save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count,
 }
 
 static void GLAPIENTRY
+save_ClipControl(GLenum origin, GLenum depth)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2);
+   if (n) {
+      n[1].e = origin;
+      n[2].e = depth;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_ClipControl(ctx->Exec, (origin, depth));
+   }
+}
+
+static void GLAPIENTRY
 save_ClampColorARB(GLenum target, GLenum clamp)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -8617,6 +8636,10 @@ execute_list(struct gl_context *ctx, GLuint list)
                                           get_pointer(&n[5])));
             break;
 
+         case OPCODE_CLIP_CONTROL:
+            CALL_ClipControl(ctx->Exec, (n[1].e, n[2].e));
+            break;
+
          case OPCODE_CLAMP_COLOR:
             CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
             break;
@@ -9551,6 +9574,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_TexParameterIiv(table, save_TexParameterIiv);
    SET_TexParameterIuiv(table, save_TexParameterIuiv);
 
+   /* GL_ARB_clip_control */
+   SET_ClipControl(table, save_ClipControl);
+
    /* GL_ARB_color_buffer_float */
    SET_ClampColor(table, save_ClampColorARB);
 
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index f0e2f89..15d66a7 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -91,6 +91,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_buffer_storage",                      o(ARB_buffer_storage),                      GL,             2013 },
    { "GL_ARB_clear_buffer_object",                 o(dummy_true),                              GL,             2012 },
    { "GL_ARB_clear_texture",                       o(ARB_clear_texture),                       GL,             2013 },
+   { "GL_ARB_clip_control",                        o(ARB_clip_control),                        GL,             2014 },
    { "GL_ARB_color_buffer_float",                  o(ARB_color_buffer_float),                  GL,             2004 },
    { "GL_ARB_compressed_texture_pixel_storage",    o(dummy_true),                              GL,             2011 },
    { "GL_ARB_compute_shader",                      o(ARB_compute_shader),                      GL,             2012 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 9bb706c..5591d57 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -665,7 +665,7 @@ static GLboolean args_match( const struct state_key *key, GLuint unit )
 }
 
 static ir_rvalue *
-smear(texenv_fragment_program *p, ir_rvalue *val)
+smear(ir_rvalue *val)
 {
    if (!val->type->is_scalar())
       return val;
@@ -722,7 +722,7 @@ emit_combine(texenv_fragment_program *p,
       tmp1 = mul(src[1], new(p->mem_ctx) ir_constant(2.0f));
       tmp1 = add(tmp1, new(p->mem_ctx) ir_constant(-1.0f));
 
-      return dot(swizzle_xyz(smear(p, tmp0)), swizzle_xyz(smear(p, tmp1)));
+      return dot(swizzle_xyz(smear(tmp0)), swizzle_xyz(smear(tmp1)));
    }
    case MODE_MODULATE_ADD_ATI:
       return add(mul(src[0], src[2]), src[1]);
@@ -804,7 +804,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
 			 key->unit[unit].NumArgsRGB,
 			 key->unit[unit].ModeRGB,
 			 key->unit[unit].OptRGB);
-      val = smear(p, val);
+      val = smear(val);
       if (rgb_saturate)
 	 val = saturate(val);
 
@@ -816,7 +816,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
 				    key->unit[unit].NumArgsRGB,
 				    key->unit[unit].ModeRGB,
 				    key->unit[unit].OptRGB);
-      val = smear(p, val);
+      val = smear(val);
       if (rgb_saturate)
 	 val = saturate(val);
       p->emit(assign(temp_var, val));
@@ -829,7 +829,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
 			 key->unit[unit].NumArgsRGB,
 			 key->unit[unit].ModeRGB,
 			 key->unit[unit].OptRGB);
-      val = swizzle_xyz(smear(p, val));
+      val = swizzle_xyz(smear(val));
       if (rgb_saturate)
 	 val = saturate(val);
       p->emit(assign(temp_var, val, WRITEMASK_XYZ));
@@ -838,7 +838,7 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
 			 key->unit[unit].NumArgsA,
 			 key->unit[unit].ModeA,
 			 key->unit[unit].OptA);
-      val = swizzle_w(smear(p, val));
+      val = swizzle_w(smear(val));
       if (alpha_saturate)
 	 val = saturate(val);
       p->emit(assign(temp_var, val, WRITEMASK_W));
@@ -1212,7 +1212,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
    p.top_instructions = p.shader->ir;
    p.instructions = p.shader->ir;
    p.state = key;
-   p.shader_program = ctx->Driver.NewShaderProgram(ctx, 0);
+   p.shader_program = ctx->Driver.NewShaderProgram(0);
 
    /* Tell the linker to ignore the fact that we're building a
     * separate shader, in case we're in a GLES2 context that would
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 0e2d8f6..6091efc 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -391,6 +391,7 @@ EXTRA_EXT(ARB_gpu_shader5);
 EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
 EXTRA_EXT(INTEL_performance_query);
 EXTRA_EXT(ARB_explicit_uniform_location);
+EXTRA_EXT(ARB_clip_control);
 
 static const int
 extra_ARB_color_buffer_float_or_glcore[] = {
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index da35684..aa9f282 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -414,6 +414,8 @@ descriptor=[
   [ "AUX_BUFFERS", "BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA" ],
   [ "BLUE_BIAS", "CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA" ],
   [ "BLUE_SCALE", "CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA" ],
+  [ "CLIP_DEPTH_MODE", "CONTEXT_ENUM(Transform.ClipDepthMode), extra_ARB_clip_control" ],
+  [ "CLIP_ORIGIN", "CONTEXT_ENUM(Transform.ClipOrigin), extra_ARB_clip_control" ],
   [ "CLIENT_ATTRIB_STACK_DEPTH", "CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA" ],
   [ "COLOR_MATERIAL_FACE", "CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA" ],
   [ "COLOR_MATERIAL_PARAMETER", "CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA" ],
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9f44eda..e1f1f1d 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1430,6 +1430,9 @@ struct gl_transform_attrib
    GLboolean RescaleNormals;			/**< GL_EXT_rescale_normal */
    GLboolean RasterPositionUnclipped;           /**< GL_IBM_rasterpos_clip */
    GLboolean DepthClamp;			/**< GL_ARB_depth_clamp */
+   /** GL_ARB_clip_control */
+   GLenum ClipOrigin;     /**< GL_LOWER_LEFT or GL_UPPER_LEFT */
+   GLenum ClipDepthMode;  /**< GL_NEGATIVE_ONE_TO_ONE or GL_ZERO_TO_ONE */
 };
 
 
@@ -2775,7 +2778,7 @@ struct gl_shader_program
     * Transform feedback varyings last specified by
     * glTransformFeedbackVaryings().
     *
-    * For the current set of transform feeedback varyings used for transform
+    * For the current set of transform feedback varyings used for transform
     * feedback output, see LinkedTransformFeedback.
     */
    struct {
@@ -2884,6 +2887,7 @@ struct gl_shader_program
    GLboolean LinkStatus;   /**< GL_LINK_STATUS */
    GLboolean Validated;
    GLboolean _Used;        /**< Ever used for drawing? */
+   GLboolean SamplersValidated; /**< Samplers validated against texture units? */
    GLchar *InfoLog;
 
    unsigned Version;       /**< GLSL version used for linking */
@@ -3697,6 +3701,7 @@ struct gl_extensions
    GLboolean ARB_blend_func_extended;
    GLboolean ARB_buffer_storage;
    GLboolean ARB_clear_texture;
+   GLboolean ARB_clip_control;
    GLboolean ARB_color_buffer_float;
    GLboolean ARB_compute_shader;
    GLboolean ARB_conditional_render_inverted;
diff --git a/mesalib/src/mesa/main/polygon.c b/mesalib/src/mesa/main/polygon.c
index 611cef6..76d6019 100644
--- a/mesalib/src/mesa/main/polygon.c
+++ b/mesalib/src/mesa/main/polygon.c
@@ -104,8 +104,6 @@ _mesa_FrontFace( GLenum mode )
    FLUSH_VERTICES(ctx, _NEW_POLYGON);
    ctx->Polygon.FrontFace = mode;
 
-   ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW);
-
    if (ctx->Driver.FrontFace)
       ctx->Driver.FrontFace( ctx, mode );
 }
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 3e6f610..2be9092 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -316,7 +316,7 @@ create_shader_program(struct gl_context *ctx)
 
    name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
 
-   shProg = ctx->Driver.NewShaderProgram(ctx, name);
+   shProg = ctx->Driver.NewShaderProgram(name);
 
    _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
 
diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h
index 17b05b3..047d256 100644
--- a/mesalib/src/mesa/main/shaderapi.h
+++ b/mesalib/src/mesa/main/shaderapi.h
@@ -205,15 +205,6 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
                          struct gl_shader_program *shProg,
                          struct gl_pipeline_object *shTarget);
 
-extern void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program);
-
-extern void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program);
-
-extern GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
-
 extern void
 _mesa_copy_linked_program_data(gl_shader_stage type,
                                const struct gl_shader_program *src,
diff --git a/mesalib/src/mesa/main/shaderimage.c b/mesalib/src/mesa/main/shaderimage.c
index 9e62f42..dcbcca6 100644
--- a/mesalib/src/mesa/main/shaderimage.c
+++ b/mesalib/src/mesa/main/shaderimage.c
@@ -384,7 +384,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
 void
 _mesa_validate_image_units(struct gl_context *ctx)
 {
-   int i;
+   unsigned i;
 
    for (i = 0; i < ctx->Const.MaxImageUnits; ++i) {
       struct gl_image_unit *u = &ctx->ImageUnits[i];
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 693e9a2..81bd782 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -235,8 +235,8 @@ _mesa_reference_shader_program(struct gl_context *ctx,
    }
 }
 
-void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog)
+static void
+init_shader_program(struct gl_shader_program *prog)
 {
    prog->Type = GL_SHADER_PROGRAM_MESA;
    prog->RefCount = 1;
@@ -261,13 +261,13 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
  * Called via ctx->Driver.NewShaderProgram()
  */
 static struct gl_shader_program *
-_mesa_new_shader_program(struct gl_context *ctx, GLuint name)
+_mesa_new_shader_program(GLuint name)
 {
    struct gl_shader_program *shProg;
    shProg = rzalloc(NULL, struct gl_shader_program);
    if (shProg) {
       shProg->Name = name;
-      _mesa_init_shader_program(ctx, shProg);
+      init_shader_program(shProg);
    }
    return shProg;
 }
@@ -277,11 +277,11 @@ _mesa_new_shader_program(struct gl_context *ctx, GLuint name)
  * Clear (free) the shader program state that gets produced by linking.
  */
 void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
-                                struct gl_shader_program *shProg)
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
 {
+   unsigned i;
+
    if (shProg->UniformStorage) {
-      unsigned i;
       for (i = 0; i < shProg->NumUserUniformStorage; ++i)
          _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
       ralloc_free(shProg->UniformStorage);
@@ -303,6 +303,18 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
    assert(shProg->InfoLog != NULL);
    ralloc_free(shProg->InfoLog);
    shProg->InfoLog = ralloc_strdup(shProg, "");
+
+   ralloc_free(shProg->UniformBlocks);
+   shProg->UniformBlocks = NULL;
+   shProg->NumUniformBlocks = 0;
+   for (i = 0; i < MESA_SHADER_STAGES; i++) {
+      ralloc_free(shProg->UniformBlockStageIndex[i]);
+      shProg->UniformBlockStageIndex[i] = NULL;
+   }
+
+   ralloc_free(shProg->AtomicBuffers);
+   shProg->AtomicBuffers = NULL;
+   shProg->NumAtomicBuffers = 0;
 }
 
 
@@ -319,7 +331,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
 
    assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
 
-   _mesa_clear_shader_program_data(ctx, shProg);
+   _mesa_clear_shader_program_data(shProg);
 
    if (shProg->AttributeBindings) {
       string_to_uint_map_dtor(shProg->AttributeBindings);
diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h
index d72919c..05ddfeb 100644
--- a/mesalib/src/mesa/main/shaderobj.h
+++ b/mesalib/src/mesa/main/shaderobj.h
@@ -71,9 +71,6 @@ _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader);
 extern struct gl_shader *
 _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
 
-extern void
-_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog);
-
 extern struct gl_shader_program *
 _mesa_lookup_shader_program(struct gl_context *ctx, GLuint name);
 
@@ -82,8 +79,7 @@ _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
                                 const char *caller);
 
 extern void
-_mesa_clear_shader_program_data(struct gl_context *ctx,
-                                struct gl_shader_program *shProg);
+_mesa_clear_shader_program_data(struct gl_shader_program *shProg);
 
 extern void
 _mesa_free_shader_program_data(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c
index 80287c4..45bce78 100644
--- a/mesalib/src/mesa/main/state.c
+++ b/mesalib/src/mesa/main/state.c
@@ -51,6 +51,7 @@
 #include "texobj.h"
 #include "texstate.h"
 #include "varray.h"
+#include "viewport.h"
 #include "blend.h"
 
 
@@ -281,16 +282,29 @@ update_viewport_matrix(struct gl_context *ctx)
     * NOTE: RasterPos uses this.
     */
    for (i = 0; i < ctx->Const.MaxViewports; i++) {
+      double scale[3], translate[3];
+
+      _mesa_get_viewport_xform(ctx, i, scale, translate);
       _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
-                            ctx->ViewportArray[i].X, ctx->ViewportArray[i].Y,
-                            ctx->ViewportArray[i].Width, ctx->ViewportArray[i].Height,
-                            ctx->ViewportArray[i].Near, ctx->ViewportArray[i].Far,
-                            depthMax);
+                            scale, translate, depthMax);
    }
 }
 
 
 /**
+ * Update the ctx->Polygon._FrontBit flag.
+ */
+static void
+update_frontbit(struct gl_context *ctx)
+{
+   if (ctx->Transform.ClipOrigin == GL_LOWER_LEFT)
+      ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CW);
+   else
+      ctx->Polygon._FrontBit = (ctx->Polygon.FrontFace == GL_CCW);
+}
+
+
+/**
  * Update derived multisample state.
  */
 static void
@@ -372,6 +386,9 @@ _mesa_update_state_locked( struct gl_context *ctx )
    if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
       _mesa_update_texture( ctx, new_state );
 
+   if (new_state & _NEW_POLYGON)
+      update_frontbit( ctx );
+
    if (new_state & _NEW_BUFFERS)
       _mesa_update_framebuffer(ctx);
 
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 1592c9b..fcb14c4 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -533,8 +533,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
       dst += array_index * store->element_stride;
 
       switch (store->format) {
-      case uniform_native:
-      case uniform_bool_int_0_1: {
+      case uniform_native: {
 	 unsigned j;
 	 unsigned v;
 
@@ -550,8 +549,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
 	 break;
       }
 
-      case uniform_int_float:
-      case uniform_bool_float: {
+      case uniform_int_float: {
 	 const int *isrc = (const int *) src;
 	 unsigned j;
 	 unsigned v;
@@ -572,27 +570,6 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
 	 break;
       }
 
-      case uniform_bool_int_0_not0: {
-	 const int *isrc = (const int *) src;
-	 unsigned j;
-	 unsigned v;
-	 unsigned c;
-
-	 for (j = 0; j < count; j++) {
-	    for (v = 0; v < vectors; v++) {
-	       for (c = 0; c < components; c++) {
-		  ((int *) dst)[c] = *isrc == 0 ? 0 : ~0;
-		  isrc++;
-	       }
-
-	       dst += store->vector_stride;
-	    }
-
-	    dst += extra_stride;
-	 }
-	 break;
-      }
-
       default:
 	 assert(!"Should not get here.");
 	 break;
@@ -996,8 +973,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
  * array offset in *offset, or GL_INVALID_INDEX (-1).
  */
 extern "C" unsigned
-_mesa_get_uniform_location(struct gl_context *ctx,
-                           struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
                            const GLchar *name,
                            unsigned *out_offset)
 {
@@ -1064,42 +1040,16 @@ extern "C" bool
 _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg,
 				 char *errMsg, size_t errMsgLength)
 {
-   const glsl_type *unit_types[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
-   memset(unit_types, 0, sizeof(unit_types));
-
-   for (unsigned i = 0; i < shProg->NumUserUniformStorage; i++) {
-      const struct gl_uniform_storage *const storage =
-	 &shProg->UniformStorage[i];
-      const glsl_type *const t = (storage->type->is_array())
-	 ? storage->type->fields.array : storage->type;
-
-      if (!t->is_sampler())
-	 continue;
-
-      const unsigned count = MAX2(1, storage->type->array_size());
-      for (unsigned j = 0; j < count; j++) {
-	 const unsigned unit = storage->storage[j].i;
-
-	 /* The types of the samplers associated with a particular texture
-	  * unit must be an exact match.  Page 74 (page 89 of the PDF) of the
-	  * OpenGL 3.3 core spec says:
-	  *
-	  *     "It is not allowed to have variables of different sampler
-	  *     types pointing to the same texture image unit within a program
-	  *     object."
-	  */
-	 if (unit_types[unit] == NULL) {
-	    unit_types[unit] = t;
-	 } else if (unit_types[unit] != t) {
-	    _mesa_snprintf(errMsg, errMsgLength,
-			   "Texture unit %d is accessed both as %s and %s",
-			   unit, unit_types[unit]->name, t->name);
-	    return false;
-	 }
-      }
+   /* Shader does not have samplers. */
+   if (shProg->NumUserUniformStorage == 0)
+      return true;
+
+   if (!shProg->SamplersValidated) {
+      _mesa_snprintf(errMsg, errMsgLength,
+                     "active samplers with a different type "
+                     "refer to the same texture image unit");
+      return false;
    }
-
    return true;
 }
 
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index 0d0cbf5..c307107 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -75,12 +75,26 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
    memcpy(prog->SamplerUnits, shader->SamplerUnits, sizeof(prog->SamplerUnits));
    memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
 
+   shProg->SamplersValidated = GL_TRUE;
+
    for (s = 0; s < MAX_SAMPLERS; s++) {
       if (prog->SamplersUsed & (1 << s)) {
          GLuint unit = shader->SamplerUnits[s];
          GLuint tgt = shader->SamplerTargets[s];
          assert(unit < Elements(prog->TexturesUsed));
          assert(tgt < NUM_TEXTURE_TARGETS);
+
+         /* The types of the samplers associated with a particular texture
+          * unit must be an exact match.  Page 74 (page 89 of the PDF) of the
+          * OpenGL 3.3 core spec says:
+          *
+          *     "It is not allowed to have variables of different sampler
+          *     types pointing to the same texture image unit within a program
+          *     object."
+          */
+         if (prog->TexturesUsed[unit] & ~(1 << tgt))
+            shProg->SamplersValidated = GL_FALSE;
+
          prog->TexturesUsed[unit] |= (1 << tgt);
       }
    }
@@ -917,7 +931,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
       return -1;
    }
 
-   index = _mesa_get_uniform_location(ctx, shProg, name, &offset);
+   index = _mesa_get_uniform_location(shProg, name, &offset);
    if (index == GL_INVALID_INDEX)
       return -1;
 
@@ -990,7 +1004,7 @@ _mesa_GetUniformIndices(GLuint program,
 
    for (i = 0; i < uniformCount; i++) {
       unsigned offset;
-      uniformIndices[i] = _mesa_get_uniform_location(ctx, shProg,
+      uniformIndices[i] = _mesa_get_uniform_location(shProg,
 						     uniformNames[i], &offset);
    }
 }
@@ -1096,7 +1110,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
       for (i = 0; i < block->NumUniforms; i++) {
 	 unsigned offset;
          const int idx =
-            _mesa_get_uniform_location(ctx, shProg,
+            _mesa_get_uniform_location(shProg,
                                        block->Uniforms[i].IndexName,
                                        &offset);
          if (idx != -1)
@@ -1113,7 +1127,7 @@ _mesa_GetActiveUniformBlockiv(GLuint program,
       for (i = 0; i < block->NumUniforms; i++) {
 	 unsigned offset;
          const int idx =
-            _mesa_get_uniform_location(ctx, shProg,
+            _mesa_get_uniform_location(shProg,
                                        block->Uniforms[i].IndexName,
                                        &offset);
 
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index e7a370e..6575a52 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -259,7 +259,7 @@ _mesa_parse_program_resource_name(const GLchar *name,
                                   const GLchar **out_base_name_end);
 
 unsigned
-_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_shader_program *shProg,
 			   const GLchar *name, unsigned *offset);
 
 void
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 71f7011..4951891 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -381,7 +381,6 @@ compute_version_es2(const struct gl_extensions *extensions)
                               extensions->ARB_shader_texture_lod &&
                               extensions->ARB_texture_float &&
                               extensions->ARB_texture_rg &&
-                              extensions->ARB_texture_compression_rgtc &&
                               extensions->EXT_draw_buffers2 &&
                               /* extensions->ARB_framebuffer_object && */
                               extensions->EXT_framebuffer_sRGB &&
@@ -389,7 +388,6 @@ compute_version_es2(const struct gl_extensions *extensions)
                               extensions->EXT_texture_array &&
                               extensions->EXT_texture_shared_exponent &&
                               extensions->EXT_transform_feedback &&
-                              extensions->NV_conditional_render &&
                               extensions->ARB_draw_instanced &&
                               extensions->ARB_uniform_buffer_object &&
                               extensions->EXT_texture_snorm &&
diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c
index 222ae30..d6a9e29 100644
--- a/mesalib/src/mesa/main/viewport.c
+++ b/mesalib/src/mesa/main/viewport.c
@@ -30,6 +30,7 @@
 
 
 #include "context.h"
+#include "enums.h"
 #include "macros.h"
 #include "mtypes.h"
 #include "viewport.h"
@@ -39,6 +40,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
                        GLfloat x, GLfloat y,
                        GLfloat width, GLfloat height)
 {
+   double scale[3], translate[3];
+
    /* clamp width and height to the implementation dependent range */
    width  = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth);
    height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight);
@@ -75,14 +78,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
     * the WindowMap matrix being up to date in the driver's Viewport
     * and DepthRange functions.
     */
+   _mesa_get_viewport_xform(ctx, idx, scale, translate);
    _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
-                         ctx->ViewportArray[idx].X,
-                         ctx->ViewportArray[idx].Y,
-                         ctx->ViewportArray[idx].Width,
-                         ctx->ViewportArray[idx].Height,
-                         ctx->ViewportArray[idx].Near,
-                         ctx->ViewportArray[idx].Far,
-                         ctx->DrawBuffer->_DepthMaxF);
+                         scale, translate, ctx->DrawBuffer->_DepthMaxF);
 #endif
 }
 
@@ -248,6 +246,8 @@ static void
 set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
                           GLclampd nearval, GLclampd farval)
 {
+   double scale[3], translate[3];
+
    if (ctx->ViewportArray[idx].Near == nearval &&
        ctx->ViewportArray[idx].Far == farval)
       return;
@@ -261,14 +261,9 @@ set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
     * the WindowMap matrix being up to date in the driver's Viewport
     * and DepthRange functions.
     */
+   _mesa_get_viewport_xform(ctx, idx, scale, translate);
    _math_matrix_viewport(&ctx->ViewportArray[idx]._WindowMap,
-                         ctx->ViewportArray[idx].X,
-                         ctx->ViewportArray[idx].Y,
-                         ctx->ViewportArray[idx].Width,
-                         ctx->ViewportArray[idx].Height,
-                         ctx->ViewportArray[idx].Near,
-                         ctx->ViewportArray[idx].Far,
-                         ctx->DrawBuffer->_DepthMaxF);
+                         scale, translate, ctx->DrawBuffer->_DepthMaxF);
 #endif
 }
 
@@ -396,10 +391,15 @@ void _mesa_init_viewport(struct gl_context *ctx)
    GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
    unsigned i;
 
+   ctx->Transform.ClipOrigin = GL_LOWER_LEFT;
+   ctx->Transform.ClipDepthMode = GL_NEGATIVE_ONE_TO_ONE;
+
    /* Note: ctx->Const.MaxViewports may not have been set by the driver yet,
     * so just initialize all of them.
     */
    for (i = 0; i < MAX_VIEWPORTS; i++) {
+      double scale[3], translate[3];
+
       /* Viewport group */
       ctx->ViewportArray[i].X = 0;
       ctx->ViewportArray[i].Y = 0;
@@ -409,8 +409,9 @@ void _mesa_init_viewport(struct gl_context *ctx)
       ctx->ViewportArray[i].Far = 1.0;
       _math_matrix_ctr(&ctx->ViewportArray[i]._WindowMap);
 
-      _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap, 0, 0, 0, 0,
-                            0.0F, 1.0F, depthMax);
+      _mesa_get_viewport_xform(ctx, i, scale, translate);
+      _math_matrix_viewport(&ctx->ViewportArray[i]._WindowMap,
+                            scale, translate, depthMax);
    }
 }
 
@@ -427,3 +428,92 @@ void _mesa_free_viewport_data(struct gl_context *ctx)
       _math_matrix_dtr(&ctx->ViewportArray[i]._WindowMap);
 }
 
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE&VERBOSE_API)
+      _mesa_debug(ctx, "glClipControl(%s, %s)\n",
+	          _mesa_lookup_enum_by_nr(origin),
+                  _mesa_lookup_enum_by_nr(depth));
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   if (!ctx->Extensions.ARB_clip_control) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl");
+      return;
+   }
+
+   if (origin != GL_LOWER_LEFT && origin != GL_UPPER_LEFT) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+      return;
+   }
+
+   if (depth != GL_NEGATIVE_ONE_TO_ONE && depth != GL_ZERO_TO_ONE) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glClipControl");
+      return;
+   }
+
+   if (ctx->Transform.ClipOrigin == origin &&
+       ctx->Transform.ClipDepthMode == depth)
+      return;
+
+   FLUSH_VERTICES(ctx, 0);
+
+   if (ctx->Transform.ClipOrigin != origin) {
+      ctx->Transform.ClipOrigin = origin;
+
+      /* Affects the winding order of the front face. */
+      ctx->NewState |= _NEW_POLYGON;
+      /* Affects the y component of the viewport transform. */
+      ctx->NewState |= _NEW_VIEWPORT;
+
+      if (ctx->Driver.FrontFace)
+         ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
+   }
+
+   if (ctx->Transform.ClipDepthMode != depth) {
+      ctx->Transform.ClipDepthMode = depth;
+
+      /* Affects the z part of the viewpoint transform. */
+      ctx->NewState |= _NEW_VIEWPORT;
+
+      if (ctx->Driver.DepthRange)
+         ctx->Driver.DepthRange(ctx);
+   }
+}
+
+/**
+ * Computes the scaling and the translation part of the
+ * viewport transform matrix of the \param i-th viewport
+ * and writes that into \param scale and \param translate.
+ */
+void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+                         double scale[3], double translate[3])
+{
+   double x = ctx->ViewportArray[i].X;
+   double y = ctx->ViewportArray[i].Y;
+   double half_width = 0.5*ctx->ViewportArray[i].Width;
+   double half_height = 0.5*ctx->ViewportArray[i].Height;
+   double n = ctx->ViewportArray[i].Near;
+   double f = ctx->ViewportArray[i].Far;
+
+   scale[0] = half_width;
+   translate[0] = half_width + x;
+   if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+      scale[1] = -half_height;
+      translate[1] = half_height - y;
+   } else {
+      scale[1] = half_height;
+      translate[1] = half_height + y;
+   }
+   if (ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE) {
+      scale[2] = 0.5*(f - n);
+      translate[2] = 0.5*(n + f);
+   } else {
+      scale[2] = f - n;
+      translate[2] = n;
+   }
+}
diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h
index f2311c0..426e194 100644
--- a/mesalib/src/mesa/main/viewport.h
+++ b/mesalib/src/mesa/main/viewport.h
@@ -71,5 +71,11 @@ _mesa_init_viewport(struct gl_context *ctx);
 extern void 
 _mesa_free_viewport_data(struct gl_context *ctx);
 
+extern void GLAPIENTRY
+_mesa_ClipControl(GLenum origin, GLenum depth);
+
+extern void
+_mesa_get_viewport_xform(struct gl_context *ctx, unsigned i,
+                         double scale[3], double translate[3]);
 
 #endif
diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c
index e512e45..9c9310d 100644
--- a/mesalib/src/mesa/math/m_matrix.c
+++ b/mesalib/src/mesa/math/m_matrix.c
@@ -1110,16 +1110,15 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
  * Transforms Normalized Device Coords to window/Z values.
  */
 void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y,
-                      GLfloat width, GLfloat height,
-                      GLdouble zNear, GLdouble zFar, GLdouble depthMax)
+_math_matrix_viewport(GLmatrix *m, const double scale[3],
+                      const double translate[3], double depthMax)
 {
-   m->m[MAT_SX] = width / 2.0F;
-   m->m[MAT_TX] = m->m[MAT_SX] + x;
-   m->m[MAT_SY] = height / 2.0F;
-   m->m[MAT_TY] = m->m[MAT_SY] + y;
-   m->m[MAT_SZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0));
-   m->m[MAT_TZ] = (GLfloat) (depthMax * ((zFar - zNear) / 2.0 + zNear));
+   m->m[MAT_SX] = scale[0];
+   m->m[MAT_TX] = translate[0];
+   m->m[MAT_SY] = scale[1];
+   m->m[MAT_TY] = translate[1];
+   m->m[MAT_SZ] = depthMax*scale[2];
+   m->m[MAT_TZ] = depthMax*translate[2];
    m->flags = MAT_FLAG_GENERAL_SCALE | MAT_FLAG_TRANSLATION;
    m->type = MATRIX_3D_NO_ROT;
 }
diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h
index dddce70..778d716 100644
--- a/mesalib/src/mesa/math/m_matrix.h
+++ b/mesalib/src/mesa/math/m_matrix.h
@@ -122,8 +122,8 @@ _math_matrix_frustum( GLmatrix *mat,
 		      GLfloat nearval, GLfloat farval );
 
 extern void
-_math_matrix_viewport(GLmatrix *m, GLfloat x, GLfloat y, GLfloat width, GLfloat height,
-                      GLdouble zNear, GLdouble zFar, GLdouble depthMax);
+_math_matrix_viewport( GLmatrix *m, const double scale[3],
+                       const double translate[3], double depthMax );
 
 extern void
 _math_matrix_set_identity( GLmatrix *dest );
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index b3e04d7..5cd9058 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3020,7 +3020,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
    unsigned int i;
 
-   _mesa_clear_shader_program_data(ctx, prog);
+   _mesa_clear_shader_program_data(prog);
 
    prog->LinkStatus = GL_TRUE;
 
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index a228538..5020978 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -33,6 +33,7 @@
 #include "main/macros.h"
 #include "st_context.h"
 #include "st_atom.h"
+#include "st_debug.h"
 #include "st_program.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -71,6 +72,11 @@ static void update_raster_state( struct st_context *st )
    {
       raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
 
+      /* _NEW_VIEWPORT */
+      if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) {
+         raster->front_ccw ^= 1;
+      }
+
       /*
        * Gallium's surfaces are Y=0=TOP orientation.  OpenGL is the
        * opposite.  Window system surfaces are Y=0=TOP.  Mesa's FBOs
@@ -119,8 +125,14 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_POLYGON
     */
    {
-      raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
-      raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+      if (ST_DEBUG & DEBUG_WIREFRAME) {
+         raster->fill_front = PIPE_POLYGON_MODE_LINE;
+         raster->fill_back = PIPE_POLYGON_MODE_LINE;
+      }
+      else {
+         raster->fill_front = translate_fill( ctx->Polygon.FrontMode );
+         raster->fill_back = translate_fill( ctx->Polygon.BackMode );
+      }
 
       /* Simplify when culling is active:
        */
@@ -234,6 +246,12 @@ static void update_raster_state( struct st_context *st )
    raster->half_pixel_center = 1;
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
       raster->bottom_edge_rule = 1;
+   /* _NEW_VIEWPORT */
+   if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT)
+      raster->bottom_edge_rule ^= 1;
+
+   /* _NEW_VIEWPORT */
+   raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
 
    /* ST_NEW_RASTERIZER */
    raster->rasterizer_discard = ctx->RasterDiscard;
@@ -265,7 +283,8 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_PROGRAM |
        _NEW_SCISSOR |
        _NEW_FRAG_CLAMP |
-       _NEW_TRANSFORM),      /* mesa state dependencies*/
+       _NEW_TRANSFORM |
+       _NEW_VIEWPORT),      /* mesa state dependencies*/
       (ST_NEW_VERTEX_PROGRAM |
        ST_NEW_RASTERIZER),  /* state tracker dependencies */
    },
diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
index 7584f9b..5b99208 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c
@@ -27,6 +27,7 @@
 
 
 #include "main/context.h"
+#include "main/viewport.h"
 #include "st_context.h"
 #include "st_atom.h"
 #include "pipe/p_context.h"
@@ -63,21 +64,17 @@ update_viewport( struct st_context *st )
     */
    for (i = 0; i < ctx->Const.MaxViewports; i++)
    {
-      GLfloat x = ctx->ViewportArray[i].X;
-      GLfloat y = ctx->ViewportArray[i].Y;
-      GLfloat z = ctx->ViewportArray[i].Near;
-      GLfloat half_width = ctx->ViewportArray[i].Width * 0.5f;
-      GLfloat half_height = ctx->ViewportArray[i].Height * 0.5f;
-      GLfloat half_depth = (GLfloat)(ctx->ViewportArray[i].Far - ctx->ViewportArray[i].Near) * 0.5f;
-      
-      st->state.viewport[i].scale[0] = half_width;
-      st->state.viewport[i].scale[1] = half_height * yScale;
-      st->state.viewport[i].scale[2] = half_depth;
+      double scale[3], translate[3];
+      _mesa_get_viewport_xform(ctx, i, scale, translate);
+
+      st->state.viewport[i].scale[0] = scale[0];
+      st->state.viewport[i].scale[1] = scale[1] * yScale;
+      st->state.viewport[i].scale[2] = scale[2];
       st->state.viewport[i].scale[3] = 1.0;
 
-      st->state.viewport[i].translate[0] = half_width + x;
-      st->state.viewport[i].translate[1] = (half_height + y) * yScale + yBias;
-      st->state.viewport[i].translate[2] = half_depth + z;
+      st->state.viewport[i].translate[0] = translate[0];
+      st->state.viewport[i].translate[1] = translate[1] * yScale + yBias;
+      st->state.viewport[i].translate[2] = translate[2];
       st->state.viewport[i].translate[3] = 0.0;
    }
 
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index 82e1fd1..faff9c4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -242,7 +242,5 @@ st_init_program_functions(struct dd_function_table *functions)
    functions->IsProgramNative = st_is_program_native;
    functions->ProgramStringNotify = st_program_string_notify;
    
-   functions->NewShader = st_new_shader;
-   functions->NewShaderProgram = st_new_shader_program;
    functions->LinkShader = st_link_shader;
 }
diff --git a/mesalib/src/mesa/state_tracker/st_debug.c b/mesalib/src/mesa/state_tracker/st_debug.c
index 8c15e18..de3e3a9 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.c
+++ b/mesalib/src/mesa/state_tracker/st_debug.c
@@ -55,6 +55,7 @@ static const struct debug_named_value st_debug_flags[] = {
    { "query",    DEBUG_QUERY, NULL },
    { "draw",     DEBUG_DRAW, NULL },
    { "buffer",   DEBUG_BUFFER, NULL },
+   { "wf",       DEBUG_WIREFRAME, NULL },
    DEBUG_NAMED_VALUE_END
 };
 
diff --git a/mesalib/src/mesa/state_tracker/st_debug.h b/mesalib/src/mesa/state_tracker/st_debug.h
index c1c4825..49b916f 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.h
+++ b/mesalib/src/mesa/state_tracker/st_debug.h
@@ -46,6 +46,7 @@ st_print_current(void);
 #define DEBUG_SCREEN    0x80
 #define DEBUG_DRAW      0x100
 #define DEBUG_BUFFER    0x200
+#define DEBUG_WIREFRAME 0x400
 
 #ifdef DEBUG
 extern int ST_DEBUG;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5dd8278..aff3dde 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -192,6 +192,10 @@ void st_init_limits(struct pipe_screen *screen,
       pc->MaxParameters      = pc->MaxNativeParameters      =
          screen->get_shader_param(screen, sh,
                    PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE) / sizeof(float[4]);
+      pc->MaxInputComponents =
+         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS) * 4;
+      pc->MaxOutputComponents =
+         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_OUTPUTS) * 4;
 
       pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);
 
@@ -261,10 +265,6 @@ void st_init_limits(struct pipe_screen *screen,
    c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
                                             PIPE_SHADER_CAP_MAX_INPUTS);
    c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
-   c->Program[MESA_SHADER_FRAGMENT].MaxInputComponents = c->MaxVarying * 4;
-   c->Program[MESA_SHADER_VERTEX].MaxOutputComponents = c->MaxVarying * 4;
-   c->Program[MESA_SHADER_GEOMETRY].MaxInputComponents = c->MaxVarying * 4;
-   c->Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = c->MaxVarying * 4;
    c->MaxGeometryOutputVertices = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES);
    c->MaxGeometryTotalOutputComponents = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS);
 
@@ -463,6 +463,7 @@ void st_init_extensions(struct pipe_screen *screen,
       { o(ARB_derivative_control),           PIPE_CAP_TGSI_FS_FINE_DERIVATIVE          },
       { o(ARB_conditional_render_inverted),  PIPE_CAP_CONDITIONAL_RENDER_INVERTED      },
       { o(ARB_texture_view),                 PIPE_CAP_SAMPLER_VIEW_TARGET              },
+      { o(ARB_clip_control),                 PIPE_CAP_CLIP_HALFZ                       },
    };
 
    /* Required: render target and sampler support */
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a0da9f6..a4e2c8d 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4781,15 +4781,19 @@ emit_wpos(struct st_context *st,
  * saturating the value to [0,1] does the job.
  */
 static void
-emit_face_var(struct st_translate *t)
+emit_face_var(struct gl_context *ctx, struct st_translate *t)
 {
    struct ureg_program *ureg = t->ureg;
    struct ureg_dst face_temp = ureg_DECL_temporary(ureg);
    struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]];
 
-   /* MOV_SAT face_temp, input[face] */
-   face_temp = ureg_saturate(face_temp);
-   ureg_MOV(ureg, face_temp, face_input);
+   if (ctx->Const.NativeIntegers) {
+      ureg_FSGE(ureg, face_temp, face_input, ureg_imm1f(ureg, 0));
+   }
+   else {
+      /* MOV_SAT face_temp, input[face] */
+      ureg_MOV(ureg, ureg_saturate(face_temp), face_input);
+   }
 
    /* Use face_temp as face input from here on: */
    t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp);
@@ -4909,7 +4913,7 @@ st_translate_program(
       }
 
       if (proginfo->InputsRead & VARYING_BIT_FACE)
-         emit_face_var(t);
+         emit_face_var(ctx, t);
 
       /*
        * Declare output attributes.
@@ -5210,6 +5214,7 @@ get_mesa_program(struct gl_context *ctx,
    v->have_sqrt = pscreen->get_shader_param(pscreen, ptarget,
                                             PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED);
 
+   _mesa_copy_linked_program_data(shader->Stage, shader_program, prog);
    _mesa_generate_parameters_list_for_uniforms(shader_program, shader,
 					       prog->Parameters);
 
@@ -5315,10 +5320,6 @@ get_mesa_program(struct gl_context *ctx,
    case GL_GEOMETRY_SHADER:
       stgp = (struct st_geometry_program *)prog;
       stgp->glsl_to_tgsi = v;
-      stgp->Base.InputType = shader_program->Geom.InputType;
-      stgp->Base.OutputType = shader_program->Geom.OutputType;
-      stgp->Base.VerticesOut = shader_program->Geom.VerticesOut;
-      stgp->Base.Invocations = shader_program->Geom.Invocations;
       break;
    default:
       assert(!"should not be reached");
@@ -5330,34 +5331,6 @@ get_mesa_program(struct gl_context *ctx,
 
 extern "C" {
 
-struct gl_shader *
-st_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
-{
-   struct gl_shader *shader;
-   assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER ||
-          type == GL_GEOMETRY_SHADER_ARB);
-   shader = rzalloc(NULL, struct gl_shader);
-   if (shader) {
-      shader->Type = type;
-      shader->Stage = _mesa_shader_enum_to_shader_stage(type);
-      shader->Name = name;
-      _mesa_init_shader(ctx, shader);
-   }
-   return shader;
-}
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name)
-{
-   struct gl_shader_program *shProg;
-   shProg = rzalloc(NULL, struct gl_shader_program);
-   if (shProg) {
-      shProg->Name = name;
-      _mesa_init_shader_program(ctx, shProg);
-   }
-   return shProg;
-}
-
 /**
  * Link a shader.
  * Called via ctx->Driver.LinkShader()
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 18f666f..5ed6407 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -61,11 +61,6 @@ void get_bitmap_visitor(struct st_fragment_program *fp,
                         struct glsl_to_tgsi_visitor *original,
                         int samplerIndex);
 
-struct gl_shader *st_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
-
-struct gl_shader_program *
-st_new_shader_program(struct gl_context *ctx, GLuint name);
-
 GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
 
 void
diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h
index 40ebf02..ff37a7d 100644
--- a/mesalib/src/util/macros.h
+++ b/mesalib/src/util/macros.h
@@ -75,6 +75,20 @@ do {                        \
 #define unreachable(str)
 #endif
 
+/**
+ * Assume macro. Useful for expressing our assumptions to the compiler,
+ * typically for purposes of silencing warnings.
+ */
+#ifdef HAVE___BUILTIN_UNREACHABLE
+#define assume(expr) ((expr) ? ((void) 0) \
+                             : (assert(!"assumption failed"), \
+                                __builtin_unreachable()))
+#elif _MSC_VER >= 1200
+#define assume(expr) __assume(expr)
+#else
+#define assume(expr) assert(expr)
+#endif
+
 #ifdef HAVE_FUNC_ATTRIBUTE_FLATTEN
 #define FLATTEN __attribute__((__flatten__))
 #else
diff --git a/mesalib/src/util/register_allocate.c b/mesalib/src/util/register_allocate.c
index afab9dd..6cf7ce7 100644
--- a/mesalib/src/util/register_allocate.c
+++ b/mesalib/src/util/register_allocate.c
@@ -335,7 +335,7 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)
 
 	    for (i = 0; i < regs->regs[rc].num_conflicts; i++) {
 	       unsigned int rb = regs->regs[rc].conflict_list[i];
-	       if (BITSET_TEST(regs->classes[b]->regs, rb))
+	       if (reg_belongs_to_class(rb, regs->classes[b]))
 		  conflicts++;
 	    }
 	    max_conflicts = MAX2(max_conflicts, conflicts);
diff --git a/pixman/pixman/pixman-mmx.c b/pixman/pixman/pixman-mmx.c
index c7fd503..42826d9 100644
--- a/pixman/pixman/pixman-mmx.c
+++ b/pixman/pixman/pixman-mmx.c
@@ -3580,6 +3580,8 @@ scaled_nearest_scanline_mmx_8888_8888_OVER (uint32_t*       pd,
 
 	w--;
     }
+
+    _mm_empty ();
 }
 
 FAST_NEAREST_MAINLOOP (mmx_8888_8888_cover_OVER,
@@ -3608,7 +3610,11 @@ scaled_nearest_scanline_mmx_8888_n_8888_OVER (const uint32_t * mask,
     __m64 mm_mask;
 
     if (zero_src || (*mask >> 24) == 0)
+    {
+	/* A workaround for https://gcc.gnu.org/PR47759 */
+	_mm_empty ();
 	return;
+    }
 
     mm_mask = expand_alpha (load8888 (mask));
 
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c
index aa3859f..0122ff3 100644
--- a/xorg-server/Xext/panoramiXprocs.c
+++ b/xorg-server/Xext/panoramiXprocs.c
@@ -1908,7 +1908,7 @@ PanoramiXGetImage(ClientPtr client)
     }
 
     rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
-                                  XRC_DRAWABLE, client, DixWriteAccess);
+                                  XRC_DRAWABLE, client, DixReadAccess);
     if (rc != Success)
         return (rc == BadValue) ? BadDrawable : rc;
 
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index c697188..ac68f17 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -2208,8 +2208,6 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes])
 AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && test "x$AIGLX" = xyes])
-AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes])
-AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
 AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
 
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c
index 21baf89..f9c9917 100644
--- a/xorg-server/fb/fbpict.c
+++ b/xorg-server/fb/fbpict.c
@@ -326,7 +326,7 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
      * only set the clip region for pictures with drawables
      */
     if (has_clip) {
-        if (pict->clientClipType != CT_NONE)
+        if (pict->clientClip)
             pixman_image_set_has_client_clip(image, TRUE);
 
         if (*xoff || *yoff)
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index c756bf5..5a8966f 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -475,7 +475,7 @@ create_driver_context(__GLXDRIcontext * context,
     context->driContext = NULL;
 
     if (screen->dri2->base.version >= 3) {
-        uint32_t ctx_attribs[3 * 2];
+        uint32_t ctx_attribs[4 * 2];
         unsigned num_ctx_attribs = 0;
         unsigned dri_err = 0;
         unsigned major_ver;
@@ -510,6 +510,8 @@ create_driver_context(__GLXDRIcontext * context,
                     __DRI_CTX_ATTRIB_RESET_STRATEGY;
                 ctx_attribs[num_ctx_attribs++] = reset;
             }
+
+            assert(num_ctx_attribs <= ARRAY_SIZE(ctx_attribs));
         }
 
         context->driContext =
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 8b88f3e..5761710 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -68,6 +68,7 @@ typedef struct _EphyrInputPrivate {
 
 Bool EphyrWantGrayScale = 0;
 Bool EphyrWantResize = 0;
+Bool EphyrWantNoHostGrab = 0;
 
 Bool
 host_has_extension(xcb_extension_t *extension)
@@ -649,7 +650,11 @@ ephyrInitScreen(ScreenPtr pScreen)
 
     EPHYR_LOG("pScreen->myNum:%d\n", pScreen->myNum);
     hostx_set_screen_number(screen, pScreen->myNum);
-    hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)");
+    if (EphyrWantNoHostGrab) {
+        hostx_set_win_title(screen, "xephyr");
+    } else {
+        hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)");
+    }
     pScreen->CreateColormap = ephyrCreateColormap;
 
 #ifdef XV
@@ -1092,12 +1097,13 @@ ephyrProcessKeyRelease(xcb_generic_event_t *xev)
     if (!keysyms)
         keysyms = xcb_key_symbols_alloc(conn);
 
-    if (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L
+    if (!EphyrWantNoHostGrab &&
+        (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L
           || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R)
          && (key->state & XCB_MOD_MASK_CONTROL)) ||
         ((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L
           || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R)
-         && (key->state & XCB_MOD_MASK_SHIFT))) {
+         && (key->state & XCB_MOD_MASK_SHIFT)))) {
         KdScreenInfo *screen = screen_from_window(key->event);
         EphyrScrPriv *scrpriv = screen->driver;
 
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index 3693531..bcfb750 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -33,6 +33,7 @@
 extern Window EphyrPreExistingHostWin;
 extern Bool EphyrWantGrayScale;
 extern Bool EphyrWantResize;
+extern Bool EphyrWantNoHostGrab;
 extern Bool kdHasPointer;
 extern Bool kdHasKbd;
 extern Bool ephyr_glamor, ephyr_glamor_gles2;
@@ -153,6 +154,7 @@ ddxUseMsg(void)
     ErrorF("-name [name]         define the name in the WM_CLASS property\n");
     ErrorF
         ("-title [title]       set the window title in the WM_NAME property\n");
+    ErrorF("-no-host-grab        Disable grabbing the keyboard and mouse.\n");
     ErrorF("\n");
 }
 
@@ -360,6 +362,10 @@ ddxProcessArgument(int argc, char **argv, int i)
         return 2;
     }
     /* end Xnest compat */
+    else if (!strcmp(argv[i], "-no-host-grab")) {
+        EphyrWantNoHostGrab = 1;
+        return 2;
+    }
 
     return KdProcessArgument(argc, argv, i);
 }
diff --git a/xorg-server/hw/kdrive/ephyr/man/Xephyr.man b/xorg-server/hw/kdrive/ephyr/man/Xephyr.man
index f14f6c8..c043790 100644
--- a/xorg-server/hw/kdrive/ephyr/man/Xephyr.man
+++ b/xorg-server/hw/kdrive/ephyr/man/Xephyr.man
@@ -63,6 +63,9 @@ improvement is negligible.
 .B -resizeable
 Allow the Xephyr window to be resized, even if not embedded into a parent
 window. By default, the Xephyr window has a fixed size.
+.TP 8
+.B -no-host-grab
+Disable grabbing the keyboard and mouse.
 .SH "SIGNALS"
 Send a SIGUSR1 to the server (e.g. pkill -USR1 Xephyr) to
 toggle the debugging mode.
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 88bc85a..e867119 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -735,12 +735,6 @@ winUseMsg(void)
            "\t\t1 - Shadow GDI\n"
            "\t\t2 - Shadow DirectDraw\n"
            "\t\t4 - Shadow DirectDraw4 Non-Locking\n"
-#ifdef XWIN_PRIMARYFB
-           "\t\t8 - Primary DirectDraw - obsolete\n"
-#endif
-#ifdef XWIN_NATIVEGDI
-           "\t\t16 - Native GDI - experimental\n"
-#endif
         );
 
     ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n");
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 2c7fde3..0ea8ba7 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -37,27 +37,6 @@ DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM
 MULTIWINDOWEXTWM_LIBS = $(top_builddir)/miext/rootless/librootless.la
 endif
 
-if XWIN_NATIVEGDI
-SRCS_NATIVEGDI = \
-	winclip.c \
-	winfillsp.c \
-	winfont.c \
-	wingc.c \
-	wingetsp.c \
-	winnativegdi.c \
-	winpixmap.c \
-	winpolyline.c \
-	winrop.c \
-	winsetsp.c
-DEFS_NATIVEGDI = -DXWIN_NATIVEGDI
-endif
-
-if XWIN_PRIMARYFB
-SRCS_PRIMARYFB = \
-	winpfbdd.c
-DEFS_PRIMARYFB = -DXWIN_PRIMARYFB
-endif
-
 if XWIN_RANDR
 SRCS_RANDR = \
 	winrandr.c
diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man
index c71f6a1..a043ac2 100644
--- a/xorg-server/hw/xwin/man/XWin.man
+++ b/xorg-server/hw/xwin/man/XWin.man
@@ -261,10 +261,6 @@ Shadow GDI
 Shadow DirectDraw
 .IP 4 4
 Shadow DirectDraw Non-Locking
-.IP 8 4
-Primary DirectDraw (unsupported, obsolete)
-.IP 16 4
-Native GDI (unsupported, experimental and barely functional)
 .RE
 
 .SH FULLSCREEN OPTIONS
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 7af35e7..ed1ad01 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -103,12 +103,6 @@
 #define WIN_SERVER_SHADOW_GDI	0x1L    /* 1 */
 #define WIN_SERVER_SHADOW_DD	0x2L    /* 2 */
 #define WIN_SERVER_SHADOW_DDNL	0x4L    /* 4 */
-#ifdef XWIN_PRIMARYFB
-#define WIN_SERVER_PRIMARY_DD	0x8L    /* 8 */
-#endif
-#ifdef XWIN_NATIVEGDI
-#define WIN_SERVER_NATIVE_GDI	0x10L   /* 16 */
-#endif
 
 #define AltMapIndex		Mod1MapIndex
 #define NumLockMapIndex		Mod2MapIndex
@@ -304,12 +298,6 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr) (WindowPtr pWin);
 
 typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
 
-#ifdef XWIN_NATIVEGDI
-/* Typedefs for native GDI wrappers */
-typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-typedef Bool (*UnrealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont);
-#endif
-
 /*
  * GC (graphics context) privates
  */
@@ -582,12 +570,6 @@ typedef struct _winPrivScreenRec {
     SetShapeProcPtr SetShape;
 
     winCursorRec cursor;
-
-#ifdef XWIN_NATIVEGDI
-    RealizeFontPtr RealizeFont;
-    UnrealizeFontPtr UnrealizeFont;
-#endif
-
 } winPrivScreenRec;
 
 #ifdef XWIN_MULTIWINDOWEXTWM
@@ -775,15 +757,6 @@ void
 winBlockHandler(ScreenPtr pScreen,
                 void *pTimeout, void *pReadMask);
 
-#ifdef XWIN_NATIVEGDI
-/*
- * winclip.c
- */
-
-RegionPtr
- winPixmapToRegionNativeGDI(PixmapPtr pPix);
-#endif
-
 #ifdef XWIN_CLIPBOARD
 /*
  * winclipboardinit.c
@@ -859,52 +832,6 @@ void
 winMessageBoxF(const char *pszError, UINT uType, ...)
 _X_ATTRIBUTE_PRINTF(1, 3);
 
-#ifdef XWIN_NATIVEGDI
-/*
- * winfillsp.c
- */
-
-void
-
-winFillSpansNativeGDI(DrawablePtr pDrawable,
-                      GCPtr pGC,
-                      int nSpans,
-                      DDXPointPtr pPoints, int *pWidths, int fSorted);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winfont.c
- */
-
-Bool
- winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
-
-Bool
- winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingc.c
- */
-
-Bool
- winCreateGCNativeGDI(GCPtr pGC);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * wingetsp.c
- */
-
-void
-
-winGetSpansNativeGDI(DrawablePtr pDrawable,
-                     int wMax,
-                     DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst);
-#endif
-
 /*
  * winglobals.c
  */
@@ -956,23 +883,12 @@ void
  * winmisc.c
  */
 
-#ifdef XWIN_NATIVEGDI
-void
-
-winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
-                          unsigned short *pHeight, ScreenPtr pScreen);
-#endif
-
 CARD8
  winCountBits(DWORD dw);
 
 Bool
  winUpdateFBPointer(ScreenPtr pScreen, void *pbits);
 
-#ifdef XWIN_NATIVEGDI
-BOOL winPaintBackground(HWND hwnd, COLORREF colorref);
-#endif
-
 /*
  * winmouse.c
  */
@@ -994,60 +910,6 @@ winMouseButtonsHandle(ScreenPtr pScreen,
 void
  winEnqueueMotion(int x, int y);
 
-#ifdef XWIN_NATIVEGDI
-/*
- * winnativegdi.c
- */
-
-HBITMAP
-winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
-                      BYTE ** ppbBits, BITMAPINFO ** ppbmi);
-
-Bool
- winSetEngineFunctionsNativeGDI(ScreenPtr pScreen);
-#endif
-
-#ifdef XWIN_PRIMARYFB
-/*
- * winpfbddd.c
- */
-
-Bool
- winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpixmap.c
- */
-
-PixmapPtr
-
-winCreatePixmapNativeGDI(ScreenPtr pScreen, int width, int height, int depth,
-                         unsigned usage_hint);
-
-Bool
- winDestroyPixmapNativeGDI(PixmapPtr pPixmap);
-
-Bool
-
-winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
-                               int iWidth, int iHeight,
-                               int iDepth,
-                               int iBitsPerPixel,
-                               int devKind, void *pPixData);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpolyline.c
- */
-
-void
-
-winPolyLineNativeGDI(DrawablePtr pDrawable,
-                     GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
-#endif
 /*
  * winscrinit.c
  */
@@ -1058,26 +920,6 @@ Bool
 Bool
  winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
 
-#if defined(XWIN_NATIVEGDI)
-Bool
-
-winFinishScreenInitNativeGDI(int i,
-                             ScreenPtr pScreen, int argc, char **argv);
-#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winsetsp.c
- */
-
-void
-
-winSetSpansNativeGDI(DrawablePtr pDrawable,
-                     GCPtr pGC,
-                     char *pSrc,
-                     DDXPointPtr pPoints, int *pWidth, int nSpans, int fSorted);
-#endif
-
 /*
  * winshaddd.c
  */
@@ -1112,30 +954,6 @@ winWakeupHandler(ScreenPtr pScreen,
  * winwindow.c
  */
 
-#ifdef XWIN_NATIVEGDI
-Bool
- winCreateWindowNativeGDI(WindowPtr pWin);
-
-Bool
- winDestroyWindowNativeGDI(WindowPtr pWin);
-
-Bool
- winPositionWindowNativeGDI(WindowPtr pWin, int x, int y);
-
-void
-
-winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
-
-Bool
- winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask);
-
-Bool
- winUnmapWindowNativeGDI(WindowPtr pWindow);
-
-Bool
- winMapWindowNativeGDI(WindowPtr pWindow);
-#endif
-
 Bool
  winCreateWindowRootless(WindowPtr pWindow);
 
diff --git a/xorg-server/hw/xwin/winclip.c b/xorg-server/hw/xwin/winclip.c
deleted file mode 100644
index 941e948..0000000
--- a/xorg-server/hw/xwin/winclip.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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 Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* Look at mfb/mfbclip.c for sample implementation */
-RegionPtr
-winPixmapToRegionNativeGDI(PixmapPtr pPix)
-{
-    ErrorF("winPixmapToRegion()\n");
-    return NULL;
-}
diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c
index 6732dcb..9f72016 100644
--- a/xorg-server/hw/xwin/wincreatewnd.c
+++ b/xorg-server/hw/xwin/wincreatewnd.c
@@ -110,20 +110,8 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen)
                              GetModuleHandle(NULL),     /* Instance handle */
                              pScreenPriv);      /* ScreenPrivates */
 
-    /* Branch on the server engine */
-    switch (pScreenInfo->dwEngine) {
-#ifdef XWIN_NATIVEGDI
-    case WIN_SERVER_SHADOW_GDI:
-        /* Show the window */
-        ShowWindow(*phwnd, SW_SHOWMAXIMIZED);
-        break;
-#endif
-
-    default:
-        /* Hide the window */
-        ShowWindow(*phwnd, SW_SHOWNORMAL);
-        break;
-    }
+    /* Hide the window */
+    ShowWindow(*phwnd, SW_SHOWNORMAL);
 
     /* Send first paint message */
     UpdateWindow(*phwnd);
@@ -474,12 +462,6 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
         }
     }
 
-#ifdef XWIN_NATIVEGDI
-    /* Paint window background blue */
-    if (pScreenInfo->dwEngine == WIN_SERVER_NATIVE_GDI)
-        winPaintBackground(*phwnd, RGB(0x00, 0x00, 0xFF));
-#endif
-
     winDebug("winCreateBoundingWindowWindowed -  Returning\n");
 
     return TRUE;
diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c
index 1f55ada..b473b3a 100644
--- a/xorg-server/hw/xwin/winengine.c
+++ b/xorg-server/hw/xwin/winengine.c
@@ -59,10 +59,6 @@ winDetectSupportedEngines(void)
     /* Initialize the engine support flags */
     g_dwEnginesSupported = WIN_SERVER_SHADOW_GDI;
 
-#ifdef XWIN_NATIVEGDI
-    g_dwEnginesSupported |= WIN_SERVER_NATIVE_GDI;
-#endif
-
     /* Get operating system version information */
     ZeroMemory(&osvi, sizeof(osvi));
     osvi.dwOSVersionInfoSize = sizeof(osvi);
@@ -94,15 +90,6 @@ winDetectSupportedEngines(void)
             winErrorFVerb(2,
                           "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n");
             g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD;
-
-#ifdef XWIN_PRIMARYFB
-            /* Allow PrimaryDD engine if NT */
-            if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-                g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD;
-                winErrorFVerb(2,
-                              "winDetectSupportedEngines - Windows NT, allowing PrimaryDD\n");
-            }
-#endif
         }
 
         /* Try to query for DirectDraw4 interface */
@@ -206,16 +193,6 @@ winSetEngine(ScreenPtr pScreen)
         case WIN_SERVER_SHADOW_DDNL:
             winSetEngineFunctionsShadowDDNL(pScreen);
             break;
-#ifdef XWIN_PRIMARYFB
-        case WIN_SERVER_PRIMARY_DD:
-            winSetEngineFunctionsPrimaryDD(pScreen);
-            break;
-#endif
-#ifdef XWIN_NATIVEGDI
-        case WIN_SERVER_NATIVE_GDI:
-            winSetEngineFunctionsNativeGDI(pScreen);
-            break;
-#endif
         default:
             FatalError("winSetEngine - Invalid engine type\n");
         }
diff --git a/xorg-server/hw/xwin/winfillsp.c b/xorg-server/hw/xwin/winfillsp.c
deleted file mode 100644
index bd0a15e..0000000
--- a/xorg-server/hw/xwin/winfillsp.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Harold L Hunt II
- * 		Alan Hourihane <alanh at fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-extern void ROP16(HDC hdc, int rop);
-
-#define TRANSLATE_COLOR(color)						\
-{									\
-  if (pDrawable->depth == 15)						\
-    color = ((color & 0x1F) << 19) | ((color & 0x03E0) << 6) |		\
-      ((color & 0xF800) >> 8);						\
-  else if (pDrawable->depth == 16)					\
-    color = ((color & 0x1F) << 19) | ((color & 0x07E0) << 5) |		\
-      ((color & 0xF800) >> 8);						\
-  else if (pDrawable->depth == 24 || pDrawable->depth == 32)		\
-    color = ((color & 0xFF) << 16) | (color & 0xFF00) |			\
-      ((color & 0xFF0000) >> 16);					\
-}
-
-/* See Porting Layer Definition - p. 54 */
-void
-winFillSpansNativeGDI(DrawablePtr pDrawable,
-                      GCPtr pGC,
-                      int iSpans,
-                      DDXPointPtr pPoints, int *piWidths, int fSorted)
-{
-    winGCPriv(pGC);
-    HBITMAP hbmpOrig = NULL, hbmpOrigStipple = NULL;
-    HBITMAP hPenOrig = NULL;
-    HBITMAP hBitmap = NULL;
-    PixmapPtr pPixmap = NULL;
-    winPrivPixmapPtr pPixmapPriv = NULL;
-    PixmapPtr pStipple = NULL;
-    winPrivPixmapPtr pStipplePriv = NULL;
-    PixmapPtr pTile = NULL;
-    winPrivPixmapPtr pTilePriv = NULL;
-    HDC hdcStipple = NULL, hdcTile = NULL;
-    HPEN hPen = NULL;
-    int iX;
-    int fg, bg;
-    RegionPtr pClip = pGC->pCompositeClip;
-    BoxPtr pextent, pbox;
-    int nbox;
-    int extentX1, extentX2, extentY1, extentY2;
-    int fullX1, fullX2, fullY1;
-    HRGN hrgn = NULL, combined = NULL;
-
-    nbox = RegionNumRects(pClip);
-    pbox = RegionRects(pClip);
-
-    if (!nbox)
-        return;
-
-    combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
-    nbox--;
-    pbox++;
-
-    while (nbox--) {
-        hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
-        CombineRgn(combined, combined, hrgn, RGN_OR);
-        DeleteObject(hrgn);
-        hrgn = NULL;
-        pbox++;
-    }
-
-    pextent = RegionExtents(pClip);
-    extentX1 = pextent->x1;
-    extentY1 = pextent->y1;
-    extentX2 = pextent->x2;
-    extentY2 = pextent->y2;
-
-    /* Branch on the type of drawable we have */
-    switch (pDrawable->type) {
-    case DRAWABLE_PIXMAP:
-
-        SelectClipRgn(pGCPriv->hdcMem, combined);
-        DeleteObject(combined);
-        combined = NULL;
-
-        /* Get a pixmap pointer from the drawable pointer, and fetch privates  */
-        pPixmap = (PixmapPtr) pDrawable;
-        pPixmapPriv = winGetPixmapPriv(pPixmap);
-
-        /* Select the drawable pixmap into memory hdc */
-        hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
-        if (hbmpOrig == NULL)
-            FatalError("winFillSpans - DRAWABLE_PIXMAP - "
-                       "SelectObject () failed on\n\tpPixmapPriv->hBitmap: "
-                       "%p\n", pPixmapPriv->hBitmap);
-
-        /* Branch on the fill type */
-        switch (pGC->fillStyle) {
-        case FillSolid:
-
-            ROP16(pGCPriv->hdcMem, pGC->alu);
-
-            if (pDrawable->depth == 1) {
-                if (pGC->fgPixel == 0)
-                    hPenOrig = SelectObject(pGCPriv->hdcMem,
-                                            GetStockObject(BLACK_PEN));
-                else
-                    hPenOrig = SelectObject(pGCPriv->hdcMem,
-                                            GetStockObject(WHITE_PEN));
-            }
-            else {
-                fg = pGC->fgPixel;
-                TRANSLATE_COLOR(fg);
-                hPen = CreatePen(PS_SOLID, 0, fg);
-                hPenOrig = SelectObject(pGCPriv->hdcMem, hPen);
-            }
-
-            while (iSpans--) {
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                MoveToEx(pGCPriv->hdcMem, fullX1, fullY1, NULL);
-                LineTo(pGCPriv->hdcMem, fullX2, fullY1);
-            }
-
-            SetROP2(pGCPriv->hdcMem, R2_COPYPEN);
-
-            /* Give back the Pen */
-            SelectObject(pGCPriv->hdcMem, hPenOrig);
-
-            if (pDrawable->depth != 1)
-                DeleteObject(hPen);
-            break;
-
-        case FillOpaqueStippled:
-
-            pStipple = pGC->stipple;
-            pStipplePriv = winGetPixmapPriv(pStipple);
-
-            /* Create a device-dependent bitmap for the stipple */
-            hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
-                                     (BITMAPINFOHEADER *) pStipplePriv->pbmih,
-                                     CBM_INIT,
-                                     pStipplePriv->pbBits,
-                                     (BITMAPINFO *) pStipplePriv->pbmih,
-                                     DIB_RGB_COLORS);
-
-            /* Create a memory DC to hold the stipple */
-            hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
-
-            /* Select the stipple bitmap into the stipple DC */
-            hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
-            if (hbmpOrigStipple == NULL)
-                FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
-                           "SelectObject () failed on hbmpOrigStipple\n");
-
-            /* Make a temporary copy of the foreground and background colors */
-            bg = pGC->bgPixel;
-            fg = pGC->fgPixel;
-
-            /* Translate the depth-dependent colors to Win32 COLORREFs */
-            TRANSLATE_COLOR(fg);
-            TRANSLATE_COLOR(bg);
-            SetTextColor(pGCPriv->hdcMem, fg);
-            SetBkColor(pGCPriv->hdcMem, bg);
-
-            while (iSpans--) {
-                int width = pStipple->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pStipple->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pStipple->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pStipple->drawable.width) -
-                              pStipple->drawable.width)) %
-                            pStipple->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pStipple->drawable.width)
-                        width = pStipple->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdcMem,
-                           iX, fullY1,
-                           width, 1,
-                           hdcStipple,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pStipple->drawable.height) -
-                             pStipple->drawable.height)) %
-                           pStipple->drawable.height, g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Clear the stipple HDC */
-            SelectObject(hdcStipple, hbmpOrigStipple);
-            DeleteDC(hdcStipple);
-
-            /* Delete the device dependent stipple bitmap */
-            DeleteObject(hBitmap);
-
-            break;
-        case FillStippled:
-
-            pStipple = pGC->stipple;
-            pStipplePriv = winGetPixmapPriv(pStipple);
-
-            /* Create a device-dependent bitmap for the stipple */
-            hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
-                                     (BITMAPINFOHEADER *) pStipplePriv->pbmih,
-                                     CBM_INIT,
-                                     pStipplePriv->pbBits,
-                                     (BITMAPINFO *) pStipplePriv->pbmih,
-                                     DIB_RGB_COLORS);
-
-            /* Create a memory DC to hold the stipple */
-            hdcStipple = CreateCompatibleDC(pGCPriv->hdcMem);
-
-            /* Select the stipple bitmap into the stipple DC */
-            hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
-            if (hbmpOrigStipple == NULL)
-                FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
-                           "SelectObject () failed on hbmpOrigStipple\n");
-
-            /* Make a temporary copy of the foreground and background colors */
-            bg = pGC->bgPixel;
-            fg = pGC->fgPixel;
-
-            /* Translate the depth-dependent colors to Win32 COLORREFs */
-            TRANSLATE_COLOR(fg);
-            TRANSLATE_COLOR(bg);
-
-            /* this is fudgy, we should only invert on the last one
-             * We need to get the black/white pixels right in the
-             * colormap. But yeah ! it's working.. 
-             */
-            if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
-                SetTextColor(pGCPriv->hdcMem, fg);
-                SetBkColor(pGCPriv->hdcMem, bg);
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-            }
-            else if (pGC->bgPixel == -1) {
-                SetTextColor(pGCPriv->hdcMem, fg);
-                SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-            }
-            else if (pGC->fgPixel == -1) {
-                SetTextColor(pGCPriv->hdcMem, bg);
-                SetBkMode(pGCPriv->hdcMem, TRANSPARENT);
-#if 0
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-#endif
-            }
-
-            while (iSpans--) {
-                int width = pStipple->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pStipple->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pStipple->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pStipple->drawable.width) -
-                              pStipple->drawable.width)) %
-                            pStipple->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pStipple->drawable.width)
-                        width = pStipple->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdcMem,
-                           iX, fullY1,
-                           width, 1,
-                           hdcStipple,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pStipple->drawable.height) -
-                             pStipple->drawable.height)) %
-                           pStipple->drawable.height, g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Clear the stipple HDC */
-            SelectObject(hdcStipple, hbmpOrigStipple);
-            DeleteDC(hdcStipple);
-
-            /* Delete the device dependent stipple bitmap */
-            DeleteObject(hBitmap);
-
-            /* Restore the background mode */
-            SetBkMode(pGCPriv->hdcMem, OPAQUE);
-            break;
-
-        case FillTiled:
-
-            /* Get a pixmap pointer from the tile pointer, and fetch privates  */
-            pTile = (PixmapPtr) pGC->tile.pixmap;
-            pTilePriv = winGetPixmapPriv(pTile);
-
-            /* Create a memory DC to hold the tile */
-            hdcTile = CreateCompatibleDC(pGCPriv->hdcMem);
-
-            /* Select the tile into a DC */
-            hbmpOrig = SelectObject(hdcTile, pTilePriv->hBitmap);
-            if (hbmpOrig == NULL)
-                FatalError("winFillSpans - DRAWABLE_PIXMAP - FillTiled - "
-                           "SelectObject () failed on pTilePriv->hBitmap\n");
-
-            while (iSpans--) {
-                int width = pTile->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pTile->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pTile->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pTile->drawable.width) -
-                              pTile->drawable.width)) % pTile->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pTile->drawable.width)
-                        width = pTile->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdcMem,
-                           iX, fullY1,
-                           width, 1,
-                           hdcTile,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pTile->drawable.height) -
-                             pTile->drawable.height)) % pTile->drawable.height,
-                           g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Push the tile pixmap out of the memory HDC */
-            SelectObject(hdcTile, hbmpOrig);
-
-            /* Delete the tile */
-            DeleteDC(hdcTile);
-            break;
-
-        default:
-            ErrorF("winFillSpans - DRAWABLE_PIXMAP - Unknown fillStyle\n");
-            break;
-        }
-
-        /* Reset clip region */
-        SelectClipRgn(pGCPriv->hdcMem, NULL);
-
-        /* Push the drawable pixmap out of the GC HDC */
-        SelectObject(pGCPriv->hdcMem, hbmpOrig);
-        break;
-
-    case DRAWABLE_WINDOW:
-
-        SelectClipRgn(pGCPriv->hdc, combined);
-        DeleteObject(combined);
-        combined = NULL;
-
-        /* Branch on fill style */
-        switch (pGC->fillStyle) {
-        case FillSolid:
-
-            ROP16(pGCPriv->hdc, pGC->alu);
-
-            if (pDrawable->depth == 1) {
-                if (pGC->fgPixel == 0)
-                    hPenOrig = SelectObject(pGCPriv->hdc,
-                                            GetStockObject(BLACK_PEN));
-                else
-                    hPenOrig = SelectObject(pGCPriv->hdc,
-                                            GetStockObject(WHITE_PEN));
-            }
-            else {
-                fg = pGC->fgPixel;
-                TRANSLATE_COLOR(fg);
-                hPen = CreatePen(PS_SOLID, 0, fg);
-                hPenOrig = SelectObject(pGCPriv->hdc, hPen);
-            }
-
-            while (iSpans--) {
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                MoveToEx(pGCPriv->hdc, fullX1, fullY1, NULL);
-                LineTo(pGCPriv->hdc, fullX2, fullY1);
-            }
-
-            SetROP2(pGCPriv->hdc, R2_COPYPEN);
-
-            /* Give back the Brush */
-            SelectObject(pGCPriv->hdc, hPenOrig);
-
-            if (pDrawable->depth != 1)
-                DeleteObject(hPen);
-            break;
-
-        case FillOpaqueStippled:
-
-            pStipple = pGC->stipple;
-            pStipplePriv = winGetPixmapPriv(pStipple);
-
-            /* Create a device-dependent bitmap for the stipple */
-            hBitmap = CreateDIBitmap(pGCPriv->hdc,
-                                     (BITMAPINFOHEADER *) pStipplePriv->pbmih,
-                                     CBM_INIT,
-                                     pStipplePriv->pbBits,
-                                     (BITMAPINFO *) pStipplePriv->pbmih,
-                                     DIB_RGB_COLORS);
-
-            /* Create a memory DC to hold the stipple */
-            hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
-
-            /* Select the stipple bitmap into the stipple DC */
-            hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
-            if (hbmpOrigStipple == NULL)
-                FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
-                           "SelectObject () failed on hbmpOrigStipple\n");
-
-            /* Make a temporary copy of the foreground and background colors */
-            bg = pGC->bgPixel;
-            fg = pGC->fgPixel;
-
-            /* Translate the depth-dependent colors to Win32 COLORREFs */
-            TRANSLATE_COLOR(fg);
-            TRANSLATE_COLOR(bg);
-            SetTextColor(pGCPriv->hdc, fg);
-            SetBkColor(pGCPriv->hdc, bg);
-
-            while (iSpans--) {
-                int width = pStipple->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pStipple->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pStipple->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pStipple->drawable.width) -
-                              pStipple->drawable.width)) %
-                            pStipple->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pStipple->drawable.width)
-                        width = pStipple->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdc,
-                           iX, fullY1,
-                           width, 1,
-                           hdcStipple,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pStipple->drawable.height) -
-                             pStipple->drawable.height)) %
-                           pStipple->drawable.height, g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Clear the stipple HDC */
-            SelectObject(hdcStipple, hbmpOrigStipple);
-            DeleteDC(hdcStipple);
-
-            /* Delete the device dependent stipple bitmap */
-            DeleteObject(hBitmap);
-
-            break;
-
-        case FillStippled:
-            pStipple = pGC->stipple;
-            pStipplePriv = winGetPixmapPriv(pStipple);
-
-            /* Create a device-dependent bitmap for the stipple */
-            hBitmap = CreateDIBitmap(pGCPriv->hdcMem,
-                                     (BITMAPINFOHEADER *) pStipplePriv->pbmih,
-                                     CBM_INIT,
-                                     pStipplePriv->pbBits,
-                                     (BITMAPINFO *) pStipplePriv->pbmih,
-                                     DIB_RGB_COLORS);
-
-            /* Create a memory DC to hold the stipple */
-            hdcStipple = CreateCompatibleDC(pGCPriv->hdc);
-
-            /* Select the stipple bitmap into the stipple DC */
-            hbmpOrigStipple = SelectObject(hdcStipple, hBitmap);
-            if (hbmpOrigStipple == NULL)
-                FatalError("winFillSpans () - DRAWABLE_PIXMAP - FillStippled - "
-                           "SelectObject () failed on hbmpOrigStipple\n");
-
-            /* Make a temporary copy of the foreground and background colors */
-            bg = pGC->bgPixel;
-            fg = pGC->fgPixel;
-
-            /* Translate the depth-dependent colors to Win32 COLORREFs */
-            TRANSLATE_COLOR(fg);
-            TRANSLATE_COLOR(bg);
-
-            /* this is fudgy, we should only invert on the last one
-             * We need to get the black/white pixels right in the
-             * colormap. But yeah ! it's working.. 
-             */
-            if (pGC->bgPixel != -1 && pGC->fgPixel != -1) {
-                SetTextColor(pGCPriv->hdc, fg);
-                SetBkColor(pGCPriv->hdc, bg);
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-            }
-            else if (pGC->bgPixel == -1) {
-                SetTextColor(pGCPriv->hdc, fg);
-                SetBkMode(pGCPriv->hdc, TRANSPARENT);
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-            }
-            else if (pGC->fgPixel == -1) {
-                SetTextColor(pGCPriv->hdc, bg);
-                SetBkMode(pGCPriv->hdc, TRANSPARENT);
-#if 0
-                BitBlt(hdcStipple,
-                       0, 0,
-                       pStipple->drawable.width, pStipple->drawable.height,
-                       hdcStipple, 0, 0, 0x330008);
-#endif
-            }
-
-            while (iSpans--) {
-                int width = pStipple->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pStipple->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pStipple->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pStipple->drawable.width) -
-                              pStipple->drawable.width)) %
-                            pStipple->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pStipple->drawable.width)
-                        width = pStipple->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdc,
-                           iX, fullY1,
-                           width, 1,
-                           hdcStipple,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pStipple->drawable.height) -
-                             pStipple->drawable.height)) %
-                           pStipple->drawable.height, g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Clear the stipple HDC */
-            SelectObject(hdcStipple, hbmpOrigStipple);
-            DeleteDC(hdcStipple);
-
-            /* Delete the device dependent stipple bitmap */
-            DeleteObject(hBitmap);
-
-            /* Restore the background mode */
-            SetBkMode(pGCPriv->hdc, OPAQUE);
-            break;
-
-        case FillTiled:
-
-            /* Get a pixmap pointer from the tile pointer, and fetch privates  */
-            pTile = (PixmapPtr) pGC->tile.pixmap;
-            pTilePriv = winGetPixmapPriv(pTile);
-
-            /* Select the tile into a DC */
-            hbmpOrig = SelectObject(pGCPriv->hdcMem, pTilePriv->hBitmap);
-            if (hbmpOrig == NULL)
-                FatalError("winFillSpans - DRAWABLE_WINDOW - FillTiled - "
-                           "SelectObject () failed on pTilePriv->hBitmap\n");
-
-            while (iSpans--) {
-                int width = pTile->drawable.width;
-
-                fullX1 = pPoints->x;
-                fullY1 = pPoints->y;
-                fullX2 = fullX1 + (int) *piWidths;
-                pPoints++;
-                piWidths++;
-
-                if (fullY1 < extentY1 || extentY2 <= fullY1)
-                    continue;
-
-                if (fullX1 < extentX1)
-                    fullX1 = extentX1;
-                if (fullX2 > extentX2)
-                    fullX2 = extentX2;
-
-                if (fullX1 >= fullX2)
-                    continue;
-
-                for (iX = fullX1; iX < fullX2; iX += width) {
-                    int xoffset;
-
-                    if ((iX + pTile->drawable.width) > fullX2)
-                        width = fullX2 - iX;
-                    else
-                        width = pTile->drawable.width;
-
-                    if (iX == fullX1)
-                        xoffset =
-                            (fullX1 -
-                             (pDrawable->x +
-                              (pGC->patOrg.x % pTile->drawable.width) -
-                              pTile->drawable.width)) % pTile->drawable.width;
-                    else
-                        xoffset = 0;
-
-                    if (xoffset + width > pTile->drawable.width)
-                        width = pTile->drawable.width - xoffset;
-
-                    BitBlt(pGCPriv->hdc,
-                           iX, fullY1,
-                           width, 1,
-                           pGCPriv->hdcMem,
-                           xoffset,
-                           (fullY1 -
-                            (pDrawable->y +
-                             (pGC->patOrg.y % pTile->drawable.height) -
-                             pTile->drawable.height)) % pTile->drawable.height,
-                           g_copyROP[pGC->alu]);
-                }
-            }
-
-            /* Push the tile pixmap out of the memory HDC */
-            SelectObject(pGCPriv->hdcMem, hbmpOrig);
-            break;
-
-        default:
-            ErrorF("winFillSpans - DRAWABLE_WINDOW - Unknown fillStyle\n");
-            break;
-        }
-
-        /* Reset clip region */
-        SelectClipRgn(pGCPriv->hdc, NULL);
-        break;
-
-    default:
-        ErrorF("winFillSpans - Unknown drawable type\n");
-        break;
-    }
-}
diff --git a/xorg-server/hw/xwin/winfont.c b/xorg-server/hw/xwin/winfont.c
deleted file mode 100644
index 7bcbce1..0000000
--- a/xorg-server/hw/xwin/winfont.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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 Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-#ifdef XWIN_NATIVEGDI
-/* See Porting Layer Definition - p. 32 */
-/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */
-Bool
-winRealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont)
-{
-    BOOL fResult = TRUE;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winRealizeFont (%p, %p)\n", pScreen, pFont);
-#endif
-
-    WIN_UNWRAP(RealizeFont);
-    if (pScreen->RealizeFont)
-        fResult = (*pScreen->RealizeFont) (pScreen, pFont);
-    WIN_WRAP(RealizeFont, winRealizeFontNativeGDI);
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 32 */
-/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */
-Bool
-winUnrealizeFontNativeGDI(ScreenPtr pScreen, FontPtr pFont)
-{
-    BOOL fResult = TRUE;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winUnrealizeFont (%p, %p)\n", pScreen, pFont);
-#endif
-
-    WIN_UNWRAP(UnrealizeFont);
-    if (pScreen->UnrealizeFont)
-        fResult = (*pScreen->UnrealizeFont) (pScreen, pFont);
-    WIN_WRAP(UnrealizeFont, winUnrealizeFontNativeGDI);
-
-    return fResult;
-#if CYGDEBUG
-    winDebug("winUnrealizeFont()\n");
-#endif
-    return TRUE;
-}
-#endif
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
deleted file mode 100644
index 5986e0a..0000000
--- a/xorg-server/hw/xwin/wingc.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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 Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/*
- * Local prototypes
- */
-
-#if 0
-static void
- winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges);
-#endif
-
-static void
-
-winValidateGCNativeGDI(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
-
-#if 0
-static void
- winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst);
-#endif
-
-static void
- winDestroyGCNativeGDI(GCPtr pGC);
-
-#if 0
-static void
- winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects);
-
-static void
- winDestroyClipNativeGDI(GCPtr pGC);
-
-static void
- winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc);
-#endif
-
-#if 0
-/* GC Handling Routines */
-const GCFuncs winGCFuncs = {
-    winValidateGCNativeGDI,
-    winChangeGCNativeGDI,
-    winCopyGCNativeGDI,
-    winDestroyGCNativeGDI,
-    winChangeClipNativeGDI,
-    winDestroyClipNativeGDI,
-    winCopyClipNativeGDI,
-};
-#else
-const GCFuncs winGCFuncs = {
-    winValidateGCNativeGDI,
-    miChangeGC,
-    miCopyGC,
-    winDestroyGCNativeGDI,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip,
-};
-#endif
-
-/* Drawing Primitives */
-const GCOps winGCOps = {
-    winFillSpansNativeGDI,
-    winSetSpansNativeGDI,
-    miPutImage,
-    miCopyArea,
-    miCopyPlane,
-    miPolyPoint,
-    winPolyLineNativeGDI,
-    miPolySegment,
-    miPolyRectangle,
-    miPolyArc,
-    miFillPolygon,
-    miPolyFillRect,
-    miPolyFillArc,
-    miPolyText8,
-    miPolyText16,
-    miImageText8,
-    miImageText16,
-#if 0
-    winImageGlyphBltNativeGDI,
-    winPolyGlyphBltNativeGDI,
-#else
-    miImageGlyphBlt,
-    miPolyGlyphBlt,
-#endif
-    miPushPixels,
-};
-
-/* See Porting Layer Definition - p. 45 */
-/* See mfb/mfbgc.c - mfbCreateGC() */
-/* See Strategies for Porting - pp. 15, 16 */
-Bool
-winCreateGCNativeGDI(GCPtr pGC)
-{
-    winPrivGCPtr pGCPriv = NULL;
-    winPrivScreenPtr pScreenPriv = NULL;
-
-#if 0
-    ErrorF("winCreateGCNativeGDI - depth: %d\n", pGC->depth);
-#endif
-
-    pGC->ops = (GCOps *) &winGCOps;
-    pGC->funcs = (GCFuncs *) &winGCFuncs;
-
-    /* We want all coordinates passed to spans functions to be screen relative */
-    pGC->miTranslate = TRUE;
-
-    /* Allocate privates for this GC */
-    pGCPriv = winGetGCPriv(pGC);
-    if (pGCPriv == NULL) {
-        ErrorF("winCreateGCNativeGDI () - Privates pointer was NULL\n");
-        return FALSE;
-    }
-
-    /* Create a new screen DC for the display window */
-    pScreenPriv = winGetScreenPriv(pGC->pScreen);
-    pGCPriv->hdc = GetDC(pScreenPriv->hwndScreen);
-
-    /* Allocate a memory DC for the GC */
-    pGCPriv->hdcMem = CreateCompatibleDC(pGCPriv->hdc);
-
-    return TRUE;
-}
-
-#if 0
-/* See Porting Layer Definition - p. 45 */
-static void
-winChangeGCNativeGDI(GCPtr pGC, unsigned long ulChanges)
-{
-#if 0
-    ErrorF("winChangeGCNativeGDI () - Doing nothing\n");
-#endif
-}
-#endif
-
-static void
-winValidateGCNativeGDI(GCPtr pGC,
-                       unsigned long ulChanges, DrawablePtr pDrawable)
-{
-    if ((ulChanges &
-         (GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode))
-        || (pDrawable->serialNumber !=
-            (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
-        miComputeCompositeClip(pGC, pDrawable);
-    }
-}
-
-#if 0
-/* See Porting Layer Definition - p. 46 */
-static void
-winCopyGCNativeGDI(GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst)
-{
-
-}
-#endif
-
-/* See Porting Layer Definition - p. 46 */
-static void
-winDestroyGCNativeGDI(GCPtr pGC)
-{
-    winGCPriv(pGC);
-    winScreenPriv(pGC->pScreen);
-
-    if (pGC->freeCompClip)
-        RegionDestroy(pGC->pCompositeClip);
-
-    /* Free the memory DC */
-    if (pGCPriv->hdcMem != NULL) {
-        DeleteDC(pGCPriv->hdcMem);
-        pGCPriv->hdcMem = NULL;
-    }
-
-    /* Release the screen DC for the display window */
-    if (pGCPriv->hdc != NULL) {
-        ReleaseDC(pScreenPriv->hwndScreen, pGCPriv->hdc);
-        pGCPriv->hdc = NULL;
-    }
-
-    /* Invalidate the GC privates pointer */
-    winSetGCPriv(pGC, NULL);
-}
-
-#if 0
-/* See Porting Layer Definition - p. 46 */
-static void
-winChangeClipNativeGDI(GCPtr pGC, int nType, void *pValue, int nRects)
-{
-
-}
-
-/* See Porting Layer Definition - p. 47 */
-static void
-winDestroyClipNativeGDI(GCPtr pGC)
-{
-
-}
-
-/* See Porting Layer Definition - p. 47 */
-static void
-winCopyClipNativeGDI(GCPtr pGCdst, GCPtr pGCsrc)
-{
-
-}
-#endif
diff --git a/xorg-server/hw/xwin/wingetsp.c b/xorg-server/hw/xwin/wingetsp.c
deleted file mode 100644
index 049e2c9..0000000
--- a/xorg-server/hw/xwin/wingetsp.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Harold L Hunt II
- * 		Alan Hourihane <alanh at fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* See Porting Layer Definition - p. 55 */
-void
-winGetSpansNativeGDI(DrawablePtr pDrawable,
-                     int nMax,
-                     DDXPointPtr pPoints,
-                     int *piWidths, int iSpans, char *pDsts)
-{
-    PixmapPtr pPixmap = NULL;
-    winPrivPixmapPtr pPixmapPriv = NULL;
-    int iSpan;
-    DDXPointPtr pPoint = NULL;
-    int *piWidth = NULL;
-    char *pDst = pDsts;
-    HBITMAP hbmpWindow, hbmpOrig, hbmpOrig1;
-    BYTE *pbWindow = NULL;
-    HDC hdcMem, hdcMem1;
-    ScreenPtr pScreen = pDrawable->pScreen;
-
-    winScreenPriv(pScreen);
-
-    /* Branch on the drawable type */
-    switch (pDrawable->type) {
-    case DRAWABLE_PIXMAP:
-#if 0
-        ErrorF("winGetSpans - DRAWABLE_PIXMAP %08x\n", pDrawable);
-#endif
-
-        pPixmap = (PixmapPtr) pDrawable;
-        pPixmapPriv = winGetPixmapPriv(pPixmap);
-
-        /* Open a memory HDC */
-        hdcMem1 = CreateCompatibleDC(NULL);
-        hdcMem = CreateCompatibleDC(NULL);
-
-        /* Select the drawable pixmap into a DC */
-        hbmpOrig1 = SelectObject(hdcMem1, pPixmapPriv->hBitmap);
-
-        if (hbmpOrig1 == NULL)
-            FatalError("winGetSpans - DRAWABLE_PIXMAP - SelectObject () "
-                       "failed on pPixmapPriv->hBitmap\n");
-
-        /* Loop through spans */
-        for (iSpan = 0; iSpan < iSpans; ++iSpan) {
-            pPoint = pPoints + iSpan;
-            piWidth = piWidths + iSpan;
-
-            hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
-                                               pDrawable->depth,
-                                               &pbWindow, NULL);
-
-            hbmpOrig = SelectObject(hdcMem, hbmpWindow);
-
-            /* Transfer the window bits to the window bitmap */
-            BitBlt(hdcMem,
-                   0, 0, *piWidth, 1, hdcMem1, pPoint->x, pPoint->y, SRCCOPY);
-
-            memcpy(pDst,
-                   (char *) pbWindow,
-                   PixmapBytePad(*piWidth, pDrawable->depth));
-
-            /* Pop the window bitmap out of the HDC and delete the bitmap */
-            SelectObject(hdcMem, hbmpOrig);
-            DeleteObject(hbmpWindow);
-
-#if 0
-            ErrorF("(%dx%dx%d) (%d,%d) w: %d\n",
-                   pDrawable->width, pDrawable->height, pDrawable->depth,
-                   pPoint->x, pPoint->y, *piWidth);
-#endif
-
-            /* Calculate offset of next bit destination */
-            pDst += PixmapBytePad(*piWidth, pDrawable->depth);
-        }
-
-        /* Pop the pixmap's bitmap out of the HDC */
-        SelectObject(hdcMem1, hbmpOrig1);
-
-        /* Delete the HDCs */
-        DeleteDC(hdcMem1);
-        DeleteDC(hdcMem);
-        break;
-
-    case DRAWABLE_WINDOW:
-#if 0
-        ErrorF("winGetSpans - DRAWABLE_WINDOW\n");
-#endif
-
-        /* Open a memory HDC */
-        hdcMem = CreateCompatibleDC(NULL);
-
-        /* Loop through spans */
-        for (iSpan = 0; iSpan < iSpans; ++iSpan) {
-            pPoint = pPoints + iSpan;
-            piWidth = piWidths + iSpan;
-
-            hbmpWindow = winCreateDIBNativeGDI(*piWidth, 1,
-                                               pDrawable->depth,
-                                               &pbWindow, NULL);
-
-            hbmpOrig = SelectObject(hdcMem, hbmpWindow);
-
-            /* Transfer the window bits to the window bitmap */
-            BitBlt(hdcMem,
-                   0, 0,
-                   *piWidth, 1,
-                   pScreenPriv->hdcScreen, pPoint->x, pPoint->y, SRCCOPY);
-
-            memcpy(pDst,
-                   (char *) pbWindow,
-                   PixmapBytePad(*piWidth, pDrawable->depth));
-
-            /* Pop the window bitmap out of the HDC */
-            SelectObject(hdcMem, hbmpOrig);
-
-            DeleteObject(hbmpWindow);
-
-#if 0
-            ErrorF("(%dx%dx%d) (%d,%d) w: %d\n",
-                   pDrawable->width, pDrawable->height, pDrawable->depth,
-                   pPoint->x, pPoint->y, *piWidth);
-#endif
-
-            /* Calculate offset of next bit destination */
-            pDst += PixmapBytePad(*piWidth, pDrawable->depth);
-        }
-
-        /* Delete the window bitmap */
-        DeleteDC(hdcMem);
-        break;
-
-    default:
-        FatalError("winGetSpans - Unknown drawable type\n");
-        break;
-    }
-}
diff --git a/xorg-server/hw/xwin/winmisc.c b/xorg-server/hw/xwin/winmisc.c
index 10f9732..bea6290 100644
--- a/xorg-server/hw/xwin/winmisc.c
+++ b/xorg-server/hw/xwin/winmisc.c
@@ -33,21 +33,6 @@
 #endif
 #include "win.h"
 
-#ifdef XWIN_NATIVEGDI
-/* See Porting Layer Definition - p. 33 */
-/*
- * Called by clients, returns the best size for a cursor, tile, or
- * stipple, specified by class (sometimes called kind)
- */
-
-void
-winQueryBestSizeNativeGDI(int class, unsigned short *pWidth,
-                          unsigned short *pHeight, ScreenPtr pScreen)
-{
-    ErrorF("winQueryBestSizeNativeGDI\n");
-}
-#endif
-
 /*
  * Count the number of one bits in a color mask.
  */
@@ -93,51 +78,3 @@ winUpdateFBPointer(ScreenPtr pScreen, void *pbits)
 
     return TRUE;
 }
-
-#ifdef XWIN_NATIVEGDI
-/*
- * Paint the window background with the specified color
- */
-
-BOOL
-winPaintBackground(HWND hwnd, COLORREF colorref)
-{
-    HDC hdc;
-    HBRUSH hbrush;
-    RECT rect;
-
-    /* Create an hdc */
-    hdc = GetDC(hwnd);
-    if (hdc == NULL) {
-        printf("gdiWindowProc - GetDC failed\n");
-        exit(1);
-    }
-
-    /* Create and select blue brush */
-    hbrush = CreateSolidBrush(colorref);
-    if (hbrush == NULL) {
-        printf("gdiWindowProc - CreateSolidBrush failed\n");
-        exit(1);
-    }
-
-    /* Get window extents */
-    if (GetClientRect(hwnd, &rect) == FALSE) {
-        printf("gdiWindowProc - GetClientRect failed\n");
-        exit(1);
-    }
-
-    /* Fill window with blue brush */
-    if (FillRect(hdc, &rect, hbrush) == 0) {
-        printf("gdiWindowProc - FillRect failed\n");
-        exit(1);
-    }
-
-    /* Delete blue brush */
-    DeleteObject(hbrush);
-
-    /* Release the hdc */
-    ReleaseDC(hwnd, hdc);
-
-    return TRUE;
-}
-#endif
diff --git a/xorg-server/hw/xwin/winnativegdi.c b/xorg-server/hw/xwin/winnativegdi.c
deleted file mode 100644
index 1859698..0000000
--- a/xorg-server/hw/xwin/winnativegdi.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/*
- * Local function prototypes
- */
-
-static Bool
- winAllocateFBNativeGDI(ScreenPtr pScreen);
-
-static void
- winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf);
-
-static Bool
- winCloseScreenNativeGDI(ScreenPtr pScreen);
-
-static Bool
- winInitVisualsNativeGDI(ScreenPtr pScreen);
-
-static Bool
- winAdjustVideoModeNativeGDI(ScreenPtr pScreen);
-
-#if 0
-static Bool
- winBltExposedRegionsNativeGDI(ScreenPtr pScreen);
-#endif
-
-static Bool
- winActivateAppNativeGDI(ScreenPtr pScreen);
-
-static Bool
- winRedrawScreenNativeGDI(ScreenPtr pScreen);
-
-static Bool
- winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen);
-
-static Bool
- winInstallColormapNativeGDI(ColormapPtr pColormap);
-
-static Bool
- winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs);
-
-static Bool
- winCreateColormapNativeGDI(ColormapPtr pColormap);
-
-static Bool
- winDestroyColormapNativeGDI(ColormapPtr pColormap);
-
-static Bool
-winAllocateFBNativeGDI(ScreenPtr pScreen)
-{
-    FatalError("winAllocateFBNativeGDI\n");
-
-    return TRUE;
-}
-
-static void
-winFreeFBNativeGDI(ScreenPtr pScreen)
-{
-    FatalError("winFreeFBNativeGDI\n");
-}
-
-static Bool
-winInitScreenNativeGDI(ScreenPtr pScreen)
-{
-    FatalError("winInitScreenNativeGDI\n");
-}
-
-/*
- * We wrap whatever CloseScreen procedure was specified by fb;
- * a pointer to said procedure is stored in our privates.
- */
-
-static Bool
-winCloseScreenNativeGDI(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
-    ErrorF("winCloseScreenNativeGDI - Freeing screen resources\n");
-
-    /* Flag that the screen is closed */
-    pScreenPriv->fClosed = TRUE;
-    pScreenPriv->fActive = FALSE;
-
-    /* 
-     * NOTE: mi doesn't use a CloseScreen procedure, so we do not
-     * need to call a wrapped procedure here.
-     */
-
-    /* Delete the window property */
-    RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
-    ErrorF("winCloseScreenNativeGDI - Destroying window\n");
-
-    /* Delete tray icon, if we have one */
-    if (!pScreenInfo->fNoTrayIcon)
-        winDeleteNotifyIcon(pScreenPriv);
-
-    /* Free the exit confirmation dialog box, if it exists */
-    if (g_hDlgExit != NULL) {
-        DestroyWindow(g_hDlgExit);
-        g_hDlgExit = NULL;
-    }
-
-    /* Kill our window */
-    if (pScreenPriv->hwndScreen) {
-        DestroyWindow(pScreenPriv->hwndScreen);
-        pScreenPriv->hwndScreen = NULL;
-    }
-
-    /* Invalidate our screeninfo's pointer to the screen */
-    pScreenInfo->pScreen = NULL;
-
-    /* Free the screen privates for this screen */
-    free(pScreenPriv);
-
-    ErrorF("winCloseScreenNativeGDI - Returning\n");
-
-    return TRUE;
-}
-
-static void
-winShadowUpdateNativeGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
-    FatalError("winShadowUpdateNativeGDI\n");
-    return;
-}
-
-static Bool
-winInitVisualsNativeGDI(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
-    /* Set the bitsPerRGB and bit masks */
-    switch (pScreenInfo->dwDepth) {
-    case 24:
-        pScreenPriv->dwBitsPerRGB = 8;
-        pScreenPriv->dwRedMask = 0x00FF0000;
-        pScreenPriv->dwGreenMask = 0x0000FF00;
-        pScreenPriv->dwBlueMask = 0x000000FF;
-        break;
-
-    case 16:
-        pScreenPriv->dwBitsPerRGB = 6;
-        pScreenPriv->dwRedMask = 0xF800;
-        pScreenPriv->dwGreenMask = 0x07E0;
-        pScreenPriv->dwBlueMask = 0x001F;
-        break;
-
-    case 15:
-        pScreenPriv->dwBitsPerRGB = 5;
-        pScreenPriv->dwRedMask = 0x7C00;
-        pScreenPriv->dwGreenMask = 0x03E0;
-        pScreenPriv->dwBlueMask = 0x001F;
-        break;
-
-    case 8:
-        pScreenPriv->dwBitsPerRGB = 8;
-        pScreenPriv->dwRedMask = 0;
-        pScreenPriv->dwGreenMask = 0;
-        pScreenPriv->dwBlueMask = 0;
-        break;
-
-    default:
-        ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
-        return FALSE;
-        break;
-    }
-
-    /* Tell the user how many bits per RGB we are using */
-    ErrorF("winInitVisualsNativeGDI - Using dwBitsPerRGB: %d\n",
-           (int) pScreenPriv->dwBitsPerRGB);
-
-    /* Create a single visual according to the Windows screen depth */
-    switch (pScreenInfo->dwDepth) {
-    case 24:
-    case 16:
-    case 15:
-        if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
-                                      TrueColorMask,
-                                      pScreenPriv->dwBitsPerRGB,
-                                      TrueColor,
-                                      pScreenPriv->dwRedMask,
-                                      pScreenPriv->dwGreenMask,
-                                      pScreenPriv->dwBlueMask)) {
-            ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
-            return FALSE;
-        }
-        break;
-
-    case 8:
-        ErrorF("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
-        if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
-                                      StaticColorMask,
-                                      pScreenPriv->dwBitsPerRGB,
-                                      StaticColor,
-                                      pScreenPriv->dwRedMask,
-                                      pScreenPriv->dwGreenMask,
-                                      pScreenPriv->dwBlueMask)) {
-            ErrorF("winInitVisuals - miSetVisualTypesAndMasks failed\n");
-            return FALSE;
-        }
-        break;
-
-    default:
-        ErrorF("winInitVisualsNativeGDI - Unknown screen depth\n");
-        return FALSE;
-    }
-
-#if 1
-    ErrorF("winInitVisualsNativeGDI - Returning\n");
-#endif
-
-    return TRUE;
-}
-
-/* Adjust the video mode */
-static Bool
-winAdjustVideoModeNativeGDI(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    HDC hdc = NULL;
-    DWORD dwBPP;
-
-    hdc = GetDC(NULL);
-
-    /* We're in serious trouble if we can't get a DC */
-    if (hdc == NULL) {
-        ErrorF("winAdjustVideoModeNativeGDI - GetDC () failed\n");
-        return FALSE;
-    }
-
-    /* Query GDI for current display depth */
-    dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
-    pScreenInfo->dwDepth = GetDeviceCaps(hdc, PLANES);
-
-    switch (pScreenInfo->dwDepth) {
-    case 24:
-    case 16:
-    case 15:
-    case 8:
-        break;
-    default:
-        if (dwBPP == 32)
-            pScreenInfo->dwDepth = 24;
-        else
-            pScreenInfo->dwDepth = dwBPP;
-        break;
-    }
-
-    /* GDI cannot change the screen depth, so we'll use GDI's depth */
-    pScreenInfo->dwBPP = dwBPP;
-
-    /* Release our DC */
-    ReleaseDC(NULL, hdc);
-
-    return TRUE;
-}
-
-static Bool
-winActivateAppNativeGDI(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-
-    /*
-     * Are we active?
-     * Are we fullscreen?
-     */
-    if (pScreenPriv != NULL
-        && pScreenPriv->fActive
-        && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
-        /*
-         * Activating, attempt to bring our window 
-         * to the top of the display
-         */
-        ShowWindow(pScreenPriv->hwndScreen, SW_RESTORE);
-    }
-
-    /*
-     * Are we inactive?
-     * Are we fullscreen?
-     */
-    if (pScreenPriv != NULL
-        && !pScreenPriv->fActive
-        && pScreenPriv->pScreenInfo && pScreenPriv->pScreenInfo->fFullScreen) {
-        /*
-         * Deactivating, stuff our window onto the
-         * task bar.
-         */
-        ShowWindow(pScreenPriv->hwndScreen, SW_MINIMIZE);
-    }
-
-    return TRUE;
-}
-
-HBITMAP
-winCreateDIBNativeGDI(int iWidth, int iHeight, int iDepth,
-                      BYTE ** ppbBits, BITMAPINFO ** ppbmi)
-{
-    BITMAPINFOHEADER *pbmih = NULL;
-    HBITMAP hBitmap = NULL;
-    BITMAPINFO *pbmi = NULL;
-
-    /* Don't create an invalid bitmap */
-    if (iWidth == 0 || iHeight == 0 || iDepth == 0) {
-        ErrorF("\nwinCreateDIBNativeGDI - Invalid specs w %d h %d d %d\n\n",
-               iWidth, iHeight, iDepth);
-        return NULL;
-    }
-
-    /* Allocate bitmap info header */
-    pbmih = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
-    if (pbmih == NULL) {
-        ErrorF("winCreateDIBNativeGDI - malloc () failed\n");
-        return FALSE;
-    }
-    ZeroMemory(pbmih, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
-
-    /* Describe bitmap to be created */
-    pbmih->biSize = sizeof(BITMAPINFOHEADER);
-    pbmih->biWidth = iWidth;
-    pbmih->biHeight = -iHeight;
-    pbmih->biPlanes = 1;
-    pbmih->biBitCount = iDepth;
-    pbmih->biCompression = BI_RGB;
-    pbmih->biSizeImage = 0;
-    pbmih->biXPelsPerMeter = 0;
-    pbmih->biYPelsPerMeter = 0;
-    pbmih->biClrUsed = 0;
-    pbmih->biClrImportant = 0;
-
-    /* Setup color table for mono DIBs */
-    if (iDepth == 1) {
-        pbmi = (BITMAPINFO *) pbmih;
-        pbmi->bmiColors[1].rgbBlue = 255;
-        pbmi->bmiColors[1].rgbGreen = 255;
-        pbmi->bmiColors[1].rgbRed = 255;
-    }
-
-    /* Create a DIB with a bit pointer */
-    hBitmap = CreateDIBSection(NULL,
-                               (BITMAPINFO *) pbmih,
-                               DIB_RGB_COLORS, (void **) ppbBits, NULL, 0);
-    if (hBitmap == NULL) {
-        ErrorF("winCreateDIBNativeGDI - CreateDIBSection () failed\n");
-        return NULL;
-    }
-
-    /* Free the bitmap info header memory */
-    if (ppbmi != NULL) {
-        /* Store the address of the BMIH in the ppbmih parameter */
-        *ppbmi = (BITMAPINFO *) pbmih;
-    }
-    else {
-        free(pbmih);
-        pbmih = NULL;
-    }
-
-    return hBitmap;
-}
-
-#if 0
-static Bool
-winBltExposedRegionsNativeGDI(ScreenPtr pScreen)
-{
-
-    return TRUE;
-}
-#endif
-
-static Bool
-winRedrawScreenNativeGDI(ScreenPtr pScreen)
-{
-    FatalError("winRedrawScreenNativeGDI\n");
-    return TRUE;
-}
-
-static Bool
-winRealizeInstalledPaletteNativeGDI(ScreenPtr pScreen)
-{
-    FatalError("winRealizeInstalledPaletteNativeGDI\n");
-    return TRUE;
-}
-
-static Bool
-winInstallColormapNativeGDI(ColormapPtr pColormap)
-{
-    FatalError("winInstallColormapNativeGDI\n");
-    return TRUE;
-}
-
-static Bool
-winStoreColorsNativeGDI(ColormapPtr pmap, int ndef, xColorItem * pdefs)
-{
-    FatalError("winStoreColorsNativeGDI\n");
-    return TRUE;
-}
-
-static Bool
-winCreateColormapNativeGDI(ColormapPtr pColormap)
-{
-    FatalError("winCreateColormapNativeGDI\n");
-    return TRUE;
-}
-
-static Bool
-winDestroyColormapNativeGDI(ColormapPtr pColormap)
-{
-    FatalError("winDestroyColormapNativeGDI\n");
-    return TRUE;
-}
-
-/* Set engine specific funtions */
-Bool
-winSetEngineFunctionsNativeGDI(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
-    /* Set our pointers */
-    pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI;
-    pScreenPriv->pwinFreeFB = winFreeFBNativeGDI;
-    pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI;
-    pScreenPriv->pwinInitScreen = winInitScreenNativeGDI;
-    pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI;
-    pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI;
-    pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI;
-    if (pScreenInfo->fFullScreen)
-        pScreenPriv->pwinCreateBoundingWindow =
-            winCreateBoundingWindowFullScreen;
-    else
-        pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
-    pScreenPriv->pwinFinishScreenInit = winFinishScreenInitNativeGDI;
-    /*
-     * WARNING: Do not set the BltExposedRegions procedure pointer to anything
-     * other than NULL until a working painting procedure is in place.
-     * Else, winWindowProc will get stuck in an infinite loop because
-     * Windows expects the BeginPaint and EndPaint functions to be called
-     * before a WM_PAINT message can be removed from the queue.  We are
-     * using NULL here as a signal for winWindowProc that it should
-     * not signal that the WM_PAINT message has been processed.
-     */
-    pScreenPriv->pwinBltExposedRegions = NULL;
-    pScreenPriv->pwinActivateApp = winActivateAppNativeGDI;
-    pScreenPriv->pwinRedrawScreen = winRedrawScreenNativeGDI;
-    pScreenPriv->pwinRealizeInstalledPalette =
-        winRealizeInstalledPaletteNativeGDI;
-    pScreenPriv->pwinInstallColormap = winInstallColormapNativeGDI;
-    pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
-    pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
-    pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
-    pScreenPriv->pwinHotKeyAltTab =
-        (winHotKeyAltTabProcPtr) (void (*)(void)) NoopDDA;
-
-    return TRUE;
-}
diff --git a/xorg-server/hw/xwin/winpfbdd.c b/xorg-server/hw/xwin/winpfbdd.c
deleted file mode 100644
index 0106161..0000000
--- a/xorg-server/hw/xwin/winpfbdd.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Dakshinamurthy Karra
- *		Suhaib M Siddiqi
- *		Peter Busch
- *		Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/*
- * Local function prototypes
- */
-
-static Bool
- winAllocateFBPrimaryDD(ScreenPtr pScreen);
-
-static Bool
- winCloseScreenPrimaryDD(ScreenPtr pScreen);
-
-static Bool
- winInitVisualsPrimaryDD(ScreenPtr pScreen);
-
-static Bool
- winAdjustVideoModePrimaryDD(ScreenPtr pScreen);
-
-static Bool
- winActivateAppPrimaryDD(ScreenPtr pScreen);
-
-static Bool
- winHotKeyAltTabPrimaryDD(ScreenPtr pScreen);
-
-/*
- * Create a DirectDraw primary surface 
- */
-
-static Bool
-winAllocateFBPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    HRESULT ddrval = DD_OK;
-    DDSURFACEDESC ddsd;
-    DDSURFACEDESC *pddsdPrimary = NULL;
-    DDSURFACEDESC *pddsdOffscreen = NULL;
-    RECT rcClient;
-
-    ErrorF("winAllocateFBPrimaryDD\n");
-
-    /* Get client area location in screen coords */
-    GetClientRect(pScreenPriv->hwndScreen, &rcClient);
-    MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) &rcClient, 2);
-
-    /* Create a DirectDraw object, store the address at lpdd */
-    ddrval = (*g_fpDirectDrawCreate) (NULL, &pScreenPriv->pdd, NULL);
-    if (ddrval != DD_OK)
-        FatalError("winAllocateFBPrimaryDD - Could not start DirectDraw\n");
-
-    /* Get a DirectDraw2 interface pointer */
-    ddrval = IDirectDraw_QueryInterface(pScreenPriv->pdd,
-                                        &IID_IDirectDraw2,
-                                        (LPVOID *) &pScreenPriv->pdd2);
-    if (FAILED(ddrval)) {
-        ErrorF("winAllocateFBShadowDD - Failed DD2 query: %08x\n",
-               (unsigned int) ddrval);
-        return FALSE;
-    }
-
-    ErrorF("winAllocateFBPrimaryDD - Created and initialized DD\n");
-
-    /* Are we windowed or fullscreen? */
-    if (pScreenInfo->fFullScreen) {
-        /* Full screen mode */
-        ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
-                                                  pScreenPriv->hwndScreen,
-                                                  DDSCL_FULLSCREEN
-                                                  | DDSCL_EXCLUSIVE);
-        if (FAILED(ddrval))
-            FatalError("winAllocateFBPrimaryDD - Could not set "
-                       "cooperative level\n");
-
-        /* Change the video mode to the mode requested */
-        ddrval = IDirectDraw2_SetDisplayMode(pScreenPriv->pdd2,
-                                             pScreenInfo->dwWidth,
-                                             pScreenInfo->dwHeight,
-                                             pScreenInfo->dwBPP,
-                                             pScreenInfo->dwRefreshRate, 0);
-        if (FAILED(ddrval))
-            FatalError("winAllocateFBPrimaryDD - Could not set "
-                       "full screen display mode\n");
-    }
-    else {
-        /* Windowed mode */
-        ddrval = IDirectDraw2_SetCooperativeLevel(pScreenPriv->pdd2,
-                                                  pScreenPriv->hwndScreen,
-                                                  DDSCL_NORMAL);
-        if (FAILED(ddrval))
-            FatalError("winAllocateFBPrimaryDD - Could not set "
-                       "cooperative level\n");
-    }
-
-    /* Describe the primary surface */
-    ZeroMemory(&ddsd, sizeof(ddsd));
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_CAPS;
-    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
-    /* Create the primary surface */
-    ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
-                                        &ddsd, &pScreenPriv->pddsPrimary, NULL);
-    if (FAILED(ddrval))
-        FatalError("winAllocateFBPrimaryDD - Could not create primary "
-                   "surface %08x\n", (unsigned int) ddrval);
-
-    ErrorF("winAllocateFBPrimaryDD - Created primary\n");
-
-    /* Allocate a DD surface description for our screen privates */
-    pddsdPrimary = pScreenPriv->pddsdPrimary = malloc(sizeof(DDSURFACEDESC));
-    if (pddsdPrimary == NULL)
-        FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
-                   "description memory\n");
-    ZeroMemory(pddsdPrimary, sizeof(*pddsdPrimary));
-    pddsdPrimary->dwSize = sizeof(*pddsdPrimary);
-
-    /* Describe the offscreen surface to be created */
-    /*
-     * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface,
-     * as drawing, locking, and unlocking take forever
-     * with video memory surfaces.  In addition,
-     * video memory is a somewhat scarce resource,
-     * so you shouldn't be allocating video memory when
-     * you have the option of using system memory instead.
-     */
-    ZeroMemory(&ddsd, sizeof(ddsd));
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
-    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
-    ddsd.dwHeight = pScreenInfo->dwHeight;
-    ddsd.dwWidth = pScreenInfo->dwWidth;
-
-    /* Create the shadow surface */
-    ddrval = IDirectDraw2_CreateSurface(pScreenPriv->pdd2,
-                                        &ddsd,
-                                        &pScreenPriv->pddsOffscreen, NULL);
-    if (ddrval != DD_OK)
-        FatalError("winAllocateFBPrimaryDD - Could not create shadow "
-                   "surface\n");
-
-    ErrorF("winAllocateFBPrimaryDD - Created offscreen\n");
-
-    /* Allocate a DD surface description for our screen privates */
-    pddsdOffscreen = pScreenPriv->pddsdOffscreen
-        = malloc(sizeof(DDSURFACEDESC));
-    if (pddsdOffscreen == NULL)
-        FatalError("winAllocateFBPrimaryDD - Could not allocate surface "
-                   "description memory\n");
-    ZeroMemory(pddsdOffscreen, sizeof(*pddsdOffscreen));
-    pddsdOffscreen->dwSize = sizeof(*pddsdOffscreen);
-
-    ErrorF("winAllocateFBPrimaryDD - Locking primary\n");
-
-    /* Lock the primary surface */
-    ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
-                                      pScreenInfo->
-                                      fFullScreen ? NULL : &rcClient,
-                                      pddsdPrimary, DDLOCK_WAIT, NULL);
-    if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL)
-        FatalError("winAllocateFBPrimaryDD - Could not lock "
-                   "primary surface\n");
-
-    ErrorF("winAllocateFBPrimaryDD - Locked primary\n");
-
-    /* We don't know how to deal with anything other than RGB */
-    if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB))
-        FatalError("winAllocateFBPrimaryDD - Color format other than RGB\n");
-
-    /* Grab the pitch from the surface desc */
-    pScreenInfo->dwStride = (pddsdPrimary->u1.lPitch * 8)
-        / pScreenInfo->dwBPP;
-
-    /* Save the pointer to our surface memory */
-    pScreenInfo->pfb = pddsdPrimary->lpSurface;
-
-    /* Grab the color depth and masks from the surface description */
-    pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask;
-    pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask;
-    pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask;
-
-    ErrorF("winAllocateFBPrimaryDD - Returning\n");
-
-    return TRUE;
-}
-
-static void
-winFreeFBPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
-    /* Free the offscreen surface, if there is one */
-    if (pScreenPriv->pddsOffscreen) {
-        IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
-        IDirectDrawSurface2_Release(pScreenPriv->pddsOffscreen);
-        pScreenPriv->pddsOffscreen = NULL;
-    }
-
-    /* Release the primary surface, if there is one */
-    if (pScreenPriv->pddsPrimary) {
-        IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
-        IDirectDrawSurface2_Release(pScreenPriv->pddsPrimary);
-        pScreenPriv->pddsPrimary = NULL;
-    }
-
-    /* Free the DirectDraw object, if there is one */
-    if (pScreenPriv->pdd) {
-        IDirectDraw2_RestoreDisplayMode(pScreenPriv->pdd);
-        IDirectDraw2_Release(pScreenPriv->pdd);
-        pScreenPriv->pdd = NULL;
-    }
-
-    /* Invalidate the ScreenInfo's fb pointer */
-    pScreenInfo->pfb = NULL;
-}
-
-static Bool
-winInitScreenPrimaryDD(ScreenPtr pScreen)
-{
-    return winAllocateFBPrimaryDD(pScreen);
-}
-
-/*
- * Call the wrapped CloseScreen function.
- * 
- * Free our resources and private structures.
- */
-
-static Bool
-winCloseScreenPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    Bool fReturn;
-
-    ErrorF("winCloseScreenPrimaryDD - Freeing screen resources\n");
-
-    /* Flag that the screen is closed */
-    pScreenPriv->fClosed = TRUE;
-    pScreenPriv->fActive = FALSE;
-
-    /* Call the wrapped CloseScreen procedure */
-    WIN_UNWRAP(CloseScreen);
-    if (pScreen->CloseScreen)
-        fReturn = (*pScreen->CloseScreen) (pScreen);
-
-    /* Delete the window property */
-    RemoveProp(pScreenPriv->hwndScreen, WIN_SCR_PROP);
-
-    winFreeFBPrimaryDD(pScreen);
-
-    /* Delete tray icon, if we have one */
-    if (!pScreenInfo->fNoTrayIcon)
-        winDeleteNotifyIcon(pScreenPriv);
-
-    /* Free the exit confirmation dialog box, if it exists */
-    if (g_hDlgExit != NULL) {
-        DestroyWindow(g_hDlgExit);
-        g_hDlgExit = NULL;
-    }
-
-    /* Kill our window */
-    if (pScreenPriv->hwndScreen) {
-        DestroyWindow(pScreenPriv->hwndScreen);
-        pScreenPriv->hwndScreen = NULL;
-    }
-
-    /* Kill our screeninfo's pointer to the screen */
-    pScreenInfo->pScreen = NULL;
-
-    /* Free the screen privates for this screen */
-    free((void *) pScreenPriv);
-
-    return fReturn;
-}
-
-/*
- * Tell mi what sort of visuals we need.
- * 
- * Generally we only need one visual, as our screen can only
- * handle one format at a time, I believe.  You may want
- * to verify that last sentence.
- */
-
-static Bool
-winInitVisualsPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    DWORD dwRedBits, dwGreenBits, dwBlueBits;
-
-    /* Count the number of ones in each color mask */
-    dwRedBits = winCountBits(pScreenPriv->dwRedMask);
-    dwGreenBits = winCountBits(pScreenPriv->dwGreenMask);
-    dwBlueBits = winCountBits(pScreenPriv->dwBlueMask);
-
-    /* Store the maximum number of ones in a color mask as the bitsPerRGB */
-    if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
-        pScreenPriv->dwBitsPerRGB = dwRedBits;
-    else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
-        pScreenPriv->dwBitsPerRGB = dwGreenBits;
-    else
-        pScreenPriv->dwBitsPerRGB = dwBlueBits;
-
-    ErrorF("winInitVisualsPrimaryDD - Masks: %08x %08x %08x bpRGB: %d\n",
-           (unsigned int) pScreenPriv->dwRedMask,
-           (unsigned int) pScreenPriv->dwGreenMask,
-           (unsigned int) pScreenPriv->dwBlueMask,
-           (int) pScreenPriv->dwBitsPerRGB);
-
-    /* Create a single visual according to the Windows screen depth */
-    switch (pScreenInfo->dwDepth) {
-    case 24:
-    case 16:
-    case 15:
-        if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
-                                      TrueColorMask,
-                                      pScreenPriv->dwBitsPerRGB,
-                                      TrueColor,
-                                      pScreenPriv->dwRedMask,
-                                      pScreenPriv->dwGreenMask,
-                                      pScreenPriv->dwBlueMask)) {
-            ErrorF("winInitVisualsPrimaryDD - "
-                   "miSetVisualTypesAndMasks failed\n");
-            return FALSE;
-        }
-        break;
-
-    case 8:
-#if CYGDEBUG
-        winDebug("winInitVisuals - Calling miSetVisualTypesAndMasks\n");
-#endif                          /* CYGDEBUG */
-        if (!miSetVisualTypesAndMasks(pScreenInfo->dwDepth,
-                                      PseudoColorMask,
-                                      pScreenPriv->dwBitsPerRGB,
-                                      PseudoColor,
-                                      pScreenPriv->dwRedMask,
-                                      pScreenPriv->dwGreenMask,
-                                      pScreenPriv->dwBlueMask)) {
-            ErrorF("winInitVisualsPrimaryDD - "
-                   "miSetVisualTypesAndMasks failed\n");
-            return FALSE;
-        }
-#if CYGDEBUG
-        winDebug("winInitVisualsPrimaryDD - Returned from "
-                 "miSetVisualTypesAndMasks\n");
-#endif                          /* CYGDEBUG */
-        break;
-
-    default:
-        ErrorF("winInitVisualsPrimaryDD - Unknown screen depth\n");
-        return FALSE;
-    }
-
-    ErrorF("winInitVisualsPrimaryDD - Returning\n");
-
-    return TRUE;
-}
-
-static Bool
-winAdjustVideoModePrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-    HDC hdc = NULL;
-    DWORD dwBPP;
-
-    /* We're in serious trouble if we can't get a DC */
-    hdc = GetDC(NULL);
-    if (hdc == NULL) {
-        ErrorF("winAdjustVideoModePrimaryDD - GetDC failed\n");
-        return FALSE;
-    }
-
-    /* Query GDI for current display depth */
-    dwBPP = GetDeviceCaps(hdc, BITSPIXEL);
-
-    /* DirectDraw can only change the depth in fullscreen mode */
-    if (!(pScreenInfo->fFullScreen && (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) {
-        /* Otherwise, We'll use GDI's depth */
-        pScreenInfo->dwBPP = dwBPP;
-    }
-
-    /* Release our DC */
-    ReleaseDC(NULL, hdc);
-
-    return TRUE;
-}
-
-/*
- * We need to blit our offscreen fb to
- * the screen when we are activated, and we need to point
- * the fb code back to the primary surface memory.
- */
-
-static Bool
-winActivateAppPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    RECT rcSrc, rcClient;
-    HRESULT ddrval = DD_OK;
-
-    /* Check for errors */
-    if (pScreenPriv == NULL
-        || pScreenPriv->pScreenInfo == NULL
-        || pScreenPriv->pddsPrimary == NULL
-        || pScreenPriv->pddsOffscreen == NULL)
-        return FALSE;
-
-    /* Check for do-nothing */
-    if (!pScreenPriv->fActive)
-        return TRUE;
-
-    /* We are activating */
-    ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsOffscreen);
-    if (ddrval == DD_OK) {
-        IDirectDrawSurface2_Unlock(pScreenPriv->pddsOffscreen, NULL);
-        /*
-         * We don't check for an error from Unlock, because it
-         * doesn't matter if the Unlock failed.
-         */
-    }
-
-    /* Restore both surfaces, just cause I like it that way */
-    IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
-    IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
-
-    /* Get client area in screen coords */
-    GetClientRect(pScreenPriv->hwndScreen, &rcClient);
-    MapWindowPoints(pScreenPriv->hwndScreen,
-                    HWND_DESKTOP, (LPPOINT) &rcClient, 2);
-
-    /* Setup a source rectangle */
-    rcSrc.left = 0;
-    rcSrc.top = 0;
-    rcSrc.right = pScreenPriv->pScreenInfo->dwWidth;
-    rcSrc.bottom = pScreenPriv->pScreenInfo->dwHeight;
-
-    ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsPrimary,
-                                     &rcClient,
-                                     pScreenPriv->pddsOffscreen,
-                                     &rcSrc, DDBLT_WAIT, NULL);
-    if (ddrval != DD_OK)
-        FatalError("winActivateAppPrimaryDD () - Failed blitting offscreen "
-                   "surface to primary surface %08x\n", (unsigned int) ddrval);
-
-    /* Lock the primary surface */
-    ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsPrimary,
-                                      &rcClient,
-                                      pScreenPriv->pddsdPrimary,
-                                      DDLOCK_WAIT, NULL);
-    if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
-        FatalError("winActivateAppPrimaryDD () - Could not lock "
-                   "primary surface\n");
-
-    /* Notify FB of the new memory pointer */
-    winUpdateFBPointer(pScreen, pScreenPriv->pddsdPrimary->lpSurface);
-
-    /*
-     * Register the Alt-Tab combo as a hotkey so we can copy
-     * the primary framebuffer before the display mode changes
-     */
-    RegisterHotKey(pScreenPriv->hwndScreen, 1, MOD_ALT, 9);
-
-    return TRUE;
-}
-
-/*
- * Handle the Alt+Tab hotkey.
- *
- * We need to save the primary fb to an offscreen fb when
- * we get deactivated, and point the fb code at the offscreen
- * fb for the duration of the deactivation.
- */
-
-static Bool
-winHotKeyAltTabPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    HRESULT ddrval = DD_OK;
-
-    ErrorF("\nwinHotKeyAltTabPrimaryDD\n\n");
-
-    /* Alt+Tab was pressed, we will lose focus very soon */
-    pScreenPriv->fActive = FALSE;
-
-    /* Check for error conditions */
-    if (pScreenPriv->pddsPrimary == NULL || pScreenPriv->pddsOffscreen == NULL)
-        return FALSE;
-
-    /* Did we loose the primary surface? */
-    ddrval = IDirectDrawSurface2_IsLost(pScreenPriv->pddsPrimary);
-    if (ddrval == DD_OK) {
-        ddrval = IDirectDrawSurface2_Unlock(pScreenPriv->pddsPrimary, NULL);
-        if (FAILED(ddrval))
-            FatalError("winHotKeyAltTabPrimaryDD - Failed unlocking primary "
-                       "surface\n");
-    }
-
-    /* Blit the primary surface to the offscreen surface */
-    ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen, NULL,  /* should be rcDest */
-                                     pScreenPriv->pddsPrimary,
-                                     NULL, DDBLT_WAIT, NULL);
-    if (ddrval == DDERR_SURFACELOST) {
-        IDirectDrawSurface2_Restore(pScreenPriv->pddsOffscreen);
-        IDirectDrawSurface2_Restore(pScreenPriv->pddsPrimary);
-
-        /* Blit the primary surface to the offscreen surface */
-        ddrval = IDirectDrawSurface2_Blt(pScreenPriv->pddsOffscreen,
-                                         NULL,
-                                         pScreenPriv->pddsPrimary,
-                                         NULL, DDBLT_WAIT, NULL);
-        if (FAILED(ddrval))
-            FatalError("winHotKeyAltTabPrimaryDD - Failed blitting primary "
-                       "surface to offscreen surface: %08x\n",
-                       (unsigned int) ddrval);
-    }
-    else {
-        FatalError("winHotKeyAltTabPrimaryDD - Unknown error from "
-                   "Blt: %08dx\n", (unsigned int) ddrval);
-    }
-
-    /* Lock the offscreen surface */
-    ddrval = IDirectDrawSurface2_Lock(pScreenPriv->pddsOffscreen,
-                                      NULL,
-                                      pScreenPriv->pddsdOffscreen,
-                                      DDLOCK_WAIT, NULL);
-    if (ddrval != DD_OK || pScreenPriv->pddsdPrimary->lpSurface == NULL)
-        FatalError("winHotKeyAltTabPrimaryDD - Could not lock "
-                   "offscreen surface\n");
-
-    /* Notify FB of the new memory pointer */
-    winUpdateFBPointer(pScreen, pScreenPriv->pddsdOffscreen->lpSurface);
-
-    /* Unregister our hotkey */
-    UnregisterHotKey(pScreenPriv->hwndScreen, 1);
-
-    return TRUE;
-}
-
-/* Set engine specific functions */
-Bool
-winSetEngineFunctionsPrimaryDD(ScreenPtr pScreen)
-{
-    winScreenPriv(pScreen);
-    winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
-
-    /* Set our pointers */
-    pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
-    pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD;
-    pScreenPriv->pwinShadowUpdate =
-        (winShadowUpdateProcPtr) (void (*)(void)) NoopDDA;
-    pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD;
-    pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
-    pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
-    pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
-    if (pScreenInfo->fFullScreen)
-        pScreenPriv->pwinCreateBoundingWindow =
-            winCreateBoundingWindowFullScreen;
-    else
-        pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
-    pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
-    pScreenPriv->pwinBltExposedRegions =
-        (winBltExposedRegionsProcPtr) (void (*)(void)) NoopDDA;
-    pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
-    pScreenPriv->pwinRedrawScreen = NULL;
-    pScreenPriv->pwinRealizeInstalledPalette = NULL;
-    pScreenPriv->pwinInstallColormap = NULL;
-    pScreenPriv->pwinStoreColors = NULL;
-    pScreenPriv->pwinCreateColormap = NULL;
-    pScreenPriv->pwinDestroyColormap = NULL;
-    pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
-    pScreenPriv->pwinCreatePrimarySurface =
-        (winCreatePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
-    pScreenPriv->pwinReleasePrimarySurface =
-        (winReleasePrimarySurfaceProcPtr) (void (*)(void)) NoopDDA;
-#ifdef XWIN_MULTIWINDOW
-    pScreenPriv->pwinFinishCreateWindowsWindow =
-        (winFinishCreateWindowsWindowProcPtr) (void (*)(void)) NoopDDA;
-#endif
-
-    return TRUE;
-}
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
deleted file mode 100644
index ef158c8..0000000
--- a/xorg-server/hw/xwin/winpixmap.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	drewry, september 1986
- *		Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/*
- * Local prototypes
- */
-
-#if 0
-static void
- winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw);
-
-static void
- winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh);
-
-static void
-
-winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix,
-                             int xrot, int yrot);
-#endif
-
-/* See Porting Layer Definition - p. 34 */
-/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
-PixmapPtr
-winCreatePixmapNativeGDI(ScreenPtr pScreen,
-                         int iWidth, int iHeight,
-                         int iDepth, unsigned usage_hint)
-{
-    winPrivPixmapPtr pPixmapPriv = NULL;
-    PixmapPtr pPixmap = NULL;
-
-    /* Allocate pixmap memory */
-    pPixmap = AllocatePixmap(pScreen, 0);
-    if (!pPixmap) {
-        ErrorF("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
-        return NullPixmap;
-    }
-
-#if CYGDEBUG
-    winDebug("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
-             iWidth, iHeight, iDepth, usage_hint,
-             PixmapBytePad(iWidth, iDepth));
-#endif
-
-    /* Setup pixmap values */
-    pPixmap->drawable.type = DRAWABLE_PIXMAP;
-    pPixmap->drawable.class = 0;
-    pPixmap->drawable.pScreen = pScreen;
-    pPixmap->drawable.depth = iDepth;
-    pPixmap->drawable.bitsPerPixel = BitsPerPixel(iDepth);
-    pPixmap->drawable.id = 0;
-    pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-    pPixmap->drawable.x = 0;
-    pPixmap->drawable.y = 0;
-    pPixmap->drawable.width = iWidth;
-    pPixmap->drawable.height = iHeight;
-    pPixmap->devKind = 0;
-    pPixmap->refcnt = 1;
-    pPixmap->devPrivate.ptr = NULL;
-    pPixmap->usage_hint = usage_hint;
-
-    /* Pixmap privates are allocated by AllocatePixmap */
-    pPixmapPriv = winGetPixmapPriv(pPixmap);
-
-    /* Initialize pixmap privates */
-    pPixmapPriv->hBitmap = NULL;
-    pPixmapPriv->hdcSelected = NULL;
-    pPixmapPriv->pbBits = NULL;
-    pPixmapPriv->dwScanlineBytes = PixmapBytePad(iWidth, iDepth);
-
-    /* Check for zero width or height pixmaps */
-    if (iWidth == 0 || iHeight == 0) {
-        /* Don't allocate a real pixmap, just set fields and return */
-        return pPixmap;
-    }
-
-    /* Create a DIB for the pixmap */
-    pPixmapPriv->hBitmap = winCreateDIBNativeGDI(iWidth, iHeight, iDepth,
-                                                 &pPixmapPriv->pbBits,
-                                                 (BITMAPINFO **) &pPixmapPriv->
-                                                 pbmih);
-
-#if CYGDEBUG
-    winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for "
-             "screen: %08x\n",
-             pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
-#endif
-
-    return pPixmap;
-}
-
-/* 
- * See Porting Layer Definition - p. 35
- *
- * See mfb/mfbpixmap.c - mfbDestroyPixmap()
- */
-
-Bool
-winDestroyPixmapNativeGDI(PixmapPtr pPixmap)
-{
-    winPrivPixmapPtr pPixmapPriv = NULL;
-
-#if CYGDEBUG
-    winDebug("winDestroyPixmapNativeGDI ()\n");
-#endif
-
-    /* Bail early if there is not a pixmap to destroy */
-    if (pPixmap == NULL) {
-        ErrorF("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
-        return TRUE;
-    }
-
-    /* Get a handle to the pixmap privates */
-    pPixmapPriv = winGetPixmapPriv(pPixmap);
-
-#if CYGDEBUG
-    winDebug("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
-             pPixmapPriv->hBitmap);
-#endif
-
-    /* Decrement reference count, return if nonzero */
-    --pPixmap->refcnt;
-    if (pPixmap->refcnt != 0)
-        return TRUE;
-
-    /* Free GDI bitmap */
-    if (pPixmapPriv->hBitmap)
-        DeleteObject(pPixmapPriv->hBitmap);
-
-    /* Free the bitmap info header memory */
-    free(pPixmapPriv->pbmih);
-    pPixmapPriv->pbmih = NULL;
-
-    /* Free the pixmap memory */
-    free(pPixmap);
-    pPixmap = NULL;
-
-    return TRUE;
-}
-
-/* 
- * Not used yet
- */
-
-Bool
-winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap,
-                               int iWidth, int iHeight,
-                               int iDepth,
-                               int iBitsPerPixel, int devKind, void *pPixData)
-{
-    FatalError("winModifyPixmapHeaderNativeGDI ()\n");
-    return TRUE;
-}
-
-#if 0
-/* 
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-
-static void
-winXRotatePixmapNativeGDI(PixmapPtr pPix, int rw)
-{
-    ErrorF("winXRotatePixmap()\n");
-    /* fill in this function, look at CFB */
-}
-
-/*
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-static void
-winYRotatePixmapNativeGDI(PixmapPtr pPix, int rh)
-{
-    ErrorF("winYRotatePixmap()\n");
-    /* fill in this function, look at CFB */
-}
-
-/* 
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-
-static void
-winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix, PixmapPtr *ppdstPix,
-                             int xrot, int yrot)
-{
-    ErrorF("winCopyRotatePixmap()\n");
-    /* fill in this function, look at CFB */
-}
-#endif
diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c
deleted file mode 100644
index 8b7e106..0000000
--- a/xorg-server/hw/xwin/winpolyline.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *Copyright (C) 2001-2004 Harold L Hunt II 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 HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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 Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* See Porting Layer Definition - p. 50 */
-void
-winPolyLineNativeGDI(DrawablePtr pDrawable,
-                     GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
-{
-    switch (pGC->lineStyle) {
-    case LineSolid:
-        if (pGC->lineWidth == 0)
-            return miZeroLine(pDrawable, pGC, mode, npt, ppt);
-        else
-            miWideLine(pDrawable, pGC, mode, npt, ppt);
-        break;
-    case LineOnOffDash:
-    case LineDoubleDash:
-        miWideDash(pDrawable, pGC, mode, npt, ppt);
-        break;
-    }
-}
diff --git a/xorg-server/hw/xwin/winrop.c b/xorg-server/hw/xwin/winrop.c
deleted file mode 100644
index 1f9ff73..0000000
--- a/xorg-server/hw/xwin/winrop.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * 	Authors:	Alan Hourihane <alanh at fairlite.demon.co.uk>
- */
-
-/*
- * Raster operations used by Windows translated to X's 16 rop codes...
- */
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-void
- ROP16(HDC hdc, int rop);
-
-int g_copyROP[16] = { 0xFF0062, /* GXclear            - 0 */
-    0x8800C6,                   /* GXand              - S & D */
-    0x440328,                   /* GXandReverse       - S & !D */
-    0xCC0020,                   /* GXcopy             - S */
-    0x220326,                   /* GXandInverted      - !S & D */
-    0xAA0029,                   /* GXnoop             - D */
-    0x660046,                   /* GXxor              - S ^ D */
-    0xEE0086,                   /* GXor               - S | D */
-    0x1100A6,                   /* GXnor              - !S & !D */
-    0x990126,                   /* GXequiv            - !S ^ D */
-    0x550009,                   /* GXinvert           - !D */
-    0xDD0228,                   /* GXorReverse        - S | !D */
-    0x330008,                   /* GXcopyInverted     - !S */
-    0xBB0226,                   /* GXorInverted       - !S | D */
-    0x7700C6,                   /* GXnand             - !S | !D */
-    0x000042                    /* GXset              - 1 */
-};
-
-int g_patternROP[16] = { 0xFF0062,      /* GXclear            - 0 */
-    0xA000C9,                   /* GXand              - P & D */
-    0xF50225,                   /* GXandReverse       - P & !D */
-    0xF00021,                   /* GXcopy             - P */
-    0x5F00E9,                   /* GXandInverted      - !P & D */
-    0xAA0029,                   /* GXnoop             - D */
-    0xA50065,                   /* GXxor              - P ^ D */
-    0xA000C9,                   /* GXor               - P | D */
-    0x5F00E9,                   /* GXnor              - !P & !D */
-    0x5A0049,                   /* GXequiv            - !P ^ D */
-    0x550009,                   /* GXinvert           - !D */
-    0x500325,                   /* GXorReverse        - P | !D */
-    0x0F0001,                   /* GXcopyInverted     - !P */
-    0x0A0329,                   /* GXorInverted       - !P | D */
-    0x0500A9,                   /* GXnand             - !P | !D */
-    0x000042                    /* GXset              - 1 */
-};
-
-void
-ROP16(HDC hdc, int rop)
-{
-    switch (rop) {
-    case GXclear:
-        SetROP2(hdc, R2_BLACK);
-        break;
-
-    case GXand:
-        SetROP2(hdc, R2_MASKPEN);
-        break;
-
-    case GXandReverse:
-        SetROP2(hdc, R2_MASKPENNOT);
-        break;
-
-    case GXcopy:
-        SetROP2(hdc, R2_COPYPEN);
-        break;
-
-    case GXnoop:
-        SetROP2(hdc, R2_NOP);
-        break;
-
-    case GXxor:
-        SetROP2(hdc, R2_XORPEN);
-        break;
-
-    case GXor:
-        SetROP2(hdc, R2_MERGEPEN);
-        break;
-
-    case GXnor:
-        SetROP2(hdc, R2_NOTMERGEPEN);
-        break;
-
-    case GXequiv:
-        SetROP2(hdc, R2_NOTXORPEN);
-        break;
-
-    case GXinvert:
-        SetROP2(hdc, R2_NOT);
-        break;
-
-    case GXorReverse:
-        SetROP2(hdc, R2_MERGEPENNOT);
-        break;
-
-    case GXcopyInverted:
-        SetROP2(hdc, R2_NOTCOPYPEN);
-        break;
-
-    case GXorInverted:
-        SetROP2(hdc, R2_MERGENOTPEN);
-        break;
-
-    case GXnand:
-        SetROP2(hdc, R2_NOTMASKPEN);
-        break;
-
-    case GXset:
-        SetROP2(hdc, R2_WHITE);
-        break;
-    }
-}
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index 23152cb..ed1773c 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -570,145 +570,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
     return TRUE;
 }
 
-#ifdef XWIN_NATIVEGDI
-/* See Porting Layer Definition - p. 20 */
-
-Bool
-winFinishScreenInitNativeGDI(int i,
-                             ScreenPtr pScreen, int argc, char **argv)
-{
-    winScreenPriv(pScreen);
-    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
-    VisualPtr pVisuals = NULL;
-    DepthPtr pDepths = NULL;
-    VisualID rootVisual = 0;
-    int nVisuals = 0, nDepths = 0, nRootDepth = 0;
-
-    /* Ignore user input (mouse, keyboard) */
-    pScreenInfo->fIgnoreInput = FALSE;
-
-    /* Get device contexts for the screen and shadow bitmap */
-    pScreenPriv->hdcScreen = GetDC(pScreenPriv->hwndScreen);
-    if (pScreenPriv->hdcScreen == NULL)
-        FatalError("winFinishScreenInitNativeGDI - Couldn't get a DC\n");
-
-    /* Init visuals */
-    if (!(*pScreenPriv->pwinInitVisuals) (pScreen)) {
-        ErrorF("winFinishScreenInitNativeGDI - pwinInitVisuals failed\n");
-        return FALSE;
-    }
-
-    /* Initialize the mi visuals */
-    if (!miInitVisuals(&pVisuals, &pDepths, &nVisuals, &nDepths, &nRootDepth,
-                       &rootVisual,
-                       ((unsigned long) 1 << (pScreenInfo->dwDepth - 1)), 8,
-                       TrueColor)) {
-        ErrorF("winFinishScreenInitNativeGDI - miInitVisuals () failed\n");
-        return FALSE;
-    }
-
-    /* Initialize the CloseScreen procedure pointer */
-    pScreen->CloseScreen = NULL;
-
-    /* Initialize the mi code */
-    if (!miScreenInit(pScreen, NULL,    /* No framebuffer */
-                      pScreenInfo->dwWidth, pScreenInfo->dwHeight,
-                      monitorResolution, monitorResolution,
-                      pScreenInfo->dwStride,
-                      nRootDepth, nDepths, pDepths, rootVisual,
-                      nVisuals, pVisuals)) {
-        ErrorF("winFinishScreenInitNativeGDI - miScreenInit failed\n");
-        return FALSE;
-    }
-
-    pScreen->defColormap = FakeClientID(0);
-
-    /*
-     * Register our block and wakeup handlers; these procedures
-     * process messages in our Windows message queue; specifically,
-     * they process mouse and keyboard input.
-     */
-    pScreen->BlockHandler = winBlockHandler;
-    pScreen->WakeupHandler = winWakeupHandler;
-
-    /* Place our save screen function */
-    pScreen->SaveScreen = winSaveScreen;
-
-    /* Pixmaps */
-    pScreen->CreatePixmap = winCreatePixmapNativeGDI;
-    pScreen->DestroyPixmap = winDestroyPixmapNativeGDI;
-
-    /* Other Screen Routines */
-    pScreen->QueryBestSize = winQueryBestSizeNativeGDI;
-    pScreen->SaveScreen = winSaveScreen;
-    pScreen->GetImage = miGetImage;
-    pScreen->GetSpans = winGetSpansNativeGDI;
-
-    /* Window Procedures */
-    pScreen->CreateWindow = winCreateWindowNativeGDI;
-    pScreen->DestroyWindow = winDestroyWindowNativeGDI;
-    pScreen->PositionWindow = winPositionWindowNativeGDI;
-    /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; */
-    pScreen->RealizeWindow = winMapWindowNativeGDI;
-    pScreen->UnrealizeWindow = winUnmapWindowNativeGDI;
-
-    /* Paint window */
-    pScreen->CopyWindow = winCopyWindowNativeGDI;
-
-    /* Fonts */
-    pScreen->RealizeFont = winRealizeFontNativeGDI;
-    pScreen->UnrealizeFont = winUnrealizeFontNativeGDI;
-
-    /* GC */
-    pScreen->CreateGC = winCreateGCNativeGDI;
-
-    /* Colormap Routines */
-    pScreen->CreateColormap = miInitializeColormap;
-    pScreen->DestroyColormap =
-        (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
-    pScreen->InstallColormap = miInstallColormap;
-    pScreen->UninstallColormap = miUninstallColormap;
-    pScreen->ListInstalledColormaps = miListInstalledColormaps;
-    pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
-    pScreen->ResolveColor = miResolveColor;
-
-    /* Bitmap */
-    pScreen->BitmapToRegion = winPixmapToRegionNativeGDI;
-
-    ErrorF("winFinishScreenInitNativeGDI - calling miDCInitialize\n");
-
-    /* Set the default white and black pixel positions */
-    pScreen->whitePixel = pScreen->blackPixel = (Pixel) 0;
-
-    /* Initialize the cursor */
-    if (!miDCInitialize(pScreen, &g_winPointerCursorFuncs)) {
-        ErrorF("winFinishScreenInitNativeGDI - miDCInitialize failed\n");
-        return FALSE;
-    }
-
-    /* Create a default colormap */
-    if (!miCreateDefColormap(pScreen)) {
-        ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
-               "failed\n");
-        return FALSE;
-    }
-
-    ErrorF("winFinishScreenInitNativeGDI - miCreateDefColormap () "
-           "returned\n");
-
-    /* mi doesn't use a CloseScreen procedure, so no need to wrap */
-    pScreen->CloseScreen = pScreenPriv->pwinCloseScreen;
-
-    /* Tell the server that we are enabled */
-    pScreenPriv->fEnabled = TRUE;
-
-    ErrorF("winFinishScreenInitNativeGDI - Successful addition of "
-           "screen %p\n", pScreen);
-
-    return TRUE;
-}
-#endif
-
 /* See Porting Layer Definition - p. 33 */
 static Bool
 winSaveScreen(ScreenPtr pScreen, int on)
diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c
deleted file mode 100644
index 11108cb..0000000
--- a/xorg-server/hw/xwin/winsetsp.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors:	Harold L Hunt II
- * 		Alan Hourihane <alanh at fairlite.demon.co.uk>
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* See Porting Layer Definition - p. 55 */
-void
-winSetSpansNativeGDI(DrawablePtr pDrawable,
-                     GCPtr pGC,
-                     char *pSrcs,
-                     DDXPointPtr pPoints,
-                     int *piWidths, int iSpans, int fSorted)
-{
-    winGCPriv(pGC);
-    PixmapPtr pPixmap = NULL;
-    winPrivPixmapPtr pPixmapPriv = NULL;
-    HBITMAP hbmpOrig = NULL;
-    BITMAPINFO *pbmi;
-    HRGN hrgn = NULL, combined = NULL;
-    int nbox;
-    BoxPtr pbox;
-
-    nbox = RegionNumRects(pGC->pCompositeClip);
-    pbox = RegionRects(pGC->pCompositeClip);
-
-    if (!nbox)
-        return;
-
-    pbmi = malloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD));
-
-    combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
-    nbox--;
-    pbox++;
-    while (nbox--) {
-        hrgn = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
-        CombineRgn(combined, combined, hrgn, RGN_OR);
-        DeleteObject(hrgn);
-        hrgn = NULL;
-        pbox++;
-    }
-
-    /* Branch on the drawable type */
-    switch (pDrawable->type) {
-    case DRAWABLE_PIXMAP:
-
-        SelectClipRgn(pGCPriv->hdcMem, combined);
-        DeleteObject(combined);
-        combined = NULL;
-
-        pPixmap = (PixmapPtr) pDrawable;
-        pPixmapPriv = winGetPixmapPriv(pPixmap);
-
-        /* Select the drawable pixmap into a DC */
-        hbmpOrig = SelectObject(pGCPriv->hdcMem, pPixmapPriv->hBitmap);
-        if (hbmpOrig == NULL)
-            FatalError("winSetSpans - DRAWABLE_PIXMAP - SelectObject () "
-                       "failed on pPixmapPriv->hBitmap\n");
-
-        while (iSpans--) {
-            ZeroMemory(pbmi, sizeof(BITMAPINFO));
-            pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-            pbmi->bmiHeader.biWidth = *piWidths;
-            pbmi->bmiHeader.biHeight = 1;
-            pbmi->bmiHeader.biPlanes = 1;
-            pbmi->bmiHeader.biBitCount = pDrawable->depth;
-            pbmi->bmiHeader.biCompression = BI_RGB;
-
-            /* Setup color table for mono DIBs */
-            if (pDrawable->depth == 1) {
-                RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
-                bmiColors[1].rgbBlue = 255;
-                bmiColors[1].rgbGreen = 255;
-                bmiColors[1].rgbRed = 255;
-            }
-
-            StretchDIBits(pGCPriv->hdcMem,
-                          pPoints->x, pPoints->y,
-                          *piWidths, 1,
-                          0, 0,
-                          *piWidths, 1,
-                          pSrcs,
-                          (BITMAPINFO *) pbmi,
-                          DIB_RGB_COLORS, g_copyROP[pGC->alu]);
-
-            pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
-            pPoints++;
-            piWidths++;
-        }
-
-        /* Reset the clip region */
-        SelectClipRgn(pGCPriv->hdcMem, NULL);
-
-        /* Push the drawable pixmap out of the GC HDC */
-        SelectObject(pGCPriv->hdcMem, hbmpOrig);
-        break;
-
-    case DRAWABLE_WINDOW:
-
-        SelectClipRgn(pGCPriv->hdc, combined);
-        DeleteObject(combined);
-        combined = NULL;
-
-        while (iSpans--) {
-            ZeroMemory(pbmi, sizeof(BITMAPINFO));
-            pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-            pbmi->bmiHeader.biWidth = *piWidths;
-            pbmi->bmiHeader.biHeight = 1;
-            pbmi->bmiHeader.biPlanes = 1;
-            pbmi->bmiHeader.biBitCount = pDrawable->depth;
-            pbmi->bmiHeader.biCompression = BI_RGB;
-
-            /* Setup color table for mono DIBs */
-            if (pDrawable->depth == 1) {
-                RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
-                bmiColors[1].rgbBlue = 255;
-                bmiColors[1].rgbGreen = 255;
-                bmiColors[1].rgbRed = 255;
-            }
-
-            StretchDIBits(pGCPriv->hdc,
-                          pPoints->x, pPoints->y,
-                          *piWidths, 1,
-                          0, 0,
-                          *piWidths, 1,
-                          pSrcs,
-                          (BITMAPINFO *) pbmi,
-                          DIB_RGB_COLORS, g_copyROP[pGC->alu]);
-
-            pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
-            pPoints++;
-            piWidths++;
-        }
-
-        /* Reset the clip region */
-        SelectClipRgn(pGCPriv->hdc, NULL);
-        break;
-
-    default:
-        FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
-        break;
-    }
-
-    free(pbmi);
-}
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index 8c1c28f..934f6d8 100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -49,225 +49,6 @@ static
     void
  winReshapeRootless(WindowPtr pWin);
 
-#ifdef XWIN_NATIVEGDI
-/* See Porting Layer Definition - p. 37 */
-/* See mfb/mfbwindow.c - mfbCreateWindow() */
-
-Bool
-winCreateWindowNativeGDI(WindowPtr pWin)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winCreateWindowNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(CreateWindow);
-    fResult = (*pScreen->CreateWindow) (pWin);
-    WIN_WRAP(CreateWindow, winCreateWindowNativeGDI);
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 37 */
-/* See mfb/mfbwindow.c - mfbDestroyWindow() */
-
-Bool
-winDestroyWindowNativeGDI(WindowPtr pWin)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winDestroyWindowNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(DestroyWindow);
-    fResult = (*pScreen->DestroyWindow) (pWin);
-    WIN_WRAP(DestroyWindow, winDestroyWindowNativeGDI);
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 37 */
-/* See mfb/mfbwindow.c - mfbPositionWindow() */
-
-Bool
-winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winPositionWindowNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(PositionWindow);
-    fResult = (*pScreen->PositionWindow) (pWin, x, y);
-    WIN_WRAP(PositionWindow, winPositionWindowNativeGDI);
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 39 */
-/* See mfb/mfbwindow.c - mfbCopyWindow() */
-
-void
-winCopyWindowNativeGDI(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
-{
-    DDXPointPtr pptSrc;
-    DDXPointPtr ppt;
-    RegionPtr prgnDst;
-    BoxPtr pBox;
-    int dx, dy;
-    int i, nbox;
-    BoxPtr pBoxDst;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if 0
-    ErrorF("winCopyWindow\n");
-#endif
-
-    /* Create a region for the destination */
-    prgnDst = RegionCreate(NULL, 1);
-
-    /* Calculate the shift from the source to the destination */
-    dx = ptOldOrg.x - pWin->drawable.x;
-    dy = ptOldOrg.y - pWin->drawable.y;
-
-    /* Translate the region from the destination to the source? */
-    RegionTranslate(prgnSrc, -dx, -dy);
-    RegionIntersect(prgnDst, &pWin->borderClip, prgnSrc);
-
-    /* Get a pointer to the first box in the region to be copied */
-    pBox = RegionRects(prgnDst);
-
-    /* Get the number of boxes in the region */
-    nbox = RegionNumRects(prgnDst);
-
-    /* Allocate source points for each box */
-    if (!(pptSrc = malloc(nbox * sizeof(DDXPointRec))))
-        return;
-
-    /* Set an iterator pointer */
-    ppt = pptSrc;
-
-    /* Calculate the source point of each box? */
-    for (i = nbox; --i >= 0; ppt++, pBox++) {
-        ppt->x = pBox->x1 + dx;
-        ppt->y = pBox->y1 + dy;
-    }
-
-    /* Setup loop pointers again */
-    pBoxDst = RegionRects(prgnDst);
-    ppt = pptSrc;
-
-#if 0
-    ErrorF("winCopyWindow - x1\tx2\ty1\ty2\tx\ty\n");
-#endif
-
-    /* BitBlt each source to the destination point */
-    for (i = nbox; --i >= 0; pBoxDst++, ppt++) {
-#if 0
-        ErrorF("winCopyWindow - %d\t%d\t%d\t%d\t%d\t%d\n",
-               pBoxDst->x1, pBoxDst->x2, pBoxDst->y1, pBoxDst->y2,
-               ppt->x, ppt->y);
-#endif
-
-        BitBlt(pScreenPriv->hdcScreen,
-               pBoxDst->x1, pBoxDst->y1,
-               pBoxDst->x2 - pBoxDst->x1, pBoxDst->y2 - pBoxDst->y1,
-               pScreenPriv->hdcScreen, ppt->x, ppt->y, SRCCOPY);
-    }
-
-    /* Cleanup the regions, etc. */
-    free(pptSrc);
-    RegionDestroy(prgnDst);
-}
-
-/* See Porting Layer Definition - p. 37 */
-/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */
-
-Bool
-winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winChangeWindowAttributesNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(ChangeWindowAttributes);
-    fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
-    WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesNativeGDI);
-
-    /*
-     * NOTE: We do not currently need to do anything here.
-     */
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 37
- * Also referred to as UnrealizeWindow
- */
-
-Bool
-winUnmapWindowNativeGDI(WindowPtr pWin)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winUnmapWindowNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(UnrealizeWindow);
-    fResult = (*pScreen->UnrealizeWindow) (pWin);
-    WIN_WRAP(UnrealizeWindow, winUnmapWindowNativeGDI);
-
-    return fResult;
-}
-
-/* See Porting Layer Definition - p. 37
- * Also referred to as RealizeWindow
- */
-
-Bool
-winMapWindowNativeGDI(WindowPtr pWin)
-{
-    Bool fResult = TRUE;
-    ScreenPtr pScreen = pWin->drawable.pScreen;
-
-    winScreenPriv(pScreen);
-
-#if CYGDEBUG
-    winTrace("winMapWindowNativeGDI (%p)\n", pWin);
-#endif
-
-    WIN_UNWRAP(RealizeWindow);
-    fResult = (*pScreen->RealizeWindow) (pWin);
-    WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
-
-    return fResult;
-
-}
-#endif
-
 /* See Porting Layer Definition - p. 37 */
 /* See mfb/mfbwindow.c - mfbCreateWindow() */
 
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index e3adb56..1b09921 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -163,11 +163,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
          */
         if (s_pScreenInfo->fFullScreen
             && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
-                || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
-#ifdef XWIN_PRIMARYFB
-                || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
-#endif
-            )) {
+                || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
             break;
         }
 
@@ -191,11 +187,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         if (s_pScreenInfo->dwBPP !=
             GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)) {
             if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD ||
-                 s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
-#ifdef XWIN_PRIMARYFB
-                 || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD
-#endif
-                )) {
+                 s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)) {
                 /* Cannot display the visual until the depth is restored */
                 ErrorF("winWindowProc - Disruptive change in depth\n");
 
diff --git a/xorg-server/mi/mibitblt.c b/xorg-server/mi/mibitblt.c
index 08bd1c5..114f72d 100644
--- a/xorg-server/mi/mibitblt.c
+++ b/xorg-server/mi/mibitblt.c
@@ -72,7 +72,7 @@ extern int ffs(int);
  *     set them in the destination with SetSpans
  * We let SetSpans worry about clipping to the destination.
  */
-RegionPtr
+_X_COLD RegionPtr
 miCopyArea(DrawablePtr pSrcDrawable,
            DrawablePtr pDstDrawable,
            GCPtr pGC,
@@ -261,8 +261,7 @@ miCopyArea(DrawablePtr pSrcDrawable,
  * This should be replaced with something more general.  mi shouldn't have to
  * care about such things as scanline padding et alia.
  */
-static
-MiBits *
+_X_COLD static MiBits *
 miGetPlane(DrawablePtr pDraw, int planeNum,     /* number of the bitPlane */
            int sx, int sy, int w, int h, MiBits * result)
 {
@@ -368,7 +367,7 @@ miGetPlane(DrawablePtr pDraw, int planeNum,     /* number of the bitPlane */
  * Note how the clipped out bits of the bitmap are always the background
  * color so that the stipple never causes FillRect to draw them.
  */
-static void
+_X_COLD static void
 miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
                   MiBits * pbits, int srcx, int w, int h, int dstx, int dsty)
 {
@@ -510,7 +509,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
  * build a source clip
  * Use the bitmap we've built up as a Stipple for the destination 
  */
-RegionPtr
+_X_COLD RegionPtr
 miCopyPlane(DrawablePtr pSrcDrawable,
             DrawablePtr pDstDrawable,
             GCPtr pGC,
@@ -599,7 +598,7 @@ miCopyPlane(DrawablePtr pSrcDrawable,
  * XY format:
  * get the single plane specified in planemask
  */
-void
+_X_COLD void
 miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
            unsigned int format, unsigned long planeMask, char *pDst)
 {
@@ -689,7 +688,7 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
  * ZPixmap format:
  *	This part is simple, just call SetSpans
  */
-void
+_X_COLD void
 miPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
            int x, int y, int w, int h, int leftPad, int format, char *pImage)
 {
diff --git a/xorg-server/mi/mifillrct.c b/xorg-server/mi/mifillrct.c
index 79c4057..faf6049 100644
--- a/xorg-server/mi/mifillrct.c
+++ b/xorg-server/mi/mifillrct.c
@@ -65,7 +65,7 @@ SOFTWARE.
  * then call FillSpans to fill each rectangle.  We let FillSpans worry about
  * clipping to the destination
  */
-void
+_X_COLD void
 miPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, /* number of rectangles to fill */
                xRectangle *prectInit    /* Pointer to first rectangle to fill */
     )
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 80415c4..75769f1 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -1373,6 +1373,7 @@ System(const char *command)
     switch (pid = fork()) {
     case -1:                   /* error */
         p = -1;
+        break;
     case 0:                    /* child */
         if (setgid(getgid()) == -1)
             _exit(127);
diff --git a/xorg-server/render/mipict.c b/xorg-server/render/mipict.c
index 3959fc4..a725104 100644
--- a/xorg-server/render/mipict.c
+++ b/xorg-server/render/mipict.c
@@ -49,23 +49,9 @@ miDestroyPicture(PicturePtr pPicture)
 void
 miDestroyPictureClip(PicturePtr pPicture)
 {
-    switch (pPicture->clientClipType) {
-    case CT_NONE:
-        return;
-    case CT_PIXMAP:
-        (*pPicture->pDrawable->pScreen->
-         DestroyPixmap) ((PixmapPtr) (pPicture->clientClip));
-        break;
-    default:
-        /*
-         * we know we'll never have a list of rectangles, since ChangeClip
-         * immediately turns them into a region
-         */
+    if (pPicture->clientClip)
         RegionDestroy(pPicture->clientClip);
-        break;
-    }
     pPicture->clientClip = NULL;
-    pPicture->clientClipType = CT_NONE;
 }
 
 int
@@ -73,37 +59,31 @@ miChangePictureClip(PicturePtr pPicture, int type, void *value, int n)
 {
     ScreenPtr pScreen = pPicture->pDrawable->pScreen;
     PictureScreenPtr ps = GetPictureScreen(pScreen);
-    void *clientClip;
-    int clientClipType;
+    RegionPtr clientClip;
 
     switch (type) {
     case CT_PIXMAP:
         /* convert the pixmap to a region */
-        clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value);
+        clientClip = BitmapToRegion(pScreen, (PixmapPtr) value);
         if (!clientClip)
             return BadAlloc;
-        clientClipType = CT_REGION;
         (*pScreen->DestroyPixmap) ((PixmapPtr) value);
         break;
     case CT_REGION:
         clientClip = value;
-        clientClipType = CT_REGION;
         break;
     case CT_NONE:
         clientClip = 0;
-        clientClipType = CT_NONE;
         break;
     default:
-        clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type);
+        clientClip = RegionFromRects(n, (xRectangle *) value, type);
         if (!clientClip)
             return BadAlloc;
-        clientClipType = CT_REGION;
         free(value);
         break;
     }
     (*ps->DestroyPictureClip) (pPicture);
     pPicture->clientClip = clientClip;
-    pPicture->clientClipType = clientClipType;
     pPicture->stateChanges |= CPClipMask;
     return Success;
 }
@@ -144,7 +124,7 @@ miValidatePicture(PicturePtr pPicture, Mask mask)
              * copying of regions.  (this wins especially if many clients clip
              * by children and have no client clip.)
              */
-            if (pPicture->clientClipType == CT_NONE) {
+            if (!pPicture->clientClip) {
                 if (freeCompClip)
                     RegionDestroy(pPicture->pCompositeClip);
                 pPicture->pCompositeClip = pregWin;
@@ -203,7 +183,7 @@ miValidatePicture(PicturePtr pPicture, Mask mask)
                 pPicture->pCompositeClip = RegionCreate(&pixbounds, 1);
             }
 
-            if (pPicture->clientClipType == CT_REGION) {
+            if (pPicture->clientClip) {
                 if (pDrawable->x || pDrawable->y) {
                     RegionTranslate(pPicture->clientClip,
                                     pDrawable->x + pPicture->clipOrigin.x,
@@ -284,7 +264,7 @@ miClipPictureReg(pixman_region16_t * pRegion,
 static inline Bool
 miClipPictureSrc(RegionPtr pRegion, PicturePtr pPicture, int dx, int dy)
 {
-    if (pPicture->clientClipType != CT_NONE) {
+    if (pPicture->clientClip) {
         Bool result;
 
         pixman_region_translate(pPicture->clientClip,
diff --git a/xorg-server/render/mirect.c b/xorg-server/render/mirect.c
index 4e76972..a36d1d6 100644
--- a/xorg-server/render/mirect.c
+++ b/xorg-server/render/mirect.c
@@ -54,7 +54,7 @@ miColorRects(PicturePtr pDst,
     tmpval[1].val = pixel;
     tmpval[2].val = pDst->subWindowMode;
     mask = GCFunction | GCForeground | GCSubwindowMode;
-    if (pClipPict->clientClipType == CT_REGION) {
+    if (pClipPict->clientClip) {
         tmpval[3].val = pDst->clipOrigin.x - xoff;
         tmpval[4].val = pDst->clipOrigin.y - yoff;
         mask |= GCClipXOrigin | GCClipYOrigin;
diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c
index 58535d4..cd9bc74 100644
--- a/xorg-server/render/picture.c
+++ b/xorg-server/render/picture.c
@@ -731,7 +731,6 @@ SetPictureToDefaults(PicturePtr pPicture)
     pPicture->polyEdge = PolyEdgeSharp;
     pPicture->polyMode = PolyModePrecise;
     pPicture->freeCompClip = FALSE;
-    pPicture->clientClipType = CT_NONE;
     pPicture->componentAlpha = FALSE;
     pPicture->repeatType = RepeatNone;
 
diff --git a/xorg-server/render/picturestr.h b/xorg-server/render/picturestr.h
index 1278f62..177f87b 100644
--- a/xorg-server/render/picturestr.h
+++ b/xorg-server/render/picturestr.h
@@ -132,7 +132,6 @@ typedef struct _Picture {
     unsigned int polyEdge:1;
     unsigned int polyMode:1;
     unsigned int freeCompClip:1;
-    unsigned int clientClipType:2;
     unsigned int componentAlpha:1;
     unsigned int repeatType:2;
     unsigned int filter:3;
@@ -145,7 +144,7 @@ typedef struct _Picture {
     DDXPointRec alphaOrigin;
 
     DDXPointRec clipOrigin;
-    void *clientClip;
+    RegionPtr clientClip;
 
     unsigned long serialNumber;
 
diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c
index f9de525..4cfeee1 100644
--- a/xorg-server/xfixes/region.c
+++ b/xorg-server/xfixes/region.c
@@ -272,20 +272,12 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client)
     if (!pPicture->pDrawable)
         return RenderErrBase + BadPicture;
 
-    switch (pPicture->clientClipType) {
-    case CT_PIXMAP:
-        pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
-                                 (PixmapPtr) pPicture->clientClip);
-        if (!pRegion)
-            return BadAlloc;
-        break;
-    case CT_REGION:
+    if (pPicture->clientClip) {
         pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip);
         if (!pRegion)
             return BadAlloc;
-        break;
-    default:
-        return BadImplementation;       /* assume sane server bits */
+    } else {
+        return BadMatch;
     }
 
     if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index 3fd0ce4..682f8c9 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -4448,6 +4448,18 @@
             </languageList>
           </configItem>
         </variant>
+        <variant>
+          <configItem>
+            <name>phonetic_azerty</name>
+            <_description>Russian (phonetic azerty)</_description>
+          </configItem>
+        </variant>
+        <variant>
+          <configItem>
+            <name>phonetic_fr</name>
+            <_description>Russian (phonetic French)</_description>
+          </configItem>
+        </variant>
       </variantList>
     </layout>
     <layout>
diff --git a/xorg-server/xkeyboard-config/symbols/keypad b/xorg-server/xkeyboard-config/symbols/keypad
index 1efc02b..a266024 100644
--- a/xorg-server/xkeyboard-config/symbols/keypad
+++ b/xorg-server/xkeyboard-config/symbols/keypad
@@ -1,3 +1,27 @@
+default  hidden partial keypad_keys
+xkb_symbols "x11" {
+
+    include "keypad(operators)"
+
+    key  <KP7> {	[  KP_Home,	KP_7	]	};
+    key  <KP8> {	[  KP_Up,	KP_8	]	};
+    key  <KP9> {	[  KP_Prior,	KP_9	]	};
+
+    key  <KP4> {	[  KP_Left,	KP_4	]	};
+    key  <KP5> {	[  KP_Begin,	KP_5	]	};
+    key  <KP6> {	[  KP_Right,	KP_6	]	};
+
+    key  <KP1> {	[  KP_End,	KP_1	]	};
+    key  <KP2> {	[  KP_Down,	KP_2	]	};
+    key  <KP3> {	[  KP_Next,	KP_3	]	};
+    key <KPEN> {	[	KP_Enter	]	};
+    key <KPEQ> {	[	KP_Equal	]	};
+
+    key  <KP0> {	[  KP_Insert,	KP_0	]	};
+    key <KPDL> {	[  KP_Delete,	KP_Decimal ]	};
+    key <KPPT> {	[  KP_Decimal,	KP_Decimal ]	};
+};
+
 hidden partial keypad_keys
 xkb_symbols "overlay" {
     include "keypad(overlay1)"
@@ -93,31 +117,6 @@ xkb_symbols "operators" {
     };
 };
 
-default  hidden partial keypad_keys
-xkb_symbols "x11" {
-
-    include "keypad(operators)"
-
-    key  <KP7> {	[  KP_Home,	KP_7	]	};
-    key  <KP8> {	[  KP_Up,	KP_8	]	};
-    key  <KP9> {	[  KP_Prior,	KP_9	]	};
-
-    key  <KP4> {	[  KP_Left,	KP_4	]	};
-    key  <KP5> {	[  KP_Begin,	KP_5	]	};
-    key  <KP6> {	[  KP_Right,	KP_6	]	};
-
-    key  <KP1> {	[  KP_End,	KP_1	]	};
-    key  <KP2> {	[  KP_Down,	KP_2	]	};
-    key  <KP3> {	[  KP_Next,	KP_3	]	};
-    key <KPEN> {	[	KP_Enter	]	};
-    key <KPEQ> {	[	KP_Equal	]	};
-
-    key  <KP0> {	[  KP_Insert,	KP_0	]	};
-    key <KPDL> {	[  KP_Delete,	KP_Decimal ]	};
-    key <KPPT> {	[  KP_Decimal,	KP_Decimal ]	};
-};
-
-
 // Legacy PC keypad definition
 // Copyright © 2006-2007 Nicolas Mailhot <nicolas.mailhot @ laposte.net>
 keypad_keys
diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch
index 7948ab1..2f0b4cf 100644
--- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch
+++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/ch
@@ -3,6 +3,7 @@
 // Andreas Tobler <a.tobler at schweiz.ch>
 // modified for Swiss German Apple Extended Keyboard II
 
+default
 partial alphanumeric_keys
 xkb_symbols "extended" {
     
diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk
index e464519..d3ba80d 100644
--- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk
+++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/dk
@@ -1,4 +1,4 @@
-partial alphanumeric_keys 
+default partial alphanumeric_keys 
 xkb_symbols "basic" {
 
     // Describes the differences between a very simple en_US
diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it
index 3784b0e..17f78e9 100644
--- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it
+++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/it
@@ -1,3 +1,4 @@
+default
 xkb_symbols "extended" {
 
     name[Group1]= "Italy - Mac";
diff --git a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
index 81e4b77..58bfee5 100644
--- a/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
+++ b/xorg-server/xkeyboard-config/symbols/macintosh_vndr/us
@@ -1,6 +1,6 @@
 // symbols definition for a Macintosh "Extended" keyboard
 
-xkb_symbols "extended" {
+default xkb_symbols "extended" {
 
     name[Group1]= "USA";
     key <ESC>  {	[ Escape			]	};
@@ -59,7 +59,7 @@ xkb_symbols "extended" {
     key <SPCE> {	[  space			]	};
 
     include "eurosign(e)"
-    include "keypad"
+    include "keypad(overlay)"
 
     key <KPEQ> {	[  equal			]	};
 };
diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru
index c4f4818..37b61a7 100644
--- a/xorg-server/xkeyboard-config/symbols/ru
+++ b/xorg-server/xkeyboard-config/symbols/ru
@@ -498,6 +498,77 @@ xkb_symbols "chm" {
     include "level3(ralt_switch)"
 };
 
+partial alphanumeric_keys
+xkb_symbols "phonetic_azerty" {
+
+    include "level3(ralt_switch)"
+
+    name[Group1]= "Russian (phonetic azerty)";
+
+     key <AE01>	{ [ ampersand,          1,  onesuperior,   exclamdown ]	};
+     key <AE02>	{ [    eacute,          2,   asciitilde,    oneeighth ]	};
+     key <AE03>	{ [  quotedbl,          3,   numbersign,     sterling ]	};
+     key <AE04>	{ [apostrophe,          4,    braceleft,       dollar ]	};
+     key <AE05>	{ [ parenleft,          5,  bracketleft, threeeighths ]	};
+     key <AE06>	{ [     minus,          6,          bar,  fiveeighths ]	};
+     key <AE07>	{ [    egrave,          7,        grave, seveneighths ]	};
+     key <AE08>	{ [underscore,          8,    backslash,    trademark ]	};
+     key <AE09>	{ [  ccedilla,          9,  asciicircum,    plusminus ]	};
+     key <AE10>	{ [    agrave,          0,           at,       degree ]	};
+     key <AE11>	{ [parenright,     degree, bracketright, questiondown ]	};
+     key <AE12>	{ [     equal,       plus,   braceright,  dead_ogonek ]	};
+
+     key <AB07>  { [     comma,   question,        acute,  doubleacute ] };
+     key <AB08>	{ [ semicolon,     period, horizconnector,   multiply ]	};
+     key <AB09>	{ [     colon,      slash, periodcentered,   division ]	};
+     key <AB10>	{ [    exclam,    section, dead_belowdot, dead_abovedot ] };
+
+     key <AC11>  { [    ugrave,    percent,  asciicircum,        caron ] };
+     key	<LSGT> {	[	      bar,	 brokenbar	]	};
+
+     key	<TLDE> {	[     Cyrillic_yu,     Cyrillic_YU	]	};
+     key	<AC01> {	[     Cyrillic_ya,     Cyrillic_YA	]	}; // Q
+     key	<AD02> {	[     Cyrillic_ze,     Cyrillic_ZE	]	}; // Z
+     key	<LatS> {	[     Cyrillic_es,     Cyrillic_ES	]	};
+     key	<AD01> {	[      Cyrillic_a,	Cyrillic_A	]	};
+     key	<AB01> {	[     Cyrillic_ve,     Cyrillic_VE	]	}; // W
+     key	<LatC> {	[    Cyrillic_tse,    Cyrillic_TSE	]	};
+     key	<LatX> {	[Cyrillic_softsign,Cyrillic_SOFTSIGN	]	};
+     key	<LatD> {	[     Cyrillic_de,     Cyrillic_DE	]	};
+     key	<LatE> {	[     Cyrillic_ie,     Cyrillic_IE	]	};
+     key	<LatV> {	[    Cyrillic_zhe,    Cyrillic_ZHE	]	};
+     key	<LatF> {	[     Cyrillic_ef,     Cyrillic_EF	]	};
+     key	<LatT> {	[     Cyrillic_te,     Cyrillic_TE	]	};
+     key	<LatR> {	[     Cyrillic_er,     Cyrillic_ER	]	};
+     key	<LatN> {	[     Cyrillic_en,     Cyrillic_EN	]	};
+     key	<LatB> {	[     Cyrillic_be,     Cyrillic_BE	]	};
+     key	<LatH> {	[     Cyrillic_ha,     Cyrillic_HA	]	};
+     key	<LatG> {	[    Cyrillic_ghe,    Cyrillic_GHE	]	};
+     key	<LatY> {	[   Cyrillic_yeru,   Cyrillic_YERU	]	};
+     key	<AC10> {	[     Cyrillic_em,     Cyrillic_EM	]	}; // M
+     key	<LatJ> {	[ Cyrillic_shorti, Cyrillic_SHORTI	]	};
+     key	<LatU> {	[      Cyrillic_u,	Cyrillic_U	]	};
+     key	<LatK> {	[     Cyrillic_ka,     Cyrillic_KA	]	};
+     key	<LatI> {	[      Cyrillic_i,	Cyrillic_I	]	};
+     key	<LatO> {	[      Cyrillic_o,	Cyrillic_O	]	};
+     key	<LatL> {	[     Cyrillic_el,     Cyrillic_EL	]	};
+     key	<LatP> {	[     Cyrillic_pe,     Cyrillic_PE	]	};
+
+    key	<AD11> {	[    Cyrillic_sha,    Cyrillic_SHA	]	};
+    key	<AE12> {	[    Cyrillic_che,    Cyrillic_CHE	]	};
+    key	<AD12> {	[  Cyrillic_shcha,  Cyrillic_SHCHA	]	};
+    key	<BKSL> {	[      Cyrillic_e,	Cyrillic_E	]	};
+};
+
+partial alphanumeric_keys
+xkb_symbols "phonetic_fr" {
+
+    include "fr"
+    include "ru(phonetic_azerty)"
+
+    name[Group1]= "Russian (phonetic French)";
+};
+
 // EXTRAS:
 
 // Church Slavonic language layout

--
Alioth's /srv/git/code.x2go.org/vcxsrv.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/vcxsrv.git


More information about the x2go-commits mailing list