Yocto 2.3

Move OpenBMC to Yocto 2.3(pyro).

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Resolves: openbmc/openbmc#2461
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
index 7f8b600..7692133 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
@@ -1 +1,2 @@
 EGLINFO_DEVICE_rpi  = "raspberrypi"
+COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'null', '"(.*)"', d)}"
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_%.bbappend
new file mode 100644
index 0000000..7897125
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa-gl_%.bbappend
@@ -0,0 +1 @@
+PACKAGECONFIG_append_rpi = " gbm"
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
index 4f72845..5861c4e 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
@@ -1,7 +1,7 @@
-From 4b68419e58ef31e72abab688d0c7cc5db80efc13 Mon Sep 17 00:00:00 2001
+From e45bc677368d0f8d42720aad242f33f6e2687fb1 Mon Sep 17 00:00:00 2001
 From: Dom Cobley <dc4@broadcom.com>
 Date: Tue, 9 Jul 2013 09:26:26 -0400
-Subject: [PATCH 01/12] Allow applications to set next resource handle
+Subject: [PATCH 01/15] Allow applications to set next resource handle
 
 This patch adds provisions in userland to
 let apps callers set the next rendereing dispmanx resource.
@@ -204,5 +204,5 @@
  
  FN(void, eglIntGetColorData_impl, (EGL_SURFACE_ID_T s, KHRN_IMAGE_FORMAT_T format, uint32_t width, uint32_t height, int32_t stride, uint32_t y_offset, void *data))
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
index 6cc8ea8..d6e6476 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
@@ -1,7 +1,7 @@
-From e3d2d0007e1c6c32ab7d9a28f1e399d42b511333 Mon Sep 17 00:00:00 2001
+From 15fb270f438f4ef1413192b5ce1e0dc784b45d9e Mon Sep 17 00:00:00 2001
 From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
 Date: Tue, 1 Oct 2013 13:19:20 +0200
-Subject: [PATCH 02/12] wayland: Add support for the Wayland winsys
+Subject: [PATCH 02/15] wayland: Add support for the Wayland winsys
 
 * Adds EGL_WL_bind_wayland_display extension
 * Adds wayland-egl library
@@ -17,7 +17,7 @@
 private header that can be included from EGL and vc_* instead of in
 vc_vchi_dispmanx.h
 ---
- .gitignore                                         |   2 +
+ .gitignore                                         |   1 +
  CMakeLists.txt                                     |  11 +
  README.md                                          |   4 +
  buildme                                            |  10 +-
@@ -47,7 +47,7 @@
  interface/vmcs_host/vc_vchi_dispmanx.h             |  15 ++
  interface/wayland/dispmanx.xml                     | 123 +++++++++++
  makefiles/cmake/Wayland.cmake                      |  72 ++++++
- 30 files changed, 1258 insertions(+), 98 deletions(-)
+ 30 files changed, 1257 insertions(+), 98 deletions(-)
  create mode 100644 interface/khronos/common/linux/khrn_wayland.c
  copy interface/{vmcs_host/vc_vchi_dispmanx.h => khronos/common/linux/khrn_wayland.h} (56%)
  create mode 100644 interface/khronos/ext/egl_wayland.c
@@ -58,17 +58,16 @@
  create mode 100644 makefiles/cmake/Wayland.cmake
 
 diff --git a/.gitignore b/.gitignore
-index 4a88665..5da71a9 100644
+index 63570f1..1459436 100644
 --- a/.gitignore
 +++ b/.gitignore
-@@ -13,3 +13,5 @@ build/
- *.lai
- *.la
- *.a
-+
+@@ -30,3 +30,4 @@ build/
+ *.pts
+ *.ppm
+ *.mkv
 +*~
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 98252c3..d6ae907 100644
+index cfc8ae5..673a5ad 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.cmake)
@@ -102,7 +101,7 @@
 +
 +$ BUILD_WAYLAND=1 ./buildme.
 diff --git a/buildme b/buildme
-index 1061745..d0e6e54 100755
+index b8fd440..a780bb6 100755
 --- a/buildme
 +++ b/buildme
 @@ -8,6 +8,10 @@ fi
@@ -117,7 +116,7 @@
  	# Native compile on the Raspberry Pi
  	mkdir -p build/raspberry/$BUILDSUBDIR
 @@ -32,9 +36,13 @@ elif [ "$1" = "--native" ]; then
- 	make -j 6 $*
+ 	make -j `nproc` $*
  else
  	# Cross compile on a more capable machine
 +	if [ -n "$BUILD_WAYLAND" ]; then
