Yocto 2.5

Move OpenBMC to Yocto 2.5(sumo)

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
index e789022..52fe757 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,3 +1,7 @@
-PACKAGECONFIG_append_rpi = " gallium"
+# DRI3 note:
+# With oe-core commit 8509e2e1a87578882b71948ccef3b50ccf1228b3 dri3 is set
+# as default. To state out clearly that Raspi needs dri3 and to avoid surprises
+# in case oe-core changes this default, we set dri3 explicitly.
+PACKAGECONFIG_append_rpi = " gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)}"
 GALLIUMDRIVERS_rpi = "vc4"
 DRIDRIVERS_rpi = ""
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 5861c4e..933f279 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 e45bc677368d0f8d42720aad242f33f6e2687fb1 Mon Sep 17 00:00:00 2001
+From 0a64dc61d3d7db69389157ae757203b4b3afdbfa 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/15] Allow applications to set next resource handle
+Subject: [PATCH 01/16] 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.15.0
+2.16.1
 
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 d6e6476..4613504 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 15fb270f438f4ef1413192b5ce1e0dc784b45d9e Mon Sep 17 00:00:00 2001
+From 5608ec8002be8370e78c9dbb1e07cee4cfb18b58 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/15] wayland: Add support for the Wayland winsys
+Subject: [PATCH 02/16] wayland: Add support for the Wayland winsys
 
 * Adds EGL_WL_bind_wayland_display extension
 * Adds wayland-egl library
@@ -57,20 +57,20 @@
  create mode 100644 interface/wayland/dispmanx.xml
  create mode 100644 makefiles/cmake/Wayland.cmake
 
-diff --git a/.gitignore b/.gitignore
-index 63570f1..1459436 100644
---- a/.gitignore
-+++ b/.gitignore
+Index: git/.gitignore
+===================================================================
+--- git.orig/.gitignore
++++ git/.gitignore
 @@ -30,3 +30,4 @@ build/
  *.pts
  *.ppm
  *.mkv
 +*~
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index cfc8ae5..673a5ad 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.cmake)
+Index: git/CMakeLists.txt
+===================================================================
+--- git.orig/CMakeLists.txt
++++ git/CMakeLists.txt
+@@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.
  include(makefiles/cmake/arm-linux.cmake)
  include(makefiles/cmake/vmcs.cmake)
  
@@ -88,22 +88,22 @@
  enable_language(ASM)
  
  # Global include paths
-diff --git a/README.md b/README.md
-index 358d2b4..4da4448 100644
---- a/README.md
-+++ b/README.md
-@@ -4,3 +4,7 @@ EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG.
- 
- Use buildme to build. It requires cmake to be installed and an arm cross compiler. It is set up to use this one:
+Index: git/README.md
+===================================================================
+--- git.orig/README.md
++++ git/README.md
+@@ -6,3 +6,7 @@ Use buildme to build. It requires cmake
  https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian
+ 
+ Note that this repository does not contain the source for the edid_parser and vcdbg binaries due to licensing restrictions.
 +
 +To build support for the Wayland winsys in EGL, execute the buildme script like this:
 +
 +$ BUILD_WAYLAND=1 ./buildme.
-diff --git a/buildme b/buildme
-index b8fd440..a780bb6 100755
---- a/buildme
-+++ b/buildme
+Index: git/buildme
+===================================================================
+--- git.orig/buildme
++++ git/buildme
 @@ -8,6 +8,10 @@ fi
  
  BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
@@ -130,11 +130,11 @@
  	make -j `nproc`
  
  	if [ "$1" != "" ]; then
