diff --git a/.gitignore b/.gitignore
index d0c81e0..eed2164 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/mesa-20160614.tar.xz
+SOURCES/mesa-20170307.tar.xz
diff --git a/.mesa.metadata b/.mesa.metadata
index e228522..c0393a2 100644
--- a/.mesa.metadata
+++ b/.mesa.metadata
@@ -1 +1 @@
-ae86032256fffb939bf1400eded554c077b522ea SOURCES/mesa-20160614.tar.xz
+42c01da9375d21e1b1814503ef5730c7260e8d62 SOURCES/mesa-20170307.tar.xz
diff --git a/SOURCES/0001-Revert-draw-use-SoA-fetch-not-AoS-one.patch b/SOURCES/0001-Revert-draw-use-SoA-fetch-not-AoS-one.patch
new file mode 100644
index 0000000..3245007
--- /dev/null
+++ b/SOURCES/0001-Revert-draw-use-SoA-fetch-not-AoS-one.patch
@@ -0,0 +1,123 @@
+From e4e52b06a9dec7d076ceeb4469bb2ca8b37c6cd5 Mon Sep 17 00:00:00 2001
+From: Lyude <lyude@redhat.com>
+Date: Tue, 2 May 2017 17:05:50 -0400
+Subject: [PATCH] Revert "draw: use SoA fetch, not AoS one"
+
+This reverts commit e827d9175675aaa6cfc0b981e2a80685fb7b3a74.
+
+Signed-off-by: Lyude <lyude@redhat.com>
+---
+ src/gallium/auxiliary/draw/draw_llvm.c | 71 +++++++++++++++++++++++-----------
+ 1 file changed, 48 insertions(+), 23 deletions(-)
+
+diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
+index 8952dc8..19b75a5 100644
+--- a/src/gallium/auxiliary/draw/draw_llvm.c
++++ b/src/gallium/auxiliary/draw/draw_llvm.c
+@@ -713,6 +713,39 @@ fetch_instanced(struct gallivm_state *gallivm,
+ 
+ 
+ static void
++convert_to_soa(struct gallivm_state *gallivm,
++               LLVMValueRef src_aos[LP_MAX_VECTOR_WIDTH / 32],
++               LLVMValueRef dst_soa[TGSI_NUM_CHANNELS],
++               const struct lp_type soa_type)
++{
++   unsigned j, k;
++   struct lp_type aos_channel_type = soa_type;
++
++   LLVMValueRef aos_channels[TGSI_NUM_CHANNELS];
++   unsigned pixels_per_channel = soa_type.length / TGSI_NUM_CHANNELS;
++
++   debug_assert(TGSI_NUM_CHANNELS == 4);
++   debug_assert((soa_type.length % TGSI_NUM_CHANNELS) == 0);
++
++   aos_channel_type.length >>= 1;
++
++   for (j = 0; j < TGSI_NUM_CHANNELS; ++j) {
++      LLVMValueRef channel[LP_MAX_VECTOR_LENGTH] = { 0 };
++
++      assert(pixels_per_channel <= LP_MAX_VECTOR_LENGTH);
++
++      for (k = 0; k < pixels_per_channel; ++k) {
++         channel[k] = src_aos[j + TGSI_NUM_CHANNELS * k];
++      }
++
++      aos_channels[j] = lp_build_concat(gallivm, channel, aos_channel_type, pixels_per_channel);
++   }
++
++   lp_build_transpose_aos(gallivm, soa_type, aos_channels, dst_soa);
++}
++
++
++static void
+ fetch_vector(struct gallivm_state *gallivm,
+              const struct util_format_description *format_desc,
+              struct lp_type vs_type,
+@@ -722,10 +755,11 @@ fetch_vector(struct gallivm_state *gallivm,
+              LLVMValueRef *inputs,
+              LLVMValueRef indices)
+ {
++   LLVMValueRef zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context));
+    LLVMBuilderRef builder = gallivm->builder;
+    struct lp_build_context blduivec;
+-   struct lp_type fetch_type = vs_type;
+    LLVMValueRef offset, valid_mask;
++   LLVMValueRef aos_fetch[LP_MAX_VECTOR_WIDTH / 32];
+    unsigned i;
+ 
+    lp_build_context_init(&blduivec, gallivm, lp_uint_type(vs_type));
+@@ -749,37 +783,28 @@ fetch_vector(struct gallivm_state *gallivm,
+    }
+ 
+    /*
+-    * Unlike fetch_instanced, use SoA fetch instead of multiple AoS fetches.
+-    * This should always produce better code.
++    * Note: we probably really want to use SoA fetch, not AoS one (albeit
++    * for most formats it will amount to the same as this isn't very
++    * optimized). But looks dangerous since it assumes alignment.
+     */
++   for (i = 0; i < vs_type.length; i++) {
++      LLVMValueRef offset1, elem;
++      elem = lp_build_const_int32(gallivm, i);
++      offset1 = LLVMBuildExtractElement(builder, offset, elem, "");
+ 
+-   /* The type handling is annoying here... */
+-   if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB &&
+-       format_desc->channel[0].pure_integer) {
+-      if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+-         fetch_type = lp_type_int_vec(vs_type.width, vs_type.width * vs_type.length);
+-      }
+-      else if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) {
+-         fetch_type = lp_type_uint_vec(vs_type.width, vs_type.width * vs_type.length);
+-      }
+-   }
+-
+-   lp_build_fetch_rgba_soa(gallivm, format_desc,
+-                           fetch_type, FALSE, map_ptr, offset,
+-                           blduivec.zero, blduivec.zero,
+-                           NULL, inputs);
+-
+-   for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
+-      inputs[i] = LLVMBuildBitCast(builder, inputs[i],
+-                                   lp_build_vec_type(gallivm, vs_type), "");
++      aos_fetch[i] = lp_build_fetch_rgba_aos(gallivm, format_desc,
++                                             lp_float32_vec4_type(),
++                                             FALSE, map_ptr, offset1,
++                                             zero, zero, NULL);
+    }
++   convert_to_soa(gallivm, aos_fetch, inputs, vs_type);
+ 
+-   /* out-of-bound fetches return all zeros */
+    for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
+       inputs[i] = LLVMBuildBitCast(builder, inputs[i], blduivec.vec_type, "");
+       inputs[i] = LLVMBuildAnd(builder, inputs[i], valid_mask, "");
+       inputs[i] = LLVMBuildBitCast(builder, inputs[i],
+                                    lp_build_vec_type(gallivm, vs_type), "");
++
+    }
+ }
+ 
+-- 
+2.9.3
+
diff --git a/SOURCES/0001-gallivm-Make-sure-module-has-the-correct-data-layout.patch b/SOURCES/0001-gallivm-Make-sure-module-has-the-correct-data-layout.patch
new file mode 100644
index 0000000..dd27ba0
--- /dev/null
+++ b/SOURCES/0001-gallivm-Make-sure-module-has-the-correct-data-layout.patch
@@ -0,0 +1,88 @@
+From 9aca538a8ae017222aded41bc530fef150db351c Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar@redhat.com>
+Date: Fri, 5 May 2017 01:07:00 +0000
+Subject: [PATCH] gallivm: Make sure module has the correct data layout when
+ pass manager runs
+
+The datalayout for modules was purposely not being set in order to work around
+the fact that the ExecutionEngine requires that the module's datalayout
+matches the datalayout of the TargetMachine that the ExecutionEngine is
+using.
+
+When the pass manager runs on a module with no datalayout, it uses
+the default datalayout which is little-endian.  This causes problems
+on big-endian targets, because some optimizations that are legal on
+little-endian or illegal on big-endian.
+
+To resolve this, we set the datalayout prior to running the pass
+manager, and then clear it before creating the ExectionEngine.
+
+This patch fixes a lot of piglit tests on big-endian ppc64.
+
+Cc: mesa-stable@lists.freedesktop.org
+---
+ src/gallium/auxiliary/gallivm/lp_bld_init.c | 34 +++++++++++++++--------------
+ 1 file changed, 18 insertions(+), 16 deletions(-)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
+index ef2580e..9f1ade6 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
+@@ -125,19 +125,6 @@ create_pass_manager(struct gallivm_state *gallivm)
+    LLVMAddTargetData(gallivm->target, gallivm->passmgr);
+ #endif
+ 
+-   /* Setting the module's DataLayout to an empty string will cause the
+-    * ExecutionEngine to copy to the DataLayout string from its target
+-    * machine to the module.  As of LLVM 3.8 the module and the execution
+-    * engine are required to have the same DataLayout.
+-    *
+-    * TODO: This is just a temporary work-around.  The correct solution is
+-    * for gallivm_init_state() to create a TargetMachine and pull the
+-    * DataLayout from there.  Currently, the TargetMachine used by llvmpipe
+-    * is being implicitly created by the EngineBuilder in
+-    * lp_build_create_jit_compiler_for_module()
+-    */
+-
+-#if HAVE_LLVM < 0x0308
+    {
+       char *td_str;
+       // New ones from the Module.
+@@ -145,9 +132,6 @@ create_pass_manager(struct gallivm_state *gallivm)
+       LLVMSetDataLayout(gallivm->module, td_str);
+       free(td_str);
+    }
+-#else
+-   LLVMSetDataLayout(gallivm->module, "");
+-#endif
+ 
+    if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) {
+       /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
+@@ -628,6 +612,24 @@ gallivm_compile_module(struct gallivm_state *gallivm)
+    }
+ 
+    if (use_mcjit) {
++      /* Setting the module's DataLayout to an empty string will cause the
++       * ExecutionEngine to copy to the DataLayout string from its target
++       * machine to the module.  As of LLVM 3.8 the module and the execution
++       * engine are required to have the same DataLayout.
++       *
++       * We must make sure we do this after running the optimization passes,
++       * because those passes need a correct datalayout string.  For example,
++       * if those optimization passes see an empty datalayout, they will assume
++       * this is a little endian target and will do optimizations that break big
++       * endian machines.
++       *
++       * TODO: This is just a temporary work-around.  The correct solution is
++       * for gallivm_init_state() to create a TargetMachine and pull the
++       * DataLayout from there.  Currently, the TargetMachine used by llvmpipe
++       * is being implicitly created by the EngineBuilder in
++       * lp_build_create_jit_compiler_for_module()
++       */
++      LLVMSetDataLayout(gallivm->module, "");
+       assert(!gallivm->engine);
+       if (!init_gallivm_engine(gallivm)) {
+          assert(0);
+-- 
+2.9.3
+
diff --git a/SOURCES/0001-glsl-Allow-compatibility-shaders-with-MESA_GL_VERSIO.patch b/SOURCES/0001-glsl-Allow-compatibility-shaders-with-MESA_GL_VERSIO.patch
new file mode 100644
index 0000000..13a45ee
--- /dev/null
+++ b/SOURCES/0001-glsl-Allow-compatibility-shaders-with-MESA_GL_VERSIO.patch
@@ -0,0 +1,114 @@
+From d7a0486a9e4e71d98c694872815909b8f8c0d3ac Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88@gmail.com>
+Date: Tue, 31 Jan 2017 15:41:52 -0800
+Subject: [PATCH] glsl: Allow compatibility shaders with
+ MESA_GL_VERSION_OVERRIDE=...
+
+Previously if you used MESA_GL_VERSION_OVERRIDE=3.3COMPAT, Mesa exposed
+an OpenGL 3.3 compatibility profile context (with various unimplemented
+features and bugs), but still refused to compile shaders with
+
+   #version 330 compatibility
+
+This patch simply adds a small bit of plumbing to let that through.
+
+Of course the same caveats apply: compatibility profile is still not
+supported (and will not be supported), so there are no guarantees that
+anything will work.
+
+Tested-by: Dylan Baker <dylan@pnwbakers.com>
+Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
+Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
+---
+ src/compiler/glsl/builtin_types.cpp      |  2 +-
+ src/compiler/glsl/builtin_variables.cpp  |  2 +-
+ src/compiler/glsl/glsl_parser_extras.cpp | 13 +++++++++++--
+ src/compiler/glsl/glsl_parser_extras.h   |  1 +
+ 4 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/src/compiler/glsl/builtin_types.cpp b/src/compiler/glsl/builtin_types.cpp
+index a63d736..cae972b 100644
+--- a/src/compiler/glsl/builtin_types.cpp
++++ b/src/compiler/glsl/builtin_types.cpp
+@@ -288,7 +288,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
+    /* Add deprecated structure types.  While these were deprecated in 1.30,
+     * they're still present.  We've removed them in 1.40+ (OpenGL 3.1+).
+     */
+-   if (!state->es_shader && state->language_version < 140) {
++   if (state->compat_shader) {
+       for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
+          add_type(symbols, deprecated_types[i]);
+       }
+diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
+index 4eb275e..be593e9 100644
+--- a/src/compiler/glsl/builtin_variables.cpp
++++ b/src/compiler/glsl/builtin_variables.cpp
+@@ -444,7 +444,7 @@ private:
+ builtin_variable_generator::builtin_variable_generator(
+    exec_list *instructions, struct _mesa_glsl_parse_state *state)
+    : instructions(instructions), state(state), symtab(state->symbols),
+-     compatibility(!state->is_version(140, 100)),
++     compatibility(state->compat_shader || !state->is_version(140, 100)),
+      bool_t(glsl_type::bool_type), int_t(glsl_type::int_type),
+      uint_t(glsl_type::uint_type),
+      float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type),
+diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
+index 6fe1dd9..c4da79a 100644
+--- a/src/compiler/glsl/glsl_parser_extras.cpp
++++ b/src/compiler/glsl/glsl_parser_extras.cpp
+@@ -83,6 +83,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
+    this->forced_language_version = ctx->Const.ForceGLSLVersion;
+    this->zero_init = ctx->Const.GLSLZeroInit;
+    this->gl_version = 20;
++   this->compat_shader = true;
+    this->es_shader = false;
+    this->ARB_texture_rectangle_enable = true;
+ 
+@@ -370,6 +371,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
+                                                   const char *ident)
+ {
+    bool es_token_present = false;
++   bool compat_token_present = false;
+    if (ident) {
+       if (strcmp(ident, "es") == 0) {
+          es_token_present = true;
+@@ -379,8 +381,12 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
+              * a core profile shader since that's the only profile we support.
+              */
+          } else if (strcmp(ident, "compatibility") == 0) {
+-            _mesa_glsl_error(locp, this,
+-                             "the compatibility profile is not supported");
++            compat_token_present = true;
++
++            if (this->ctx->API != API_OPENGL_COMPAT) {
++               _mesa_glsl_error(locp, this,
++                                "the compatibility profile is not supported");
++            }
+          } else {
+             _mesa_glsl_error(locp, this,
+                              "\"%s\" is not a valid shading language profile; "
+@@ -412,6 +418,9 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
+    else
+       this->language_version = version;
+ 
++   this->compat_shader = compat_token_present ||
++                         (!this->es_shader && this->language_version < 140);
++
+    bool supported = false;
+    for (unsigned i = 0; i < this->num_supported_versions; i++) {
+       if (this->supported_versions[i].ver == this->language_version
+diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
+index 424cab5..66a954f 100644
+--- a/src/compiler/glsl/glsl_parser_extras.h
++++ b/src/compiler/glsl/glsl_parser_extras.h
+@@ -348,6 +348,7 @@ struct _mesa_glsl_parse_state {
+    } supported_versions[16];
+ 
+    bool es_shader;
++   bool compat_shader;
+    unsigned language_version;
+    unsigned forced_language_version;
+    bool zero_init;
+-- 
+2.9.3
+
diff --git a/SOURCES/0001-i956-Add-more-Kabylake-PCI-IDs.patch b/SOURCES/0001-i956-Add-more-Kabylake-PCI-IDs.patch
deleted file mode 100644
index caaaf2d..0000000
--- a/SOURCES/0001-i956-Add-more-Kabylake-PCI-IDs.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 958e3df72c1ff440babfc3f875a6aa3d9bb13f4c Mon Sep 17 00:00:00 2001
-From: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Date: Thu, 23 Jun 2016 14:35:09 -0700
-Subject: [PATCH 1/2] i956: Add more Kabylake PCI IDs.
-
-The spec has been updated adding new PCI IDs.
-
-Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
-Acked-by: Kenneth Graunke <kenneth@whitecape.org>
-Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
----
- include/pci_ids/i965_pci_ids.h | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/include/pci_ids/i965_pci_ids.h b/include/pci_ids/i965_pci_ids.h
-index bdfbefe..02031ed 100644
---- a/include/pci_ids/i965_pci_ids.h
-+++ b/include/pci_ids/i965_pci_ids.h
-@@ -137,6 +137,7 @@ CHIPSET(0x193D, skl_gt4, "Intel(R) Iris Pro Graphics P580 (Skylake GT4e)")
- CHIPSET(0x5902, kbl_gt1, "Intel(R) Kabylake GT1")
- CHIPSET(0x5906, kbl_gt1, "Intel(R) Kabylake GT1")
- CHIPSET(0x590A, kbl_gt1, "Intel(R) Kabylake GT1")
-+CHIPSET(0x5908, kbl_gt1, "Intel(R) Kabylake GT1")
- CHIPSET(0x590B, kbl_gt1, "Intel(R) Kabylake GT1")
- CHIPSET(0x590E, kbl_gt1, "Intel(R) Kabylake GT1")
- CHIPSET(0x5913, kbl_gt1_5, "Intel(R) Kabylake GT1.5")
-@@ -149,7 +150,9 @@ CHIPSET(0x591B, kbl_gt2, "Intel(R) Kabylake GT2")
- CHIPSET(0x591D, kbl_gt2, "Intel(R) Kabylake GT2")
- CHIPSET(0x591E, kbl_gt2, "Intel(R) Kabylake GT2")
- CHIPSET(0x5921, kbl_gt2, "Intel(R) Kabylake GT2F")
-+CHIPSET(0x5923, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x5926, kbl_gt3, "Intel(R) Kabylake GT3")
-+CHIPSET(0x5927, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x592A, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x592B, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x5932, kbl_gt4, "Intel(R) Kabylake GT4")
--- 
-2.7.4
-
diff --git a/SOURCES/0001-virgl-fix-checking-fences.patch b/SOURCES/0001-virgl-fix-checking-fences.patch
deleted file mode 100644
index eee5d99..0000000
--- a/SOURCES/0001-virgl-fix-checking-fences.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From dc81b3ad43dde0815baf957e7cf4c633d6f350f8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
-Date: Tue, 7 Jun 2016 14:54:34 +0200
-Subject: [PATCH] virgl: fix checking fences
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When calling virgl_fence_wait() with timeout=0,
-virgl_{drm,vtest}_resource_is_busy() is called. However, it returns TRUE
-for a busy resource, whereace virgl_fence_wait() should return TRUE for
-a completed (non-busy) resource.
-
-This fixes running supertuxkart in a VM (I could not reproduce locally
-with vtest though there is a similar fix)
-
-Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Cc: "11.1 11.2 12.0" <mesa-stable@lists.freedesktop.org>
-Signed-off-by: Dave Airlie <airlied@redhat.com>
----
- src/gallium/winsys/virgl/drm/virgl_drm_winsys.c     | 2 +-
- src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
-index c77b899..81afa84 100644
---- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
-+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
-@@ -734,7 +734,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
-    struct virgl_hw_res *res = virgl_hw_res(fence);
- 
-    if (timeout == 0)
--      return virgl_drm_resource_is_busy(vdws, res);
-+      return !virgl_drm_resource_is_busy(vdws, res);
- 
-    if (timeout != PIPE_TIMEOUT_INFINITE) {
-       int64_t start_time = os_time_get();
-diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
-index 9c9ec04..ce8ac97 100644
---- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
-+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
-@@ -544,7 +544,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
-    struct virgl_hw_res *res = virgl_hw_res(fence);
- 
-    if (timeout == 0)
--      return virgl_vtest_resource_is_busy(vdws, res);
-+      return !virgl_vtest_resource_is_busy(vdws, res);
- 
-    if (timeout != PIPE_TIMEOUT_INFINITE) {
-       int64_t start_time = os_time_get();
--- 
-2.5.5
-
diff --git a/SOURCES/0002-i965-Removing-PCI-IDs-that-are-no-longer-listed-as-K.patch b/SOURCES/0002-i965-Removing-PCI-IDs-that-are-no-longer-listed-as-K.patch
deleted file mode 100644
index 680ef7a..0000000
--- a/SOURCES/0002-i965-Removing-PCI-IDs-that-are-no-longer-listed-as-K.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 900068c8108607b025c990857580a4e5923b94d4 Mon Sep 17 00:00:00 2001
-From: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Date: Thu, 23 Jun 2016 14:38:18 -0700
-Subject: [PATCH 2/2] i965: Removing PCI IDs that are no longer listed as
- Kabylake.
-
-This is unusual. Usually IDs listed on early stages of platform
-definition are kept there as reserved for later use.
-
-However these IDs here are not listed anymore in any of steppings
-and devices IDs tables for Kabylake on configurations overview
-section of BSpec.
-
-So it is better removing them before they become used in any
-other future platform.
-
-Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
-Acked-by: Kenneth Graunke <kenneth@whitecape.org>
-Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
----
- include/pci_ids/i965_pci_ids.h | 5 -----
- 1 file changed, 5 deletions(-)
-
-diff --git a/include/pci_ids/i965_pci_ids.h b/include/pci_ids/i965_pci_ids.h
-index 02031ed..189a1c7 100644
---- a/include/pci_ids/i965_pci_ids.h
-+++ b/include/pci_ids/i965_pci_ids.h
-@@ -153,12 +153,7 @@ CHIPSET(0x5921, kbl_gt2, "Intel(R) Kabylake GT2F")
- CHIPSET(0x5923, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x5926, kbl_gt3, "Intel(R) Kabylake GT3")
- CHIPSET(0x5927, kbl_gt3, "Intel(R) Kabylake GT3")
--CHIPSET(0x592A, kbl_gt3, "Intel(R) Kabylake GT3")
--CHIPSET(0x592B, kbl_gt3, "Intel(R) Kabylake GT3")
--CHIPSET(0x5932, kbl_gt4, "Intel(R) Kabylake GT4")
--CHIPSET(0x593A, kbl_gt4, "Intel(R) Kabylake GT4")
- CHIPSET(0x593B, kbl_gt4, "Intel(R) Kabylake GT4")
--CHIPSET(0x593D, kbl_gt4, "Intel(R) Kabylake GT4")
- CHIPSET(0x22B0, chv,     "Intel(R) HD Graphics (Cherryview)")
- CHIPSET(0x22B1, chv,     "Intel(R) HD Graphics (Cherryview)")
- CHIPSET(0x22B2, chv,     "Intel(R) HD Graphics (Cherryview)")
--- 
-2.7.4
-
diff --git a/SOURCES/make-git-snapshot.sh b/SOURCES/make-git-snapshot.sh
index 54a8b16..318d45c 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:-11.2}
+echo HEAD ${1:-17.0}
 
 rm -rf $DIRNAME
 
-git clone --depth 1 ${REF:+--reference $REF} --branch 11.2 \
+git clone --depth 1 ${REF:+--reference $REF} --branch 17.0 \
 	git://git.freedesktop.org/git/mesa/mesa $DIRNAME
 
 GIT_DIR=$DIRNAME/.git git archive --format=tar --prefix=$DIRNAME/ ${1:-HEAD} \
diff --git a/SPECS/mesa.spec b/SPECS/mesa.spec
index ba6f923..5046980 100644
--- a/SPECS/mesa.spec
+++ b/SPECS/mesa.spec
@@ -1,5 +1,6 @@
 %if 0%{?rhel}
 %define with_private_llvm 1
+%define with_vdpau 1
 %else
 %define with_private_llvm 0
 %define with_vdpau 1
@@ -29,26 +30,38 @@
 %else
 %define with_hardware 1
 %define base_drivers nouveau,radeon,r200
+%define base_vulkan_drivers radeon
 %ifarch %{ix86} x86_64
 %define platform_drivers ,i915,i965
 %define with_vmware 1
+%define platform_vulkan_drivers ,intel
 %endif
 %ifarch ppc
 %define platform_drivers ,swrast
 %endif
 %endif
 
+%ifarch x86_64 ppc64le
+%define with_vulkan 1
+%else
+%define with_vulkan 0
+%endif
+
 %define dri_drivers --with-dri-drivers=%{?base_drivers}%{?platform_drivers}
 
+%if 0%{?with_vulkan}
+%define vulkan_drivers --with-vulkan-drivers=%{?base_vulkan_drivers}%{?platform_vulkan_drivers}
+%endif
+
 %define _default_patch_fuzz 2
 
-%define gitdate 20160614
+%define gitdate 20170307
 #% define snapshot 
 
 Summary: Mesa graphics libraries
 Name: mesa
-Version: 11.2.2
-Release: 2.%{gitdate}%{?dist}
+Version: 17.0.1
+Release: 6.%{gitdate}%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://www.mesa3d.org
@@ -70,10 +83,11 @@ Patch12: mesa-8.0.1-fix-16bpp.patch
 Patch15: mesa-9.2-hardware-float.patch
 Patch20: mesa-10.2-evergreen-big-endian.patch
 
-Patch30: 0001-virgl-fix-checking-fences.patch
+Patch30: 0001-glsl-Allow-compatibility-shaders-with-MESA_GL_VERSIO.patch
 
-Patch40: 0001-i956-Add-more-Kabylake-PCI-IDs.patch
-Patch41: 0002-i965-Removing-PCI-IDs-that-are-no-longer-listed-as-K.patch
+Patch40: 0001-Revert-draw-use-SoA-fetch-not-AoS-one.patch
+
+Patch50: 0001-gallivm-Make-sure-module-has-the-correct-data-layout.patch
 
 BuildRequires: pkgconfig autoconf automake libtool
 %if %{with_hardware}
@@ -98,7 +112,7 @@ BuildRequires: python-mako
 BuildRequires: gettext
 %if 0%{?with_llvm}
 %if 0%{?with_private_llvm}
-BuildRequires: mesa-private-llvm-devel >= 3.6
+BuildRequires: mesa-private-llvm-devel >= 3.9
 %else
 BuildRequires: llvm-devel >= 3.0
 %endif
@@ -286,6 +300,15 @@ Group: System Environment/Libraries
 %description libglapi
 Mesa shared glapi
 
+%if 0%{?with_vulkan}
+%package vulkan-drivers
+Summary:        Mesa Vulkan drivers
+Requires:       vulkan%{_isa}
+
+%description vulkan-drivers
+The drivers with support for the Vulkan API.
+%endif
+
 %prep
 #setup -q -n Mesa-%{version}%{?snapshot}
 %setup -q -n mesa-%{gitdate}
@@ -306,9 +329,12 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1
 
 %patch15 -p1 -b .hwfloat
 #patch20 -p1 -b .egbe
-%patch30 -p1 -b .virglfix
-%patch40 -p1 -b .kblid1
-%patch41 -p1 -b .kblid2
+
+%patch30 -p1 -b .glslfix
+
+%patch40 -p1 -b .bigendian-fix
+
+%patch50 -p1 -b .gallivm-datalayout-fix
 
 %if 0%{with_private_llvm}
 sed -i 's/\[llvm-config\]/\[mesa-private-llvm-config-%{__isa_bits}\]/g' configure.ac
@@ -356,12 +382,14 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions"
     --disable-opencl \
     --enable-glx-tls \
     --enable-texture-float=yes \
+%if %{with_vulkan}
+    %{?vulkan_drivers} \
+%endif
     %{?with_llvm:--enable-gallium-llvm} \
-    %{?with_llvm:--with-llvm-shared-libs} \
     --enable-dri \
 %if %{with_hardware}
     %{?with_vmware:--enable-xa} \
-    --with-gallium-drivers=%{?with_vmware:svga,}%{?with_radeonsi:radeonsi,}%{?with_llvm:swrast,r600,}%{?with_freedreno:freedreno,}r300,nouveau,virgl \
+    --with-gallium-drivers=%{?with_vmware:svga,}%{?with_radeonsi:radeonsi,}%{?with_llvm:swrast,r600,r300}%{?with_freedreno:freedreno,},nouveau,virgl \
 %else
     --with-gallium-drivers=%{?with_llvm:swrast} \
 %endif
@@ -380,6 +408,8 @@ make install DESTDIR=$RPM_BUILD_ROOT
 %if 0%{?rhel}
 # remove pre-DX9 drivers
 rm -f $RPM_BUILD_ROOT%{_libdir}/dri/{radeon,r200,nouveau_vieux}_dri.*
+# remove r300 vdpau
+rm -f $RPM_BUILD_ROOT%{_libdir}/vdpau/libvdpau_r300.*
 %endif
 
 %if !%{with_hardware}
@@ -394,6 +424,8 @@ rm -f $RPM_BUILD_ROOT%{_includedir}/GL/w*.h
 
 rm -rf $RPM_BUILD_ROOT%{_libdir}/gallium-pipe/
 
+rm -f $RPM_BUILD_ROOT%{_includedir}/vulkan/vulkan_intel.h
+
 # remove .la files
 find $RPM_BUILD_ROOT -name \*.la | xargs rm -f
 
@@ -432,25 +464,22 @@ rm -rf $RPM_BUILD_ROOT
 
 %files libGL
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libGL.so.1
 %{_libdir}/libGL.so.1.*
 
 %files libEGL
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libEGL.so.1
 %{_libdir}/libEGL.so.1.*
 
 %files libGLES
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libGLESv2.so.2
 %{_libdir}/libGLESv2.so.2.*
 
 %files filesystem
 %defattr(-,root,root,-)
-%doc docs/COPYING docs/Mesa-MLAA-License-Clarification-Email.txt
+%doc docs/Mesa-MLAA-License-Clarification-Email.txt
 %dir %{_libdir}/dri
 %if %{with_hardware}
 %if 0%{?with_vdpau}
@@ -471,8 +500,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/dri/r200_dri.so
 %{_libdir}/dri/nouveau_vieux_dri.so
 %endif
-%{_libdir}/dri/r300_dri.so
 %if 0%{?with_llvm}
+%{_libdir}/dri/r300_dri.so
 %{_libdir}/dri/r600_dri.so
 %if 0%{?with_radeonsi}
 %{_libdir}/dri/radeonsi_dri.so
@@ -544,19 +573,20 @@ rm -rf $RPM_BUILD_ROOT
 %files libGLES-devel
 %defattr(-,root,root,-)
 %dir %{_includedir}/GLES2
+%dir %{_includedir}/GLES3
 %{_includedir}/GLES2/gl2platform.h
 %{_includedir}/GLES2/gl2.h
 %{_includedir}/GLES2/gl2ext.h
 %{_includedir}/GLES3/gl3platform.h
 %{_includedir}/GLES3/gl3.h
 %{_includedir}/GLES3/gl31.h
+%{_includedir}/GLES3/gl32.h
 %{_includedir}/GLES3/gl3ext.h
 %{_libdir}/pkgconfig/glesv2.pc
 %{_libdir}/libGLESv2.so
 
 %files libOSMesa
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libOSMesa.so.8*
 
 %files libOSMesa-devel
@@ -568,7 +598,6 @@ rm -rf $RPM_BUILD_ROOT
 
 %files libgbm
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libgbm.so.1
 %{_libdir}/libgbm.so.1.*
 
@@ -581,7 +610,6 @@ rm -rf $RPM_BUILD_ROOT
 %if !0%{?rhel}
 %files libwayland-egl
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %{_libdir}/libwayland-egl.so.1
 %{_libdir}/libwayland-egl.so.1.*
 
@@ -594,7 +622,6 @@ rm -rf $RPM_BUILD_ROOT
 %if 0%{?with_vmware}
 %files libxatracker
 %defattr(-,root,root,-)
-%doc docs/COPYING
 %if %{with_hardware}
 %{_libdir}/libxatracker.so.2
 %{_libdir}/libxatracker.so.2.*
@@ -611,7 +638,52 @@ rm -rf $RPM_BUILD_ROOT
 %endif
 %endif
 
+%if 0%{?with_vulkan}
+%files vulkan-drivers
+%ifarch x86_64
+%{_libdir}/libvulkan_intel.so
+%{_datadir}/vulkan/icd.d/intel_icd.x86_64.json
+%endif
+%{_libdir}/libvulkan_radeon.so
+%ifarch x86_64
+%{_datadir}/vulkan/icd.d/radeon_icd.x86_64.json
+%endif
+%ifarch ppc64le
+%{_datadir}/vulkan/icd.d/radeon_icd.powerpc64le.json
+%endif
+%endif
+
 %changelog
+* Thu May 11 2017 Dave Airlie <airlied@redhat.com> - 17.0.1-6.20170307
+- enable VDPAU drivers (#1297276)
+
+* Tue May 09 2017 Tom Stellard <tstellar@redhat.com> - 17.0.1-5.20170307
+- Use correct datalayout for llvmpipe (#1445423)
+
+* Fri May 05 2017 Adam Jackson <ajax@redhat.com> - 17.0.1-4.20170307
+- Add ppc64le vulkan build
+
+* Wed May 03 2017 Lyude Paul <lyude@redhat.com> - 17.0.1-3.20170307
+- Add temporary revert for #1438891
+
+* Tue Mar 28 2017 Dave Airlie <airlied@redhat.com> - 17.0.1-2.20170307
+- Allow compat shaders override. (#1429813)
+
+* Tue Mar 07 2017 Dave Airlie <airlied@redhat.com> - 17.0.1-1.20170307
+- mesa 17.0.1 release
+
+* Tue Feb 28 2017 Dave Airlie <airlied@redhat.com> - 17.0.0-2.20170215
+- enable more drivers on aarch64 + vulkan drivers (#1358444)
+
+* Wed Feb 15 2017 Dave Airlie <airlied@redhat.com> - 17.0.0-1.20170215
+- mesa 17.0.0 release
+
+* Mon Feb 06 2017 Adam Jackson <ajax@redhat.com> - 17.0.0-0.2.20170123
+- Rebuild against (and BuildRequire) mesa-private-llvm >= 3.9
+
+* Mon Jan 23 2017 Dave Airlie <airlied@redhat.com> - 17.0.0-0.1.20170123
+- mesa 17.0.0-rc1
+
 * Tue Aug 09 2016 Rob Clark <rclark@redhat.com> - 11.2.2-2.20160614
 - update kbl pci ids.