Yocto 2.4

Move OpenBMC to Yocto 2.4(rocko)

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Makefile.vulkan.am-explictly-add-lib-expat-to-intel-.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Makefile.vulkan.am-explictly-add-lib-expat-to-intel-.patch
new file mode 100644
index 0000000..bd1e863
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Makefile.vulkan.am-explictly-add-lib-expat-to-intel-.patch
@@ -0,0 +1,44 @@
+From 342311dbb190735b7b32ab20f81c1d8dbcfe717a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Wed, 11 Oct 2017 15:40:42 +0800
+Subject: [PATCH] Makefile.vulkan.am: explictly add lib expat to intel
+ libvulkan's lib depends
+
+While built with "-fvisibility=default"
+...
+|i586-oe-linux-gcc ... -fvisibility=default ... -o common/.libs/common_libintel_common_la-gen_decoder.o
+...
+
+It triggered the failure
+...
+|i586-oe-linux-g++  ... common/.libs/libintel_common.a ... -o vulkan/.libs/libvulkan_intel.so
+|common/.libs/libintel_common.a(common_libintel_common_la-gen_decoder.o):
+|In function `start_element':
+|/usr/src/debug/mesa/2_17.1.7-r0/mesa-17.1.7/src/intel/common/gen_decoder.c:371:
+undefined reference to `XML_GetCurrentLineNumber'
+...
+
+explictly add EXPAT_LIBS to intel's VULKAN_LIB_DEPS
+
+Upstream-Status: Submitted [mesa-dev@lists.freedesktop.org]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ src/intel/Makefile.vulkan.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
+index 271b0a5..8fbe2c8 100644
+--- a/src/intel/Makefile.vulkan.am
++++ b/src/intel/Makefile.vulkan.am
+@@ -144,6 +144,7 @@ VULKAN_LIB_DEPS = \
+ 	$(LIBDRM_LIBS) \
+ 	$(PTHREAD_LIBS) \
+ 	$(DLOPEN_LIBS) \
++	$(EXPAT_LIBS) \
+ 	-lm
+ 
+ if HAVE_PLATFORM_X11
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Use-wayland-scanner-in-the-path.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Use-wayland-scanner-in-the-path.patch
index e49695b..eb6ff4f 100644
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Use-wayland-scanner-in-the-path.patch
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-Use-wayland-scanner-in-the-path.patch
@@ -1,4 +1,4 @@
-From 2f68fcaaf4964e7feeb383f5c26851965cda037c Mon Sep 17 00:00:00 2001
+From c908f0c13ac81a3a52140f129a13b2bc997ff4ee Mon Sep 17 00:00:00 2001
 From: Jussi Kukkonen <jussi.kukkonen@intel.com>
 Date: Tue, 15 Nov 2016 15:20:49 +0200
 Subject: [PATCH] Simplify wayland-scanner lookup
@@ -15,23 +15,23 @@
  1 file changed, 1 insertion(+), 6 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