-diff --git a/host_applications/linux/apps/raspicam/CMakeLists.txt b/host_applications/linux/apps/raspicam/CMakeLists.txt
-index e6aa6b8..69059cb 100644
---- a/host_applications/linux/apps/raspicam/CMakeLists.txt
-+++ b/host_applications/linux/apps/raspicam/CMakeLists.txt
-@@ -28,7 +28,7 @@ add_executable(raspividyuv  ${COMMON_SOURCES} RaspiVidYUV.c)
+Index: git/host_applications/linux/apps/raspicam/CMakeLists.txt
+===================================================================
+--- git.orig/host_applications/linux/apps/raspicam/CMakeLists.txt
++++ git/host_applications/linux/apps/raspicam/CMakeLists.txt
+@@ -28,7 +28,7 @@ add_executable(raspividyuv  ${COMMON_SOU
  
  set (MMAL_LIBS mmal_core mmal_util mmal_vc_client)
  
@@ -143,10 +143,10 @@
  target_link_libraries(raspiyuv   ${MMAL_LIBS} vcos bcm_host)
  target_link_libraries(raspivid   ${MMAL_LIBS} vcos bcm_host)
  target_link_libraries(raspividyuv   ${MMAL_LIBS} vcos bcm_host)
-diff --git a/interface/khronos/CMakeLists.txt b/interface/khronos/CMakeLists.txt
-index 9ad615b..3d3571a 100644
---- a/interface/khronos/CMakeLists.txt
-+++ b/interface/khronos/CMakeLists.txt
+Index: git/interface/khronos/CMakeLists.txt
+===================================================================
+--- git.orig/interface/khronos/CMakeLists.txt
++++ git/interface/khronos/CMakeLists.txt
 @@ -6,6 +6,12 @@
  # have quite a few circular dependencies, and so the only way
  # to make it work seems to be to have everything static.
@@ -160,7 +160,7 @@
  set(EGL_SOURCE
     egl/egl_client_config.c
     egl/egl_client_context.c
-@@ -55,12 +61,56 @@ set(CLIENT_SOURCE
+@@ -55,12 +61,55 @@ set(CLIENT_SOURCE
     common/khrn_int_hash_asm.s
     common/khrn_client_cache.c)
  
@@ -168,8 +168,7 @@
 +   khrn_client
 +   vchiq_arm
 +   vcos
-+   bcm_host
-+   -lm)
++   bcm_host)
 +
 +if (BUILD_WAYLAND)
 +   set(EGL_SOURCE
@@ -217,21 +216,30 @@
  # TODO do we need EGL_static and GLESv2_static now that khrn_static exists?
  add_library(EGL_static STATIC ${EGL_SOURCE})
  add_library(GLESv2_static STATIC ${GLES_SOURCE})
-@@ -72,8 +122,7 @@ include_directories (../../host_applications/linux/libs/sm )
+@@ -72,8 +121,7 @@ include_directories (../../host_applicat
  set(VCSM_LIBS vcsm)
  add_definitions(-DKHRONOS_HAVE_VCSM)
  endif()
 -
 -target_link_libraries(EGL khrn_client vchiq_arm vcos bcm_host ${VCSM_LIBS} -lm)
-+target_link_libraries(EGL ${EGL_LIBS} ${VCSM_LIBS})
++target_link_libraries(EGL ${EGL_LIBS} ${VCSM_LIBS} -lm)
  target_link_libraries(GLESv2 EGL khrn_client vcos)
  target_link_libraries(WFC EGL)
  target_link_libraries(OpenVG EGL)
-diff --git a/interface/khronos/common/khrn_client.c b/interface/khronos/common/khrn_client.c
-index ef4babd..d7e798e 100644
---- a/interface/khronos/common/khrn_client.c
-+++ b/interface/khronos/common/khrn_client.c
-@@ -54,6 +54,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+@@ -87,7 +135,7 @@ add_library(brcmGLESv2 ${SHARED} ${GLES_
+ add_library(brcmOpenVG ${SHARED} ${VG_SOURCE})
+ add_library(brcmWFC ${SHARED} ${WFC_SOURCE})
+ 
+-target_link_libraries(brcmEGL khrn_client vchiq_arm vcos bcm_host ${VCSM_LIBS} -lm)
++target_link_libraries(brcmEGL ${EGL_LIBS} ${VCSM_LIBS} -lm)
+ target_link_libraries(brcmGLESv2 brcmEGL khrn_client vcos)
+ target_link_libraries(brcmWFC brcmEGL)
+ target_link_libraries(brcmOpenVG brcmEGL)
+Index: git/interface/khronos/common/khrn_client.c
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client.c
++++ git/interface/khronos/common/khrn_client.c
+@@ -54,6 +54,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "applications/vmcs/khronos/khronos_server.h"
  #endif
  
@@ -242,7 +250,7 @@
  VCOS_LOG_CAT_T khrn_client_log = VCOS_LOG_INIT("khrn_client", VCOS_LOG_WARN);
  
  /*
-@@ -142,6 +146,10 @@ void client_try_unload_server(CLIENT_PROCESS_STATE_T *process)
+@@ -142,6 +146,10 @@ void client_try_unload_server(CLIENT_PRO
  bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
  {
     if (!process->inited) {
@@ -253,7 +261,7 @@
        if (!khrn_pointer_map_init(&process->contexts, 64))
           return false;
  
-@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
+@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PR
        }
  #endif
  
@@ -267,10 +275,10 @@
        process->inited = true;
     }
  
-diff --git a/interface/khronos/common/khrn_client.h b/interface/khronos/common/khrn_client.h
-index 804039b..615f7b4 100644
---- a/interface/khronos/common/khrn_client.h
-+++ b/interface/khronos/common/khrn_client.h
+Index: git/interface/khronos/common/khrn_client.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client.h
++++ git/interface/khronos/common/khrn_client.h
 @@ -310,6 +310,16 @@ struct CLIENT_PROCESS_STATE {
  #ifdef RPC_LIBRARY
     KHRONOS_SERVER_CONNECTION_T khrn_connection;
@@ -288,11 +296,11 @@
  };
  
  extern bool client_process_state_init(CLIENT_PROCESS_STATE_T *process);
-diff --git a/interface/khronos/common/khrn_client_mangle.h b/interface/khronos/common/khrn_client_mangle.h
-index b3c04f4..b7b21c5 100644
---- a/interface/khronos/common/khrn_client_mangle.h
-+++ b/interface/khronos/common/khrn_client_mangle.h
-@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_mangle.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_mangle.h
++++ git/interface/khronos/common/khrn_client_mangle.h
+@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #define eglReleaseGlobalImageBRCM mangled_eglReleaseGlobalImageBRCM
  #define eglInitGlobalImageBRCM mangled_eglInitGlobalImageBRCM
  #define eglTermGlobalImageBRCM mangled_eglTermGlobalImageBRCM
@@ -302,11 +310,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-diff --git a/interface/khronos/common/khrn_client_platform.h b/interface/khronos/common/khrn_client_platform.h
-index 1c9da3a..715c67e 100644
---- a/interface/khronos/common/khrn_client_platform.h
-+++ b/interface/khronos/common/khrn_client_platform.h
-@@ -48,6 +48,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_platform.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_platform.h
++++ git/interface/khronos/common/khrn_client_platform.h
+@@ -48,6 +48,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "interface/khronos/common/vcos/khrn_client_platform_filler_vcos.h"
  #endif
  
@@ -326,11 +334,11 @@
 +#endif
 +
  #endif // KHRN_CLIENT_PLATFORM_H
-diff --git a/interface/khronos/common/khrn_client_unmangle.h b/interface/khronos/common/khrn_client_unmangle.h
-index 4f3ce49..84f6ec0 100644
---- a/interface/khronos/common/khrn_client_unmangle.h
-+++ b/interface/khronos/common/khrn_client_unmangle.h
-@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_unmangle.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_unmangle.h
++++ git/interface/khronos/common/khrn_client_unmangle.h
+@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #undef eglReleaseGlobalImageBRCM
  #undef eglInitGlobalImageBRCM
  #undef eglTermGlobalImageBRCM
@@ -340,11 +348,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-diff --git a/interface/khronos/common/linux/khrn_client_platform_linux.c b/interface/khronos/common/linux/khrn_client_platform_linux.c
-index 710d20f..50d60a6 100644
---- a/interface/khronos/common/linux/khrn_client_platform_linux.c
-+++ b/interface/khronos/common/linux/khrn_client_platform_linux.c
-@@ -37,6 +37,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/linux/khrn_client_platform_linux.c
+===================================================================
+--- git.orig/interface/khronos/common/linux/khrn_client_platform_linux.c
++++ git/interface/khronos/common/linux/khrn_client_platform_linux.c
+@@ -37,6 +37,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "X11/Xlib.h"
  #endif
  
@@ -356,7 +364,7 @@
  extern VCOS_LOG_CAT_T khrn_client_log;
  
  extern void vc_vchi_khronos_init();
-@@ -464,13 +469,36 @@ EGLDisplay khrn_platform_set_display_id(EGLNativeDisplayType display_id)
+@@ -464,14 +469,37 @@ EGLDisplay khrn_platform_set_display_id(
  	   return EGL_NO_DISPLAY;
  }
  #else
@@ -384,18 +392,19 @@
 +#endif
 +         return EGL_NO_DISPLAY;
 +   }
- }
++}
 +
 +#ifdef BUILD_WAYLAND
 +struct wl_display *khrn_platform_get_wl_display()
 +{
 +   return hacky_display;
-+}
-+#endif
+ }
  #endif
++#endif
  
  #ifdef WANT_X
-@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_default(EGLNativeWindowType win)
+ static void dump_hierarchy(Window w, Window thisw, Window look, int level)
+@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_defa
  void platform_get_dimensions(EGLDisplay dpy, EGLNativeWindowType win,
        uint32_t *width, uint32_t *height, uint32_t *swapchain_count)
  {
@@ -426,8 +435,8 @@
 +#ifdef BUILD_WAYLAND
 +   }
 +#endif
- }
- 
++}
++
 +#ifdef BUILD_WAYLAND
 +static DISPMANX_ELEMENT_HANDLE_T create_dummy_element()
 +{
@@ -458,9 +467,9 @@
 +   vc_dispmanx_display_close(display);
 +
 +   return element;
-+}
+ }
 +#endif
-+
+ 
  uint32_t platform_get_handle(EGLDisplay dpy, EGLNativeWindowType win)
  {
 -   EGL_DISPMANX_WINDOW_T *dwin = check_default(win);
@@ -489,11 +498,10 @@
  }
  
  #endif
-diff --git a/interface/khronos/common/linux/khrn_wayland.c b/interface/khronos/common/linux/khrn_wayland.c
-new file mode 100644
-index 0000000..0e1b9e7
+Index: git/interface/khronos/common/linux/khrn_wayland.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/common/linux/khrn_wayland.c
++++ git/interface/khronos/common/linux/khrn_wayland.c
 @@ -0,0 +1,215 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -710,74 +718,72 @@
 +
 +   return wl_dispmanx_client_buffer;
 +}
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.h b/interface/khronos/common/linux/khrn_wayland.h
-similarity index 56%
-copy from interface/vmcs_host/vc_vchi_dispmanx.h
-copy to interface/khronos/common/linux/khrn_wayland.h
-index b723b76..b9bf08c 100644
---- a/interface/vmcs_host/vc_vchi_dispmanx.h
-+++ b/interface/khronos/common/linux/khrn_wayland.h
-@@ -1,5 +1,5 @@
- /*
--Copyright (c) 2012, Broadcom Europe Ltd
+Index: git/interface/vmcs_host/vc_vchi_dispmanx.h
+===================================================================
+--- git.orig/interface/vmcs_host/vc_vchi_dispmanx.h
++++ git/interface/vmcs_host/vc_vchi_dispmanx.h
+@@ -66,4 +66,19 @@ typedef struct {
+ #define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
+ #define ELEMENT_CHANGE_TRANSFORM      (1<<5)
+ 
++#ifdef BUILD_WAYLAND
++/* XXX: This should be in a private header that can be included from EGL and vc_* */
++#include <wayland-server.h>
++#include "interface/vmcs_host/wayland-dispmanx-server-protocol.h"
++struct wl_dispmanx_server_buffer {
++	struct wl_resource *resource;
++	struct wl_dispmanx *dispmanx;
++	enum wl_dispmanx_format format;
++	DISPMANX_RESOURCE_HANDLE_T handle;
++	int32_t width;
++	int32_t height;
++	int in_use;
++};
++#endif
++
+ #endif
+Index: git/interface/khronos/common/linux/khrn_wayland.h
+===================================================================
+--- /dev/null
++++ git/interface/khronos/common/linux/khrn_wayland.h
+@@ -0,0 +1,33 @@
++/*
 +Copyright (c) 2013, Raspberry Pi Foundation
- All rights reserved.
- 
- Redistribution and use in source and binary forms, with or without
-@@ -25,45 +25,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- 
--#ifndef VC_VCHI_DISPMANX_H
--#define VC_VCHI_DISPMANX_H
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++    * Redistributions of source code must retain the above copyright
++      notice, this list of conditions and the following disclaimer.
++    * Redistributions in binary form must reproduce the above copyright
++      notice, this list of conditions and the following disclaimer in the
++      documentation and/or other materials provided with the distribution.
++    * Neither the name of the copyright holder nor the
++      names of its contributors may be used to endorse or promote products
++      derived from this software without specific prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++*/
++
 +#include "interface/khronos/common/khrn_client.h"
- 
--#include "interface/peer/vc_vchi_dispmanx_common.h"
++
 +int init_process_wayland(CLIENT_PROCESS_STATE_T *process);
 +int do_wl_roundtrip();
- 
--#define VC_NUM_HOST_RESOURCES 64
--#define DISPMANX_MSGFIFO_SIZE 1024
--#define DISPMANX_CLIENT_NAME MAKE_FOURCC("DISP")
--#define DISPMANX_NOTIFY_NAME MAKE_FOURCC("UPDH")
--
--//Or with command to indicate we don't need a response
--#define DISPMANX_NO_REPLY_MASK (1<<31)
--
--typedef struct {
--   char     description[32];
--   uint32_t width;
--   uint32_t height;
--   uint32_t aspect_pixwidth;
--   uint32_t aspect_pixheight;
--   uint32_t fieldrate_num;
--   uint32_t fieldrate_denom;
--   uint32_t fields_per_frame;
--   uint32_t transform;        
--} GET_MODES_DATA_T;
--
--typedef struct {
--   int32_t  response;
--   uint32_t width;
--   uint32_t height;
--   uint32_t transform;
--   uint32_t input_format;
--} GET_INFO_DATA_T;
--
--//Attributes changes flag mask
--#define ELEMENT_CHANGE_LAYER          (1<<0)
--#define ELEMENT_CHANGE_OPACITY        (1<<1)
--#define ELEMENT_CHANGE_DEST_RECT      (1<<2)
--#define ELEMENT_CHANGE_SRC_RECT       (1<<3)
--#define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
--#define ELEMENT_CHANGE_TRANSFORM      (1<<5)
--
--#endif
++
 +struct wl_dispmanx_client_buffer *allocate_wl_buffer(struct wl_egl_window *window, KHRN_IMAGE_FORMAT_T color);
-diff --git a/interface/khronos/egl/egl_client.c b/interface/khronos/egl/egl_client.c
-index b8bb374..03fe67b 100644
---- a/interface/khronos/egl/egl_client.c
-+++ b/interface/khronos/egl/egl_client.c
+Index: git/interface/khronos/egl/egl_client.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client.c
++++ git/interface/khronos/egl/egl_client.c
 @@ -153,6 +153,10 @@ by an attribute value"
  #include <stdlib.h>
  #include <string.h>
@@ -789,7 +795,7 @@
  
  #include "interface/khronos/egl/egl_client_cr.c"
  
-@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_PROCESS_STATE_T *process, EGL_CURRENT_T *
+@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_P
  void egl_gl_flush_callback(bool wait);
  void egl_vg_flush_callback(bool wait);
  
@@ -807,17 +813,17 @@
  /*
  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?)
-@@ -450,6 +443,9 @@ EGLAPI const char EGLAPIENTRY * eglQueryString(EGLDisplay dpy, EGLint name)
- #ifdef EGL_KHR_fence_sync
+@@ -451,6 +444,9 @@ EGLAPI const char EGLAPIENTRY * eglQuery
              "EGL_KHR_fence_sync "
  #endif
-+#endif
+ #endif
 +#if EGL_WL_bind_wayland_display
 +            "EGL_WL_bind_wayland_display "
- #endif
++#endif
              ;
           break;
-@@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig c
+       case EGL_VENDOR:
+@@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateW
                                  false,
                                  EGL_NO_TEXTURE,
                                  EGL_NO_TEXTURE,
@@ -827,7 +833,7 @@
  
                 if (surface) {
                    if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig
+@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
                               mipmap_texture,
                               texture_format,
                               texture_target,
@@ -836,7 +842,7 @@
  
              if (surface) {
                 if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig c
+@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
                                     false,
                                     EGL_NO_TEXTURE,
                                     EGL_NO_TEXTURE,
@@ -845,7 +851,7 @@
  
                       if (surface) {
                          if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
+@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
     CLIENT_THREAD_STATE_T *thread;
     CLIENT_PROCESS_STATE_T *process;
     EGLBoolean result;
@@ -855,7 +861,7 @@
  
     vcos_log_trace("eglSwapBuffers start. dpy=%d. surf=%d.", (int)dpy, (int)surf);
  
-@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
+@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
  
                 vcos_log_trace("eglSwapBuffers server call");
  
@@ -926,11 +932,11 @@
                 RPC_CALL6(eglIntSwapBuffers_impl,
                       thread,
                       EGLINTSWAPBUFFERS_ID,
-diff --git a/interface/khronos/egl/egl_client_get_proc.c b/interface/khronos/egl/egl_client_get_proc.c
-index 4cfa9ff..6a715af 100644
---- a/interface/khronos/egl/egl_client_get_proc.c
-+++ b/interface/khronos/egl/egl_client_get_proc.c
-@@ -254,6 +254,17 @@ EGLAPI void EGLAPIENTRY (* eglGetProcAddress(const char *procname))(void)
+Index: git/interface/khronos/egl/egl_client_get_proc.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_get_proc.c
++++ git/interface/khronos/egl/egl_client_get_proc.c
+@@ -254,6 +254,17 @@ EGLAPI void EGLAPIENTRY (* eglGetProcAdd
        return (void(*)(void))eglQueryGlobalImageBRCM;
  #endif
  
@@ -948,11 +954,11 @@
     return (void(*)(void)) NULL;
  }
  
-diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
-index 128325e..42350bf 100644
---- a/interface/khronos/egl/egl_client_surface.c
-+++ b/interface/khronos/egl/egl_client_surface.c
-@@ -46,6 +46,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/egl/egl_client_surface.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_surface.c
++++ git/interface/khronos/egl/egl_client_surface.c
+@@ -46,6 +46,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "interface/khronos/egl/egl_int_impl.h"
  #endif
  
@@ -1026,7 +1032,7 @@
           RPC_CALL15_OUT_CTRL(eglIntCreateSurface_impl,
                               thread,
                               EGLINTCREATESURFACE_ID,
-@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *surface)
+@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *sur
     if( surface->type == WINDOW ) {
        vcos_log_trace("egl_surface_free: calling platform_destroy_winhandle...");
        platform_destroy_winhandle( surface->win, surface->internal_handle );
@@ -1045,10 +1051,10 @@
     }
     /* return value ignored -- read performed to ensure blocking. we want this to
      * block so clients can safely destroy the surface's window as soon as the
-diff --git a/interface/khronos/egl/egl_client_surface.h b/interface/khronos/egl/egl_client_surface.h
-index b5bf70a..e328b77 100644
---- a/interface/khronos/egl/egl_client_surface.h
-+++ b/interface/khronos/egl/egl_client_surface.h
+Index: git/interface/khronos/egl/egl_client_surface.h
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_surface.h
++++ git/interface/khronos/egl/egl_client_surface.h
 @@ -288,6 +288,41 @@ typedef struct {
        type == PIXMAP
     */
@@ -1091,7 +1097,7 @@
  } EGL_SURFACE_T;
  
  extern bool egl_surface_check_attribs(
-@@ -322,8 +357,7 @@ extern EGL_SURFACE_T *egl_surface_create(
+@@ -322,8 +357,7 @@ extern EGL_SURFACE_T *egl_surface_create
     EGLenum texture_format,
     EGLenum texture_target,
     EGLNativePixmapType pixmap,
@@ -1101,10 +1107,10 @@
  extern EGL_SURFACE_T *egl_surface_from_vg_image(
     VGImage vg_handle,
     EGLSurface name,
-diff --git a/interface/khronos/egl/egl_int_impl.h b/interface/khronos/egl/egl_int_impl.h
-index 51b3580..6863a3b 100644
---- a/interface/khronos/egl/egl_int_impl.h
-+++ b/interface/khronos/egl/egl_int_impl.h
+Index: git/interface/khronos/egl/egl_int_impl.h
+===================================================================
+--- git.orig/interface/khronos/egl/egl_int_impl.h
++++ git/interface/khronos/egl/egl_int_impl.h
 @@ -57,7 +57,7 @@ FN(int, eglIntCreateSurface_impl, (
     uint32_t sem,
     uint32_t type,
@@ -1114,11 +1120,10 @@
  
  FN(int, eglIntCreatePbufferFromVGImage_impl, (
     VGImage vg_handle,
-diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
-new file mode 100644
-index 0000000..5730743
+Index: git/interface/khronos/ext/egl_wayland.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/ext/egl_wayland.c
++++ git/interface/khronos/ext/egl_wayland.c
 @@ -0,0 +1,246 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -1366,11 +1371,11 @@
 +
 +   return EGL_FALSE;
 +}
-diff --git a/interface/khronos/include/EGL/eglext.h b/interface/khronos/include/EGL/eglext.h
-index 89a3369..d7e5ba7 100755
---- a/interface/khronos/include/EGL/eglext.h
-+++ b/interface/khronos/include/EGL/eglext.h
-@@ -191,6 +191,29 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
+Index: git/interface/khronos/include/EGL/eglext.h
+===================================================================
+--- git.orig/interface/khronos/include/EGL/eglext.h
++++ git/interface/khronos/include/EGL/eglext.h
+@@ -191,6 +191,29 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLG
  #endif
  
  
@@ -1400,11 +1405,10 @@
  #ifdef __cplusplus
  }
  #endif
-diff --git a/interface/khronos/wayland-egl/wayland-egl-priv.h b/interface/khronos/wayland-egl/wayland-egl-priv.h
-new file mode 100644
-index 0000000..8e38d36
+Index: git/interface/khronos/wayland-egl/wayland-egl-priv.h
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl-priv.h
++++ git/interface/khronos/wayland-egl/wayland-egl-priv.h
 @@ -0,0 +1,53 @@
 +/* Copied from Mesa */
 +
@@ -1459,11 +1463,10 @@
 +#endif
 +
 +#endif
-diff --git a/interface/khronos/wayland-egl/wayland-egl.c b/interface/khronos/wayland-egl/wayland-egl.c
-new file mode 100644
-index 0000000..b8f050b
+Index: git/interface/khronos/wayland-egl/wayland-egl.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl.c
++++ git/interface/khronos/wayland-egl/wayland-egl.c
 @@ -0,0 +1,59 @@
 +/* Copied from Mesa */
 +
@@ -1524,11 +1527,10 @@
 +	if (height)
 +		*height = egl_window->attached_height;
 +}
-diff --git a/interface/khronos/wayland-egl/wayland-egl.pc.in b/interface/khronos/wayland-egl/wayland-egl.pc.in
-new file mode 100644
-index 0000000..8bafc15
+Index: git/interface/khronos/wayland-egl/wayland-egl.pc.in
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl.pc.in
++++ git/interface/khronos/wayland-egl/wayland-egl.pc.in
 @@ -0,0 +1,10 @@
 +prefix=@CMAKE_INSTALL_PREFIX@
 +exec_prefix=${prefix}
@@ -1540,10 +1542,10 @@
 +Version: @PROJECT_APIVER@
 +Libs: -L${libdir} -lwayland-egl
 +Cflags: -I${includedir}
-diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt
-index fde18da..6718215 100755
---- a/interface/vmcs_host/CMakeLists.txt
-+++ b/interface/vmcs_host/CMakeLists.txt
+Index: git/interface/vmcs_host/CMakeLists.txt
+===================================================================
+--- git.orig/interface/vmcs_host/CMakeLists.txt
++++ git/interface/vmcs_host/CMakeLists.txt
 @@ -9,13 +9,24 @@ add_definitions(-fno-strict-aliasing)
  
  include_directories(${VMCS_TARGET}/vcfiled)
@@ -1574,11 +1576,11 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
  # OpenMAX/IL component service
-diff --git a/interface/vmcs_host/vc_dispmanx.h b/interface/vmcs_host/vc_dispmanx.h
-index 37fdae1..fe3619a 100755
---- a/interface/vmcs_host/vc_dispmanx.h
-+++ b/interface/vmcs_host/vc_dispmanx.h
-@@ -39,6 +39,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/vmcs_host/vc_dispmanx.h
+===================================================================
+--- git.orig/interface/vmcs_host/vc_dispmanx.h
++++ git/interface/vmcs_host/vc_dispmanx.h
+@@ -39,6 +39,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #ifdef __cplusplus
  extern "C" {
  #endif
@@ -1590,7 +1592,7 @@
  // Same function as above, to aid migration of code.
  VCHPRE_ int VCHPOST_ vc_dispman_init( void );
  // Stop the service from being used
-@@ -135,6 +140,11 @@ VCHPRE_ int VCHPOST_ vc_dispmanx_resource_set_palette( DISPMANX_RESOURCE_HANDLE_
+@@ -135,6 +140,11 @@ VCHPRE_ int VCHPOST_ vc_dispmanx_resourc
  // Start triggering callbacks synced to vsync
  VCHPRE_ int VCHPOST_ vc_dispmanx_vsync_callback( DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_CALLBACK_FUNC_T cb_func, void *cb_arg );
  
@@ -1602,11 +1604,11 @@
  #ifdef __cplusplus
  }
  #endif
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.c b/interface/vmcs_host/vc_vchi_dispmanx.c
-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 ) {
+Index: git/interface/vmcs_host/vc_vchi_dispmanx.c
+===================================================================
+--- git.orig/interface/vmcs_host/vc_vchi_dispmanx.c
++++ git/interface/vmcs_host/vc_vchi_dispmanx.c
+@@ -1319,3 +1319,45 @@ static void *dispmanx_notify_func( void
     }
     return 0;
  }
@@ -1652,35 +1654,10 @@
 +	buffer->in_use = in_use;
 +}
 +#endif
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.h b/interface/vmcs_host/vc_vchi_dispmanx.h
-index b723b76..f0bae30 100644
---- a/interface/vmcs_host/vc_vchi_dispmanx.h
-+++ b/interface/vmcs_host/vc_vchi_dispmanx.h
-@@ -66,4 +66,19 @@ typedef struct {
- #define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
- #define ELEMENT_CHANGE_TRANSFORM      (1<<5)
- 
-+#ifdef BUILD_WAYLAND
-+/* XXX: This should be in a private header that can be included from EGL and vc_* */
-+#include <wayland-server.h>
-+#include "interface/vmcs_host/wayland-dispmanx-server-protocol.h"
-+struct wl_dispmanx_server_buffer {
-+	struct wl_resource *resource;
-+	struct wl_dispmanx *dispmanx;
-+	enum wl_dispmanx_format format;
-+	DISPMANX_RESOURCE_HANDLE_T handle;
-+	int32_t width;
-+	int32_t height;
-+	int in_use;
-+};
-+#endif
-+
- #endif
-diff --git a/interface/wayland/dispmanx.xml b/interface/wayland/dispmanx.xml
-new file mode 100644
-index 0000000..c18626d
+Index: git/interface/wayland/dispmanx.xml
+===================================================================
 --- /dev/null
-+++ b/interface/wayland/dispmanx.xml
++++ git/interface/wayland/dispmanx.xml
 @@ -0,0 +1,123 @@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<protocol name="dispmanx">
@@ -1805,11 +1782,10 @@
 +  </interface>
 +
 +</protocol>
-diff --git a/makefiles/cmake/Wayland.cmake b/makefiles/cmake/Wayland.cmake
-new file mode 100644
-index 0000000..ad90d30
+Index: git/makefiles/cmake/Wayland.cmake
+===================================================================
 --- /dev/null
-+++ b/makefiles/cmake/Wayland.cmake
++++ git/makefiles/cmake/Wayland.cmake
 @@ -0,0 +1,72 @@
 +#=============================================================================
 +# Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
@@ -1883,6 +1859,3 @@
 +    list(APPEND ${_sources} "${_server_header}")
 +    set(${_sources} ${${_sources}} PARENT_SCOPE)
 +endfunction()
--- 
-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 1d78755..e3a0cf2 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 d60c432..713fc3e 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 cae4ff834eef23c8f23126ba4d630db395f13aee Mon Sep 17 00:00:00 2001
+From f17879b691984b5c4950e4b94ebf102c78797ede 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/15] wayland-egl: Add bcm_host to dependencies
+Subject: [PATCH 04/16] 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.15.0
+2.16.1
 
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 676f34c..8d78333 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 8ee4f6eedb81e9bfe0e603a21606c52f9501e609 Mon Sep 17 00:00:00 2001
+From 0273b7b9d7a27d8fe7d3ad8680b799f997e75dca 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/15] interface: remove faulty assert() to make weston happy
+Subject: [PATCH 05/16] interface: remove faulty assert() to make weston happy
  at runtime
 
 This was removed after a discussion on IRC with the weston guys
@@ -25,5 +25,5 @@
              }
           } else {
 -- 
-2.15.0
+2.16.1
 
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 a8f1f24..43eb7f0 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 789b0b0c04b741c21dd573b78eded970721d14c2 Mon Sep 17 00:00:00 2001
+From 0d678cd2042551cc4e26ec42fa3aba7c72d033b4 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/15] zero-out wl buffers in egl_surface_free
+Subject: [PATCH 06/16] zero-out wl buffers in egl_surface_free
 
 origins from buildroot
 
@@ -29,5 +29,5 @@
  #endif
     }
 -- 
-2.15.0
+2.16.1
 
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 ad2636a..987740b 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 762dd3156775f167ff0dfd44322dbb19a85822a7 Mon Sep 17 00:00:00 2001
+From ec2e00989bf614b259bc9a47b5035f8586e8a214 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/15] initialize front back wayland buffers
+Subject: [PATCH 07/16] initialize front back wayland buffers
 
 origins from metrological wayland support
 
@@ -30,5 +30,5 @@
     }
  #endif
 -- 
-2.15.0
+2.16.1
 
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 1e66813..4bf05c1 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 f8929adbf95ad3d44491cf6fc8a84a686b71193e Mon Sep 17 00:00:00 2001
+From 59ba66c2ea17f7a57124b9fd6c9bdff4325ff5c9 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/15] Remove RPC_FLUSH
+Subject: [PATCH 08/16] Remove RPC_FLUSH
 
 Origins from buildroot
 
@@ -23,5 +23,5 @@
        }
  #endif
 -- 
