diff --git a/.gitignore b/.gitignore
index 7b564bc..b7e1e0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/mesa-20131218.tar.xz
+SOURCES/mesa-20140910.tar.xz
diff --git a/.mesa.metadata b/.mesa.metadata
index cb49df3..47ed87e 100644
--- a/.mesa.metadata
+++ b/.mesa.metadata
@@ -1 +1 @@
-f4f0d3bc6f0b28bcd95f17b75126d543d65929b5 SOURCES/mesa-20131218.tar.xz
+487e487decc60815209baf72467ac240f9ba0cf7 SOURCES/mesa-20140910.tar.xz
diff --git a/SOURCES/0001-gallivm-Fix-Altivec-pack-intrinsics-for-little-endia.patch b/SOURCES/0001-gallivm-Fix-Altivec-pack-intrinsics-for-little-endia.patch
new file mode 100644
index 0000000..814314e
--- /dev/null
+++ b/SOURCES/0001-gallivm-Fix-Altivec-pack-intrinsics-for-little-endia.patch
@@ -0,0 +1,116 @@
+From 0feb977bbfb0d6bb2c8d3178246acb035a739f37 Mon Sep 17 00:00:00 2001
+From: Ulrich Weigand <uweigand@de.ibm.com>
+Date: Mon, 4 Aug 2014 18:41:00 +0200
+Subject: [PATCH] gallivm: Fix Altivec pack intrinsics for little-endian
+
+This patch fixes use of Altivec pack intrinsics on little-endian PowerPC
+systems.  Since little-endian operation only affects the load and store
+instructions, the semantics of pack (and other) instructions that take
+two input vectors implicitly change: the pack instructions still fill
+a register placing values from the first operand into the "high" parts
+of the register, and values from the second operand into the "low" parts
+of the register, but since vector loads and stores perform an endian swap,
+the high parts end up at high memory addresses.
+
+To still achieve the desired effect, we have to swap the two inputs to
+the pack instruction on little-endian systems.  This is done automatically
+by the back-end for instructions generated by LLVM, but needs to be done
+manually when emitting intrisincs (which still result in that instruction
+being emitted directly).
+
+Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
+Signed-off-by: Maarten Lankhorst <dev@mblankhorst.nl>
+---
+ src/gallium/auxiliary/gallivm/lp_bld_pack.c | 26 +++++++++++++++++++++-----
+ 1 file changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+index a48a922..cdf6d80 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+@@ -464,6 +464,7 @@ lp_build_pack2(struct gallivm_state *gallivm,
+    if((util_cpu_caps.has_sse2 || util_cpu_caps.has_altivec) &&
+        src_type.width * src_type.length >= 128) {
+       const char *intrinsic = NULL;
++      boolean swap_intrinsic_operands = FALSE;
+ 
+       switch(src_type.width) {
+       case 32:
+@@ -482,6 +483,9 @@ lp_build_pack2(struct gallivm_state *gallivm,
+            } else {
+               intrinsic = "llvm.ppc.altivec.vpkuwus";
+            }
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
++           swap_intrinsic_operands = TRUE;
++#endif
+          }
+          break;
+       case 16:
+@@ -490,12 +494,18 @@ lp_build_pack2(struct gallivm_state *gallivm,
+               intrinsic = "llvm.x86.sse2.packsswb.128";
+             } else if (util_cpu_caps.has_altivec) {
+               intrinsic = "llvm.ppc.altivec.vpkshss";
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
++              swap_intrinsic_operands = TRUE;
++#endif
+             }
+          } else {
+             if (util_cpu_caps.has_sse2) {
+               intrinsic = "llvm.x86.sse2.packuswb.128";
+             } else if (util_cpu_caps.has_altivec) {
+ 	      intrinsic = "llvm.ppc.altivec.vpkshus";
++#ifdef PIPE_ARCH_LITTLE_ENDIAN
++              swap_intrinsic_operands = TRUE;
++#endif
+             }
+          }
+          break;
+@@ -504,7 +514,11 @@ lp_build_pack2(struct gallivm_state *gallivm,
+       if (intrinsic) {
+          if (src_type.width * src_type.length == 128) {
+             LLVMTypeRef intr_vec_type = lp_build_vec_type(gallivm, intr_type);
+-            res = lp_build_intrinsic_binary(builder, intrinsic, intr_vec_type, lo, hi);
++            if (swap_intrinsic_operands) {
++               res = lp_build_intrinsic_binary(builder, intrinsic, intr_vec_type, hi, lo);
++            } else {
++               res = lp_build_intrinsic_binary(builder, intrinsic, intr_vec_type, lo, hi);
++            }
+             if (dst_vec_type != intr_vec_type) {
+                res = LLVMBuildBitCast(builder, res, dst_vec_type, "");
+             }
+@@ -513,6 +527,8 @@ lp_build_pack2(struct gallivm_state *gallivm,
+             int num_split = src_type.width * src_type.length / 128;
+             int i;
+             int nlen = 128 / src_type.width;
++            int lo_off = swap_intrinsic_operands ? nlen : 0;
++            int hi_off = swap_intrinsic_operands ? 0 : nlen;
+             struct lp_type ndst_type = lp_type_unorm(dst_type.width, 128);
+             struct lp_type nintr_type = lp_type_unorm(intr_type.width, 128);
+             LLVMValueRef tmpres[LP_MAX_VECTOR_WIDTH / 128];
+@@ -524,9 +540,9 @@ lp_build_pack2(struct gallivm_state *gallivm,
+ 
+             for (i = 0; i < num_split / 2; i++) {
+                tmplo = lp_build_extract_range(gallivm,
+-                                              lo, i*nlen*2, nlen);
++                                              lo, i*nlen*2 + lo_off, nlen);
+                tmphi = lp_build_extract_range(gallivm,
+-                                              lo, i*nlen*2 + nlen, nlen);
++                                              lo, i*nlen*2 + hi_off, nlen);
+                tmpres[i] = lp_build_intrinsic_binary(builder, intrinsic,
+                                                      nintr_vec_type, tmplo, tmphi);
+                if (ndst_vec_type != nintr_vec_type) {
+@@ -535,9 +551,9 @@ lp_build_pack2(struct gallivm_state *gallivm,
+             }
+             for (i = 0; i < num_split / 2; i++) {
+                tmplo = lp_build_extract_range(gallivm,
+-                                              hi, i*nlen*2, nlen);
++                                              hi, i*nlen*2 + lo_off, nlen);
+                tmphi = lp_build_extract_range(gallivm,
+-                                              hi, i*nlen*2 + nlen, nlen);
++                                              hi, i*nlen*2 + hi_off, nlen);
+                tmpres[i+num_split/2] = lp_build_intrinsic_binary(builder, intrinsic,
+                                                                  nintr_vec_type,
+                                                                  tmplo, tmphi);
+-- 
+1.9.3
+
diff --git a/SOURCES/0001-glx-Fix-the-default-values-for-GLXFBConfig-attribute.patch b/SOURCES/0001-glx-Fix-the-default-values-for-GLXFBConfig-attribute.patch
deleted file mode 100644
index 8892d99..0000000
--- a/SOURCES/0001-glx-Fix-the-default-values-for-GLXFBConfig-attribute.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 8b8eb7562699c091841ec6edec7e60ab3c4dfe67 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= <fredrik@kde.org>
-Date: Mon, 17 Feb 2014 23:10:17 +0100
-Subject: [PATCH] glx: Fix the default values for GLXFBConfig attributes
-
-The default values for GLX_DRAWABLE_TYPE and GLX_RENDER_TYPE are
-GLX_WINDOW_BIT and GLX_RGBA_BIT respectively, as specified in
-the GLX 1.4 specification.
-
-This fixes the glx-choosefbconfig-defaults piglit test.
-
-Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
-
-Signed-off-by: Dave Airlie <airlied@redhat.com>
----
- src/glx/glxcmds.c | 9 ++-------
- 1 file changed, 2 insertions(+), 7 deletions(-)
-
-diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
-index ec16e8f..e005639 100644
---- a/src/glx/glxcmds.c
-+++ b/src/glx/glxcmds.c
-@@ -917,13 +917,10 @@ init_fbconfig_for_chooser(struct glx_config * config,
-    if (fbconfig_style_tags) {
-       config->rgbMode = GL_TRUE;
-       config->doubleBufferMode = GLX_DONT_CARE;
--      /* allow any kind of drawable, including those for off-screen buffers */
--      config->drawableType = 0;
--   } else {
--       /* allow configs which support on-screen drawing */
--       config->drawableType = GLX_WINDOW_BIT;
-+      config->renderType = GLX_RGBA_BIT;
-    }
- 
-+   config->drawableType = GLX_WINDOW_BIT;
-    config->visualRating = GLX_DONT_CARE;
-    config->transparentPixel = GLX_NONE;
-    config->transparentRed = GLX_DONT_CARE;
-@@ -932,8 +929,6 @@ init_fbconfig_for_chooser(struct glx_config * config,
-    config->transparentAlpha = GLX_DONT_CARE;
-    config->transparentIndex = GLX_DONT_CARE;
- 
--   /* Set GLX_RENDER_TYPE property to not expect any flags by default. */
--   config->renderType = 0;
-    config->xRenderable = GLX_DONT_CARE;
-    config->fbconfigID = (GLXFBConfigID) (GLX_DONT_CARE);
- 
--- 
-1.8.3.1
-
diff --git a/SOURCES/0001-r600g-fix-SUMO2-pci-id.patch b/SOURCES/0001-r600g-fix-SUMO2-pci-id.patch
deleted file mode 100644
index a22210e..0000000
--- a/SOURCES/0001-r600g-fix-SUMO2-pci-id.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From e2d53fac1c5b18f5c9e95d39d4e2be4703b0b363 Mon Sep 17 00:00:00 2001
-From: Alex Deucher <alexander.deucher@amd.com>
-Date: Tue, 24 Dec 2013 15:22:31 -0500
-Subject: [PATCH] r600g: fix SUMO2 pci id
-
-0x9649 is sumo2, not sumo.
-
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-CC: "9.2" "10.0" <mesa-stable@lists.freedesktop.org>
----
- include/pci_ids/r600_pci_ids.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/pci_ids/r600_pci_ids.h b/include/pci_ids/r600_pci_ids.h
-index 5036a83..533c9f3 100644
---- a/include/pci_ids/r600_pci_ids.h
-+++ b/include/pci_ids/r600_pci_ids.h
-@@ -208,7 +208,7 @@ CHIPSET(0x9644, SUMO2_9644, SUMO2)
- CHIPSET(0x9645, SUMO2_9645, SUMO2)
- CHIPSET(0x9647, SUMO_9647,  SUMO)
- CHIPSET(0x9648, SUMO_9648,  SUMO)
--CHIPSET(0x9649, SUMO_9649,  SUMO)
-+CHIPSET(0x9649, SUMO2_9649, SUMO2)
- CHIPSET(0x964a, SUMO_964A,  SUMO)
- CHIPSET(0x964b, SUMO_964B,  SUMO)
- CHIPSET(0x964c, SUMO_964C,  SUMO)
--- 
-1.8.4.2
-
diff --git a/SOURCES/0001-swrast-gallium-classic-add-MESA_copy_sub_buffer-supp.patch b/SOURCES/0001-swrast-gallium-classic-add-MESA_copy_sub_buffer-supp.patch
deleted file mode 100644
index 494a05f..0000000
--- a/SOURCES/0001-swrast-gallium-classic-add-MESA_copy_sub_buffer-supp.patch
+++ /dev/null
@@ -1,1020 +0,0 @@
-From cbefe3f43f3d7e81367f7515512950b97fc0dd2c Mon Sep 17 00:00:00 2001
-From: Dave Airlie <airlied@gmail.com>
-Date: Thu, 28 Nov 2013 11:08:11 +1000
-Subject: [PATCH] swrast* (gallium, classic): add MESA_copy_sub_buffer support
- (v3)
-
-This patches add MESA_copy_sub_buffer support to the dri sw loader and
-then to gallium state tracker, llvmpipe, softpipe and other bits.
-
-It reuses the dri1 driver extension interface, and it updates the swrast
-loader interface for a new putimage which can take a stride.
-
-I've tested this with gnome-shell with a cogl hacked to reenable sub copies
-for llvmpipe and the one piglit test.
-
-I could probably split this patch up as well.
-
-v2: pass a pipe_box, to reduce the entrypoints, as per Jose's review,
-add to p_screen doc comments.
-
-v3: finish off winsys interfaces, add swrast classic support as well.
-
-Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
-Signed-off-by: Dave Airlie <airlied@redhat.com>
-
-swrast: add support for copy_sub_buffer
-
-Conflicts:
-	src/gallium/state_trackers/dri/sw/drisw.c
-	src/gallium/targets/haiku-softpipe/GalliumContext.cpp
-	src/mesa/drivers/dri/common/dri_util.c
-	src/mesa/drivers/dri/swrast/swrast.c
----
- include/GL/internal/dri_interface.h                |  9 +++-
- src/gallium/auxiliary/vl/vl_winsys_dri.c           |  2 +-
- src/gallium/drivers/galahad/glhd_screen.c          |  5 +-
- src/gallium/drivers/i915/i915_screen.c             |  4 +-
- src/gallium/drivers/identity/id_screen.c           |  5 +-
- src/gallium/drivers/llvmpipe/lp_screen.c           |  6 +--
- src/gallium/drivers/noop/noop_pipe.c               |  2 +-
- src/gallium/drivers/rbug/rbug_screen.c             |  4 +-
- src/gallium/drivers/softpipe/sp_screen.c           |  5 +-
- src/gallium/drivers/trace/tr_screen.c              |  5 +-
- src/gallium/include/pipe/p_screen.h                |  7 +--
- src/gallium/include/state_tracker/drisw_api.h      |  2 +
- src/gallium/include/state_tracker/sw_winsys.h      |  5 +-
- src/gallium/state_trackers/dri/sw/drisw.c          | 58 ++++++++++++++++++++--
- .../state_trackers/egl/common/native_helper.c      |  2 +-
- src/gallium/state_trackers/egl/x11/native_ximage.c |  2 +-
- src/gallium/state_trackers/glx/xlib/xm_st.c        |  2 +-
- src/gallium/state_trackers/vdpau/presentation.c    |  2 +-
- src/gallium/state_trackers/xvmc/surface.c          |  2 +-
- src/gallium/tests/graw/clear.c                     |  2 +-
- src/gallium/tests/graw/fs-test.c                   |  2 +-
- src/gallium/tests/graw/graw_util.h                 |  2 +-
- src/gallium/tests/graw/gs-test.c                   |  2 +-
- src/gallium/tests/graw/quad-sample.c               |  2 +-
- src/gallium/tests/graw/shader-leak.c               |  2 +-
- src/gallium/tests/graw/tri-gs.c                    |  2 +-
- src/gallium/tests/graw/tri-instanced.c             |  2 +-
- src/gallium/tests/graw/vs-test.c                   |  2 +-
- .../winsys/sw/android/android_sw_winsys.cpp        |  3 +-
- src/gallium/winsys/sw/dri/dri_sw_winsys.c          | 16 ++++--
- src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c      |  3 +-
- src/gallium/winsys/sw/gdi/gdi_sw_winsys.c          |  3 +-
- src/gallium/winsys/sw/hgl/hgl_sw_winsys.c          |  3 +-
- src/gallium/winsys/sw/null/null_sw_winsys.c        |  3 +-
- src/gallium/winsys/sw/wayland/wayland_sw_winsys.c  |  3 +-
- src/gallium/winsys/sw/xlib/xlib_sw_winsys.c        |  3 +-
- src/glx/drisw_glx.c                                | 43 ++++++++++++++--
- src/mesa/drivers/dri/common/dri_util.h             |  5 +-
- src/mesa/drivers/dri/common/drisw_util.c           | 15 ++++++
- src/mesa/drivers/dri/swrast/swrast.c               | 35 +++++++++++++
- 40 files changed, 225 insertions(+), 57 deletions(-)
-
-diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
-index 5c99d55..09c1406 100644
---- a/include/GL/internal/dri_interface.h
-+++ b/include/GL/internal/dri_interface.h
-@@ -439,7 +439,7 @@ struct __DRIdamageExtensionRec {
-  * SWRast Loader extension.
-  */
- #define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
--#define __DRI_SWRAST_LOADER_VERSION 1
-+#define __DRI_SWRAST_LOADER_VERSION 2
- struct __DRIswrastLoaderExtensionRec {
-     __DRIextension base;
- 
-@@ -463,6 +463,13 @@ struct __DRIswrastLoaderExtensionRec {
-     void (*getImage)(__DRIdrawable *readable,
- 		     int x, int y, int width, int height,
- 		     char *data, void *loaderPrivate);
-+
-+    /**
-+     * Put image to drawable
-+     */
-+    void (*putImage2)(__DRIdrawable *drawable, int op,
-+                      int x, int y, int width, int height, int stride,
-+                      char *data, void *loaderPrivate);
- };
- 
- /**
-diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
-index 7aec3fe..e747a66 100644
---- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
-+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
-@@ -115,7 +115,7 @@ static void
- vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
-                           struct pipe_resource *resource,
-                           unsigned level, unsigned layer,
--                          void *context_private)
-+                          void *context_private, struct pipe_box *sub_box)
- {
-    struct vl_dri_screen *scrn = (struct vl_dri_screen*)context_private;
-    uint32_t msc_hi, msc_lo;
-diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c
-index 16a5ff1..5a91077 100644
---- a/src/gallium/drivers/galahad/glhd_screen.c
-+++ b/src/gallium/drivers/galahad/glhd_screen.c
-@@ -275,7 +275,8 @@ static void
- galahad_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                                   struct pipe_resource *_resource,
-                                   unsigned level, unsigned layer,
--                                  void *context_private)
-+                                  void *context_private,
-+                                  struct pipe_box *sub_box)
- {
-    struct galahad_screen *glhd_screen = galahad_screen(_screen);
-    struct galahad_resource *glhd_resource = galahad_resource(_resource);
-@@ -285,7 +286,7 @@ galahad_screen_flush_frontbuffer(struct pipe_screen *_screen,
-    screen->flush_frontbuffer(screen,
-                              resource,
-                              level, layer,
--                             context_private);
-+                             context_private, sub_box);
- }
- 
- static void
-diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
-index 556dda8..0ff2640 100644
---- a/src/gallium/drivers/i915/i915_screen.c
-+++ b/src/gallium/drivers/i915/i915_screen.c
-@@ -419,7 +419,8 @@ static void
- i915_flush_frontbuffer(struct pipe_screen *screen,
-                        struct pipe_resource *resource,
-                        unsigned level, unsigned layer,
--                       void *winsys_drawable_handle)
-+                       void *winsys_drawable_handle,
-+                       struct pipe_box *sub_box)
- {
-    /* XXX: Dummy right now. */
-    (void)screen;
-@@ -427,6 +428,7 @@ i915_flush_frontbuffer(struct pipe_screen *screen,
-    (void)level;
-    (void)layer;
-    (void)winsys_drawable_handle;
-+   (void)sub_box;
- }
- 
- static void
-diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
-index 26df7f6..28cfa1f6 100644
---- a/src/gallium/drivers/identity/id_screen.c
-+++ b/src/gallium/drivers/identity/id_screen.c
-@@ -192,7 +192,8 @@ static void
- identity_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                                   struct pipe_resource *_resource,
-                                   unsigned level, unsigned layer,
--                                  void *context_private)
-+                                  void *context_private,
-+                                  struct pipe_box *sub_box)
- {
-    struct identity_screen *id_screen = identity_screen(_screen);
-    struct identity_resource *id_resource = identity_resource(_resource);
-@@ -202,7 +203,7 @@ identity_screen_flush_frontbuffer(struct pipe_screen *_screen,
-    screen->flush_frontbuffer(screen,
-                              resource,
-                              level, layer,
--                             context_private);
-+                             context_private, sub_box);
- }
- 
- static void
-diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
-index b3cd77f..f488d6d 100644
---- a/src/gallium/drivers/llvmpipe/lp_screen.c
-+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
-@@ -403,7 +403,8 @@ static void
- llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
-                            struct pipe_resource *resource,
-                            unsigned level, unsigned layer,
--                           void *context_private)
-+                           void *context_private,
-+                           struct pipe_box *sub_box)
- {
-    struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
-    struct sw_winsys *winsys = screen->winsys;
-@@ -411,10 +412,9 @@ llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
- 
-    assert(texture->dt);
-    if (texture->dt)
--      winsys->displaytarget_display(winsys, texture->dt, context_private);
-+      winsys->displaytarget_display(winsys, texture->dt, context_private, sub_box);
- }
- 
--
- static void
- llvmpipe_destroy_screen( struct pipe_screen *_screen )
- {
-diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
-index ac837b1..849a4d1 100644
---- a/src/gallium/drivers/noop/noop_pipe.c
-+++ b/src/gallium/drivers/noop/noop_pipe.c
-@@ -288,7 +288,7 @@ static struct pipe_context *noop_create_context(struct pipe_screen *screen, void
- static void noop_flush_frontbuffer(struct pipe_screen *_screen,
- 				   struct pipe_resource *resource,
- 				   unsigned level, unsigned layer,
--				   void *context_private)
-+				   void *context_private, struct pipe_box *box)
- {
- }
- 
-diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
-index 2471fdb..8576e2f 100644
---- a/src/gallium/drivers/rbug/rbug_screen.c
-+++ b/src/gallium/drivers/rbug/rbug_screen.c
-@@ -190,7 +190,7 @@ static void
- rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                               struct pipe_resource *_resource,
-                               unsigned level, unsigned layer,
--                              void *context_private)
-+                              void *context_private, struct pipe_box *sub_box)
- {
-    struct rbug_screen *rb_screen = rbug_screen(_screen);
-    struct rbug_resource *rb_resource = rbug_resource(_resource);
-@@ -200,7 +200,7 @@ rbug_screen_flush_frontbuffer(struct pipe_screen *_screen,
-    screen->flush_frontbuffer(screen,
-                              resource,
-                              level, layer,
--                             context_private);
-+                             context_private, sub_box);
- }
- 
- static void
-diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
-index f6acdc8..3e3f366 100644
---- a/src/gallium/drivers/softpipe/sp_screen.c
-+++ b/src/gallium/drivers/softpipe/sp_screen.c
-@@ -364,7 +364,8 @@ static void
- softpipe_flush_frontbuffer(struct pipe_screen *_screen,
-                            struct pipe_resource *resource,
-                            unsigned level, unsigned layer,
--                           void *context_private)
-+                           void *context_private,
-+                           struct pipe_box *sub_box)
- {
-    struct softpipe_screen *screen = softpipe_screen(_screen);
-    struct sw_winsys *winsys = screen->winsys;
-@@ -372,7 +373,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
- 
-    assert(texture->dt);
-    if (texture->dt)
--      winsys->displaytarget_display(winsys, texture->dt, context_private);
-+      winsys->displaytarget_display(winsys, texture->dt, context_private, sub_box);
- }
- 
- static uint64_t
-diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
-index 5281ba8..b71ebbe 100644
---- a/src/gallium/drivers/trace/tr_screen.c
-+++ b/src/gallium/drivers/trace/tr_screen.c
-@@ -210,7 +210,8 @@ static void
- trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
-                                struct pipe_resource *_resource,
-                                unsigned level, unsigned layer,
--                               void *context_private)
-+                               void *context_private,
-+                               struct pipe_box *sub_box)
- {
-    struct trace_screen *tr_scr = trace_screen(_screen);
-    struct trace_resource *tr_res = trace_resource(_resource);
-@@ -227,7 +228,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
-    trace_dump_arg(ptr, context_private);
-    */
- 
--   screen->flush_frontbuffer(screen, resource, level, layer, context_private);
-+   screen->flush_frontbuffer(screen, resource, level, layer, context_private, sub_box);
- 
-    trace_dump_call_end();
- }
-diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
-index c487e8e..c0f4fd1 100644
---- a/src/gallium/include/pipe/p_screen.h
-+++ b/src/gallium/include/pipe/p_screen.h
-@@ -56,6 +56,7 @@ struct pipe_fence_handle;
- struct pipe_resource;
- struct pipe_surface;
- struct pipe_transfer;
-+struct pipe_box;
- 
- 
- /**
-@@ -179,13 +180,13 @@ struct pipe_screen {
-     * displayed, eg copy fake frontbuffer.
-     * \param winsys_drawable_handle  an opaque handle that the calling context
-     *                                gets out-of-band
-+    * \param subbox an optional sub region to flush
-     */
-    void (*flush_frontbuffer)( struct pipe_screen *screen,
-                               struct pipe_resource *resource,
-                               unsigned level, unsigned layer,
--                              void *winsys_drawable_handle );
--
--
-+                              void *winsys_drawable_handle,
-+                              struct pipe_box *subbox );
- 
-    /** Set ptr = fence, with reference counting */
-    void (*fence_reference)( struct pipe_screen *screen,
-diff --git a/src/gallium/include/state_tracker/drisw_api.h b/src/gallium/include/state_tracker/drisw_api.h
-index 944a649..328440c 100644
---- a/src/gallium/include/state_tracker/drisw_api.h
-+++ b/src/gallium/include/state_tracker/drisw_api.h
-@@ -13,6 +13,8 @@ struct drisw_loader_funcs
- {
-    void (*put_image) (struct dri_drawable *dri_drawable,
-                       void *data, unsigned width, unsigned height);
-+   void (*put_image2) (struct dri_drawable *dri_drawable,
-+                       void *data, int x, int y, unsigned width, unsigned height, unsigned stride);
- };
- 
- /**
-diff --git a/src/gallium/include/state_tracker/sw_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h
-index 0b11fe3..d08ddd6 100644
---- a/src/gallium/include/state_tracker/sw_winsys.h
-+++ b/src/gallium/include/state_tracker/sw_winsys.h
-@@ -48,7 +48,7 @@ struct winsys_handle;
- struct pipe_screen;
- struct pipe_context;
- struct pipe_resource;
--
-+struct pipe_box;
- 
- /**
-  * Opaque pointer.
-@@ -129,7 +129,8 @@ struct sw_winsys
-    void
-    (*displaytarget_display)( struct sw_winsys *ws, 
-                              struct sw_displaytarget *dt,
--                             void *context_private );
-+                             void *context_private,
-+                             struct pipe_box *box );
- 
-    void 
-    (*displaytarget_destroy)( struct sw_winsys *ws, 
-diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
-index 121a205..aa0d3e0 100644
---- a/src/gallium/state_trackers/dri/sw/drisw.c
-+++ b/src/gallium/state_trackers/dri/sw/drisw.c
-@@ -37,6 +37,7 @@
- #include "util/u_format.h"
- #include "util/u_memory.h"
- #include "util/u_inlines.h"
-+#include "util/u_box.h"
- #include "pipe/p_context.h"
- #include "state_tracker/drisw_api.h"
- #include "state_tracker/st_context.h"
-@@ -71,6 +72,18 @@ put_image(__DRIdrawable *dPriv, void *data, unsigned width, unsigned height)
- }
- 
- static INLINE void
-+put_image2(__DRIdrawable *dPriv, void *data, int x, int y,
-+           unsigned width, unsigned height, unsigned stride)
-+{
-+   __DRIscreen *sPriv = dPriv->driScreenPriv;
-+   const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
-+
-+   loader->putImage2(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
-+                     x, y, width, height, stride,
-+                     data, dPriv->loaderPrivate);
-+}
-+
-+static INLINE void
- get_image(__DRIdrawable *dPriv, int x, int y, int width, int height, void *data)
- {
-    __DRIscreen *sPriv = dPriv->driScreenPriv;
-@@ -99,9 +112,19 @@ drisw_put_image(struct dri_drawable *drawable,
-    put_image(dPriv, data, width, height);
- }
- 
-+static void
-+drisw_put_image2(struct dri_drawable *drawable,
-+                 void *data, int x, int y, unsigned width, unsigned height,
-+                 unsigned stride)
-+{
-+   __DRIdrawable *dPriv = drawable->dPriv;
-+
-+   put_image2(dPriv, data, x, y, width, height, stride);
-+}
-+
- static INLINE void
- drisw_present_texture(__DRIdrawable *dPriv,
--                      struct pipe_resource *ptex)
-+                      struct pipe_resource *ptex, struct pipe_box *sub_box)
- {
-    struct dri_drawable *drawable = dri_drawable(dPriv);
-    struct dri_screen *screen = dri_screen(drawable->sPriv);
-@@ -109,7 +132,7 @@ drisw_present_texture(__DRIdrawable *dPriv,
-    if (swrast_no_present)
-       return;
- 
--   screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable);
-+   screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable, sub_box);
- }
- 
- static INLINE void
-@@ -126,7 +149,7 @@ static INLINE void
- drisw_copy_to_front(__DRIdrawable * dPriv,
-                     struct pipe_resource *ptex)
- {
--   drisw_present_texture(dPriv, ptex);
-+   drisw_present_texture(dPriv, ptex, NULL);
- 
-    drisw_invalidate_drawable(dPriv);
- }
-@@ -158,6 +181,30 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
- }
- 
- static void
-+drisw_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
-+                      int w, int h)
-+{
-+   struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
-+   struct dri_drawable *drawable = dri_drawable(dPriv);
-+   struct pipe_resource *ptex;
-+   struct pipe_box box;
-+   if (!ctx)
-+      return;
-+
-+   ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
-+
-+   if (ptex) {
-+      if (ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
-+         pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
-+
-+      ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
-+
-+      u_box_2d(x, dPriv->h - y - h, w, h, &box);
-+      drisw_present_texture(dPriv, ptex, &box);
-+   }
-+}
-+
-+static void
- drisw_flush_frontbuffer(struct dri_context *ctx,
-                         struct dri_drawable *drawable,
-                         enum st_attachment_type statt)
-@@ -288,7 +335,8 @@ static const __DRIextension *drisw_screen_extensions[] = {
- };
- 
- static struct drisw_loader_funcs drisw_lf = {
--   .put_image = drisw_put_image
-+   .put_image = drisw_put_image,
-+   .put_image2 = drisw_put_image2
- };
- 
- static const __DRIconfig **
-@@ -359,12 +407,14 @@ const struct __DriverAPIRec driDriverAPI = {
-    .SwapBuffers = drisw_swap_buffers,
-    .MakeCurrent = dri_make_current,
-    .UnbindContext = dri_unbind_context,
-+   .CopySubBuffer = drisw_copy_sub_buffer,
- };
- 
- /* This is the table of extensions that the loader will dlsym() for. */
- PUBLIC const __DRIextension *__driDriverExtensions[] = {
-     &driCoreExtension.base,
-     &driSWRastExtension.base,
-+    &driCopySubBufferExtension.base,
-     NULL
- };
- 
-diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
-index b578a8a..5c2be19 100644
---- a/src/gallium/state_trackers/egl/common/native_helper.c
-+++ b/src/gallium/state_trackers/egl/common/native_helper.c
-@@ -244,7 +244,7 @@ resource_surface_present(struct resource_surface *rsurf,
-       return TRUE;
- 
-    rsurf->screen->flush_frontbuffer(rsurf->screen,
--         pres, 0, 0, winsys_drawable_handle);
-+         pres, 0, 0, winsys_drawable_handle, NULL);
- 
-    return TRUE;
- }
-diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
-index 28c6442..019e535 100644
---- a/src/gallium/state_trackers/egl/x11/native_ximage.c
-+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
-@@ -476,7 +476,7 @@ ximage_display_copy_to_pixmap(struct native_display *ndpy,
-       xdraw.drawable = (Drawable) pix;
- 
-       xdpy->base.screen->flush_frontbuffer(xdpy->base.screen,
--            src, 0, 0, &xdraw);
-+            src, 0, 0, &xdraw, NULL);
- 
-       return TRUE;
-    }
-diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
-index fb69998..7f73a3a 100644
---- a/src/gallium/state_trackers/glx/xlib/xm_st.c
-+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
-@@ -74,7 +74,7 @@ xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
-       pres = xstfb->display_resource;
-    }
- 
--   xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws);
-+   xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws, NULL);
-    return TRUE;
- }
- 
-diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
-index c9f8ea7..e68e25f 100644
---- a/src/gallium/state_trackers/vdpau/presentation.c
-+++ b/src/gallium/state_trackers/vdpau/presentation.c
-@@ -269,7 +269,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue,
-    pipe->screen->flush_frontbuffer
-    (
-       pipe->screen, tex, 0, 0,
--      vl_screen_get_private(pq->device->vscreen)
-+      vl_screen_get_private(pq->device->vscreen), NULL
-    );
- 
-    pipe->screen->fence_reference(pipe->screen, &surf->fence, NULL);
-diff --git a/src/gallium/state_trackers/xvmc/surface.c b/src/gallium/state_trackers/xvmc/surface.c
-index 6a895aa..ea778a3 100644
---- a/src/gallium/state_trackers/xvmc/surface.c
-+++ b/src/gallium/state_trackers/xvmc/surface.c
-@@ -441,7 +441,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
-    pipe->screen->flush_frontbuffer
-    (
-       pipe->screen, tex, 0, 0,
--      vl_screen_get_private(context_priv->vscreen)
-+      vl_screen_get_private(context_priv->vscreen), NULL
-    );
- 
-    if(dump_window == -1) {
-diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c
-index 77c59db..f38da47 100644
---- a/src/gallium/tests/graw/clear.c
-+++ b/src/gallium/tests/graw/clear.c
-@@ -33,7 +33,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, tex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL);
- }
- 
- static void init( void )
-diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
-index 38a2c4b..a01c014 100644
---- a/src/gallium/tests/graw/fs-test.c
-+++ b/src/gallium/tests/graw/fs-test.c
-@@ -240,7 +240,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL);
- }
- 
- #define SIZE 16
-diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
-index 8557285..1856f0d 100644
---- a/src/gallium/tests/graw/graw_util.h
-+++ b/src/gallium/tests/graw/graw_util.h
-@@ -211,7 +211,7 @@ static INLINE void
- graw_util_flush_front(const struct graw_info *info)
- {
-    info->screen->flush_frontbuffer(info->screen, info->color_buf[0],
--                                   0, 0, info->window);
-+                                   0, 0, info->window, NULL);
- }
- 
- 
-diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
-index e4e4f61..1745c84 100644
---- a/src/gallium/tests/graw/gs-test.c
-+++ b/src/gallium/tests/graw/gs-test.c
-@@ -347,7 +347,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL);
- }
- 
- #define SIZE 16
-diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c
-index 969ffa7..9960c30 100644
---- a/src/gallium/tests/graw/quad-sample.c
-+++ b/src/gallium/tests/graw/quad-sample.c
-@@ -156,7 +156,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL);
- }
- 
- #define SIZE 16
-diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
-index 4ef752b..754ada6 100644
---- a/src/gallium/tests/graw/shader-leak.c
-+++ b/src/gallium/tests/graw/shader-leak.c
-@@ -158,7 +158,7 @@ static void draw( void )
-       ctx->delete_fs_state(ctx, fs);
-    }
- 
--   screen->flush_frontbuffer(screen, tex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL);
-    ctx->destroy(ctx);
- 
-    exit(0);
-diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
-index 37323aa..24de12b 100644
---- a/src/gallium/tests/graw/tri-gs.c
-+++ b/src/gallium/tests/graw/tri-gs.c
-@@ -168,7 +168,7 @@ static void draw( void )
-    util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
-    ctx->flush(ctx, NULL, 0);
- 
--   screen->flush_frontbuffer(screen, tex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL);
- }
- 
- 
-diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
-index f84463d..55bc3a5 100644
---- a/src/gallium/tests/graw/tri-instanced.c
-+++ b/src/gallium/tests/graw/tri-instanced.c
-@@ -219,7 +219,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, tex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL);
- }
- 
- 
-diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
-index 5a7d0a0..ce1941d 100644
---- a/src/gallium/tests/graw/vs-test.c
-+++ b/src/gallium/tests/graw/vs-test.c
-@@ -234,7 +234,7 @@ static void draw( void )
- 
-    graw_save_surface_to_file(ctx, surf, NULL);
- 
--   screen->flush_frontbuffer(screen, rttex, 0, 0, window);
-+   screen->flush_frontbuffer(screen, rttex, 0, 0, window, NULL);
- }
- 
- #define SIZE 16
-diff --git a/src/gallium/winsys/sw/android/android_sw_winsys.cpp b/src/gallium/winsys/sw/android/android_sw_winsys.cpp
-index cb91aad..4b1040c 100644
---- a/src/gallium/winsys/sw/android/android_sw_winsys.cpp
-+++ b/src/gallium/winsys/sw/android/android_sw_winsys.cpp
-@@ -74,7 +74,8 @@ namespace android {
- static void
- android_displaytarget_display(struct sw_winsys *ws,
-                               struct sw_displaytarget *dt,
--                              void *context_private)
-+                              void *context_private,
-+                              struct pipe_box *box)
- {
- }
- 
-diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-index edb3a38..6fed22b 100644
---- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
-@@ -166,25 +166,33 @@ dri_sw_displaytarget_get_handle(struct sw_winsys *winsys,
- static void
- dri_sw_displaytarget_display(struct sw_winsys *ws,
-                              struct sw_displaytarget *dt,
--                             void *context_private)
-+                             void *context_private,
-+                             struct pipe_box *box)
- {
-    struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-    struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
-    struct dri_drawable *dri_drawable = (struct dri_drawable *)context_private;
-    unsigned width, height;
-+   unsigned blsize = util_format_get_blocksize(dri_sw_dt->format);
- 
-    /* Set the width to 'stride / cpp'.
-     *
-     * PutImage correctly clips to the width of the dst drawable.
-     */
--   width = dri_sw_dt->stride / util_format_get_blocksize(dri_sw_dt->format);
-+   width = dri_sw_dt->stride / blsize;
- 
-    height = dri_sw_dt->height;
- 
--   dri_sw_ws->lf->put_image(dri_drawable, dri_sw_dt->data, width, height);
-+   if (box) {
-+       void *data;
-+       data = dri_sw_dt->data + (dri_sw_dt->stride * box->y) + box->x * blsize;
-+       dri_sw_ws->lf->put_image2(dri_drawable, data,
-+                                 box->x, box->y, box->width, box->height, dri_sw_dt->stride);
-+   } else {
-+       dri_sw_ws->lf->put_image(dri_drawable, dri_sw_dt->data, width, height);
-+   }
- }
- 
--
- static void
- dri_destroy_sw_winsys(struct sw_winsys *winsys)
- {
-diff --git a/src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c b/src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c
-index a280985..cc3ce1a 100644
---- a/src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c
-+++ b/src/gallium/winsys/sw/fbdev/fbdev_sw_winsys.c
-@@ -74,7 +74,8 @@ fbdev_sw_winsys(struct sw_winsys *ws)
- static void
- fbdev_displaytarget_display(struct sw_winsys *ws,
-                             struct sw_displaytarget *dt,
--                            void *winsys_private)
-+                            void *winsys_private,
-+                            struct pipe_box *box)
- {
-    struct fbdev_sw_winsys *fbdev = fbdev_sw_winsys(ws);
-    struct fbdev_sw_displaytarget *src = fbdev_sw_displaytarget(dt);
-diff --git a/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
-index 2e12f6e..aae3ec5 100644
---- a/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
-+++ b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
-@@ -207,7 +207,8 @@ gdi_sw_display( struct sw_winsys *winsys,
- static void
- gdi_sw_displaytarget_display(struct sw_winsys *winsys, 
-                              struct sw_displaytarget *dt,
--                             void *context_private)
-+                             void *context_private,
-+                             struct pipe_box *box)
- {
-     /* nasty:
-      */
-diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
-index 1d51dd6..f09272a 100644
---- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
-+++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
-@@ -147,7 +147,8 @@ hgl_winsys_displaytarget_unmap(struct sw_winsys* winsys,
- 
- static void
- hgl_winsys_displaytarget_display(struct sw_winsys* winsys,
--	struct sw_displaytarget* displayTarget, void* contextPrivate)
-+	struct sw_displaytarget* displayTarget, void* contextPrivate,
-+	struct pipe_box *box)
- {
- 	assert(contextPrivate);
- 
-diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.c b/src/gallium/winsys/sw/null/null_sw_winsys.c
-index 44849da..9c8b3ec 100644
---- a/src/gallium/winsys/sw/null/null_sw_winsys.c
-+++ b/src/gallium/winsys/sw/null/null_sw_winsys.c
-@@ -114,7 +114,8 @@ null_sw_displaytarget_get_handle(struct sw_winsys *winsys,
- static void
- null_sw_displaytarget_display(struct sw_winsys *winsys,
-                               struct sw_displaytarget *dt,
--                              void *context_private)
-+                              void *context_private,
-+                              struct pipe_box *box)
- {
-    assert(0);
- }
-diff --git a/src/gallium/winsys/sw/wayland/wayland_sw_winsys.c b/src/gallium/winsys/sw/wayland/wayland_sw_winsys.c
-index f432de9..e428613 100644
---- a/src/gallium/winsys/sw/wayland/wayland_sw_winsys.c
-+++ b/src/gallium/winsys/sw/wayland/wayland_sw_winsys.c
-@@ -75,7 +75,8 @@ wayland_sw_winsys(struct sw_winsys *ws)
- static void
- wayland_displaytarget_display(struct sw_winsys *ws,
-                               struct sw_displaytarget *dt,
--                              void *context_private)
-+                              void *context_private,
-+                              struct pipe_box *box)
- {
- }
- 
-diff --git a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
-index 6e71530..99da2ae 100644
---- a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
-+++ b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
-@@ -376,7 +376,8 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable,
- static void
- xlib_displaytarget_display(struct sw_winsys *ws,
-                            struct sw_displaytarget *dt,
--                           void *context_private)
-+                           void *context_private,
-+                           struct pipe_box *box)
- {
-    struct xlib_drawable *xlib_drawable = (struct xlib_drawable *)context_private;
-    xlib_sw_display(xlib_drawable, dt);
-diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
-index 393be20..f903b2d 100644
---- a/src/glx/drisw_glx.c
-+++ b/src/glx/drisw_glx.c
-@@ -49,6 +49,7 @@ struct drisw_screen
-    const __DRIcoreExtension *core;
-    const __DRIswrastExtension *swrast;
-    const __DRItexBufferExtension *texBuffer;
-+   const __DRIcopySubBufferExtension *copySubBuffer;
- 
-    const __DRIconfig **driver_configs;
- 
-@@ -171,9 +172,9 @@ bytes_per_line(unsigned pitch_bits, unsigned mul)
- }
- 
- static void
--swrastPutImage(__DRIdrawable * draw, int op,
--               int x, int y, int w, int h,
--               char *data, void *loaderPrivate)
-+swrastPutImage2(__DRIdrawable * draw, int op,
-+                int x, int y, int w, int h, int stride,
-+                char *data, void *loaderPrivate)
- {
-    struct drisw_drawable *pdp = loaderPrivate;
-    __GLXDRIdrawable *pdraw = &(pdp->base);
-@@ -199,7 +200,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
-    ximage->data = data;
-    ximage->width = w;
-    ximage->height = h;
--   ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
-+   ximage->bytes_per_line = stride ? stride : bytes_per_line(w * ximage->bits_per_pixel, 32);
- 
-    XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
- 
-@@ -207,6 +208,14 @@ swrastPutImage(__DRIdrawable * draw, int op,
- }
- 
- static void
-+swrastPutImage(__DRIdrawable * draw, int op,
-+               int x, int y, int w, int h,
-+               char *data, void *loaderPrivate)
-+{
-+   swrastPutImage2(draw, op, x, y, w, h, 0, data, loaderPrivate);
-+}
-+
-+static void
- swrastGetImage(__DRIdrawable * read,
-                int x, int y, int w, int h,
-                char *data, void *loaderPrivate)
-@@ -234,7 +243,8 @@ static const __DRIswrastLoaderExtension swrastLoaderExtension = {
-    {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
-    swrastGetDrawableInfo,
-    swrastPutImage,
--   swrastGetImage
-+   swrastGetImage,
-+   swrastPutImage2,
- };
- 
- static const __DRIextension *loader_extensions[] = {
-@@ -585,6 +595,21 @@ driswSwapBuffers(__GLXDRIdrawable * pdraw,
- }
- 
- static void
-+driswCopySubBuffer(__GLXDRIdrawable * pdraw,
-+                   int x, int y, int width, int height, Bool flush)
-+{
-+   struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
-+   struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
-+
-+   if (flush) {
-+      glFlush();
-+   }
-+
-+   (*psc->copySubBuffer->copySubBuffer) (pdp->driDrawable,
-+					    x, y, width, height);
-+}
-+
-+static void
- driswDestroyScreen(struct glx_screen *base)
- {
-    struct drisw_screen *psc = (struct drisw_screen *) base;
-@@ -632,6 +657,9 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions)
- 				 "GLX_EXT_create_context_es2_profile");
-    }
- 
-+   if (psc->copySubBuffer)
-+      __glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer");      
-+
-    /* FIXME: Figure out what other extensions can be ported here from dri2. */
-    for (i = 0; extensions[i]; i++) {
-       if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0)) {
-@@ -675,6 +703,8 @@ driswCreateScreen(int screen, struct glx_display *priv)
- 	 psc->core = (__DRIcoreExtension *) extensions[i];
-       if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
- 	 psc->swrast = (__DRIswrastExtension *) extensions[i];
-+      if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0)
-+	 psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
-    }
- 
-    if (psc->core == NULL || psc->swrast == NULL) {
-@@ -713,6 +743,9 @@ driswCreateScreen(int screen, struct glx_display *priv)
-    psp->createDrawable = driswCreateDrawable;
-    psp->swapBuffers = driswSwapBuffers;
- 
-+   if (psc->copySubBuffer)
-+      psp->copySubBuffer = driswCopySubBuffer;
-+
-    return &psc->base;
- 
-  handle_error:
-diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
-index 900f048..4c71fe4 100644
---- a/src/mesa/drivers/dri/common/dri_util.h
-+++ b/src/mesa/drivers/dri/common/dri_util.h
-@@ -65,7 +65,7 @@ extern const __DRIcoreExtension driCoreExtension;
- extern const __DRIswrastExtension driSWRastExtension;
- extern const __DRIdri2Extension driDRI2Extension;
- extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
--
-+extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
- /**
-  * Driver callback functions.
-  *
-@@ -113,6 +113,9 @@ struct __DriverAPIRec {
-                                     int width, int height);
- 
-     void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
-+
-+    void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, int x, int y,
-+                          int w, int h);
- };
- 
- extern const struct __DriverAPIRec driDriverAPI;
-diff --git a/src/mesa/drivers/dri/common/drisw_util.c b/src/mesa/drivers/dri/common/drisw_util.c
-index 89f03c3..0da4142 100644
---- a/src/mesa/drivers/dri/common/drisw_util.c
-+++ b/src/mesa/drivers/dri/common/drisw_util.c
-@@ -373,3 +373,18 @@ const __DRIswrastExtension driSWRastExtension = {
-     driCreateNewContextForAPI,
-     driCreateContextAttribs
- };
-+
-+/* swrast copy sub buffer entrypoint. */
-+static void driCopySubBuffer(__DRIdrawable *pdp, int x, int y,
-+                             int w, int h)
-+{
-+    assert(pdp->driScreenPriv->swrast_loader);
-+
-+    driDriverAPI.CopySubBuffer(pdp, x, y, w, h);
-+}
-+
-+/* for swrast only */
-+const __DRIcopySubBufferExtension driCopySubBufferExtension = {
-+   { __DRI_COPY_SUB_BUFFER, 1 },
-+   .copySubBuffer = driCopySubBuffer,
-+};
-diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
-index 3870673..eb6d23b 100644
---- a/src/mesa/drivers/dri/swrast/swrast.c
-+++ b/src/mesa/drivers/dri/swrast/swrast.c
-@@ -830,6 +830,39 @@ dri_unbind_context(__DRIcontext * cPriv)
-     return GL_TRUE;
- }
- 
-+static void
-+dri_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
-+                    int w, int h)
-+{
-+    __DRIscreen *sPriv = dPriv->driScreenPriv;
-+    void *data;
-+    int iy;
-+    struct dri_drawable *drawable = dri_drawable(dPriv);
-+    struct gl_framebuffer *fb;
-+    struct dri_swrast_renderbuffer *frontrb, *backrb;
-+
-+    TRACE;
-+
-+    fb = &drawable->Base;
-+
-+    frontrb =
-+	dri_swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
-+    backrb =
-+	dri_swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
-+
-+    /* check for signle-buffered */
-+    if (backrb == NULL)
-+       return;
-+
-+    iy = frontrb->Base.Base.Height - y - h;
-+    data = (char *)backrb->Base.Buffer + (iy * backrb->pitch) + (x * ((backrb->bpp + 7) / 8));
-+    sPriv->swrast_loader->putImage2(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
-+                                    x, iy, w, h,
-+                                    frontrb->pitch,
-+                                    data,
-+                                    dPriv->loaderPrivate);
-+}
-+
- 
- const struct __DriverAPIRec driDriverAPI = {
-     .InitScreen = dri_init_screen,
-@@ -841,11 +874,13 @@ const struct __DriverAPIRec driDriverAPI = {
-     .SwapBuffers = dri_swap_buffers,
-     .MakeCurrent = dri_make_current,
-     .UnbindContext = dri_unbind_context,
-+    .CopySubBuffer = dri_copy_sub_buffer,
- };
- 
- /* This is the table of extensions that the loader will dlsym() for. */
- PUBLIC const __DRIextension *__driDriverExtensions[] = {
-     &driCoreExtension.base,
-     &driSWRastExtension.base,
-+    &driCopySubBufferExtension.base,
-     NULL
- };
--- 
-1.8.4.2
-
diff --git a/SOURCES/add-kaveri-berlin-pciid.patch b/SOURCES/add-kaveri-berlin-pciid.patch
deleted file mode 100644
index c435532..0000000
--- a/SOURCES/add-kaveri-berlin-pciid.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/include/pci_ids/radeonsi_pci_ids.h b/include/pci_ids/radeonsi_pci_ids.h
-index 2156728..0fdd1ad 100644
---- a/include/pci_ids/radeonsi_pci_ids.h
-+++ b/include/pci_ids/radeonsi_pci_ids.h
-@@ -96,3 +96,25 @@ CHIPSET(0x983C, KABINI_983C, KABINI)
- CHIPSET(0x983D, KABINI_983D, KABINI)
- CHIPSET(0x983E, KABINI_983E, KABINI)
- CHIPSET(0x983F, KABINI_983F, KABINI)
-+
-+CHIPSET(0x1304, KAVERI_1304, KAVERI)
-+CHIPSET(0x1305, KAVERI_1305, KAVERI)
-+CHIPSET(0x1306, KAVERI_1306, KAVERI)
-+CHIPSET(0x1307, KAVERI_1307, KAVERI)
-+CHIPSET(0x1309, KAVERI_1309, KAVERI)
-+CHIPSET(0x130A, KAVERI_130A, KAVERI)
-+CHIPSET(0x130B, KAVERI_130B, KAVERI)
-+CHIPSET(0x130C, KAVERI_130C, KAVERI)
-+CHIPSET(0x130D, KAVERI_130D, KAVERI)
-+CHIPSET(0x130E, KAVERI_130E, KAVERI)
-+CHIPSET(0x130F, KAVERI_130F, KAVERI)
-+CHIPSET(0x1310, KAVERI_1310, KAVERI)
-+CHIPSET(0x1311, KAVERI_1311, KAVERI)
-+CHIPSET(0x1312, KAVERI_1312, KAVERI)
-+CHIPSET(0x1313, KAVERI_1313, KAVERI)
-+CHIPSET(0x1315, KAVERI_1315, KAVERI)
-+CHIPSET(0x1316, KAVERI_1316, KAVERI)
-+CHIPSET(0x1317, KAVERI_1317, KAVERI)
-+CHIPSET(0x131B, KAVERI_131B, KAVERI)
-+CHIPSET(0x131C, KAVERI_131C, KAVERI)
-+CHIPSET(0x131D, KAVERI_131D, KAVERI)
diff --git a/SOURCES/make-git-snapshot.sh b/SOURCES/make-git-snapshot.sh
index e393eb3..b5045fe 100755
--- a/SOURCES/make-git-snapshot.sh
+++ b/SOURCES/make-git-snapshot.sh
@@ -15,11 +15,11 @@ DIRNAME=mesa-$( date +%Y%m%d )
 
 echo REF ${REF:+--reference $REF}
 echo DIRNAME $DIRNAME
-echo HEAD ${1:-9.2}
+echo HEAD ${1:-10.2}
 
 rm -rf $DIRNAME
 
-git clone --depth 1 ${REF:+--reference $REF} --branch 9.2 \
+git clone --depth 1 ${REF:+--reference $REF} --branch 10.2 \
 	git://git.freedesktop.org/git/mesa/mesa $DIRNAME
 
 GIT_DIR=$DIRNAME/.git git archive --format=tar --prefix=$DIRNAME/ ${1:-HEAD} \
diff --git a/SOURCES/mesa-10.2-evergreen-big-endian.patch b/SOURCES/mesa-10.2-evergreen-big-endian.patch
new file mode 100644
index 0000000..227f120
--- /dev/null
+++ b/SOURCES/mesa-10.2-evergreen-big-endian.patch
@@ -0,0 +1,334 @@
+diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
+index f0d4503..c617425 100644
+--- a/src/gallium/drivers/r600/evergreen_state.c
++++ b/src/gallium/drivers/r600/evergreen_state.c
+@@ -219,7 +219,7 @@ static bool r600_is_sampler_format_supported(struct pipe_screen *screen, enum pi
+ static bool r600_is_colorbuffer_format_supported(enum chip_class chip, enum pipe_format format)
+ {
+ 	return r600_translate_colorformat(chip, format) != ~0U &&
+-		r600_translate_colorswap(format) != ~0U;
++		r600_translate_colorswap(chip, format) != ~0U;
+ }
+ 
+ static bool r600_is_zs_format_supported(enum pipe_format format)
+@@ -918,7 +918,8 @@ void evergreen_init_color_surface_rat(struct r600_context *rctx,
+ 	unsigned format = r600_translate_colorformat(rctx->b.chip_class,
+ 						     surf->base.format);
+ 	unsigned endian = r600_colorformat_endian_swap(format);
+-	unsigned swap = r600_translate_colorswap(surf->base.format);
++	unsigned swap = r600_translate_colorswap(rctx->b.chip_class,
++						 surf->base.format);
+ 	unsigned block_size =
+ 		align(util_format_get_blocksize(pipe_buffer->format), 4);
+ 	unsigned pitch_alignment =
+@@ -1078,7 +1079,7 @@ void evergreen_init_color_surface(struct r600_context *rctx,
+ 	format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format);
+ 	assert(format != ~0);
+ 
+-	swap = r600_translate_colorswap(surf->base.format);
++	swap = r600_translate_colorswap(rctx->b.chip_class, surf->base.format);
+ 	assert(swap != ~0);
+ 
+ 	if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
+diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
+index dd2e423..190fdfc 100644
+--- a/src/gallium/drivers/r600/r600_state.c
++++ b/src/gallium/drivers/r600/r600_state.c
+@@ -149,7 +149,7 @@ static bool r600_is_sampler_format_supported(struct pipe_screen *screen, enum pi
+ static bool r600_is_colorbuffer_format_supported(enum chip_class chip, enum pipe_format format)
+ {
+ 	return r600_translate_colorformat(chip, format) != ~0U &&
+-	       r600_translate_colorswap(format) != ~0U;
++	       r600_translate_colorswap(chip, format) != ~0U;
+ }
+ 
+ static bool r600_is_zs_format_supported(enum pipe_format format)
+@@ -899,7 +899,7 @@ static void r600_init_color_surface(struct r600_context *rctx,
+ 	format = r600_translate_colorformat(rctx->b.chip_class, surf->base.format);
+ 	assert(format != ~0);
+ 
+-	swap = r600_translate_colorswap(surf->base.format);
++	swap = r600_translate_colorswap(rctx->b.chip_class, surf->base.format);
+ 	assert(swap != ~0);
+ 
+ 	if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
+diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
+index fabc52c..c276016 100644
+--- a/src/gallium/drivers/r600/r600_state_common.c
++++ b/src/gallium/drivers/r600/r600_state_common.c
+@@ -2258,7 +2258,7 @@ uint32_t r600_translate_colorformat(enum chip_class chip, enum pipe_format forma
+ 
+ uint32_t r600_colorformat_endian_swap(uint32_t colorformat)
+ {
+-	if (R600_BIG_ENDIAN) {
++	if (0 && R600_BIG_ENDIAN) {
+ 		switch(colorformat) {
+ 		/* 8-bit buffers. */
+ 		case V_0280A0_COLOR_4_4:
+diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
+index e7f410d..9bb471a 100644
+--- a/src/gallium/drivers/radeon/r600_pipe_common.h
++++ b/src/gallium/drivers/radeon/r600_pipe_common.h
+@@ -457,7 +457,7 @@ struct pipe_surface *r600_create_surface_custom(struct pipe_context *pipe,
+ 						struct pipe_resource *texture,
+ 						const struct pipe_surface *templ,
+ 						unsigned width, unsigned height);
+-unsigned r600_translate_colorswap(enum pipe_format format);
++unsigned r600_translate_colorswap(enum chip_class chip, enum pipe_format format);
+ void evergreen_do_fast_color_clear(struct r600_common_context *rctx,
+ 				   struct pipe_framebuffer_state *fb,
+ 				   struct r600_atom *fb_state,
+diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
+index 9a46c53..5022666 100644
+--- a/src/gallium/drivers/radeon/r600_texture.c
++++ b/src/gallium/drivers/radeon/r600_texture.c
+@@ -1157,10 +1157,215 @@ static void r600_surface_destroy(struct pipe_context *pipe,
+ 	FREE(surface);
+ }
+ 
+-unsigned r600_translate_colorswap(enum pipe_format format)
++static uint32_t evergreen_translate_colorswap(enum pipe_format format)
++{
++	switch (format) {
++	/* 8-bit buffers. */
++	case PIPE_FORMAT_A8_UNORM:
++	case PIPE_FORMAT_A8_SNORM:
++	case PIPE_FORMAT_A8_UINT:
++	case PIPE_FORMAT_A8_SINT:
++	case PIPE_FORMAT_A16_UNORM:
++	case PIPE_FORMAT_A16_SNORM:
++	case PIPE_FORMAT_A16_UINT:
++	case PIPE_FORMAT_A16_SINT:
++	case PIPE_FORMAT_A16_FLOAT:
++	case PIPE_FORMAT_A32_UINT:
++	case PIPE_FORMAT_A32_SINT:
++	case PIPE_FORMAT_A32_FLOAT:
++	case PIPE_FORMAT_R4A4_UNORM:
++		return V_0280A0_SWAP_ALT_REV;
++	case PIPE_FORMAT_I8_UNORM:
++	case PIPE_FORMAT_I8_SNORM:
++	case PIPE_FORMAT_I8_UINT:
++	case PIPE_FORMAT_I8_SINT:
++	case PIPE_FORMAT_L8_UNORM:
++	case PIPE_FORMAT_L8_SNORM:
++	case PIPE_FORMAT_L8_UINT:
++	case PIPE_FORMAT_L8_SINT:
++	case PIPE_FORMAT_L8_SRGB:
++	case PIPE_FORMAT_L16_UNORM:
++	case PIPE_FORMAT_L16_SNORM:
++	case PIPE_FORMAT_L16_UINT:
++	case PIPE_FORMAT_L16_SINT:
++	case PIPE_FORMAT_L16_FLOAT:
++	case PIPE_FORMAT_L32_UINT:
++	case PIPE_FORMAT_L32_SINT:
++	case PIPE_FORMAT_L32_FLOAT:
++	case PIPE_FORMAT_I16_UNORM:
++	case PIPE_FORMAT_I16_SNORM:
++	case PIPE_FORMAT_I16_UINT:
++	case PIPE_FORMAT_I16_SINT:
++	case PIPE_FORMAT_I16_FLOAT:
++	case PIPE_FORMAT_I32_UINT:
++	case PIPE_FORMAT_I32_SINT:
++	case PIPE_FORMAT_I32_FLOAT:
++	case PIPE_FORMAT_R8_UNORM:
++	case PIPE_FORMAT_R8_SNORM:
++	case PIPE_FORMAT_R8_UINT:
++	case PIPE_FORMAT_R8_SINT:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_L4A4_UNORM:
++	case PIPE_FORMAT_A4R4_UNORM:
++		return V_0280A0_SWAP_ALT;
++
++	/* 16-bit buffers. */
++	case PIPE_FORMAT_B5G6R5_UNORM:
++		return V_0280A0_SWAP_STD_REV;
++
++	case PIPE_FORMAT_B5G5R5A1_UNORM:
++	case PIPE_FORMAT_B5G5R5X1_UNORM:
++		return V_0280A0_SWAP_ALT;
++
++	case PIPE_FORMAT_B4G4R4A4_UNORM:
++	case PIPE_FORMAT_B4G4R4X4_UNORM:
++		return V_0280A0_SWAP_ALT;
++
++	case PIPE_FORMAT_Z16_UNORM:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_L8A8_UNORM:
++	case PIPE_FORMAT_L8A8_SNORM:
++	case PIPE_FORMAT_L8A8_UINT:
++	case PIPE_FORMAT_L8A8_SINT:
++	case PIPE_FORMAT_L8A8_SRGB:
++	case PIPE_FORMAT_L16A16_UNORM:
++	case PIPE_FORMAT_L16A16_SNORM:
++	case PIPE_FORMAT_L16A16_UINT:
++	case PIPE_FORMAT_L16A16_SINT:
++	case PIPE_FORMAT_L16A16_FLOAT:
++	case PIPE_FORMAT_L32A32_UINT:
++	case PIPE_FORMAT_L32A32_SINT:
++	case PIPE_FORMAT_L32A32_FLOAT:
++        case PIPE_FORMAT_R8A8_UNORM:
++	case PIPE_FORMAT_R8A8_SNORM:
++	case PIPE_FORMAT_R8A8_UINT:
++	case PIPE_FORMAT_R8A8_SINT:
++	case PIPE_FORMAT_R16A16_UNORM:
++	case PIPE_FORMAT_R16A16_SNORM:
++	case PIPE_FORMAT_R16A16_UINT:
++	case PIPE_FORMAT_R16A16_SINT:
++	case PIPE_FORMAT_R16A16_FLOAT:
++	case PIPE_FORMAT_R32A32_UINT:
++	case PIPE_FORMAT_R32A32_SINT:
++	case PIPE_FORMAT_R32A32_FLOAT:
++		return V_0280A0_SWAP_ALT;
++	case PIPE_FORMAT_R8G8_UNORM:
++	case PIPE_FORMAT_R8G8_SNORM:
++	case PIPE_FORMAT_R8G8_UINT:
++	case PIPE_FORMAT_R8G8_SINT:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_R16_UNORM:
++	case PIPE_FORMAT_R16_SNORM:
++	case PIPE_FORMAT_R16_UINT:
++	case PIPE_FORMAT_R16_SINT:
++	case PIPE_FORMAT_R16_FLOAT:
++		return V_0280A0_SWAP_STD;
++
++	/* 32-bit buffers. */
++
++	case PIPE_FORMAT_A8B8G8R8_SRGB:
++		return V_0280A0_SWAP_STD_REV;
++	case PIPE_FORMAT_B8G8R8A8_SRGB:
++		return V_0280A0_SWAP_ALT;
++
++	case PIPE_FORMAT_B8G8R8A8_UNORM:
++	case PIPE_FORMAT_B8G8R8X8_UNORM:
++		return V_0280A0_SWAP_ALT;
++
++	case PIPE_FORMAT_A8R8G8B8_UNORM:
++	case PIPE_FORMAT_X8R8G8B8_UNORM:
++		return V_0280A0_SWAP_ALT_REV;
++	case PIPE_FORMAT_R8G8B8A8_SNORM:
++	case PIPE_FORMAT_R8G8B8A8_UNORM:
++	case PIPE_FORMAT_R8G8B8X8_UNORM:
++	case PIPE_FORMAT_R8G8B8X8_SNORM:
++	case PIPE_FORMAT_R8G8B8X8_SRGB:
++	case PIPE_FORMAT_R8G8B8X8_UINT:
++	case PIPE_FORMAT_R8G8B8X8_SINT:
++	case PIPE_FORMAT_R8G8B8A8_SINT:
++	case PIPE_FORMAT_R8G8B8A8_UINT:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_A8B8G8R8_UNORM:
++	case PIPE_FORMAT_X8B8G8R8_UNORM:
++	/* case PIPE_FORMAT_R8SG8SB8UX8U_NORM: */
++		return V_0280A0_SWAP_STD_REV;
++
++	case PIPE_FORMAT_Z24X8_UNORM:
++	case PIPE_FORMAT_Z24_UNORM_S8_UINT:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_R10G10B10A2_UNORM:
++	case PIPE_FORMAT_R10G10B10X2_SNORM:
++	case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
++	case PIPE_FORMAT_R10G10B10A2_UINT:
++		return V_0280A0_SWAP_STD;
++
++	case PIPE_FORMAT_B10G10R10A2_UNORM:
++	case PIPE_FORMAT_B10G10R10A2_UINT:
++	case PIPE_FORMAT_B10G10R10X2_UNORM:
++		return V_0280A0_SWAP_ALT;
++
++	case PIPE_FORMAT_R11G11B10_FLOAT:
++	case PIPE_FORMAT_R16G16_UNORM:
++	case PIPE_FORMAT_R16G16_SNORM:
++	case PIPE_FORMAT_R16G16_FLOAT:
++	case PIPE_FORMAT_R16G16_UINT:
++	case PIPE_FORMAT_R16G16_SINT:
++	case PIPE_FORMAT_R32_UINT:
++	case PIPE_FORMAT_R32_SINT:
++	case PIPE_FORMAT_R32_FLOAT:
++	case PIPE_FORMAT_Z32_FLOAT:
++		return V_0280A0_SWAP_STD;
++
++	/* 64-bit buffers. */
++	case PIPE_FORMAT_R32G32_FLOAT:
++	case PIPE_FORMAT_R32G32_UINT:
++	case PIPE_FORMAT_R32G32_SINT:
++	case PIPE_FORMAT_R16G16B16A16_UNORM:
++	case PIPE_FORMAT_R16G16B16A16_SNORM:
++	case PIPE_FORMAT_R16G16B16A16_UINT:
++	case PIPE_FORMAT_R16G16B16A16_SINT:
++	case PIPE_FORMAT_R16G16B16A16_FLOAT:
++	case PIPE_FORMAT_R16G16B16X16_UNORM:
++	case PIPE_FORMAT_R16G16B16X16_SNORM:
++	case PIPE_FORMAT_R16G16B16X16_FLOAT:
++	case PIPE_FORMAT_R16G16B16X16_UINT:
++	case PIPE_FORMAT_R16G16B16X16_SINT:
++	case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
++
++	/* 128-bit buffers. */
++	case PIPE_FORMAT_R32G32B32A32_FLOAT:
++	case PIPE_FORMAT_R32G32B32A32_SNORM:
++	case PIPE_FORMAT_R32G32B32A32_UNORM:
++	case PIPE_FORMAT_R32G32B32A32_SINT:
++	case PIPE_FORMAT_R32G32B32A32_UINT:
++	case PIPE_FORMAT_R32G32B32X32_FLOAT:
++	case PIPE_FORMAT_R32G32B32X32_UINT:
++	case PIPE_FORMAT_R32G32B32X32_SINT:
++		return V_0280A0_SWAP_STD;
++	default:
++		R600_ERR("unsupported colorswap format %d\n", format);
++		return ~0U;
++	}
++	return ~0U;
++}
++
++unsigned r600_translate_colorswap(enum chip_class chip, enum pipe_format format)
+ {
+ 	const struct util_format_description *desc = util_format_description(format);
+ 
++#ifdef PIPE_ARCH_BIG_ENDIAN
++	if (chip == EVERGREEN) {
++	    unsigned ret = evergreen_translate_colorswap(format);
++	    if (ret != ~0U)
++		return ret;
++	}
++#endif
++
+ #define HAS_SWIZZLE(chan,swz) (desc->swizzle[chan] == UTIL_FORMAT_SWIZZLE_##swz)
+ 
+ 	if (format == PIPE_FORMAT_R11G11B10_FLOAT) /* isn't plain */
+@@ -1238,6 +1443,10 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx,
+ {
+ 	int i;
+ 
++#ifdef PIPE_ARCH_BIG_ENDIAN
++	return false; /* broken; overkill to just disable them, but */
++#endif
++
+ 	if (rctx->current_render_cond)
+ 		return;
+ 
+diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
+index 7f65c47..f3976eb 100644
+--- a/src/gallium/drivers/radeonsi/si_state.c
++++ b/src/gallium/drivers/radeonsi/si_state.c
+@@ -1447,7 +1447,7 @@ static bool si_is_vertex_format_supported(struct pipe_screen *screen, enum pipe_
+ static bool si_is_colorbuffer_format_supported(enum pipe_format format)
+ {
+ 	return si_translate_colorformat(format) != V_028C70_COLOR_INVALID &&
+-		r600_translate_colorswap(format) != ~0U;
++		r600_translate_colorswap(0, format) != ~0U;
+ }
+ 
+ static bool si_is_zs_format_supported(enum pipe_format format)
+@@ -1615,7 +1615,7 @@ static void si_initialize_color_surface(struct si_context *sctx,
+ 		R600_ERR("Invalid CB format: %d, disabling CB.\n", surf->base.format);
+ 	}
+ 	assert(format != V_028C70_COLOR_INVALID);
+-	swap = r600_translate_colorswap(surf->base.format);
++	swap = r600_translate_colorswap(0, surf->base.format);
+ 	if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) {
+ 		endian = V_028C70_ENDIAN_NONE;
+ 	} else {
diff --git a/SOURCES/mesa-9.2-evergreen-big-endian.patch b/SOURCES/mesa-9.2-evergreen-big-endian.patch
deleted file mode 100644
index bc6486b..0000000
--- a/SOURCES/mesa-9.2-evergreen-big-endian.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up mesa-20130610/src/gallium/drivers/r600/evergreen_state.c.jx mesa-20130610/src/gallium/drivers/r600/evergreen_state.c
---- mesa-20130610/src/gallium/drivers/r600/evergreen_state.c.jx	2013-06-10 13:58:51.000000000 -0400
-+++ mesa-20130610/src/gallium/drivers/r600/evergreen_state.c	2013-06-17 10:24:14.687160428 -0400
-@@ -615,7 +615,7 @@ static uint32_t r600_translate_colorform
- 
- static uint32_t r600_colorformat_endian_swap(uint32_t colorformat)
- {
--	if (R600_BIG_ENDIAN) {
-+	if (0 && R600_BIG_ENDIAN) {
- 		switch(colorformat) {
- 
- 		/* 8-bit buffers. */
diff --git a/SOURCES/mesa-9.2-no-useless-vdpau.patch b/SOURCES/mesa-9.2-no-useless-vdpau.patch
deleted file mode 100644
index 0be3d3a..0000000
--- a/SOURCES/mesa-9.2-no-useless-vdpau.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Neither of these drivers does anything on-GPU, so, no.
-
-diff -up mesa-20130508/src/gallium/targets/Makefile.am.jx mesa-20130508/src/gallium/targets/Makefile.am
---- mesa-20130508/src/gallium/targets/Makefile.am.jx	2013-05-08 13:23:41.000000000 -0400
-+++ mesa-20130508/src/gallium/targets/Makefile.am	2013-05-08 14:59:50.897835932 -0400
-@@ -78,10 +78,6 @@ endif
- if HAVE_ST_XVMC
- SUBDIRS += xvmc-r300
- endif
--
--if HAVE_ST_VDPAU
--SUBDIRS += vdpau-r300
--endif
- endif
- 
- if HAVE_GALLIUM_R600
-@@ -142,10 +138,6 @@ endif
- if HAVE_ST_XVMC
- SUBDIRS += xvmc-softpipe
- endif
--
--if HAVE_ST_VDPAU
--SUBDIRS += vdpau-softpipe
--endif
- endif
- 
- if NEED_GALLIUM_LOADER
diff --git a/SOURCES/mesa-big-endian-fixes.patch b/SOURCES/mesa-big-endian-fixes.patch
index d324b2e..243ef5d 100644
--- a/SOURCES/mesa-big-endian-fixes.patch
+++ b/SOURCES/mesa-big-endian-fixes.patch
@@ -1,8 +1,56 @@
 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
-index 74b4e9f..eb3b2eb 100644
+index e516ae8..a4237f5 100644
 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
 +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
-@@ -1640,7 +1640,7 @@ lp_build_trunc(struct lp_build_context *bld,
+@@ -512,9 +512,20 @@ lp_build_add(struct lp_build_context *bld,
+          return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
+    }
+ 
+-   /* TODO: handle signed case */
+-   if(type.norm && !type.floating && !type.fixed && !type.sign)
+-      a = lp_build_min_simple(bld, a, lp_build_comp(bld, b), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++   if(type.norm && !type.floating && !type.fixed) {
++      if (type.sign) {
++         uint64_t sign = (uint64_t)1 << (type.width - 1);
++         LLVMValueRef max_val = lp_build_const_int_vec(bld->gallivm, type, sign - 1);
++         LLVMValueRef min_val = lp_build_const_int_vec(bld->gallivm, type, sign);
++         /* a_clamp_max is the maximum a for positive b,
++            a_clamp_min is the minimum a for negative b. */
++         LLVMValueRef a_clamp_max = lp_build_min_simple(bld, a, LLVMBuildSub(builder, max_val, b, ""), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++         LLVMValueRef a_clamp_min = lp_build_max_simple(bld, a, LLVMBuildSub(builder, min_val, b, ""), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++         a = lp_build_select(bld, lp_build_cmp(bld, PIPE_FUNC_GREATER, b, bld->zero), a_clamp_max, a_clamp_min);
++      } else {
++         a = lp_build_min_simple(bld, a, lp_build_comp(bld, b), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++      }
++   }
+ 
+    if(LLVMIsConstant(a) && LLVMIsConstant(b))
+       if (type.floating)
+@@ -793,9 +804,20 @@ lp_build_sub(struct lp_build_context *bld,
+          return lp_build_intrinsic_binary(builder, intrinsic, lp_build_vec_type(bld->gallivm, bld->type), a, b);
+    }
+ 
+-   /* TODO: handle signed case */
+-   if(type.norm && !type.floating && !type.fixed && !type.sign)
+-      a = lp_build_max_simple(bld, a, b, GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++   if(type.norm && !type.floating && !type.fixed) {
++      if (type.sign) {
++         uint64_t sign = (uint64_t)1 << (type.width - 1);
++         LLVMValueRef max_val = lp_build_const_int_vec(bld->gallivm, type, sign - 1);
++         LLVMValueRef min_val = lp_build_const_int_vec(bld->gallivm, type, sign);
++         /* a_clamp_max is the maximum a for negative b,
++            a_clamp_min is the minimum a for positive b. */
++         LLVMValueRef a_clamp_max = lp_build_min_simple(bld, a, LLVMBuildAdd(builder, max_val, b, ""), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++         LLVMValueRef a_clamp_min = lp_build_max_simple(bld, a, LLVMBuildAdd(builder, min_val, b, ""), GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++         a = lp_build_select(bld, lp_build_cmp(bld, PIPE_FUNC_GREATER, b, bld->zero), a_clamp_min, a_clamp_max);
++      } else {
++         a = lp_build_max_simple(bld, a, b, GALLIVM_NAN_BEHAVIOR_UNDEFINED);
++      }
++   }
+ 
+    if(LLVMIsConstant(a) && LLVMIsConstant(b))
+       if (type.floating)
+@@ -1852,7 +1874,7 @@ lp_build_trunc(struct lp_build_context *bld,
        const struct lp_type type = bld->type;
        struct lp_type inttype;
        struct lp_build_context intbld;
@@ -11,7 +59,7 @@ index 74b4e9f..eb3b2eb 100644
        LLVMValueRef trunc, res, anosign, mask;
        LLVMTypeRef int_vec_type = bld->int_vec_type;
        LLVMTypeRef vec_type = bld->vec_type;
-@@ -1695,7 +1695,7 @@ lp_build_round(struct lp_build_context *bld,
+@@ -1907,7 +1929,7 @@ lp_build_round(struct lp_build_context *bld,
        const struct lp_type type = bld->type;
        struct lp_type inttype;
        struct lp_build_context intbld;
@@ -20,7 +68,7 @@ index 74b4e9f..eb3b2eb 100644
        LLVMValueRef res, anosign, mask;
        LLVMTypeRef int_vec_type = bld->int_vec_type;
        LLVMTypeRef vec_type = bld->vec_type;
-@@ -1748,7 +1748,7 @@ lp_build_floor(struct lp_build_context *bld,
+@@ -1960,7 +1982,7 @@ lp_build_floor(struct lp_build_context *bld,
        const struct lp_type type = bld->type;
        struct lp_type inttype;
        struct lp_build_context intbld;
@@ -29,7 +77,7 @@ index 74b4e9f..eb3b2eb 100644
        LLVMValueRef trunc, res, anosign, mask;
        LLVMTypeRef int_vec_type = bld->int_vec_type;
        LLVMTypeRef vec_type = bld->vec_type;
-@@ -1817,7 +1817,7 @@ lp_build_ceil(struct lp_build_context *bld,
+@@ -2029,7 +2051,7 @@ lp_build_ceil(struct lp_build_context *bld,
        const struct lp_type type = bld->type;
        struct lp_type inttype;
        struct lp_build_context intbld;
@@ -39,7 +87,7 @@ index 74b4e9f..eb3b2eb 100644
        LLVMTypeRef int_vec_type = bld->int_vec_type;
        LLVMTypeRef vec_type = bld->vec_type;
 diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
-index f3925bb..baddc61 100644
+index 8aa5c36..1cd4954 100644
 --- a/src/gallium/auxiliary/util/u_format.csv
 +++ b/src/gallium/auxiliary/util/u_format.csv
 @@ -46,6 +46,8 @@
@@ -130,8 +178,8 @@ index f3925bb..baddc61 100644
  PIPE_FORMAT_NV21                  , other, 1, 1, x8  , x8  , x8  , x8  , xyzw, yuv
  
  # Usually used to implement IA44 and AI44 formats in video decoding
--PIPE_FORMAT_R4A4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , y00x, rgb
--PIPE_FORMAT_A4R4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , x00y, rgb
+-PIPE_FORMAT_A4R4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , y00x, rgb
+-PIPE_FORMAT_R4A4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , x00y, rgb
 +PIPE_FORMAT_A4R4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , y00x, rgb, un4, un4 ,     ,     , x00y
 +PIPE_FORMAT_R4A4_UNORM            , plain, 1, 1, un4 , un4 ,     ,     , x00y, rgb, un4, un4 ,     ,     , y00x
  PIPE_FORMAT_R8A8_UNORM            , plain, 1, 1, un8 , un8 ,     ,     , x00y, rgb
@@ -169,513 +217,21 @@ index f3925bb..baddc61 100644
  PIPE_FORMAT_R16G16B16X16_UNORM      , plain, 1, 1, un16, un16, un16, x16, xyz1, rgb
  PIPE_FORMAT_R16G16B16X16_SNORM      , plain, 1, 1, sn16, sn16, sn16, x16, xyz1, rgb
  PIPE_FORMAT_R16G16B16X16_FLOAT      , plain, 1, 1, f16,  f16,  f16,  x16, xyz1, rgb
-diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
-index 28527f5..d24d6ed 100644
---- a/src/gallium/auxiliary/util/u_format.h
-+++ b/src/gallium/auxiliary/util/u_format.h
-@@ -1022,8 +1022,7 @@ util_format_luminance_to_red(enum pipe_format format)
-       return PIPE_FORMAT_RGTC1_SNORM;
- 
-    case PIPE_FORMAT_L4A4_UNORM:
--      /* XXX A4R4 is defined as x00y in u_format.csv */
--      return PIPE_FORMAT_A4R4_UNORM;
-+      return PIPE_FORMAT_R4A4_UNORM;
- 
-    case PIPE_FORMAT_L8A8_UNORM:
-       return PIPE_FORMAT_R8A8_UNORM;
-diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
-index d1f68c8..114c97c 100644
---- a/src/gallium/auxiliary/util/u_format_pack.py
-+++ b/src/gallium/auxiliary/util/u_format_pack.py
-@@ -40,24 +40,33 @@
- from u_format_parse import *
- 
- 
-+def inv_swizzles(swizzles):
-+    '''Return an array[4] of inverse swizzle terms'''
-+    '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha'''
-+    inv_swizzle = [None]*4
-+    for i in range(4):
-+        swizzle = swizzles[i]
-+        if swizzle < 4 and inv_swizzle[swizzle] == None:
-+            inv_swizzle[swizzle] = i
-+    return inv_swizzle
-+
-+def print_channels(format, func):
-+    if format.nr_channels() <= 1:
-+        func(format.le_channels, format.le_swizzles)
-+    else:
-+        print '#ifdef PIPE_ARCH_BIG_ENDIAN'
-+        func(format.be_channels, format.be_swizzles)
-+        print '#else'
-+        func(format.le_channels, format.le_swizzles)
-+        print '#endif'
-+
- def generate_format_type(format):
-     '''Generate a structure that describes the format.'''
- 
-     assert format.layout == PLAIN
-     
--    print 'union util_format_%s {' % format.short_name()
--    
--    if format.block_size() in (8, 16, 32, 64):
--        print '   uint%u_t value;' % (format.block_size(),)
--
--    use_bitfields = False
--    for channel in format.channels:
--        if channel.size % 8 or not is_pot(channel.size):
--            use_bitfields = True
--
--    print '   struct {'
--    for channel in format.channels:
--        if use_bitfields:
-+    def generate_bitfields(channels, swizzles):
-+        for channel in channels:
-             if channel.type == VOID:
-                 if channel.size:
-                     print '      unsigned %s:%u;' % (channel.name, channel.size)
-@@ -74,7 +83,9 @@ def generate_format_type(format):
-                     print '      unsigned %s:%u;' % (channel.name, channel.size)
-             else:
-                 assert 0
--        else:
-+
-+    def generate_full_fields(channels, swizzles):
-+        for channel in channels:
-             assert channel.size % 8 == 0 and is_pot(channel.size)
-             if channel.type == VOID:
-                 if channel.size:
-@@ -94,6 +105,22 @@ def generate_format_type(format):
-                     assert 0
-             else:
-                 assert 0
-+
-+    print 'union util_format_%s {' % format.short_name()
-+    
-+    if format.block_size() in (8, 16, 32, 64):
-+        print '   uint%u_t value;' % (format.block_size(),)
-+
-+    use_bitfields = False
-+    for channel in format.le_channels:
-+        if channel.size % 8 or not is_pot(channel.size):
-+            use_bitfields = True
-+
-+    print '   struct {'
-+    if use_bitfields:
-+        print_channels(format, generate_bitfields)
-+    else:
-+        print_channels(format, generate_full_fields)
-     print '   } chan;'
-     print '};'
-     print
-@@ -109,7 +136,7 @@ def is_format_supported(format):
-         return False
- 
-     for i in range(4):
--        channel = format.channels[i]
-+        channel = format.le_channels[i]
-         if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT, FIXED):
-             return False
-         if channel.type == FLOAT and channel.size not in (16, 32, 64):
-@@ -117,27 +144,6 @@ def is_format_supported(format):
- 
-     return True
- 
--def is_format_pure_unsigned(format):
--    for i in range(4):
--        channel = format.channels[i]
--        if channel.type not in (VOID, UNSIGNED):
--            return False
--        if channel.type == UNSIGNED and channel.pure == False:
--            return False
--
--    return True
--
--
--def is_format_pure_signed(format):
--    for i in range(4):
--        channel = format.channels[i]
--        if channel.type not in (VOID, SIGNED):
--            return False
--        if channel.type == SIGNED and channel.pure == False:
--            return False
--
--    return True
--
- def native_type(format):
-     '''Get the native appropriate for a format.'''
- 
-@@ -152,7 +158,7 @@ def native_type(format):
-             return 'uint%u_t' % format.block_size()
-         else:
-             # For array pixel formats return the integer type that matches the color channel
--            channel = format.channels[0]
-+            channel = format.array_element()
-             if channel.type in (UNSIGNED, VOID):
-                 return 'uint%u_t' % channel.size
-             elif channel.type in (SIGNED, FIXED):
-@@ -402,13 +408,13 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
- 
-     src_native_type = native_type(format)
+@@ -372,7 +374,7 @@ PIPE_FORMAT_R16A16_UINT             , plain, 1, 1, up16 , up16 ,     ,     , x00
+ PIPE_FORMAT_R16A16_SINT             , plain, 1, 1, sp16 , sp16 ,     ,     , x00y, rgb
+ PIPE_FORMAT_R32A32_UINT             , plain, 1, 1, up32 , up32 ,     ,     , x00y, rgb
+ PIPE_FORMAT_R32A32_SINT             , plain, 1, 1, sp32 , sp32 ,     ,     , x00y, rgb
+-PIPE_FORMAT_R10G10B10A2_UINT        , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb
++PIPE_FORMAT_R10G10B10A2_UINT        , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb, up2 , up10, up10, up10, wzyx
  
--    if format.is_bitmask():
-+    def unpack_from_bitmask(channels, swizzles):
-         depth = format.block_size()
-         print '         uint%u_t value = *(const uint%u_t *)src;' % (depth, depth) 
+-PIPE_FORMAT_B5G6R5_SRGB             , plain, 1, 1, un5 , un6 , un5 ,     , zyx1, srgb
++PIPE_FORMAT_B5G6R5_SRGB             , plain, 1, 1, un5 , un6 , un5 ,     , zyx1, srgb, un5 , un6 , un5 ,     , xyz1
  
-         # Declare the intermediate variables
-         for i in range(format.nr_channels()):
--            src_channel = format.channels[i]
-+            src_channel = channels[i]
-             if src_channel.type == UNSIGNED:
-                 print '         uint%u_t %s;' % (depth, src_channel.name)
-             elif src_channel.type == SIGNED:
-@@ -416,7 +422,7 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
- 
-         # Compute the intermediate unshifted values 
-         for i in range(format.nr_channels()):
--            src_channel = format.channels[i]
-+            src_channel = channels[i]
-             value = 'value'
-             shift = src_channel.shift
-             if src_channel.type == UNSIGNED:
-@@ -443,9 +449,9 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
-                 
-         # Convert, swizzle, and store final values
-         for i in range(4):
--            swizzle = format.swizzles[i]
-+            swizzle = swizzles[i]
-             if swizzle < 4:
--                src_channel = format.channels[swizzle]
-+                src_channel = channels[swizzle]
-                 src_colorspace = format.colorspace
-                 if src_colorspace == SRGB and i == 3:
-                     # Alpha channel is linear
-@@ -465,14 +471,14 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
-                 assert False
-             print '         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
-         
--    else:
-+    def unpack_from_union(channels, swizzles):
-         print '         union util_format_%s pixel;' % format.short_name()
-         print '         memcpy(&pixel, src, sizeof pixel);'
-     
-         for i in range(4):
--            swizzle = format.swizzles[i]
-+            swizzle = swizzles[i]
-             if swizzle < 4:
--                src_channel = format.channels[swizzle]
-+                src_channel = channels[swizzle]
-                 src_colorspace = format.colorspace
-                 if src_colorspace == SRGB and i == 3:
-                     # Alpha channel is linear
-@@ -492,6 +498,11 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
-                 assert False
-             print '         dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
-     
-+    if format.is_bitmask():
-+        print_channels(format, unpack_from_bitmask)
-+    else:
-+        print_channels(format, unpack_from_union)
-+
- 
- def generate_pack_kernel(format, src_channel, src_native_type):
- 
-@@ -502,14 +513,14 @@ def generate_pack_kernel(format, src_channel, src_native_type):
- 
-     assert format.layout == PLAIN
- 
--    inv_swizzle = format.inv_swizzles()
-+    def pack_into_bitmask(channels, swizzles):
-+        inv_swizzle = inv_swizzles(swizzles)
- 
--    if format.is_bitmask():
-         depth = format.block_size()
-         print '         uint%u_t value = 0;' % depth 
- 
-         for i in range(4):
--            dst_channel = format.channels[i]
-+            dst_channel = channels[i]
-             shift = dst_channel.shift
-             if inv_swizzle[i] is not None:
-                 value ='src[%u]' % inv_swizzle[i]
-@@ -536,11 +547,13 @@ def generate_pack_kernel(format, src_channel, src_native_type):
-                 
-         print '         *(uint%u_t *)dst = value;' % depth 
- 
--    else:
-+    def pack_into_union(channels, swizzles):
-+        inv_swizzle = inv_swizzles(swizzles)
-+
-         print '         union util_format_%s pixel;' % format.short_name()
-     
-         for i in range(4):
--            dst_channel = format.channels[i]
-+            dst_channel = channels[i]
-             width = dst_channel.size
-             if inv_swizzle[i] is None:
-                 continue
-@@ -557,6 +570,11 @@ def generate_pack_kernel(format, src_channel, src_native_type):
-     
-         print '         memcpy(dst, &pixel, sizeof pixel);'
-     
-+    if format.is_bitmask():
-+        print_channels(format, pack_into_bitmask)
-+    else:
-+        print_channels(format, pack_into_union)
-+
- 
- def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
-     '''Generate the function to unpack pixels from a particular format'''
-@@ -654,7 +672,7 @@ def generate(formats):
-             if is_format_supported(format):
-                 generate_format_type(format)
- 
--            if is_format_pure_unsigned(format):
-+            if format.is_pure_unsigned():
-                 native_type = 'unsigned'
-                 suffix = 'unsigned'
-                 channel = Channel(UNSIGNED, False, True, 32)
-@@ -668,7 +686,7 @@ def generate(formats):
-                 suffix = 'signed'
-                 generate_format_unpack(format, channel, native_type, suffix)
-                 generate_format_pack(format, channel, native_type, suffix)   
--            elif is_format_pure_signed(format):
-+            elif format.is_pure_signed():
-                 native_type = 'int'
-                 suffix = 'signed'
-                 channel = Channel(SIGNED, False, True, 32)
 diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
-index e202099..929017a 100755
+index 15cc6d4..929017a 100755
 --- a/src/gallium/auxiliary/util/u_format_parse.py
 +++ b/src/gallium/auxiliary/util/u_format_parse.py
-@@ -30,8 +30,6 @@
- '''
- 
- 
--import sys
--
- VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
- 
- SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, = range(7)
-@@ -44,9 +42,6 @@ YUV = 'yuv'
- ZS = 'zs'
- 
- 
--# Not cross-compiler friendly
--is_big_endian = sys.byteorder == 'big'
--
- def is_pot(x):
-    return (x & (x - 1)) == 0
- 
-@@ -109,13 +104,15 @@ class Channel:
- class Format:
-     '''Describe a pixel format.'''
- 
--    def __init__(self, name, layout, block_width, block_height, channels, swizzles, colorspace):
-+    def __init__(self, name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace):
-         self.name = name
-         self.layout = layout
-         self.block_width = block_width
-         self.block_height = block_height
--        self.channels = channels
--        self.swizzles = swizzles
-+        self.le_channels = le_channels
-+        self.le_swizzles = le_swizzles
-+        self.be_channels = be_channels
-+        self.be_swizzles = be_swizzles
-         self.name = name
-         self.colorspace = colorspace
- 
-@@ -134,42 +131,45 @@ class Format:
- 
-     def block_size(self):
-         size = 0
--        for channel in self.channels:
-+        for channel in self.le_channels:
-             size += channel.size
-         return size
- 
-     def nr_channels(self):
-         nr_channels = 0
--        for channel in self.channels:
-+        for channel in self.le_channels:
-             if channel.size:
-                 nr_channels += 1
-         return nr_channels
- 
--    def is_array(self):
-+    def array_element(self):
-         if self.layout != PLAIN:
--            return False
--        ref_channel = self.channels[0]
-+            return None
-+        ref_channel = self.le_channels[0]
-         if ref_channel.type == VOID:
--           ref_channel = self.channels[1]
--        for channel in self.channels:
-+           ref_channel = self.le_channels[1]
-+        for channel in self.le_channels:
-             if channel.size and (channel.size != ref_channel.size or channel.size % 8):
--                return False
-+                return None
-             if channel.type != VOID:
-                 if channel.type != ref_channel.type:
--                    return False
-+                    return None
-                 if channel.norm != ref_channel.norm:
--                    return False
-+                    return None
-                 if channel.pure != ref_channel.pure:
--                    return False
--        return True
-+                    return None
-+        return ref_channel
-+
-+    def is_array(self):
-+        return self.array_element() != None
- 
-     def is_mixed(self):
-         if self.layout != PLAIN:
-             return False
--        ref_channel = self.channels[0]
-+        ref_channel = self.le_channels[0]
-         if ref_channel.type == VOID:
--           ref_channel = self.channels[1]
--        for channel in self.channels[1:]:
-+           ref_channel = self.le_channels[1]
-+        for channel in self.le_channels[1:]:
-             if channel.type != VOID:
-                 if channel.type != ref_channel.type:
-                     return True
-@@ -185,7 +185,7 @@ class Format:
-     def is_int(self):
-         if self.layout != PLAIN:
-             return False
--        for channel in self.channels:
-+        for channel in self.le_channels:
-             if channel.type not in (VOID, UNSIGNED, SIGNED):
-                 return False
-         return True
-@@ -193,7 +193,7 @@ class Format:
-     def is_float(self):
-         if self.layout != PLAIN:
-             return False
--        for channel in self.channels:
-+        for channel in self.le_channels:
-             if channel.type not in (VOID, FLOAT):
-                 return False
-         return True
-@@ -203,20 +203,43 @@ class Format:
-             return False
-         if self.block_size() not in (8, 16, 32):
-             return False
--        for channel in self.channels:
-+        for channel in self.le_channels:
-             if channel.type not in (VOID, UNSIGNED, SIGNED):
-                 return False
-         return True
- 
--    def inv_swizzles(self):
--        '''Return an array[4] of inverse swizzle terms'''
--        '''Only pick the first matching value to avoid l8 getting blue and i8 getting alpha'''
--        inv_swizzle = [None]*4
--        for i in range(4):
--            swizzle = self.swizzles[i]
--            if swizzle < 4 and inv_swizzle[swizzle] == None:
--                inv_swizzle[swizzle] = i
--        return inv_swizzle
-+    def is_pure_color(self):
-+        if self.layout != PLAIN or self.colorspace == ZS:
-+            return False
-+        pures = [channel.pure
-+                 for channel in self.le_channels
-+                 if channel.type != VOID]
-+        for x in pures:
-+           assert x == pures[0]
-+        return pures[0]
-+
-+    def channel_type(self):
-+        types = [channel.type
-+                 for channel in self.le_channels
-+                 if channel.type != VOID]
-+        for x in types:
-+           assert x == types[0]
-+        return types[0]
-+
-+    def is_pure_signed(self):
-+        return self.is_pure_color() and self.channel_type() == SIGNED
-+
-+    def is_pure_unsigned(self):
-+        return self.is_pure_color() and self.channel_type() == UNSIGNED
-+
-+    def has_channel(self, id):
-+        return self.le_swizzles[id] != SWIZZLE_NONE
-+
-+    def has_depth(self):
-+        return self.colorspace == ZS and self.has_channel(0)
-+
-+    def has_stencil(self):
-+        return self.colorspace == ZS and self.has_channel(1)
- 
-     def stride(self):
-         return self.block_size()/8
-@@ -241,6 +264,54 @@ _swizzle_parse_map = {
-     '_': SWIZZLE_NONE,
- }
- 
-+def _parse_channels(fields, layout, colorspace, swizzles):
-+    if layout == PLAIN:
-+        names = ['']*4
-+        if colorspace in (RGB, SRGB):
-+            for i in range(4):
-+                swizzle = swizzles[i]
-+                if swizzle < 4:
-+                    names[swizzle] += 'rgba'[i]
-+        elif colorspace == ZS:
-+            for i in range(4):
-+                swizzle = swizzles[i]
-+                if swizzle < 4:
-+                    names[swizzle] += 'zs'[i]
-+        else:
-+            assert False
-+        for i in range(4):
-+            if names[i] == '':
-+                names[i] = 'x'
-+    else:
-+        names = ['x', 'y', 'z', 'w']
-+
-+    channels = []
-+    for i in range(0, 4):
-+        field = fields[i]
-+        if field:
-+            type = _type_parse_map[field[0]]
-+            if field[1] == 'n':
-+                norm = True
-+                pure = False
-+                size = int(field[2:])
-+            elif field[1] == 'p':
-+                pure = True
-+                norm = False
-+                size = int(field[2:])
-+            else:
-+                norm = False
-+                pure = False
-+                size = int(field[1:])
-+        else:
-+            type = VOID
-+            norm = False
-+            pure = False
-+            size = 0
-+        channel = Channel(type, norm, pure, size, names[i])
-+        channels.append(channel)
-+
-+    return channels
-+
- def parse(filename):
-     '''Parse the format descrition in CSV format in terms of the 
-     Channel and Format classes above.'''
-@@ -259,65 +330,36 @@ def parse(filename):
+@@ -330,6 +330,9 @@ def parse(filename):
              continue
  
          fields = [field.strip() for field in line.split(',')]
@@ -685,211 +241,26 @@ index e202099..929017a 100755
          
          name = fields[0]
          layout = fields[1]
-         block_width, block_height = map(int, fields[2:4])
--
--        swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
-         colorspace = fields[9]
--        
--        if layout == PLAIN:
--            names = ['']*4
--            if colorspace in (RGB, SRGB):
--                for i in range(4):
--                    swizzle = swizzles[i]
--                    if swizzle < 4:
--                        names[swizzle] += 'rgba'[i]
--            elif colorspace == ZS:
--                for i in range(4):
--                    swizzle = swizzles[i]
--                    if swizzle < 4:
--                        names[swizzle] += 'zs'[i]
--            else:
--                assert False
--            for i in range(4):
--                if names[i] == '':
--                    names[i] = 'x'
--        else:
--            names = ['x', 'y', 'z', 'w']
--
--        channels = []
--        for i in range(0, 4):
--            field = fields[4 + i]
--            if field:
--                type = _type_parse_map[field[0]]
--                if field[1] == 'n':
--                    norm = True
--                    pure = False
--                    size = int(field[2:])
--                elif field[1] == 'p':
--                    pure = True
--                    norm = False
--                    size = int(field[2:])
--                else:
--                    norm = False
--                    pure = False
--                    size = int(field[1:])
--            else:
--                type = VOID
--                norm = False
--                pure = False
--                size = 0
--            channel = Channel(type, norm, pure, size, names[i])
--            channels.append(channel)
+@@ -339,8 +342,8 @@ def parse(filename):
+         le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
+         le_channels = _parse_channels(fields[4:8], layout, colorspace, le_swizzles)
  
--        shift = 0
--        for channel in channels[3::-1] if is_big_endian else channels:
--            channel.shift = shift
--            shift += channel.size
-+        le_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
-+        le_channels = _parse_channels(fields[4:8], layout, colorspace, le_swizzles)
-+
+-        be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[8]]
+-        be_channels = _parse_channels(fields[4:8], layout, colorspace, be_swizzles)
 +        be_swizzles = [_swizzle_parse_map[swizzle] for swizzle in fields[14]]
 +        be_channels = _parse_channels(fields[10:14], layout, colorspace, be_swizzles)
-+
-+        le_shift = 0
-+        for channel in le_channels:
-+            channel.shift = le_shift
-+            le_shift += channel.size
-+
-+        be_shift = 0
-+        for channel in be_channels[3::-1]:
-+            channel.shift = be_shift
-+            be_shift += channel.size
-+
-+        assert le_shift == be_shift
+ 
+         le_shift = 0
+         for channel in le_channels:
+@@ -353,6 +356,8 @@ def parse(filename):
+             be_shift += channel.size
+ 
+         assert le_shift == be_shift
 +        for i in range(4):
 +            assert (le_swizzles[i] != SWIZZLE_NONE) == (be_swizzles[i] != SWIZZLE_NONE)
  
--        format = Format(name, layout, block_width, block_height, channels, swizzles, colorspace)
-+        format = Format(name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
+         format = Format(name, layout, block_width, block_height, le_channels, le_swizzles, be_channels, be_swizzles, colorspace)
          formats.append(format)
-     return formats
- 
-diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
-index 9d44cf3..81fd399 100755
---- a/src/gallium/auxiliary/util/u_format_table.py
-+++ b/src/gallium/auxiliary/util/u_format_table.py
-@@ -94,21 +94,10 @@ def write_format_table(formats):
-     
-     u_format_pack.generate(formats)
-     
--    for format in formats:
--        print 'const struct util_format_description'
--        print 'util_format_%s_description = {' % (format.short_name(),)
--        print "   %s," % (format.name,)
--        print "   \"%s\"," % (format.name,)
--        print "   \"%s\"," % (format.short_name(),)
--        print "   {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size())
--        print "   %s," % (layout_map(format.layout),)
--        print "   %u,\t/* nr_channels */" % (format.nr_channels(),)
--        print "   %s,\t/* is_array */" % (bool_map(format.is_array()),)
--        print "   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
--        print "   %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),)
-+    def do_channel_array(channels, swizzles):
-         print "   {"
-         for i in range(4):
--            channel = format.channels[i]
-+            channel = channels[i]
-             if i < 3:
-                 sep = ","
-             else:
-@@ -118,9 +107,11 @@ def write_format_table(formats):
-             else:
-                 print "      {0, 0, 0, 0, 0}%s" % (sep,)
-         print "   },"
-+
-+    def do_swizzle_array(channels, swizzles):
-         print "   {"
-         for i in range(4):
--            swizzle = format.swizzles[i]
-+            swizzle = swizzles[i]
-             if i < 3:
-                 sep = ","
-             else:
-@@ -131,8 +122,23 @@ def write_format_table(formats):
-                 comment = 'ignored'
-             print "      %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment)
-         print "   },"
-+
-+    for format in formats:
-+        print 'const struct util_format_description'
-+        print 'util_format_%s_description = {' % (format.short_name(),)
-+        print "   %s," % (format.name,)
-+        print "   \"%s\"," % (format.name,)
-+        print "   \"%s\"," % (format.short_name(),)
-+        print "   {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size())
-+        print "   %s," % (layout_map(format.layout),)
-+        print "   %u,\t/* nr_channels */" % (format.nr_channels(),)
-+        print "   %s,\t/* is_array */" % (bool_map(format.is_array()),)
-+        print "   %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
-+        print "   %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),)
-+        u_format_pack.print_channels(format, do_channel_array)
-+        u_format_pack.print_channels(format, do_swizzle_array)
-         print "   %s," % (colorspace_map(format.colorspace),)
--        if format.colorspace != ZS and format.channels[0].pure == False:
-+        if format.colorspace != ZS and not format.is_pure_color():
-             print "   &util_format_%s_unpack_rgba_8unorm," % format.short_name() 
-             print "   &util_format_%s_pack_rgba_8unorm," % format.short_name() 
-             if format.layout == 's3tc' or format.layout == 'rgtc':
-@@ -149,7 +155,7 @@ def write_format_table(formats):
-             print "   NULL, /* unpack_rgba_float */" 
-             print "   NULL, /* pack_rgba_float */" 
-             print "   NULL, /* fetch_rgba_float */" 
--        if format.colorspace == ZS and format.swizzles[0] != SWIZZLE_NONE:
-+        if format.has_depth():
-             print "   &util_format_%s_unpack_z_32unorm," % format.short_name() 
-             print "   &util_format_%s_pack_z_32unorm," % format.short_name() 
-             print "   &util_format_%s_unpack_z_float," % format.short_name() 
-@@ -159,20 +165,20 @@ def write_format_table(formats):
-             print "   NULL, /* pack_z_32unorm */" 
-             print "   NULL, /* unpack_z_float */" 
-             print "   NULL, /* pack_z_float */" 
--        if format.colorspace == ZS and format.swizzles[1] != SWIZZLE_NONE:
-+        if format.has_stencil():
-             print "   &util_format_%s_unpack_s_8uint," % format.short_name() 
-             print "   &util_format_%s_pack_s_8uint," % format.short_name() 
-         else:
-             print "   NULL, /* unpack_s_8uint */" 
-             print "   NULL, /* pack_s_8uint */"
--        if format.colorspace != ZS and format.channels[0].pure == True and format.channels[0].type == UNSIGNED:
-+        if format.is_pure_unsigned():
-             print "   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name() 
-             print "   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name()
-             print "   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name()
-             print "   &util_format_%s_pack_signed,  /* pack_rgba_sint */" % format.short_name()
-             print "   &util_format_%s_fetch_unsigned,  /* fetch_rgba_uint */" % format.short_name()
-             print "   NULL  /* fetch_rgba_sint */"
--        elif format.colorspace != ZS and format.channels[0].pure == True and format.channels[0].type == SIGNED:
-+        elif format.is_pure_signed():
-             print "   &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name()
-             print "   &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name()
-             print "   &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name()
-diff --git a/src/gallium/drivers/ilo/ilo_format.c b/src/gallium/drivers/ilo/ilo_format.c
-index 65fb820..6bdac11 100644
---- a/src/gallium/drivers/ilo/ilo_format.c
-+++ b/src/gallium/drivers/ilo/ilo_format.c
-@@ -504,8 +504,8 @@ ilo_translate_color_format(enum pipe_format format)
-       [PIPE_FORMAT_IYUV]                  = 0,
-       [PIPE_FORMAT_NV12]                  = 0,
-       [PIPE_FORMAT_NV21]                  = 0,
--      [PIPE_FORMAT_R4A4_UNORM]            = 0,
-       [PIPE_FORMAT_A4R4_UNORM]            = 0,
-+      [PIPE_FORMAT_R4A4_UNORM]            = 0,
-       [PIPE_FORMAT_R8A8_UNORM]            = 0,
-       [PIPE_FORMAT_A8R8_UNORM]            = 0,
-       [PIPE_FORMAT_R10G10B10A2_SSCALED]   = BRW_SURFACEFORMAT_R10G10B10A2_SSCALED,
-diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
-index 377eaa5..564e19a 100644
---- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
-+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
-@@ -255,7 +255,7 @@ lp_build_blend_factor(struct lp_build_blend_aos_context *bld,
-    LLVMValueRef rgb_factor_, alpha_factor_;
-    enum lp_build_blend_swizzle rgb_swizzle;
- 
--   if (alpha_swizzle == 0) {
-+   if (alpha_swizzle == UTIL_FORMAT_SWIZZLE_X && num_channels == 1) {
-       return lp_build_blend_factor_unswizzled(bld, alpha_factor, TRUE);
-    }
- 
 diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c
 index 5c13ee5..b6c32ff 100644
 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c
@@ -904,61 +275,53 @@ index 5c13ee5..b6c32ff 100644
  
     if (*width == total_bits) {
        *mask = 0xffffffff;
-diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
-index f181621..4cc0582 100644
---- a/src/gallium/include/pipe/p_format.h
-+++ b/src/gallium/include/pipe/p_format.h
-@@ -236,8 +236,8 @@ enum pipe_format {
-    PIPE_FORMAT_NV12                    = 166,
-    PIPE_FORMAT_NV21                    = 167,
- 
--   PIPE_FORMAT_R4A4_UNORM              = 168,
--   PIPE_FORMAT_A4R4_UNORM              = 169,
-+   PIPE_FORMAT_A4R4_UNORM              = 168,
-+   PIPE_FORMAT_R4A4_UNORM              = 169,
-    PIPE_FORMAT_R8A8_UNORM              = 170,
-    PIPE_FORMAT_A8R8_UNORM              = 171,
+diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
+index 9cc8f4d..239b61a 100644
+--- a/src/mesa/main/format_unpack.c
++++ b/src/mesa/main/format_unpack.c
+@@ -2119,7 +2119,7 @@ unpack_XRGB1555_UNORM(const void *src, GLfloat dst[][4], GLuint n)
+ }
  
-diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
-index 716d218..dd51d69 100644
---- a/src/gallium/state_trackers/vdpau/vdpau_private.h
-+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
-@@ -182,9 +182,9 @@ FormatIndexedToPipe(VdpRGBAFormat vdpau_format)
+ static void
+-unpack_XBGR8888_SNORM(const void *src, GLfloat dst[][4], GLuint n)
++unpack_R8G8B8X8_SNORM(const void *src, GLfloat dst[][4], GLuint n)
  {
-    switch (vdpau_format) {
-       case VDP_INDEXED_FORMAT_A4I4:
--         return PIPE_FORMAT_A4R4_UNORM;
--      case VDP_INDEXED_FORMAT_I4A4:
-          return PIPE_FORMAT_R4A4_UNORM;
-+      case VDP_INDEXED_FORMAT_I4A4:
-+         return PIPE_FORMAT_A4R4_UNORM;
-       case VDP_INDEXED_FORMAT_A8I8:
-          return PIPE_FORMAT_A8R8_UNORM;
-       case VDP_INDEXED_FORMAT_I8A8:
-diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c
-index 3e13aa6..5898011 100644
---- a/src/gallium/state_trackers/xvmc/subpicture.c
-+++ b/src/gallium/state_trackers/xvmc/subpicture.c
-@@ -54,10 +54,10 @@ static enum pipe_format XvIDToPipe(int xvimage_id)
-          return PIPE_FORMAT_B8G8R8X8_UNORM;
- 
-       case FOURCC_AI44:
--         return PIPE_FORMAT_A4R4_UNORM;
-+         return PIPE_FORMAT_R4A4_UNORM;
+    const GLuint *s = ((const GLuint *) src);
+    GLuint i;
+@@ -2140,7 +2140,7 @@ unpack_R8G8B8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
+       dst[i][RCOMP] = _mesa_nonlinear_to_linear( (s[i]      ) & 0xff );
+       dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >>  8) & 0xff );
+       dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+-      dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
++      dst[i][ACOMP] = 1.0f;
+    }
+ }
  
-       case FOURCC_IA44:
--         return PIPE_FORMAT_R4A4_UNORM;
-+         return PIPE_FORMAT_A4R4_UNORM;
+@@ -2538,7 +2538,7 @@ get_unpack_rgba_function(mesa_format format)
+ 
+       table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM;
+       table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
+-      table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_XBGR8888_SNORM;
++      table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_R8G8B8X8_SNORM;
+       table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_R8G8B8X8_SRGB;
+       table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT;
+       table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT;
+diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
+index d48e39b..e1ce179 100644
+--- a/src/mesa/swrast/s_texfetch_tmp.h
++++ b/src/mesa/swrast/s_texfetch_tmp.h
+@@ -808,11 +808,11 @@ static void
+ FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
+                  GLint i, GLint j, GLint k, GLfloat *texel)
+ {
+-   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
++   const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+    texel[RCOMP] =
+    texel[GCOMP] =
+-   texel[BCOMP] = nonlinear_to_linear(src[0]);
+-   texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */
++   texel[BCOMP] = nonlinear_to_linear(s & 0xff);
++   texel[ACOMP] = UBYTE_TO_FLOAT(s >> 8); /* linear */
+ }
  
-       default:
-          XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", xvimage_id);
-@@ -89,8 +89,8 @@ static int PipeToComponentOrder(enum pipe_format format, char *component_order)
-       case PIPE_FORMAT_B8G8R8X8_UNORM:
-          return 0;
  
--      case PIPE_FORMAT_R4A4_UNORM:
-       case PIPE_FORMAT_A4R4_UNORM:
-+      case PIPE_FORMAT_R4A4_UNORM:
-          component_order[0] = 'Y';
-          component_order[1] = 'U';
-          component_order[2] = 'V';
diff --git a/SOURCES/mesa-llvm-3.5-cpu-fix.patch b/SOURCES/mesa-llvm-3.5-cpu-fix.patch
new file mode 100644
index 0000000..ab52b58
--- /dev/null
+++ b/SOURCES/mesa-llvm-3.5-cpu-fix.patch
@@ -0,0 +1,58 @@
+diff -up mesa-20140910/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp.dma mesa-20140910/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+--- mesa-20140910/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp.dma	2014-09-10 06:29:29.000000000 +1000
++++ mesa-20140910/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp	2014-09-17 12:58:19.526487782 +1000
+@@ -59,6 +59,7 @@
+ #include <llvm/ExecutionEngine/JITMemoryManager.h>
+ #endif
+ #include <llvm/Support/CommandLine.h>
++#include <llvm/Support/Host.h>
+ #include <llvm/Support/PrettyStackTrace.h>
+ 
+ #if HAVE_LLVM >= 0x0300
+@@ -309,8 +310,8 @@ lp_build_create_jit_compiler_for_module(
+       /*
+        * AVX feature is not automatically detected from CPUID by the X86 target
+        * yet, because the old (yet default) JIT engine is not capable of
+-       * emitting the opcodes.  But as we're using MCJIT here, it is safe to
+-       * add set this attribute.
++       * emitting the opcodes. On newer llvm versions it is and at least some
++       * versions (tested with 3.3) will emit avx opcodes without this anyway.
+        */
+       MAttrs.push_back("+avx");
+       if (util_cpu_caps.has_f16c) {
+@@ -318,14 +319,33 @@ lp_build_create_jit_compiler_for_module(
+       }
+       builder.setMAttrs(MAttrs);
+    }
++
++#if HAVE_LLVM >= 0x0305
++   StringRef MCPU = llvm::sys::getHostCPUName();
++   /*
++    * The cpu bits are no longer set automatically, so need to set mcpu manually.
++    * Note that the MAttrs set above will be sort of ignored (since we should
++    * not set any which would not be set by specifying the cpu anyway).
++    * It ought to be safe though since getHostCPUName() should include bits
++    * not only from the cpu but environment as well (for instance if it's safe
++    * to use avx instructions which need OS support). According to
++    * http://llvm.org/bugs/show_bug.cgi?id=19429 however if I understand this
++    * right it may be necessary to specify older cpu (or disable mattrs) though
++    * when not using MCJIT so no instructions are generated which the old JIT
++    * can't handle. Not entirely sure if we really need to do anything yet.
++    */
++   builder.setMCPU(MCPU);
++#endif
++
+    builder.setJITMemoryManager(JITMemoryManager::CreateDefaultMemManager());
+ 
+    ExecutionEngine *JIT;
+-#if 0
++
++#if HAVE_LLVM >= 0x0302
+    JIT = builder.create();
+ #else
+    /*
+-    * Workaround http://llvm.org/bugs/show_bug.cgi?id=12833
++    * Workaround http://llvm.org/PR12833
+     */
+    StringRef MArch = "";
+    StringRef MCPU = "";
diff --git a/SOURCES/nv50-fix-build.patch b/SOURCES/nv50-fix-build.patch
index 81862f3..af64216 100644
--- a/SOURCES/nv50-fix-build.patch
+++ b/SOURCES/nv50-fix-build.patch
@@ -1,12 +1,12 @@
-diff -up mesa-20130213/src/gallium/drivers/nv50/codegen/nv50_ir.cpp.rtti mesa-20130213/src/gallium/drivers/nv50/codegen/nv50_ir.cpp
---- mesa-20130213/src/gallium/drivers/nv50/codegen/nv50_ir.cpp.rtti	2013-02-13 18:08:17.533677028 +1000
-+++ mesa-20130213/src/gallium/drivers/nv50/codegen/nv50_ir.cpp	2013-02-13 18:08:20.496752128 +1000
-@@ -716,7 +716,7 @@ Instruction::clone(ClonePolicy<Function>
+diff -up mesa-20140827/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp.fixbuild mesa-20140827/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+--- mesa-20140827/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp.fixbuild	2014-08-27 15:33:21.858830514 +1000
++++ mesa-20140827/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp	2014-08-27 15:33:33.193830514 +1000
+@@ -739,7 +739,7 @@ Instruction::clone(ClonePolicy<Function>
     if (!i)
        i = new_Instruction(pol.context(), op, dType);
  #ifndef NDEBUG // non-conformant assert, so this is required
 -   assert(typeid(*i) == typeid(*this));
-+  // assert(typeid(*i) == typeid(*this));
++   //assert(typeid(*i) == typeid(*this));
  #endif
  
     pol.set<Instruction>(this, i);
diff --git a/SOURCES/sanitize-tarball.sh b/SOURCES/sanitize-tarball.sh
index 54b2d0c..e7fa18a 100755
--- a/SOURCES/sanitize-tarball.sh
+++ b/SOURCES/sanitize-tarball.sh
@@ -20,14 +20,9 @@ pushd $dirname
 
 cat > src/gallium/auxiliary/vl/vl_mpeg12_decoder.c << EOF
 #include "vl_mpeg12_decoder.h"
-struct pipe_video_decoder *
+struct pipe_video_codec *
 vl_create_mpeg12_decoder(struct pipe_context *context,
-                         enum pipe_video_profile profile,
-			 enum pipe_video_entrypoint entrypoint,
-			 enum pipe_video_chroma_format chroma_format,
-			 unsigned width, unsigned height,
-			 unsigned max_references,
-			 bool expect_chunked_decode)
+		const struct pipe_video_codec *templat)
 {
     return NULL;
 }
@@ -36,17 +31,21 @@ EOF
 cat > src/gallium/auxiliary/vl/vl_decoder.c << EOF
 #include "vl_decoder.h"
 bool vl_profile_supported(struct pipe_screen *screen,
-                          enum pipe_video_profile profile)
+                          enum pipe_video_profile profile,
+			enum pipe_video_entrypoint entrypoint)
 {
     return false;
 }
-struct pipe_video_decoder *
+
+int
+vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
+{
+   return 0;
+}
+
+struct pipe_video_codec *
 vl_create_decoder(struct pipe_context *pipe,
-                  enum pipe_video_profile profile,
-                  enum pipe_video_entrypoint entrypoint,
-                  enum pipe_video_chroma_format chroma_format,
-                  unsigned width, unsigned height, unsigned max_references,
-                  bool expect_chunked_decode)
+	const struct pipe_video_codec *templat)
 {
     return NULL;
 }
diff --git a/SPECS/mesa.spec b/SPECS/mesa.spec
index 372c220..d96bad4 100644
--- a/SPECS/mesa.spec
+++ b/SPECS/mesa.spec
@@ -42,13 +42,13 @@
 
 %define _default_patch_fuzz 2
 
-%define gitdate 20131218
+%define gitdate 20140910
 #% define snapshot 
 
 Summary: Mesa graphics libraries
 Name: mesa
-Version: 9.2.5
-Release: 6.%{gitdate}%{?dist}
+Version: 10.2.7
+Release: 5.%{gitdate}%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://www.mesa3d.org
@@ -68,19 +68,16 @@ Patch1: nv50-fix-build.patch
 Patch9: mesa-8.0-llvmpipe-shmget.patch
 Patch12: mesa-8.0.1-fix-16bpp.patch
 Patch15: mesa-9.2-hardware-float.patch
-Patch16: mesa-9.2-no-useless-vdpau.patch
-Patch20: mesa-9.2-evergreen-big-endian.patch
-Patch21: add-kaveri-berlin-pciid.patch
-Patch22: 0001-r600g-fix-SUMO2-pci-id.patch
+Patch20: mesa-10.2-evergreen-big-endian.patch
 
-# fix copy sub buffer on swrast
-Patch30: 0001-swrast-gallium-classic-add-MESA_copy_sub_buffer-supp.patch
+# ppc64le enablement
+Patch70: 0001-gallivm-Fix-Altivec-pack-intrinsics-for-little-endia.patch
 
-# fix GLX defaults against binary
-Patch40: 0001-glx-Fix-the-default-values-for-GLXFBConfig-attribute.patch
+# 1112753 - backport some of the upstream format fixes.
+Patch80: mesa-big-endian-fixes.patch
 
-# Z stream fix big endian
-Patch50: mesa-big-endian-fixes.patch
+# upstream backport to fix llvmpipe on older x86
+Patch81: mesa-llvm-3.5-cpu-fix.patch
 
 BuildRequires: pkgconfig autoconf automake libtool
 %if %{with_hardware}
@@ -103,7 +100,7 @@ BuildRequires: python
 BuildRequires: gettext
 %if 0%{?with_llvm}
 %if 0%{?with_private_llvm}
-BuildRequires: mesa-private-llvm-devel
+BuildRequires: mesa-private-llvm-devel >= 3.5
 %else
 BuildRequires: llvm-devel >= 3.0
 %endif
@@ -310,17 +307,14 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1
 #patch12 -p1 -b .16bpp
 
 %patch15 -p1 -b .hwfloat
-%patch16 -p1 -b .vdpau
 %patch20 -p1 -b .egbe
-%patch21 -p1 -b .kaveri
-%patch22 -p1 -b .sumo2
-%patch30 -p1 -b .copysub
-%patch40 -p1 -b .fixglx
-%patch50 -p1 -b .bigfix
+%patch70 -p1 -b .powerle
+%patch80 -p1 -b .bigendian
+%patch81 -p1 -b .cpu
 
 %if 0%{with_private_llvm}
-sed -i 's/llvm-config/mesa-private-llvm-config-%{__isa_bits}/g' configure.ac
-sed -i 's/`$LLVM_CONFIG --version`/&-mesa/' configure.ac
+sed -i 's/\[llvm-config\]/\[mesa-private-llvm-config-%{__isa_bits}\]/g' configure.ac
+sed -i 's/`$LLVM_CONFIG --version`/$LLVM_VERSION_MAJOR.$LLVM_VERSION_MINOR-mesa/' configure.ac
 %endif
 
 # need to use libdrm_nouveau2 on F17
@@ -358,6 +352,7 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions"
     --enable-gles2 \
     --disable-gallium-egl \
     --disable-xvmc \
+    --disable-dri3 \
     %{?with_vdpau:--enable-vdpau} \
     --with-egl-platforms=x11,drm%{?with_wayland:,wayland} \
     --enable-shared-glapi \
@@ -401,6 +396,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/vdpau/*.so
 # strip out useless headers
 rm -f $RPM_BUILD_ROOT%{_includedir}/GL/w*.h
 
+rm -rf $RPM_BUILD_ROOT%{_libdir}/gallium-pipe/
+
 # remove .la files
 find $RPM_BUILD_ROOT -name \*.la | xargs rm -f
 
@@ -496,15 +493,11 @@ rm -rf $RPM_BUILD_ROOT
 %if 0%{?with_vmware}
 %{_libdir}/dri/vmwgfx_dri.so
 %endif
-%{_libdir}/libdricore*.so*
 %endif
 # this is funky; it doesn't get built for gallium drivers, so it doesn't
 # exist on s390x where swrast is llvmpipe, but does exist on s390 where
 # swrast is classic mesa.  this seems like a bug?  in that it probably
 # means the gallium drivers are linking dricore statically?  fixme.
-%ifarch s390
-%{_libdir}/libdricore*.so*
-%endif
 %{_libdir}/dri/swrast_dri.so
 
 %if %{with_hardware}
@@ -554,6 +547,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_includedir}/GLES2/gl2ext.h
 %{_includedir}/GLES3/gl3platform.h
 %{_includedir}/GLES3/gl3.h
+%{_includedir}/GLES3/gl31.h
 %{_includedir}/GLES3/gl3ext.h
 %{_libdir}/pkgconfig/glesv2.pc
 %{_libdir}/libGLESv2.so
@@ -600,8 +594,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc docs/COPYING
 %if %{with_hardware}
-%{_libdir}/libxatracker.so.1
-%{_libdir}/libxatracker.so.1.*
+%{_libdir}/libxatracker.so.2
+%{_libdir}/libxatracker.so.2.*
 %endif
 
 %files libxatracker-devel
@@ -616,8 +610,26 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 
 %changelog
-* Fri Sep 19 2014 Dave Airlie <airlied@redhat.com> 9.2.5-6.20131218
-- fix big endian depth rendering (#1144237)
+* Wed Jan 28 2015 Adam Jackson <ajax@redhat.com> 10.2.7-5.20140910
+- Fix color clears and colorformat selection on big-endian evergreen
+
+* Wed Sep 17 2014 Dave Airlie <airlied@redhat.com> 10.2.7-3.20140910
+- backport regression fix for old x86 cpus
+
+* Wed Sep 17 2014 Dave Airlie <airlied@redhat.com> 10.2.7-2.20140910
+- backport upstream big endian format fixes
+
+* Wed Sep 10 2014 Dave Airlie <airlied@redhat.com> 10.2.7-1.20140910
+- rebase to latest 10.2.x branch - fixes HSW gnome-shell
+
+* Tue Sep 09 2014 Adam Jackson <ajax@redhat.com> 10.2.5-3.20140827
+- Backport a ppc64le fix
+
+* Wed Aug 27 2014 Adam Jackson <ajax@redhat.com> 10.2.5-2.20140827
+- Rebuild against llvm 3.5.0rc3
+
+* Wed Aug 27 2014 Dave Airlie <airlied@redhat.com> 10.2.5-1.20140827
+- rebase to 10.2.5 (well .6 in branch has hawaii fixes)
 
 * Mon Feb 24 2014 Dave Airlie <airlied@redhat.com> 9.2.5-5.20131218
 - fix GLX attribs against binary drivers (#1064117)