-index e56e35a..a92005a 100644
+index 2c7e636fac..d2b2350739 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -2020,12 +2020,7 @@ if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
-     AC_MSG_ERROR([cannot build egl state tracker without EGL library])
+@@ -2174,12 +2174,7 @@ if test "x$with_platforms" != xauto; then
+     with_egl_platforms=$with_platforms
  fi
  
 -PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland-scanner],
 -        WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`,
 -        WAYLAND_SCANNER='')
 -if test "x$WAYLAND_SCANNER" = x; then
--    AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
+-    AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
 -fi
 +AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
  
  # Do per-EGL platform setups and checks
  egl_platforms=`IFS=', '; echo $with_egl_platforms`
 -- 
-2.1.4
+2.13.0
 
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch
new file mode 100644
index 0000000..b27a3bc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch
@@ -0,0 +1,40 @@
+From 9861437e58fdd0de01193a102608d34e5952953f Mon Sep 17 00:00:00 2001
+From: Christoph Haag <haagch+mesadev@frickel.club>
+Date: Thu, 20 Apr 2017 10:34:18 +0200
+Subject: [PATCH 1/2] ac: fix build after LLVM 5.0 SVN r300718
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+v2: previously getWithDereferenceableBytes() exists, but addAttr() doesn't take that type
+
+Signed-off-by: Christoph Haag <haagch+mesadev@frickel.club>
+Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
+Tested-and-reviewed-by: Mike Lothian <mike@fireburn.co.uk>
+---
+Upstream-Status: Backport
+
+ src/amd/common/ac_llvm_helper.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
+index d9ea4b1..11fa809 100644
+--- a/src/amd/common/ac_llvm_helper.cpp
++++ b/src/amd/common/ac_llvm_helper.cpp
+@@ -44,9 +44,13 @@ typedef AttributeSet AttributeList;
+ void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
+ {
+    llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
++#if HAVE_LLVM < 0x0500
+    llvm::AttrBuilder B;
+    B.addDereferenceableAttr(bytes);
+    A->addAttr(llvm::AttributeList::get(A->getContext(), A->getArgNo() + 1,  B));
++#else
++   A->addAttr(llvm::Attribute::getWithDereferenceableBytes(A->getContext(), bytes));
++#endif
+ }
+ 
+ bool ac_is_sgpr_param(LLVMValueRef arg)
+-- 
+2.13.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-configure.ac-Always-check-for-expat.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-configure.ac-Always-check-for-expat.patch
new file mode 100644
index 0000000..4753c49
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-configure.ac-Always-check-for-expat.patch
@@ -0,0 +1,51 @@
+From 1f7d752193f02d15d5923cee992e8f46d4c6df1b Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Mon, 28 Aug 2017 13:51:49 +0300
+Subject: [PATCH] configure.ac: Always check for expat
+
+expat was not checked if dri was not built leading to build failure
+in vulkan driver: backport a fix (a combination of multiple commits
+that should end up in 17.3).
+
+Upstream-Status: Backport
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+---
+ configure.ac | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index fd346c8aa2..662faecefa 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1777,6 +1777,12 @@ if test "x$with_dri_drivers" = xno; then
+     with_dri_drivers=''
+ fi
+ 
++# Check for expat
++PKG_CHECK_MODULES([EXPAT], [expat])
++PKG_CHECK_MODULES([EXPAT], [expat],,
++    [PKG_CHECK_MODULES([EXPAT], [expat21])]
++)
++
+ dnl If $with_dri_drivers is yes, drivers will be added through
+ dnl platform checks. Set DEFINES and LIB_DEPS
+ if test "x$enable_dri" = xyes; then
+@@ -1810,15 +1816,6 @@ if test "x$enable_dri" = xyes; then
+         with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
+     fi
+ 
+-    # Check for expat
+-    PKG_CHECK_MODULES([EXPAT], [expat], [],
+-        # expat version 2.0 and earlier do not provide expat.pc
+-        [AC_CHECK_HEADER([expat.h],[],
+-                         [AC_MSG_ERROR([Expat headers required for DRI not found])])
+-         AC_CHECK_LIB([expat],[XML_ParserCreate],[],
+-                     [AC_MSG_ERROR([Expat library required for DRI not found])])
+-         EXPAT_LIBS="-lexpat"])
+-
+     # put all the necessary libs together
+     DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
+ fi
+-- 
+2.14.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-winsys-svga-drm-Include-sys-types.h.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-winsys-svga-drm-Include-sys-types.h.patch
new file mode 100644
index 0000000..549b867
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0001-winsys-svga-drm-Include-sys-types.h.patch
@@ -0,0 +1,34 @@
+From d8750776404b1031d762966d0f551d13d2fe05a7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Aug 2017 18:58:20 -0700
+Subject: [PATCH] winsys/svga/drm: Include sys/types.h
+
+vmw_screen.h uses dev_t which is defines in sys/types.h
+this header is required to be included for getting dev_t
+definition. This issue happens on musl C library, it is hidden
+on glibc since sys/types.h is included through another
+system headers
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+
+Upstream-Status: Submitted
+
+ src/gallium/winsys/svga/drm/vmw_screen.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h
+index 0ef8e84..2eda97e 100644
+--- a/src/gallium/winsys/svga/drm/vmw_screen.h
++++ b/src/gallium/winsys/svga/drm/vmw_screen.h
+@@ -41,6 +41,7 @@
+ #include "svga_winsys.h"
+ #include "pipebuffer/pb_buffer_fenced.h"
+ #include <os/os_thread.h>
++#include <sys/types.h>
+ 
+ #define VMW_GMR_POOL_SIZE (16*1024*1024)
+ #define VMW_QUERY_POOL_SIZE (8192)
+-- 
+2.14.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch
new file mode 100644
index 0000000..ac8caec
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch
@@ -0,0 +1,49 @@
+From a02a0dfda2712d30ad62b8f0421ec7b8244ba2cb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Wed, 10 May 2017 17:26:07 +0900
+Subject: [PATCH 2/2] gallivm: Fix build against LLVM SVN >= r302589
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+deregisterEHFrames doesn't take any parameters anymore.
+
+Reviewed-by: Vedran Miletić <vedran@miletic.net>
+Reviewed-by: Marek Olšák <marek.olsak@amd.com>
+---
+Upstream-Status: Backport
+
+ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+index 2a388cb..0e4a531 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+@@ -342,14 +342,20 @@ class DelegatingJITMemoryManager : public BaseMemoryManager {
+       virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
+          mgr()->registerEHFrames(Addr, LoadAddr, Size);
+       }
+-      virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
+-         mgr()->deregisterEHFrames(Addr, LoadAddr, Size);
+-      }
+ #else
+       virtual void registerEHFrames(llvm::StringRef SectionData) {
+          mgr()->registerEHFrames(SectionData);
+       }
+ #endif
++#if HAVE_LLVM >= 0x0500
++      virtual void deregisterEHFrames() {
++         mgr()->deregisterEHFrames();
++      }
++#elif HAVE_LLVM >= 0x0304
++      virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
++         mgr()->deregisterEHFrames(Addr, LoadAddr, Size);
++      }
++#endif
+       virtual void *getPointerToNamedFunction(const std::string &Name,
+                                               bool AbortOnFailure=true) {
+          return mgr()->getPointerToNamedFunction(Name, AbortOnFailure);
+-- 
+2.13.3
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch
new file mode 100644
index 0000000..0e014dc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch
@@ -0,0 +1,51 @@
+From 00bcd599310dc7fce4fe336ffd85902429051a0c Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+Date: Sun, 20 Mar 2016 13:27:04 +0100
+Subject: [PATCH 2/4] hardware gloat
+
+Upstream-Status: Inappropriate [not author]
+Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+---
+ src/gallium/drivers/llvmpipe/lp_screen.c | 7 +++++++
+ src/gallium/drivers/softpipe/sp_screen.c | 7 +++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
+index 4f61de8..3b0ec77 100644
+--- a/src/gallium/drivers/llvmpipe/lp_screen.c
++++ b/src/gallium/drivers/llvmpipe/lp_screen.c
+@@ -411,6 +411,13 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
+    if (!format_desc)
+       return FALSE;
+ 
++   if ((bind & PIPE_BIND_RENDER_TARGET) &&
++       format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++       format != PIPE_FORMAT_R11G11B10_FLOAT &&
++       util_format_is_float(format)) {
++      return FALSE;
++   }
++
+    assert(target == PIPE_BUFFER ||
+           target == PIPE_TEXTURE_1D ||
+           target == PIPE_TEXTURE_1D_ARRAY ||
+diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
+index 031602b..c279120 100644
+--- a/src/gallium/drivers/softpipe/sp_screen.c
++++ b/src/gallium/drivers/softpipe/sp_screen.c
+@@ -358,6 +358,13 @@ softpipe_is_format_supported( struct pipe_screen *screen,
+    if (!format_desc)
+       return FALSE;
+ 
++   if ((bind & PIPE_BIND_RENDER_TARGET) &&
++       format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++       format != PIPE_FORMAT_R11G11B10_FLOAT &&
++       util_format_is_float(format)) {
++      return FALSE;
++   }
++
+    if (sample_count > 1)
+       return FALSE;
+ 
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/llvm-config-version.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/llvm-config-version.patch
new file mode 100644
index 0000000..aa33a1e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/llvm-config-version.patch
@@ -0,0 +1,32 @@
+When building llvm from git or svn it embeds the svn/git revision into internal version string
+
+$ /mnt/a/oe/build/tmp/work/corei7-64-bec-linux/mesa/2_17.1.5-r0/recipe-sysroot/usr/lib/llvm5.0/llvm-config-host --version
+5.0.0git-9a5c333388c
+
+We need to ignore everything after 5.0.0 which is what the cut cmd is doing
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: mesa-17.1.5/configure.ac
+===================================================================
+--- mesa-17.1.5.orig/configure.ac
++++ mesa-17.1.5/configure.ac
+@@ -967,7 +967,7 @@ strip_unwanted_llvm_flags() {
+ 
+ llvm_set_environment_variables() {
+     if test "x$LLVM_CONFIG" != xno; then
+-        LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
++        LLVM_VERSION=`$LLVM_CONFIG --version | cut -c1-5`
+         LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+         LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+         LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+@@ -2560,7 +2560,7 @@ if test "x$enable_llvm" = xyes; then
+     dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
+     if test "x$enable_llvm_shared_libs" = xyes; then
+         dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
+-        LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
++        LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version|cut -c1-5`
+         AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
+ 
+         if test "x$llvm_have_one_so" = xyes; then
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/vulkan-mkdir.patch b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/vulkan-mkdir.patch
new file mode 100644
index 0000000..15ee5ee
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/files/vulkan-mkdir.patch
@@ -0,0 +1,37 @@
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From c78979fd95a1c4f732f7e6edf0f32c524e5955b8 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Wed, 12 Jul 2017 17:10:07 +0100
+Subject: [PATCH] src/intel/Makefile.vulkan.am: create target directories when
+ required
+
+In out-of-tree builds src/intel/vulkan won't exist, so always create it before
+writing into it.
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ src/intel/Makefile.vulkan.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
+index 3857a5dc62..26e9cd410c 100644
+--- a/src/intel/Makefile.vulkan.am
++++ b/src/intel/Makefile.vulkan.am
+@@ -44,11 +44,13 @@ EXTRA_DIST += \
+ 	vulkan/TODO
+ 
+ vulkan/dev_icd.json : vulkan/dev_icd.json.in
++	$(MKDIR_GEN)
+ 	$(AM_V_GEN) $(SED) \
+ 		-e "s#@build_libdir@#${abs_top_builddir}/${LIB_DIR}#" \
+ 		< $(srcdir)/vulkan/dev_icd.json.in > $@
+ 
+ vulkan/intel_icd.@host_cpu@.json : vulkan/intel_icd.json.in
++	$(MKDIR_GEN)
+ 	$(AM_V_GEN) $(SED) \
+ 		-e "s#@install_libdir@#${libdir}#" \
+ 		< $(srcdir)/vulkan/intel_icd.json.in > $@
+-- 
+2.11.0
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/libglu_9.0.0.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/libglu_9.0.0.bb
index 8b94613..eeb898f 100644
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/libglu_9.0.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/libglu_9.0.0.bb
@@ -12,7 +12,7 @@
 PE = "2"
 PR = "0"
 
-SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${PV}.tar.bz2"
+SRC_URI = "https://mesa.freedesktop.org/archive/glu/glu-${PV}.tar.bz2"
 
 SRC_URI[md5sum] = "be9249132ff49275461cf92039083030"
 SRC_URI[sha256sum] = "1f7ad0d379a722fcbd303aa5650c6d7d5544fde83196b42a73d1193568a4df12"
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-demos_8.3.0.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-demos_8.3.0.bb
index e43b9ef..bae3b18 100644
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-demos_8.3.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-demos_8.3.0.bb
@@ -9,7 +9,7 @@
 LIC_FILES_CHKSUM = "file://src/xdemos/glxgears.c;beginline=1;endline=20;md5=914225785450eff644a86c871d3ae00e \
                     file://src/xdemos/glxdemo.c;beginline=1;endline=8;md5=b01d5ab1aee94d35b7efaa2ef48e1a06"
 
-SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${BPN}-${PV}.tar.bz2 \
+SRC_URI = "https://mesa.freedesktop.org/archive/demos/${PV}/${BPN}-${PV}.tar.bz2 \
            file://0001-mesa-demos-Add-missing-data-files.patch \
            file://0003-configure-Allow-to-disable-demos-which-require-GLEW-.patch \
            file://0004-Use-DEMOS_DATA_DIR-to-locate-data-files.patch \
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.0.2.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.0.2.bb
deleted file mode 100644
index e3604f3..0000000
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.0.2.bb
+++ /dev/null
@@ -1,13 +0,0 @@
-require mesa_${PV}.bb
-
-SUMMARY += " (OpenGL only, no EGL/GLES)"
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/mesa:"
-
-PROVIDES = "virtual/libgl virtual/mesa"
-
-S = "${WORKDIR}/mesa-${PV}"
-
-PACKAGECONFIG ??= "dri ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
-
-EXCLUDE_FROM_WORLD = "1"
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.1.7.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.1.7.bb
new file mode 100644
index 0000000..73267eb
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa-gl_17.1.7.bb
@@ -0,0 +1,9 @@
+require mesa_${PV}.bb
+
+SUMMARY += " (OpenGL only, no EGL/GLES)"
+
+PROVIDES = "virtual/libgl virtual/mesa"
+
+S = "${WORKDIR}/mesa-${PV}"
+
+PACKAGECONFIG ??= "opengl dri ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa.inc b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa.inc
index 25cbf63..4f31ed2 100644
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa.inc
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa.inc
@@ -10,47 +10,64 @@
 BUGTRACKER = "https://bugs.freedesktop.org"
 SECTION = "x11"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://docs/license.html;md5=899fbe7e42d494c7c8c159c7001693d5"
+LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c4"
 
 PE = "2"
 
-DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native"
-
+DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native"
+EXTRANATIVEPATH += "chrpath-native"
 PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa"
 
-inherit autotools pkgconfig pythonnative gettext distro_features_check
+inherit autotools pkgconfig gettext distro_features_check
 
-REQUIRED_DISTRO_FEATURES = "opengl"
+ANY_OF_DISTRO_FEATURES = "opengl vulkan"
 
-export LLVM_CONFIG = "${STAGING_BINDIR_CROSS}/llvm-config"
-EXTRA_OECONF = "--enable-shared-glapi"
+PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
+               ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}"
 
-PACKAGECONFIG ??= "gbm egl gles dri \
-		${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)} \
-		"
+export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
+EXTRA_OECONF = "--enable-shared-glapi \
+                --disable-opencl \
+                --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
+                --with-platforms='${PLATFORMS}'"
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
+		   "
+
+# "gbm" requires "dri", "opengl"
 PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm"
 
 X11_DEPS = "xf86driproto glproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes"
+# "x11" requires "opengl"
 PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}"
 PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc"
-PACKAGECONFIG[wayland] = ",,wayland-native wayland"
+PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm"
 
 DRIDRIVERS = "swrast"
 DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915"
 DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915"
+# "dri" requires "opengl"
 PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, dri2proto libdrm"
 PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, dri3proto presentproto libxshmfence"
 
 # Vulkan drivers need dri3 enabled
 # radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
-PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=intel, --without-vulkan-drivers"
+VULKAN_DRIVERS = ""
+VULKAN_DRIVERS_append_x86 = ",intel"
+VULKAN_DRIVERS_append_x86-64 = ",intel"
+PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=${VULKAN_DRIVERS}, --without-vulkan-drivers"
 
+PACKAGECONFIG[opengl] = "--enable-opengl, --disable-opengl"
+
+# "gles" requires "opengl"
 PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2"
 
-EGL_PLATFORMS  = "drm"
-EGL_PLATFORMS .="${@bb.utils.contains('PACKAGECONFIG', 'x11', ',x11', '', d)}"
-EGL_PLATFORMS .="${@bb.utils.contains('PACKAGECONFIG', 'wayland', ',wayland', '', d)}"
-PACKAGECONFIG[egl] = "--enable-egl --with-egl-platforms=${EGL_PLATFORMS}, --disable-egl"
+# "egl" requires "dri", "opengl"
+PACKAGECONFIG[egl] = "--enable-egl, --disable-egl"
 
 PACKAGECONFIG[etnaviv] = ""
 PACKAGECONFIG[imx] = ""
@@ -65,9 +82,9 @@
 GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
 GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
 # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
-PACKAGECONFIG[gallium]      = "--with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
-MESA_LLVM_RELEASE ?= "3.3"
-PACKAGECONFIG[gallium-llvm] = "--enable-gallium-llvm --enable-llvm-shared-libs, --disable-gallium-llvm, llvm${MESA_LLVM_RELEASE} \
+PACKAGECONFIG[gallium]      = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
+MESA_LLVM_RELEASE ?= "5.0"
+PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
                                ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
 export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
 PACKAGECONFIG[xa]  = "--enable-xa, --disable-xa"