-2.15.0
+2.16.1
 
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 214d5e2..a2c1df5 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 f53e028f33f261f85883c9168977dd5486e9b47c Mon Sep 17 00:00:00 2001
+From 264d82387ea1e607b2e5c899ff6bd46807c7b185 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/15] fix cmake dependency race
+Subject: [PATCH 09/16] fix cmake dependency race
 
 Fixes errors like
 
@@ -74,5 +74,5 @@
  	struct wl_resource *resource;
  	struct wl_dispmanx *dispmanx;
 -- 
-2.15.0
+2.16.1
 
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 9f77920..a6c9a59 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 6559a57c66c5f55571a1aa29cf14d9130a9ef2c9 Mon Sep 17 00:00:00 2001
+From 7c51c2d37bfadaabbbf205237d932b685b09d34f 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/15] Fix for framerate with nested composition
+Subject: [PATCH 10/16] 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.15.0
+2.16.1
 
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 5ee5cbd..55a5be8 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 3e396f0b514f3acf90c02f5d55b3816028367a55 Mon Sep 17 00:00:00 2001
+From fb3002f77a175633af31019c513754d2ef5f3ac0 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/15] build shared library for vchostif
+Subject: [PATCH 11/16] build shared library for vchostif
 
 Fixes #149
 
@@ -24,5 +24,5 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
 -- 