@@ -128,7 +127,7 @@
  	pushd build/arm-linux/$BUILDSUBDIR
 -	cmake -DCMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
 +	cmake -DCMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE $WAYLAND_VARS ../../..
- 	make -j 6
+ 	make -j `nproc`
  
  	if [ "$1" != "" ]; then
 diff --git a/host_applications/linux/apps/raspicam/CMakeLists.txt b/host_applications/linux/apps/raspicam/CMakeLists.txt
@@ -808,16 +807,16 @@
  /*
  TODO: do an RPC call to make sure the Khronos vll is loaded (and that it stays loaded until eglTerminate)
  Also affects global image (and possibly others?)
-@@ -451,6 +444,9 @@ EGLAPI const char EGLAPIENTRY * eglQueryString(EGLDisplay dpy, EGLint name)
+@@ -450,6 +443,9 @@ EGLAPI const char EGLAPIENTRY * eglQueryString(EGLDisplay dpy, EGLint name)
+ #ifdef EGL_KHR_fence_sync
              "EGL_KHR_fence_sync "
  #endif
- #endif
++#endif
 +#if EGL_WL_bind_wayland_display
 +            "EGL_WL_bind_wayland_display "
-+#endif
+ #endif
              ;
           break;
-       case EGL_VENDOR:
 @@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig c
                                  false,
                                  EGL_NO_TEXTURE,
@@ -1542,7 +1541,7 @@
 +Libs: -L${libdir} -lwayland-egl
 +Cflags: -I${includedir}
 diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt
-index 0b3adc9..f44d01f 100755
+index fde18da..6718215 100755
 --- a/interface/vmcs_host/CMakeLists.txt
 +++ b/interface/vmcs_host/CMakeLists.txt
 @@ -9,13 +9,24 @@ add_definitions(-fno-strict-aliasing)
@@ -1551,12 +1550,12 @@
  
 -add_library(vchostif
 -            ${VMCS_TARGET}/vcfilesys.c ${VMCS_TARGET}/vcmisc.c
--            vc_vchi_gencmd.c vc_vchi_filesys.c
+-            vc_vchi_gencmd.c vc_vchi_filesys.c vc_vchi_gpuserv.c
 -            vc_vchi_tvservice.c vc_vchi_cecservice.c
 -            vc_vchi_dispmanx.c vc_service_common.c)
 +set(VCHOSTIF_SOURCE
 +    ${VMCS_TARGET}/vcfilesys.c ${VMCS_TARGET}/vcmisc.c
-+    vc_vchi_gencmd.c vc_vchi_filesys.c
++    vc_vchi_gencmd.c vc_vchi_filesys.c vc_vchi_gpuserv.c
 +    vc_vchi_tvservice.c vc_vchi_cecservice.c
 +    vc_vchi_dispmanx.c vc_service_common.c)
  #            ${VMCS_TARGET}/vmcs_main.c
@@ -1604,7 +1603,7 @@
  }
  #endif
 diff --git a/interface/vmcs_host/vc_vchi_dispmanx.c b/interface/vmcs_host/vc_vchi_dispmanx.c
-index 133e86d..45f4cff 100755
+index 7a6cdcd..eab146e 100755
 --- a/interface/vmcs_host/vc_vchi_dispmanx.c
 +++ b/interface/vmcs_host/vc_vchi_dispmanx.c
 @@ -1319,3 +1319,45 @@ static void *dispmanx_notify_func( void *arg ) {
@@ -1885,5 +1884,5 @@
 +    set(${_sources} ${${_sources}} PARENT_SCOPE)
 +endfunction()
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
index bbd9727..1d78755 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
Binary files differ
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
index 752b61a..d60c432 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
@@ -1,7 +1,7 @@
-From 718402e1be80ff9fb9863e847e31072ec735a5eb Mon Sep 17 00:00:00 2001
+From cae4ff834eef23c8f23126ba4d630db395f13aee Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 10 Aug 2015 02:38:27 -0700
-Subject: [PATCH 04/12] wayland-egl: Add bcm_host to dependencies
+Subject: [PATCH 04/15] wayland-egl: Add bcm_host to dependencies
 
 It uses headers like vcos_platform_types.h but does not
 depend on module which should add the required include paths
@@ -24,5 +24,5 @@
  Libs: -L${libdir} -lwayland-egl
  Cflags: -I${includedir}
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
index 05b0dfa..676f34c 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
@@ -1,7 +1,7 @@
-From 2a6e3d53a75fe44ec6fa3ae64c8ca5664b614979 Mon Sep 17 00:00:00 2001
+From 8ee4f6eedb81e9bfe0e603a21606c52f9501e609 Mon Sep 17 00:00:00 2001
 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 Date: Sat, 24 Jan 2015 22:07:19 +0100
-Subject: [PATCH 05/12] interface: remove faulty assert() to make weston happy
+Subject: [PATCH 05/15] interface: remove faulty assert() to make weston happy
  at runtime
 
 This was removed after a discussion on IRC with the weston guys
@@ -13,7 +13,7 @@
  1 file changed, 1 deletion(-)
 
 diff --git a/interface/vmcs_host/vc_vchi_dispmanx.c b/interface/vmcs_host/vc_vchi_dispmanx.c
-index 45f4cff..5d0368c 100755
+index eab146e..29e0dee 100755
 --- a/interface/vmcs_host/vc_vchi_dispmanx.c
 +++ b/interface/vmcs_host/vc_vchi_dispmanx.c
 @@ -1306,7 +1306,6 @@ static void *dispmanx_notify_func( void *arg ) {
@@ -25,5 +25,5 @@
              }
           } else {
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
index f4da1c1..a8f1f24 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
@@ -1,7 +1,7 @@
-From a3d43c1b754fc0576b428d36a877b9b50dd5d1ce Mon Sep 17 00:00:00 2001
+From 789b0b0c04b741c21dd573b78eded970721d14c2 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:10:47 -0800
-Subject: [PATCH 06/12] zero-out wl buffers in egl_surface_free
+Subject: [PATCH 06/15] zero-out wl buffers in egl_surface_free
 
 origins from buildroot
 
@@ -29,5 +29,5 @@
  #endif
     }
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
index 47f633a..ad2636a 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
@@ -1,7 +1,7 @@
-From 5b37f53cff07f37b281c25f987b9dbdacc264bf6 Mon Sep 17 00:00:00 2001
+From 762dd3156775f167ff0dfd44322dbb19a85822a7 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:11:41 -0800
-Subject: [PATCH 07/12] initialize front back wayland buffers
+Subject: [PATCH 07/15] initialize front back wayland buffers
 
 origins from metrological wayland support
 
@@ -30,5 +30,5 @@
     }
  #endif
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
index 7491842..1e66813 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
@@ -1,7 +1,7 @@
-From 14a749a3f840e93db548373b907a7a0e664dcfdb Mon Sep 17 00:00:00 2001
+From f8929adbf95ad3d44491cf6fc8a84a686b71193e Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:09:18 -0800
-Subject: [PATCH 08/12] Remove RPC_FLUSH
+Subject: [PATCH 08/15] Remove RPC_FLUSH
 
 Origins from buildroot
 
@@ -23,5 +23,5 @@
        }
  #endif
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
index 3f57d1e..214d5e2 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
@@ -1,7 +1,7 @@
-From b5392c39d7407a5226c9314bc01ed82877ff0539 Mon Sep 17 00:00:00 2001
+From f53e028f33f261f85883c9168977dd5486e9b47c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 13:12:47 -0800
-Subject: [PATCH 09/12] fix cmake dependency race
+Subject: [PATCH 09/15] fix cmake dependency race
 
 Fixes errors like
 
@@ -42,7 +42,7 @@
     add_library (vcos SHARED ${SOURCES})
     target_link_libraries (vcos pthread dl rt)
 diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt
-index f44d01f..9bcc2c3 100755
+index 6718215..c415176 100755
 --- a/interface/vmcs_host/CMakeLists.txt
 +++ b/interface/vmcs_host/CMakeLists.txt
 @@ -17,14 +17,6 @@ set(VCHOSTIF_SOURCE
@@ -74,5 +74,5 @@
  	struct wl_resource *resource;
  	struct wl_dispmanx *dispmanx;
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
index 8a34f3f..9f77920 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
@@ -1,7 +1,7 @@
-From 098faed5e7035b51f14700fdf4cf5875aa7af97e Mon Sep 17 00:00:00 2001
+From 6559a57c66c5f55571a1aa29cf14d9130a9ef2c9 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 29 Mar 2016 20:38:30 -0700
-Subject: [PATCH 10/12] Fix for framerate with nested composition
+Subject: [PATCH 10/15] Fix for framerate with nested composition
 
 frame rate appears irregular and lower than expected when using nested composition.
 
@@ -56,5 +56,5 @@
  #ifdef ANDROID
                 CLIENT_UNLOCK();
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
index f2455e5..5ee5cbd 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
@@ -1,7 +1,7 @@
-From b533d784484caead1dc84c766127e1d3854d2aad Mon Sep 17 00:00:00 2001
+From 3e396f0b514f3acf90c02f5d55b3816028367a55 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 2 Apr 2016 10:37:24 -0700
-Subject: [PATCH 11/12] build shared library for vchostif
+Subject: [PATCH 11/15] build shared library for vchostif
 
 Fixes #149
 
@@ -11,7 +11,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt
-index 9bcc2c3..0ef753f 100755
+index c415176..d0cca1a 100755
 --- a/interface/vmcs_host/CMakeLists.txt
 +++ b/interface/vmcs_host/CMakeLists.txt
 @@ -17,7 +17,7 @@ set(VCHOSTIF_SOURCE
@@ -24,5 +24,5 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
index aa3e0ef..48af588 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
@@ -1,7 +1,7 @@
-From ee5ebfcf0e030efed17f2a45fbb018a02dd421b3 Mon Sep 17 00:00:00 2001
+From f5b2263c8d65e307cb085414e08118cbbe00a94c Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 2 Apr 2016 10:54:59 -0700
-Subject: [PATCH 12/12] implement buffer wrapping interface for dispmanx
+Subject: [PATCH 12/15] implement buffer wrapping interface for dispmanx
 
 Courtesy: Zan Dobersek
 
@@ -88,5 +88,5 @@
  
  </protocol>
 -- 
-2.10.2
+2.15.0
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
new file mode 100644
index 0000000..d3a9840
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
@@ -0,0 +1,90 @@
+From 10ba55489002c2ccdf96d221301ec059c4574811 Mon Sep 17 00:00:00 2001
+From: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Date: Thu, 19 Jan 2017 18:56:07 +0000
+Subject: [PATCH 13/15] Implement triple buffering for wayland
+
+Change from double to triple buffering for wayland.
+This enables higher frame rates without tearing artifacts
+by allowing both the glFinish and the buffer release
+interlock to operate without pushing the frame period
+to two vertical intervals
+
+Signed-off-by: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ interface/khronos/egl/egl_client.c         |  3 ++-
+ interface/khronos/egl/egl_client_surface.c |  8 ++++++++
+ interface/khronos/egl/egl_client_surface.h | 11 +++++++++++
+ 3 files changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/interface/khronos/egl/egl_client.c b/interface/khronos/egl/egl_client.c
+index 13a110c..0380274 100644
+--- a/interface/khronos/egl/egl_client.c
++++ b/interface/khronos/egl/egl_client.c
+@@ -2323,7 +2323,8 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
+ 
+                   buffer_temp = surface->front_wl_buffer;
+                   surface->front_wl_buffer = surface->back_wl_buffer;
+-                  surface->back_wl_buffer = buffer_temp;
++                  surface->back_wl_buffer = surface->middle_wl_buffer;
++                  surface->middle_wl_buffer = buffer_temp;
+ 
+                   configid = egl_config_to_id(surface->config);
+                   color = egl_config_get_color_format(configid);
+diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
+index 9a9582c..10b3b04 100644
+--- a/interface/khronos/egl/egl_client_surface.c
++++ b/interface/khronos/egl/egl_client_surface.c
+@@ -402,12 +402,14 @@ EGL_SURFACE_T *egl_surface_create(
+    if (type == WINDOW && wl_display) {
+       surface->wl_egl_window = (struct wl_egl_window*)win;
+       surface->front_wl_buffer = NULL;
++      surface->middle_wl_buffer = NULL;
+       surface->back_wl_buffer = allocate_wl_buffer(
+             surface->wl_egl_window, color);
+       resource = surface->back_wl_buffer->resource;
+    } else {
+       surface->wl_egl_window = NULL;
+       surface->front_wl_buffer = NULL;
++      surface->middle_wl_buffer = NULL;
+       surface->back_wl_buffer = NULL;
+       resource = DISPMANX_NO_HANDLE;
+    }
+@@ -696,6 +698,12 @@ void egl_surface_free(EGL_SURFACE_T *surface)
+          surface->back_wl_buffer = 0;
+       }
+ 
++      if (surface->middle_wl_buffer) {
++         wl_buffer_destroy(surface->middle_wl_buffer->wl_buffer);
++         free(surface->middle_wl_buffer);
++         surface->middle_wl_buffer = 0;
++      }
++
+       if (surface->front_wl_buffer) {
+          wl_buffer_destroy(surface->front_wl_buffer->wl_buffer);
+          free(surface->front_wl_buffer);
+diff --git a/interface/khronos/egl/egl_client_surface.h b/interface/khronos/egl/egl_client_surface.h
+index e328b77..58a3184 100644
+--- a/interface/khronos/egl/egl_client_surface.h
++++ b/interface/khronos/egl/egl_client_surface.h
+@@ -312,6 +312,17 @@ typedef struct {
+    */
+    struct wl_dispmanx_client_buffer *front_wl_buffer;
+ 
++   /*
++      middle_wl_buffer
++
++      Validity:
++      type == WINDOW
++
++      Invariant:
++      client-side information about the wl_buffer in the middle
++   */
++   struct wl_dispmanx_client_buffer *middle_wl_buffer;
++
+    /*
+       back_wl_buffer
+ 
+-- 
+2.15.0
+
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
new file mode 100644
index 0000000..b596056
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
@@ -0,0 +1,30 @@
+From d750c738b5c23bba24531cb713292e4ab3f2ec56 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 10 May 2017 06:39:34 +0000
+Subject: [PATCH 14/15] GLES2/gl2ext.h: Define GL_R8_EXT and GL_RG8_EXT
+
+weston code uses these defines
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ interface/khronos/include/GLES2/gl2ext.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/interface/khronos/include/GLES2/gl2ext.h b/interface/khronos/include/GLES2/gl2ext.h
+index 4eacf7f..283e3e1 100644
+--- a/interface/khronos/include/GLES2/gl2ext.h
++++ b/interface/khronos/include/GLES2/gl2ext.h
+@@ -327,6 +327,9 @@ typedef void* GLeglImageOES;
+ #define GL_RGBX_BRCM                                            0x80EE
+ #endif
+ 
++#define GL_R8_EXT                                               0x8229
++#define GL_RG8_EXT                                              0x822B
++
+ /* GL_EXT_texture_type_2_10_10_10_REV */
+ #ifndef GL_EXT_texture_type_2_10_10_10_REV
+ #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
+-- 
+2.15.0
+
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
new file mode 100644
index 0000000..f10740b
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
@@ -0,0 +1,32 @@
+From 827907f2223df93918e680101a1ac6228ba0f07e Mon Sep 17 00:00:00 2001
+From: Andrea Galbusera <gizero@gmail.com>
+Date: Fri, 14 Jul 2017 09:52:54 +0200
+Subject: [PATCH 15/15] EGL/glplatform.h: define EGL_CAST
+
+C++ / C typecast macros for special EGL handle values: used by libepoxy code
+The definition comes from the updated version of this header in mesa.
+
+Upstream-Status: Pending
+---
+ interface/khronos/include/EGL/eglplatform.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/interface/khronos/include/EGL/eglplatform.h b/interface/khronos/include/EGL/eglplatform.h
+index 1f7c930..c39d425 100644
+--- a/interface/khronos/include/EGL/eglplatform.h
++++ b/interface/khronos/include/EGL/eglplatform.h
+@@ -202,4 +202,11 @@ EGLAPI void EGLAPIENTRY BEGL_GetDefaultDriverInterfaces(BEGL_DriverInterfaces *i
+ #include "interface/khronos/common/khrn_client_mangle.h"
+ #endif
+ 
++/* C++ / C typecast macros for special EGL handle values */
++#if defined(__cplusplus)
++#define EGL_CAST(type, value) (static_cast<type>(value))
++#else
++#define EGL_CAST(type, value) ((type) (value))
++#endif
++
+ #endif /* __eglplatform_h */
+-- 
+2.15.0
+
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
index a37249c..579aace 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
@@ -10,13 +10,13 @@
 PROVIDES = "virtual/libgles2 \
             virtual/egl"
 
-RPROVIDES_${PN} += "libgles2 libgl"
+RPROVIDES_${PN} += "libgles2 egl libegl"
 
 COMPATIBLE_MACHINE = "raspberrypi"
 
 SRCBRANCH = "master"
 SRCFORK = "raspberrypi"
-SRCREV = "bb15afe33b313fe045d52277a78653d288e04f67"
+SRCREV = "bc3c52a51315399a9f31ed24049eb4bc81fd1c60"
 
 SRC_URI = "\
     git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
@@ -32,6 +32,9 @@
     file://0010-Fix-for-framerate-with-nested-composition.patch \
     file://0011-build-shared-library-for-vchostif.patch \
     file://0012-implement-buffer-wrapping-interface-for-dispmanx.patch \
+    file://0013-Implement-triple-buffering-for-wayland.patch \
+    file://0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch \
+    file://0015-EGL-glplatform.h-define-EGL_CAST.patch \
 "
 S = "${WORKDIR}/git"
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend
index 6fd17da..a5a6af3 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend
@@ -7,5 +7,3 @@
     ${@bb.utils.contains("DISTRO_FEATURES", "wayland", "xwayland", "", d)} \
     ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)} \
 "
-
-XSERVER_RRECOMMENDS_append = " xf86-input-libinput"