@@ -75,9 +92,13 @@
 OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium-osmesa', 'osmesa', d)}"
 PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}"
 
+PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind"
+
 # llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
 FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
 
+CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
+
 # Multiple virtual/gl providers being built breaks staging
 EXCLUDE_FROM_WORLD = "1"
 
@@ -106,9 +127,10 @@
     rm -f ${D}${libdir}/egl/*.la
     rm -f ${D}${libdir}/gallium-pipe/*.la
     rm -f ${D}${libdir}/gbm/*.la
-    
+
     # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used 
     rm -f ${D}${sysconfdir}/drirc
+    chrpath --delete ${D}${libdir}/dri/*_dri.so || true
 }
 
 # For the packages that make up the OpenGL interfaces, inject variables so that
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.0.2.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.0.2.bb
deleted file mode 100644
index 2689e8f..0000000
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.0.2.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-require ${BPN}.inc
-
-SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/mesa-${PV}.tar.xz \
-           file://replace_glibc_check_with_linux.patch \
-           file://disable-asm-on-non-gcc.patch \
-           file://0001-Use-wayland-scanner-in-the-path.patch \
-"
-
-SRC_URI[md5sum] = "8f808e92b893d412fbd6510e1d16f5c5"
-SRC_URI[sha256sum] = "f8f191f909e01e65de38d5bdea5fb057f21649a3aed20948be02348e77a689d4"
-
-#because we cannot rely on the fact that all apps will use pkgconfig,
-#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
-do_install_append() {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then
-        sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if defined(MESA_EGL_NO_X11_HEADERS) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h
-    fi
-}
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.1.7.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.1.7.bb
new file mode 100644
index 0000000..39cfce9
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_17.1.7.bb
@@ -0,0 +1,25 @@
+require ${BPN}.inc
+
+SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
+           file://replace_glibc_check_with_linux.patch \
+           file://disable-asm-on-non-gcc.patch \
+           file://0001-Use-wayland-scanner-in-the-path.patch \
+           file://0002-hardware-gloat.patch \
+           file://vulkan-mkdir.patch \
+           file://llvm-config-version.patch \
+           file://0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch \
+           file://0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch \
+           file://0001-winsys-svga-drm-Include-sys-types.h.patch \
+           file://0001-configure.ac-Always-check-for-expat.patch \
+           file://0001-Makefile.vulkan.am-explictly-add-lib-expat-to-intel-.patch \
+           "
+SRC_URI[md5sum] = "e40bb428a263bd28cbf6478dae45b207"
+SRC_URI[sha256sum] = "69f472a874b1122404fa0bd13e2d6bf87eb3b9ad9c21d2f39872a96d83d9e5f5"
+
+#because we cannot rely on the fact that all apps will use pkgconfig,
+#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
+do_install_append() {
+    if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then
+        sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if defined(MESA_EGL_NO_X11_HEADERS) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h
+    fi
+}
diff --git a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_git.bb b/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_git.bb
deleted file mode 100644
index c034517..0000000
--- a/import-layers/yocto-poky/meta/recipes-graphics/mesa/mesa_git.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-require ${BPN}.inc
-
-DEFAULT_PREFERENCE = "-1"
-
-SRCREV = "ea0d1f575c214c09ba3df12644a960e86e031766"
-PV = "10.5.4+git${SRCPV}"
-
-SRC_URI = "git://anongit.freedesktop.org/git/mesa/mesa;branch=10.5"
-
-S = "${WORKDIR}/git"
-
-DEPENDS += "python-mako-native"
-
-inherit pythonnative
-
-#because we cannot rely on the fact that all apps will use pkgconfig,
-#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
-do_install_append() {
-    if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then
-        sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if defined(MESA_EGL_NO_X11_HEADERS) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h
-    fi
-}