-2.15.0
+2.16.1
 
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 48af588..28a5fc6 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 f5b2263c8d65e307cb085414e08118cbbe00a94c Mon Sep 17 00:00:00 2001
+From df8b9633a45069bdd1bf256d974636ef11aa39cb 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/15] implement buffer wrapping interface for dispmanx
+Subject: [PATCH 12/16] implement buffer wrapping interface for dispmanx
 
 Courtesy: Zan Dobersek
 
@@ -88,5 +88,5 @@
  
  </protocol>
 -- 
-2.15.0
+2.16.1
 
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
index d3a9840..ebff314 100644
--- 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
@@ -1,7 +1,7 @@
-From 10ba55489002c2ccdf96d221301ec059c4574811 Mon Sep 17 00:00:00 2001
+From 2e0e331da8556fecd841349cfae294baf0f14485 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
+Subject: [PATCH 13/16] Implement triple buffering for wayland
 
 Change from double to triple buffering for wayland.
 This enables higher frame rates without tearing artifacts
@@ -86,5 +86,5 @@
        back_wl_buffer
  
 -- 
-2.15.0
+2.16.1
 
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
index b596056..025b6bc 100644
--- 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
@@ -1,7 +1,7 @@
-From d750c738b5c23bba24531cb713292e4ab3f2ec56 Mon Sep 17 00:00:00 2001
+From 8d9299d219a2a4f76f8278973584e1a9f7116c78 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
+Subject: [PATCH 14/16] GLES2/gl2ext.h: Define GL_R8_EXT and GL_RG8_EXT
 
 weston code uses these defines
 Upstream-Status: Pending
@@ -26,5 +26,5 @@
  #ifndef GL_EXT_texture_type_2_10_10_10_REV
  #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
 -- 
-2.15.0
+2.16.1
 
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
index f10740b..605d0c0 100644
--- 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
@@ -1,7 +1,7 @@
-From 827907f2223df93918e680101a1ac6228ba0f07e Mon Sep 17 00:00:00 2001
+From a2182e5437a6664cdb0f3330f6cbee873b6f975a 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
+Subject: [PATCH 15/16] 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.
@@ -28,5 +28,5 @@
 +
  #endif /* __eglplatform_h */
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
new file mode 100644
index 0000000..d20ec82
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
@@ -0,0 +1,145 @@
+From 6b4c4d469d435bfcfb464356b6ccc9421c6b8fd5 Mon Sep 17 00:00:00 2001
+From: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Date: Sat, 27 Jan 2018 12:28:31 -0500
+Subject: [PATCH 16/16] Allow multiple wayland compositor state data per
+ process
+
+When eglBindWaylandDisplayWL is called store the wl_global
+created in a list associated with the wayland display.
+This allows multiple wayland compositor instances to be
+created and used per process. This scenario is common for
+applications integrating externl process UI elements
+via embedded composition e.g. westeros
+
+Signed-off-by: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ interface/khronos/common/khrn_client.c |  2 +-
+ interface/khronos/common/khrn_client.h | 11 +++++++-
+ interface/khronos/ext/egl_wayland.c    | 50 ++++++++++++++++++++++++++++++----
+ 3 files changed, 55 insertions(+), 8 deletions(-)
+
+diff --git a/interface/khronos/common/khrn_client.c b/interface/khronos/common/khrn_client.c
+index d7e798e..60bdb63 100644
+--- a/interface/khronos/common/khrn_client.c
++++ b/interface/khronos/common/khrn_client.c
+@@ -147,7 +147,7 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
+ {
+    if (!process->inited) {
+ #ifdef BUILD_WAYLAND
+-      process->wl_global = NULL;
++      process->wlStateMap = NULL;
+ #endif
+ 
+       if (!khrn_pointer_map_init(&process->contexts, 64))
+diff --git a/interface/khronos/common/khrn_client.h b/interface/khronos/common/khrn_client.h
+index 615f7b4..4fa86f7 100644
+--- a/interface/khronos/common/khrn_client.h
++++ b/interface/khronos/common/khrn_client.h
+@@ -170,6 +170,15 @@ static INLINE CLIENT_THREAD_STATE_T *CLIENT_GET_CHECK_THREAD_STATE(void)
+    return (CLIENT_THREAD_STATE_T *)platform_tls_get_check(client_tls);
+ }
+ 
++#ifdef BUILD_WAYLAND
++typedef struct WAYLAND_STATE
++{
++   struct WAYLAND_STATE *next;
++   struct wl_display *display;
++   struct wl_global *wl_global;
++} WAYLAND_STATE_T;
++#endif
++
+ /*
+    per-process state
+ 
+@@ -318,7 +327,7 @@ struct CLIENT_PROCESS_STATE {
+    struct wl_event_queue *wl_queue;
+ 
+    /* Compositor-side Wayland state */
+-   struct wl_global *wl_global;
++   WAYLAND_STATE_T *wlStateMap;
+ #endif
+ };
+ 
+diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
+index 9ef89cd..abd5ab3 100644
+--- a/interface/khronos/ext/egl_wayland.c
++++ b/interface/khronos/ext/egl_wayland.c
+@@ -208,17 +208,38 @@ eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+ {
+    CLIENT_THREAD_STATE_T *thread;
+    CLIENT_PROCESS_STATE_T *process;
++   WAYLAND_STATE_T *stateIter;
++   WAYLAND_STATE_T *stateNew;
++   struct wl_global *wl_global;
+ 
+    if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
+       return EGL_FALSE;
+ 
+-   if (process->wl_global != NULL)
++   stateIter= process->wlStateMap;
++   while( stateIter )
++   {
++      if ( stateIter->display == display )
++         goto error;
++      stateIter= stateIter->next;
++   }
++
++   wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
++                                NULL, bind_dispmanx);
++   if (wl_global == NULL)
+       goto error;
+ 
+-   process->wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
+-                                         NULL, bind_dispmanx);
+-   if (process->wl_global == NULL)
++   stateNew= (WAYLAND_STATE_T*)calloc( 1, sizeof(WAYLAND_STATE_T));
++   if (stateNew == NULL )
++   {
++      wl_global_destroy(wl_global);
+       goto error;
++   }
++
++   stateNew->next= process->wlStateMap;
++   stateNew->display= display;
++   stateNew->wl_global= wl_global;
++   process->wlStateMap= stateNew;
++   CLIENT_UNLOCK();
+ 
+    return EGL_TRUE;
+ 
+@@ -232,12 +253,29 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+ {
+    CLIENT_THREAD_STATE_T *thread;
+    CLIENT_PROCESS_STATE_T *process;
++   WAYLAND_STATE_T *stateIter;
++   WAYLAND_STATE_T *statePrev;
+ 
+    if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
+       return EGL_FALSE;
+ 
+-   wl_global_destroy(process->wl_global);
+-   process->wl_global = NULL;
++   statePrev= NULL;
++   stateIter= process->wlStateMap;
++   while( stateIter )
++   {
++      if ( stateIter->display == display )
++      {
++         wl_global_destroy(stateIter->wl_global);
++         if ( statePrev )
++            statePrev->next= stateIter->next;
++         else
++            process->wlStateMap= stateIter->next;
++         free( stateIter );
++         break;
++      }
++      statePrev= stateIter;
++      stateIter= stateIter->next;
++   }
+ 
+    CLIENT_UNLOCK();
+ 
+-- 
+2.16.1
+
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 d38b02d..7f2dca6 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
@@ -5,8 +5,6 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=0448d6488ef8cc380632b1569ee6d196"
 
-PR = "r5"
-
 PROVIDES = "virtual/libgles2 \
             virtual/egl"
 
@@ -16,7 +14,11 @@
 
 SRCBRANCH = "master"
 SRCFORK = "raspberrypi"
-SRCREV = "bc3c52a51315399a9f31ed24049eb4bc81fd1c60"
+SRCREV = "11389772c79685442e0ab8aa9be8ad0e32703f68"
+
+# Use the date of the above commit as the package version. Update this when
+# SRCREV is changed.
+PV = "20180219"
 
 SRC_URI = "\
     git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
@@ -35,6 +37,7 @@
     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 \
+    file://0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch \
 "
 S = "${WORKDIR}/git"
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc b/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
index 668c5ce..cd0d57b 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
+++ b/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
@@ -6,6 +6,8 @@
 PROVIDES = "virtual/libgles2 virtual/egl"
 COMPATIBLE_MACHINE = "^rpi$"
 
+INHIBIT_DEFAULT_DEPS = "1"
+
 include recipes-bsp/common/firmware.inc
 
 SRC_URI += " \
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
index 7902f20..919e95e 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
@@ -3,20 +3,19 @@
 SRC_URI_append_rpi = " \
     file://xorg.conf.d/98-pitft.conf \
     file://xorg.conf.d/99-calibration.conf \
-"
-SRC_URI_append_libc-musl_raspberrypi3-64 = " \
     file://xorg.conf.d/10-noglamor.conf \
 "
 do_install_append_rpi () {
     PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
+    VC4="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
     if [ "${PITFT}" = "1" ]; then
         install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
         install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
         install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
     fi
+    if [ "${VC4}" = "1" ]; then
+        install -Dm 0644 ${WORKDIR}/xorg.conf.d/10-noglamor.conf ${D}/${sysconfdir}/X11/xorg.conf.d/10-noglamor.conf
+    fi
 }
-do_install_append_libc-musl_raspberrypi3-64 () {
-    install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
-    install -m 0644 ${WORKDIR}/xorg.conf.d/10-noglamor.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
-}
+
 FILES_${PN}_rpi += "${sysconfdir}/X11/xorg.conf ${sysconfdir}/X11/xorg.conf.d/*"