reset upstream subtrees to yocto 2.6

Reset the following subtrees on thud HEAD:

  poky: 87e3a9739d
  meta-openembedded: 6094ae18c8
  meta-security: 31dc4e7532
  meta-raspberrypi: a48743dc36
  meta-xilinx: c42016e2e6

Also re-apply backports that didn't make it into thud:
  poky:
    17726d0 systemd-systemctl-native: handle Install wildcards

  meta-openembedded:
    4321a5d libtinyxml2: update to 7.0.1
    042f0a3 libcereal: Add native and nativesdk classes
    e23284f libcereal: Allow empty package
    030e8d4 rsyslog: curl-less build with fmhttp PACKAGECONFIG
    179a1b9 gtest: update to 1.8.1

Squashed OpenBMC subtree compatibility updates:
  meta-aspeed:
    Brad Bishop (1):
          aspeed: add yocto 2.6 compatibility

  meta-ibm:
    Brad Bishop (1):
          ibm: prepare for yocto 2.6

  meta-ingrasys:
    Brad Bishop (1):
          ingrasys: set layer compatibility to yocto 2.6

  meta-openpower:
    Brad Bishop (1):
          openpower: set layer compatibility to yocto 2.6

  meta-phosphor:
    Brad Bishop (3):
          phosphor: set layer compatibility to thud
          phosphor: libgpg-error: drop patches
          phosphor: react to fitimage artifact rename

    Ed Tanous (4):
          Dropbear: upgrade options for latest upgrade
          yocto2.6: update openssl options
          busybox: remove upstream watchdog patch
          systemd: Rebase CONFIG_CGROUP_BPF patch

Change-Id: I7b1fe71cca880d0372a82d94b5fd785323e3a9e7
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-raspberrypi/classes/sdcard_image-rpi.bbclass b/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
index e7c34c6..6244ee5 100644
--- a/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
+++ b/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
@@ -28,9 +28,6 @@
 # Set kernel and boot loader
 IMAGE_BOOTLOADER ?= "bcm2835-bootfiles"
 
-# Set initramfs extension
-KERNEL_INITRAMFS ?= ""
-
 # Kernel image name
 SDIMG_KERNELIMAGE_raspberrypi  ?= "kernel.img"
 SDIMG_KERNELIMAGE_raspberrypi2 ?= "kernel7.img"
@@ -49,6 +46,9 @@
 SDIMG_ROOTFS_TYPE ?= "ext3"
 SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${SDIMG_ROOTFS_TYPE}"
 
+# For the names of kernel artifacts
+inherit kernel-artifact-names
+
 do_image_rpi_sdimg[depends] = " \
     parted-native:do_populate_sysroot \
     mtools-native:do_populate_sysroot \
@@ -75,6 +75,7 @@
 FATPAYLOAD ?= ""
 
 # SD card vfat partition image name
+SDIMG_VFAT_DEPLOY ?= "${RPI_USE_U_BOOT}"
 SDIMG_VFAT = "${IMAGE_NAME}.vfat"
 SDIMG_LINK_VFAT = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vfat"
 
@@ -135,10 +136,18 @@
     fi
     if [ "${RPI_USE_U_BOOT}" = "1" ]; then
         mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
-        mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
         mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
+        if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
+            mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${KERNEL_IMAGETYPE}
+        else
+            mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${KERNEL_IMAGETYPE}
+        fi
     else
-        mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
+        if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
+            mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${SDIMG_KERNELIMAGE}
+        else
+            mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${SDIMG_KERNELIMAGE}
+        fi
     fi
 
     if [ -n ${FATPAYLOAD} ] ; then
@@ -153,8 +162,8 @@
     echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info
     mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
 
-    # Deploy vfat partition (for u-boot case only)
-    if [ "${RPI_USE_U_BOOT}" = "1" ]; then
+    # Deploy vfat partition
+    if [ "${SDIMG_VFAT_DEPLOY}" = "1" ]; then
         cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT}
         ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
     fi
diff --git a/meta-raspberrypi/conf/layer.conf b/meta-raspberrypi/conf/layer.conf
index cfc2234..6e2fdf6 100644
--- a/meta-raspberrypi/conf/layer.conf
+++ b/meta-raspberrypi/conf/layer.conf
@@ -9,7 +9,7 @@
 BBFILE_PATTERN_raspberrypi := "^${LAYERDIR}/"
 BBFILE_PRIORITY_raspberrypi = "9"
 
-LAYERSERIES_COMPAT_raspberrypi = "sumo"
+LAYERSERIES_COMPAT_raspberrypi = "sumo thud"
 
 # Additional license directories.
 LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
@@ -23,3 +23,8 @@
                for layer in BBFILE_COLLECTIONS.split())}"
 BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bb' % layer \
                for layer in BBFILE_COLLECTIONS.split())}"
+
+BBFILES_DYNAMIC += " \
+    qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bb \
+    qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bbappend \
+"
diff --git a/meta-raspberrypi/conf/machine/include/rpi-base.inc b/meta-raspberrypi/conf/machine/include/rpi-base.inc
index 539d1bc..4bbd576 100644
--- a/meta-raspberrypi/conf/machine/include/rpi-base.inc
+++ b/meta-raspberrypi/conf/machine/include/rpi-base.inc
@@ -15,7 +15,9 @@
     "
 
 RPI_KERNEL_DEVICETREE_OVERLAYS ?= " \
+    overlays/at86rf233.dtbo \
     overlays/dwc2.dtbo \
+    overlays/gpio-key.dtbo \
     overlays/hifiberry-amp.dtbo \
     overlays/hifiberry-dac.dtbo \
     overlays/hifiberry-dacplus.dtbo \
@@ -24,18 +26,17 @@
     overlays/iqaudio-dac.dtbo \
     overlays/iqaudio-dacplus.dtbo \
     overlays/lirc-rpi.dtbo \
+    overlays/pi3-disable-bt.dtbo \
+    overlays/pi3-miniuart-bt.dtbo \
     overlays/pitft22.dtbo \
     overlays/pitft28-resistive.dtbo \
     overlays/pitft35-resistive.dtbo \
     overlays/pps-gpio.dtbo \
     overlays/rpi-ft5406.dtbo \
     overlays/rpi-poe.dtbo \
-    overlays/w1-gpio.dtbo \
-    overlays/w1-gpio-pullup.dtbo \
-    overlays/pi3-disable-bt.dtbo \
-    overlays/pi3-miniuart-bt.dtbo \
     overlays/vc4-kms-v3d.dtbo \
-    overlays/at86rf233.dtbo \
+    overlays/w1-gpio-pullup.dtbo \
+    overlays/w1-gpio.dtbo \
     "
 
 RPI_KERNEL_DEVICETREE ?= " \
@@ -84,23 +85,18 @@
     imgtyp = d.getVar('KERNEL_IMAGETYPE')
 
     def transform(dtb):
+        base = os.path.basename(dtb)
         if dtb.endswith('dtb'):
             # eg: whatever/bcm2708-rpi-b.dtb has:
-            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-bcm2708-rpi-b.dtb
+            #     DEPLOYDIR file: bcm2708-rpi-b.dtb
             #     destination: bcm2708-rpi-b.dtb
-            base = os.path.basename(dtb)
-            src = '{}-{}'.format(imgtyp, base)
-            dst = base
-            return '{};{}'.format(src, dst)
+            return base
         elif dtb.endswith('dtbo'):
             # overlay dtb:
             # eg: overlays/hifiberry-amp.dtbo has:
-            #     DEPLOYDIR file: ${KERNEL_IMAGETYPE}-hifiberry-amp.dtbo
+            #     DEPLOYDIR file: hifiberry-amp.dtbo
             #     destination: overlays/hifiberry-amp.dtbo
-            base = os.path.basename(dtb)
-            src = '{}-{}'.format(imgtyp, base)
-            dst = dtb
-            return '{};{}'.format(src, dtb)
+            return '{};{}'.format(base, dtb)
 
     return ' '.join([transform(dtb) for dtb in alldtbs.split(' ') if dtb])
 
diff --git a/meta-raspberrypi/conf/machine/raspberrypi-cm3.conf b/meta-raspberrypi/conf/machine/raspberrypi-cm3.conf
index 153d5d5..5f6d3b6 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi-cm3.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi-cm3.conf
@@ -2,5 +2,5 @@
 #@NAME: RaspberryPi Compute Module 3 (CM3)
 #@DESCRIPTION: Machine configuration for the RaspberryPi Compute Module 3 (CM3)
 
-MACHINEOVERRIDES = "raspberrypi2:${MACHINE}"
-include conf/machine/raspberrypi2.conf
+MACHINEOVERRIDES = "raspberrypi3:${MACHINE}"
+include conf/machine/raspberrypi3.conf
diff --git a/meta-raspberrypi/conf/machine/raspberrypi.conf b/meta-raspberrypi/conf/machine/raspberrypi.conf
index ddd3801..e94ad86 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi.conf
@@ -7,7 +7,6 @@
 require conf/machine/include/tune-arm1176jzf-s.inc
 include conf/machine/include/rpi-base.inc
 
-SERIAL_CONSOLE ?= "115200 ttyAMA0"
+SERIAL_CONSOLES ?= "115200;ttyAMA0"
 
 UBOOT_MACHINE = "rpi_config"
-VC4_CMA_SIZE_raspberrypi ?= "cma-64"
diff --git a/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf b/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
index accdf3c..2c4f760 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
@@ -7,11 +7,10 @@
 include conf/machine/include/rpi-base.inc
 
 MACHINE_EXTRA_RRECOMMENDS += "\
-    linux-firmware-bcm43430 \
-    linux-firmware-bcm43430a1-hcd \
+    linux-firmware-rpidistro-bcm43430 \
+    bluez-firmware-rpidistro-bcm43430a1-hcd \
 "
 
 SDIMG_KERNELIMAGE ?= "kernel.img"
 UBOOT_MACHINE ?= "rpi_0_w_defconfig"
-SERIAL_CONSOLE ?= "115200 ttyS0"
-VC4_CMA_SIZE ?= "cma-128"
+SERIAL_CONSOLES ?= "115200;ttyS0"
diff --git a/meta-raspberrypi/conf/machine/raspberrypi0.conf b/meta-raspberrypi/conf/machine/raspberrypi0.conf
index 3bd9e95..80297b5 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi0.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi0.conf
@@ -5,5 +5,4 @@
 MACHINEOVERRIDES = "raspberrypi:${MACHINE}"
 include conf/machine/raspberrypi.conf
 
-SERIAL_CONSOLE ?= "115200 ttyAMA0"
-VC4_CMA_SIZE ?= "cma-128"
+SERIAL_CONSOLES ?= "115200;ttyAMA0"
diff --git a/meta-raspberrypi/conf/machine/raspberrypi2.conf b/meta-raspberrypi/conf/machine/raspberrypi2.conf
index a17289c..bd191c3 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi2.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi2.conf
@@ -7,7 +7,6 @@
 require conf/machine/include/tune-cortexa7.inc
 include conf/machine/include/rpi-base.inc
 
-SERIAL_CONSOLE ?= "115200 ttyAMA0"
+SERIAL_CONSOLES ?= "115200;ttyAMA0"
 
 UBOOT_MACHINE = "rpi_2_config"
-VC4_CMA_SIZE ?= "cma-256"
diff --git a/meta-raspberrypi/conf/machine/raspberrypi3-64.conf b/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
index fb21b12..635e4f6 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
@@ -5,10 +5,10 @@
 MACHINEOVERRIDES = "raspberrypi3:${MACHINE}"
 
 MACHINE_EXTRA_RRECOMMENDS += "\
-    linux-firmware-bcm43430 \
-    linux-firmware-bcm43455 \
-    linux-firmware-bcm43430a1-hcd \
-    linux-firmware-bcm4345c0-hcd \
+    linux-firmware-rpidistro-bcm43430 \
+    linux-firmware-rpidistro-bcm43455 \
+    bluez-firmware-rpidistro-bcm43430a1-hcd \
+    bluez-firmware-rpidistro-bcm4345c0-hcd \
 "
 
 require conf/machine/include/arm/arch-armv8.inc
@@ -20,8 +20,7 @@
     broadcom/bcm2837-rpi-3-b.dtb \
     "
 
-SERIAL_CONSOLE ?= "115200 ttyS0"
-VC4_CMA_SIZE ?= "cma-256"
+SERIAL_CONSOLES ?= "115200;ttyS0"
 
 UBOOT_MACHINE = "rpi_3_config"
 MACHINE_FEATURES_append = " vc4graphics"
diff --git a/meta-raspberrypi/conf/machine/raspberrypi3.conf b/meta-raspberrypi/conf/machine/raspberrypi3.conf
index 8b5cce5..df64cbb 100644
--- a/meta-raspberrypi/conf/machine/raspberrypi3.conf
+++ b/meta-raspberrypi/conf/machine/raspberrypi3.conf
@@ -7,13 +7,12 @@
 include conf/machine/include/rpi-base.inc
 
 MACHINE_EXTRA_RRECOMMENDS += "\
-    linux-firmware-bcm43430 \
-    linux-firmware-bcm43455 \
-    linux-firmware-bcm43430a1-hcd \
-    linux-firmware-bcm4345c0-hcd \
+    linux-firmware-rpidistro-bcm43430 \
+    linux-firmware-rpidistro-bcm43455 \
+    bluez-firmware-rpidistro-bcm43430a1-hcd \
+    bluez-firmware-rpidistro-bcm4345c0-hcd \
 "
 
 SDIMG_KERNELIMAGE ?= "kernel7.img"
 UBOOT_MACHINE = "rpi_3_32b_config"
-SERIAL_CONSOLE ?= "115200 ttyS0"
-VC4_CMA_SIZE ?= "cma-256"
+SERIAL_CONSOLES ?= "115200;ttyS0"
diff --git a/meta-raspberrypi/docs/extra-build-config.md b/meta-raspberrypi/docs/extra-build-config.md
index 04314aa..732c102 100644
--- a/meta-raspberrypi/docs/extra-build-config.md
+++ b/meta-raspberrypi/docs/extra-build-config.md
@@ -158,17 +158,18 @@
 
 To build an initramfs image:
 
-* Set this 3 kernel variables (in linux-raspberrypi.inc for example)
+* Set this 3 kernel variables (in kernel's do_configure_prepend in linux-raspberrypi.inc after the line kernel_configure_variable LOCALVERSION "\"\""
+)
   - kernel_configure_variable BLK_DEV_INITRD y
   - kernel_configure_variable INITRAMFS_SOURCE ""
   - kernel_configure_variable RD_GZIP y
 
-* Set the yocto variables (in linux-raspberrypi.inc for example)
-  - `INITRAMFS_IMAGE = "<a name for your initramfs image>"`
+* Set the yocto variables (e.g. in local.conf)
+  - `INITRAMFS_IMAGE = "<name for your initramfs image>"`
   - `INITRAMFS_IMAGE_BUNDLE = "1"`
-
-* Set the meta-rasberrypi variable (in raspberrypi.conf for example)
-  - `KERNEL_INITRAMFS = "-initramfs"`
+  - `BOOT_SPACE = "1073741"`
+  - `INITRAMFS_MAXSIZE = "315400"`
+  - `IMAGE_FSTYPES_pn-${INITRAMFS_IMAGE} = "${INITRAMFS_FSTYPES}"`
 
 ## Enable SPI bus
 
diff --git a/meta-raspberrypi/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend b/meta-raspberrypi/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend
new file mode 100644
index 0000000..7d6ab84
--- /dev/null
+++ b/meta-raspberrypi/dynamic-layers/qt5-layer/recipes-qt/qt5/qtbase_%.bbappend
@@ -0,0 +1,17 @@
+PACKAGECONFIG_GL_rpi = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'gl', \
+                        bb.utils.contains('DISTRO_FEATURES',     'opengl', 'eglfs gles2 linuxfb', \
+                                                                       '', d), d)}"
+#PACKAGECONFIG_GL_rpi = "${@bb.utils.any_distro_features('x11 wayland', '', 'eglfs', d)}"
+PACKAGECONFIG_FONTS_rpi = "fontconfig"
+PACKAGECONFIG_append_rpi = " libinput examples tslib xkb xkbcommon-evdev"
+PACKAGECONFIG_remove_rpi = "tests"
+
+OE_QTBASE_EGLFS_DEVICE_INTEGRATION_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'eglfs_kms', 'eglfs_brcm', d)}"
+
+do_configure_prepend_rpi() {
+    # Add the appropriate EGLFS_DEVICE_INTEGRATION
+    if [ "${@d.getVar('OE_QTBASE_EGLFS_DEVICE_INTEGRATION')}" != "" ]; then
+        echo "EGLFS_DEVICE_INTEGRATION = ${OE_QTBASE_EGLFS_DEVICE_INTEGRATION}" > ${S}/mkspecs/oe-device-extra.pri
+    fi
+}
+RDEPENDS_${PN}_append_rpi = " userland"
diff --git a/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb b/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
index a85c916..d92b8e4 100644
--- a/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
+++ b/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
@@ -23,7 +23,6 @@
 PITFT35r="${@bb.utils.contains("MACHINE_FEATURES", "pitft35r", "1", "0", d)}"
 
 VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
-VC4DTBO_raspberrypi3-64 ?= "vc4-fkms-v3d"
 VC4DTBO ?= "vc4-kms-v3d"
 
 inherit deploy nopackages
@@ -159,7 +158,7 @@
     # VC4 Graphics support
     if [ "${VC4GRAPHICS}" = "1" ]; then
         echo "# Enable VC4 Graphics" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
-        echo "dtoverlay=${VC4DTBO},${VC4_CMA_SIZE}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        echo "dtoverlay=${VC4DTBO}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
 
     # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm)
diff --git a/meta-raspberrypi/recipes-bsp/common/firmware.inc b/meta-raspberrypi/recipes-bsp/common/firmware.inc
index 3baa1f8..7be848a 100644
--- a/meta-raspberrypi/recipes-bsp/common/firmware.inc
+++ b/meta-raspberrypi/recipes-bsp/common/firmware.inc
@@ -1,11 +1,11 @@
-RPIFW_DATE ?= "20180817"
-SRCREV ?= "53ac68e1eb02138f72a5056efed9dac9d3883a3f"
+RPIFW_DATE ?= "20180924"
+SRCREV ?= "5b49caa17e91d0e64024380119ad739bb201c674"
 RPIFW_SRC_URI ?= "https://github.com/raspberrypi/firmware/archive/${SRCREV}.tar.gz"
 RPIFW_S ?= "${WORKDIR}/firmware-${SRCREV}"
 
 SRC_URI = "${RPIFW_SRC_URI}"
-SRC_URI[md5sum] = "6b3d901decf2fe4fad151e3ebb28cb62"
-SRC_URI[sha256sum] = "3680de3ea9817b10fa8998b0dfa6811e58c96945474f4c782710dcd0a56c8cf0"
+SRC_URI[md5sum] = "51352972a029c6f47bde6d302b69440e"
+SRC_URI[sha256sum] = "d1f9c58957dfe681fff7e1cf1eabb9e0f6fdc99720f1d059fb24a37750573310"
 
 
 PV = "${RPIFW_DATE}"
diff --git a/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch b/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch
deleted file mode 100644
index e98fd85..0000000
--- a/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 5d113dc0130ea2ea9faaa000fba9c737266b9747 Mon Sep 17 00:00:00 2001
-From: Drew Moseley <drew.moseley@northern.tech>
-Date: Fri, 9 Feb 2018 18:10:09 -0500
-Subject: [PATCH] rpi_0_w: Add configs consistent with RpI3
-
-Upstream-Status: Accepted [https://patchwork.ozlabs.org/patch/856572/]
-
-Signed-off-by: Drew Moseley <drew.moseley@northern.tech>
----
- configs/rpi_0_w_defconfig | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
-index 9a6d24b..1248294 100644
---- a/configs/rpi_0_w_defconfig
-+++ b/configs/rpi_0_w_defconfig
-@@ -12,14 +12,21 @@ CONFIG_SYS_PROMPT="U-Boot> "
- CONFIG_CMD_GPIO=y
- CONFIG_CMD_MMC=y
- CONFIG_CMD_USB=y
-+CONFIG_OF_EMBED=y
-+CONFIG_ENV_FAT_INTERFACE="mmc"
-+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
-+CONFIG_DM_KEYBOARD=y
- CONFIG_DM_MMC=y
- CONFIG_MMC_SDHCI=y
- CONFIG_MMC_SDHCI_BCM2835=y
- CONFIG_DM_ETH=y
- CONFIG_USB=y
- CONFIG_DM_USB=y
-+CONFIG_USB_DWC2=y
- CONFIG_USB_STORAGE=y
- CONFIG_USB_KEYBOARD=y
-+CONFIG_USB_HOST_ETHER=y
-+CONFIG_USB_ETHER_SMSC95XX=y
- CONFIG_DM_VIDEO=y
- CONFIG_SYS_WHITE_ON_BLACK=y
- CONFIG_CONSOLE_SCROLL_LINES=10
--- 
-2.7.4
-
diff --git a/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
index 7d4a49e..95015f4 100644
--- a/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -1,7 +1 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:"
-
-SRC_URI_append_rpi = " \
-    file://0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch \
-"
-
 DEPENDS_append_rpi = " rpi-u-boot-scr"
diff --git a/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service b/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service
deleted file mode 100644
index a51f6bc..0000000
--- a/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Broadcom BCM43438 bluetooth HCI
-ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins
-Before=bluetooth.service
-BindsTo=dev-serial1.device
-After=dev-serial1.device
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-ExecStart=/usr/bin/btuart
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
index d1b84df..6651fb8 100644
--- a/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
+++ b/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
@@ -5,41 +5,12 @@
     file://0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch \
     file://0003-Increase-firmware-load-timeout-to-30s.patch \
     file://0004-Move-the-43xx-firmware-into-lib-firmware.patch \
-    file://brcm43438.service \
-    "
-
-BCM_BT_SERVICE = "brcm43438.service"
-
-enable_bcm_bluetooth() {
-    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-        install -d ${D}${systemd_unitdir}/system
-        install -m 0644 ${WORKDIR}/${BCM_BT_SERVICE} ${D}${systemd_unitdir}/system
-    fi
-}
-
-BCM_BT_RDEPENDS = "\
-    udev-rules-rpi \
-    pi-bluetooth \
 "
 
-# for raspberrypi3
+BCM_BT_RDEPENDS = "pi-bluetooth"
+
+SRC_URI_append_raspberrypi0-wifi = " ${BCM_BT_SOURCES}"
 SRC_URI_append_raspberrypi3 = " ${BCM_BT_SOURCES}"
 
-do_install_append_raspberrypi3() {
-    enable_bcm_bluetooth
-}
-
-SYSTEMD_SERVICE_${PN}_append_raspberrypi3 = " ${BCM_BT_SERVICE}"
-
-RDEPENDS_${PN}_append_raspberrypi3 = " ${BCM_BT_RDEPENDS}"
-
-# for raspberrypi0-wifi
-SRC_URI_append_raspberrypi0-wifi = " ${BCM_BT_SOURCES}"
-
-do_install_append_raspberrypi0-wifi() {
-    enable_bcm_bluetooth
-}
-
-SYSTEMD_SERVICE_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_SERVICE}"
-
 RDEPENDS_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_RDEPENDS}"
+RDEPENDS_${PN}_append_raspberrypi3 = " ${BCM_BT_RDEPENDS}"
diff --git a/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth/0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch b/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth/0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch
new file mode 100644
index 0000000..4583905
--- /dev/null
+++ b/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth/0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch
@@ -0,0 +1,28 @@
+From af91c96951a11f81f5cea88a0010161592c89310 Mon Sep 17 00:00:00 2001
+From: "Peter A. Bigot" <pab@pabigot.com>
+Date: Wed, 14 Nov 2018 09:19:51 -0600
+Subject: [PATCH] bthelper: correct path for hciconfig under Yocto
+
+Upstream-Status: Inapproprate [OE-specific]
+Signed-off-by: Peter A. Bigot <pab@pabigot.com>
+---
+ usr/bin/bthelper | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/usr/bin/bthelper b/usr/bin/bthelper
+index 255fdeb..4e1a1a4 100755
+--- a/usr/bin/bthelper
++++ b/usr/bin/bthelper
+@@ -10,7 +10,7 @@ fi
+ 
+ dev="$1"
+ # Need to bring hci up before looking at MAC as it can be all zeros during init
+-/bin/hciconfig "$dev" up
+-/bin/hciconfig "$dev" |grep -q "BD Address: B8:27:EB:" || exit 0
++/usr/bin/hciconfig "$dev" up
++/usr/bin/hciconfig "$dev" |grep -q "BD Address: B8:27:EB:" || exit 0
+ /usr/bin/hcitool -i "$dev" cmd 0x3f 0x1c 0x01 0x02 0x00 0x01 0x01 > /dev/null
+ 
+-- 
+2.17.1
+
diff --git a/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth_git.bb b/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth_git.bb
index e185f25..b2401b9 100644
--- a/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth_git.bb
+++ b/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth_git.bb
@@ -6,17 +6,41 @@
     file://debian/copyright;md5=6af8de3c8ee71f8e91e9b22f84ff2022 \
 "
 
-SRC_URI = "git://github.com/RPi-Distro/pi-bluetooth"
-SRCREV = "2a7477966bb3c69838b224f3ea92cb49a88124d5"
-UPSTREAM_VERSION_UNKNOWN = "1"
+SRC_URI = "\
+    git://github.com/RPi-Distro/pi-bluetooth \
+    file://0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch \
+"
+SRCREV = "2e1a393955910aea67bbf3c921be35a66e8a8fbe"
+PV = "1.1+git${SRCPV}"
 
 S = "${WORKDIR}/git"
 
+# hciuart.service replaces what was brcm43438.service 
+inherit systemd
+SYSTEMD_SERVICE_${PN} = "\
+    hciuart.service \
+    bthelper@.service \
+"
+
 inherit allarch
 
 do_install() {
+    install -d ${D}${sysconfdir}/udev/rules.d
+    install -m 0644 ${S}/lib/udev/rules.d/* ${D}${sysconfdir}/udev/rules.d
+
     install -d ${D}${bindir}
+    install -m 0755 ${S}/usr/bin/bthelper ${D}${bindir}
     install -m 0755 ${S}/usr/bin/btuart ${D}${bindir}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${systemd_system_unitdir}
+        install -m 0644 ${S}/debian/pi-bluetooth.bthelper@.service ${D}${systemd_system_unitdir}/bthelper@.service
+        install -m 0644 ${S}/debian/pi-bluetooth.hciuart.service ${D}${systemd_system_unitdir}/hciuart.service
+    fi
 }
 
-FILES_${PN} = "${bindir}"
+FILES_${PN} = "\
+    ${bindir} \
+    ${sysconfdir} \
+    ${systemd_unitdir}/system \
+"
diff --git a/meta-raspberrypi/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend b/meta-raspberrypi/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend
new file mode 100644
index 0000000..500d871
--- /dev/null
+++ b/meta-raspberrypi/recipes-core/packagegroups/packagegroup-core-tools-testapps.bbappend
@@ -0,0 +1,2 @@
+# mesa-demos needs gles1 and userland driver does not have it, works ok with vc4 graphics driver
+X11GLTOOLS_remove_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'mesa-demos', d)}"
diff --git a/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb b/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
index d91ce0b..9159346 100644
--- a/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
+++ b/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
@@ -6,8 +6,7 @@
 
 COMPATIBLE_MACHINE = "^rpi$"
 
-OMXPLAYER_rpi = "omxplayer"
-OMXPLAYER_rpi_aarch64 = ""
+OMXPLAYER  = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'omxplayer', d)}"
 
 RDEPENDS_${PN} = "\
     ${OMXPLAYER} \
diff --git a/meta-raspberrypi/recipes-devtools/pi-blaster/files/0001-pi-blaster-Include-sys-sysmacros.h-for-makedev.patch b/meta-raspberrypi/recipes-devtools/pi-blaster/files/0001-pi-blaster-Include-sys-sysmacros.h-for-makedev.patch
new file mode 100644
index 0000000..b4bc4b2
--- /dev/null
+++ b/meta-raspberrypi/recipes-devtools/pi-blaster/files/0001-pi-blaster-Include-sys-sysmacros.h-for-makedev.patch
@@ -0,0 +1,32 @@
+From 6a6b705ff5cba960c54bdb4d4bcdaa3b00a854a2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 11 Aug 2018 10:24:24 -0700
+Subject: [PATCH] pi-blaster: Include sys/sysmacros.h for makedev()
+
+In glibc 2.28+ this header is not included indirectly anymore
+
+fixes
+
+ld: pi-blaster.o: in function `mbox_open':
+pi-blaster.c:(.text+0x28): undefined reference to `makedev'
+collect2: error: ld returned 1 exit status
+
+Upstream-Status: Submitted [https://github.com/sarfata/pi-blaster/pull/100]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ pi-blaster.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/pi-blaster.c b/pi-blaster.c
+index 6cfd010..fc4e686 100644
+--- a/pi-blaster.c
++++ b/pi-blaster.c
+@@ -41,6 +41,7 @@ static char VERSION[] = "SNAPSHOT";
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <fcntl.h>
+ #include <sys/mman.h>
+ #include "mailbox.h"
diff --git a/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb b/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
index 2748459..9cedf5e 100644
--- a/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
+++ b/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
@@ -2,15 +2,16 @@
 HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
 SECTION = "devel/libs"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://README.md;beginline=225;endline=252;md5=a012868ef5f83b9f257af253d7cb07a3"
+LIC_FILES_CHKSUM = "file://README.md;beginline=244;endline=268;md5=86d10e4bcf4b4014d306dde7c1d2a80d"
 
 SRC_URI = "git://github.com/sarfata/pi-blaster \
            file://remove-initscript-lsb-dependency.patch \
-"
+           file://0001-pi-blaster-Include-sys-sysmacros.h-for-makedev.patch \
+           "
 
 S = "${WORKDIR}/git"
 
-SRCREV = "1035ad7dffb270c40eec1bb3a654171a755fba98"
+SRCREV = "e981aa5d7624c75a4d4afcddcbd235f25e32ffe4"
 
 inherit update-rc.d autotools
 
diff --git a/meta-raspberrypi/recipes-devtools/wiringpi/files/0001-Add-initial-cross-compile-support.patch b/meta-raspberrypi/recipes-devtools/wiringpi/files/0001-Add-initial-cross-compile-support.patch
index 01e0546..d97bbef 100644
--- a/meta-raspberrypi/recipes-devtools/wiringpi/files/0001-Add-initial-cross-compile-support.patch
+++ b/meta-raspberrypi/recipes-devtools/wiringpi/files/0001-Add-initial-cross-compile-support.patch
@@ -1,8 +1,11 @@
-From ca25788e2563bad0d554deb9f4300d1e7d062825 Mon Sep 17 00:00:00 2001
-From: Aurelian Zanoschi <aurelian17@gmail.com>
-Date: Mon, 31 Jul 2017 20:25:15 +0300
+From 9a47fd5da546d148886c8890cd48249ebe826948 Mon Sep 17 00:00:00 2001
+From: Daniel Rank <dwrank@gmail.com>
+Date: Wed, 1 Aug 2018 23:32:00 -0700
 Subject: [PATCH] Add initial cross compile support
 
+Upstream-Status: Pending
+Signed-off-by: Daniel Rank <dwrank@gmail.com>
+
 ---
  devLib/Makefile             | 54 +++++++++++++++++++++++++--------------------
  examples/Gertboard/Makefile | 22 +++++++++++-------
@@ -11,8 +14,8 @@
  examples/PiGlow/Makefile    |  4 ++--
  examples/q2w/Makefile       |  4 ++--
  gpio/Makefile               | 29 ++++++++++++------------
- wiringPi/Makefile           | 52 ++++++++++++++++++++++++-------------------
- 8 files changed, 120 insertions(+), 89 deletions(-)
+ wiringPi/Makefile           | 46 +++++++++++++++++++++-----------------
+ 8 files changed, 117 insertions(+), 86 deletions(-)
 
 diff --git a/devLib/Makefile b/devLib/Makefile
 index cf665d6..040c03a 100644
@@ -248,7 +251,7 @@
  
  ###############################################################################
 diff --git a/gpio/Makefile b/gpio/Makefile
-index f41a005..22753ee 100644
+index 9ec160d..a294242 100644
 --- a/gpio/Makefile
 +++ b/gpio/Makefile
 @@ -30,13 +30,17 @@ ifneq ($V,1)
@@ -284,8 +287,8 @@
 -	$Q chown root.root	$(DESTDIR)$(PREFIX)/bin/gpio
 -	$Q chmod 4755		$(DESTDIR)$(PREFIX)/bin/gpio
 -endif
--	$Q mkdir -p		$(DESTDIR)$(PREFIX)/man/man1
--	$Q cp gpio.1		$(DESTDIR)$(PREFIX)/man/man1
+-	$Q mkdir -p		$(DESTDIR)$(PREFIX)/share/man/man1
+-	$Q cp gpio.1		$(DESTDIR)$(PREFIX)/share/man/man1
 +	$Q install -d $(BIN_DIR)
 +	$Q install -m 4755 -o root -g root gpio $(BIN_DIR)
 +	$Q install -d $(DESTDIR)$(PREFIX)/share/man/man1
@@ -299,14 +302,14 @@
  	$Q echo "[UnInstall]"
 -	$Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio
 +	$Q rm -f $(BIN_DIR)/gpio
- 	$Q rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1
+ 	$Q rm -f $(DESTDIR)$(PREFIX)/share/man/man1/gpio.1
  
  .PHONY:	depend
 diff --git a/wiringPi/Makefile b/wiringPi/Makefile
-index e1868b9..750d290 100644
+index 287fa58..670a6db 100644
 --- a/wiringPi/Makefile
 +++ b/wiringPi/Makefile
-@@ -25,21 +25,25 @@ VERSION=$(shell cat ../VERSION)
+@@ -25,22 +25,26 @@ VERSION=$(shell cat ../VERSION)
  DESTDIR?=/usr
  PREFIX?=/local
  
@@ -335,11 +338,13 @@
 +INCLUDE	?= -I.
  DEFS	= -D_GNU_SOURCE
 -CFLAGS	= $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
+-#CFLAGS	= $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Wconversion -Winline $(INCLUDE) -pipe -fPIC
 +CFLAGS	= $(DEBUG) $(DEFS) $(INCLUDE) -Wformat=2 -Wall -Wextra -Winline -pipe -fPIC
++#CFLAGS	= $(DEBUG) $(DEFS) $(INCLUDE) -Wformat=2 -Wall -Wextra -Wconversion -Winline -pipe -fPIC
  
  LIBS    = -lm -lpthread -lrt -lcrypt
  
-@@ -78,17 +82,17 @@ $(STATIC):	$(OBJ)
+@@ -75,17 +79,17 @@ static:
  
  $(DYNAMIC):	$(OBJ)
  	$Q echo "[Link (Dynamic)]"
@@ -360,7 +365,7 @@
  
  .PHONY:	tags
  tags:	$(SRC)
-@@ -99,22 +103,22 @@ tags:	$(SRC)
+@@ -96,13 +100,13 @@ tags:	$(SRC)
  .PHONY:	install
  install:	$(DYNAMIC)
  	$Q echo "[Install Headers]"
@@ -378,22 +383,9 @@
 +	$Q ln -sf $(DYNAMIC)						$(LIB_DIR)/$(BASE_NAME).so
 +	$Q ln -sf $(DYNAMIC)						$(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ)
  
- .PHONY:	install-static
- install-static:	$(STATIC)
- 	$Q echo "[Install Headers]"
--	$Q install -m 0755 -d						$(DESTDIR)$(PREFIX)/include
--	$Q install -m 0644 $(HEADERS)					$(DESTDIR)$(PREFIX)/include
-+	$Q install -m 0755 -d						$(INCLUDE_DIR)
-+	$Q install -m 0644 $(HEADERS)					$(INCLUDE_DIR)
- 	$Q echo "[Install Static Lib]"
--	$Q install -m 0755 -d						$(DESTDIR)$(PREFIX)/lib
--	$Q install -m 0755 libwiringPi.a					$(DESTDIR)$(PREFIX)/lib
-+	$Q install -m 0755 -d						$(LIB_DIR)
-+	$Q install -m 0755 $(STATIC)					$(LIB_DIR)
- 
  .PHONY:	install-deb
  install-deb:	$(DYNAMIC)
-@@ -129,9 +133,11 @@ install-deb:	$(DYNAMIC)
+@@ -117,9 +121,11 @@ install-deb:	$(DYNAMIC)
  .PHONY:	uninstall
  uninstall:
  	$Q echo "[UnInstall]"
diff --git a/meta-raspberrypi/recipes-devtools/wiringpi/wiringpi_git.bb b/meta-raspberrypi/recipes-devtools/wiringpi/wiringpi_git.bb
index f1b01db..e78c58a 100644
--- a/meta-raspberrypi/recipes-devtools/wiringpi/wiringpi_git.bb
+++ b/meta-raspberrypi/recipes-devtools/wiringpi/wiringpi_git.bb
@@ -4,8 +4,10 @@
 LICENSE = "LGPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=e6a600fd5e1d9cbde2d983680233ad02"
 
-# tag 2.44
-SRCREV = "96344ff7125182989f98d3be8d111952a8f74e15"
+DEPENDS += "virtual/crypt"
+
+# tag 2.46
+SRCREV = "8d188fa0e00bb8c6ff6eddd07bf92857e9bd533a"
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend b/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
index 7692133..c152bd9 100644
--- a/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
+++ b/meta-raspberrypi/recipes-graphics/eglinfo/eglinfo-fb_%.bbappend
@@ -1,2 +1,2 @@
 EGLINFO_DEVICE_rpi  = "raspberrypi"
-COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'null', '"(.*)"', d)}"
+COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'null', '(.*)', d)}"
diff --git a/meta-raspberrypi/recipes-graphics/kmscube/kmscube_%.bbappend b/meta-raspberrypi/recipes-graphics/kmscube/kmscube_%.bbappend
new file mode 100644
index 0000000..9343fb0
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/kmscube/kmscube_%.bbappend
@@ -0,0 +1,2 @@
+# userland driver EGL implementation does not have all needed bits for it so remove it from build
+COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '(.*)', 'null', d)}"
diff --git a/meta-raspberrypi/recipes-graphics/mesa/mesa-demos_%.bbappend b/meta-raspberrypi/recipes-graphics/mesa/mesa-demos_%.bbappend
new file mode 100644
index 0000000..c187ab9
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/mesa/mesa-demos_%.bbappend
@@ -0,0 +1,2 @@
+# mesa-demos need libgles1 and userland driver does not have it
+COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '(.*)', 'null', d)}"
diff --git a/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend b/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
index 52fe757..8152cc3 100644
--- a/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
+++ b/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
@@ -3,5 +3,5 @@
 # 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"
+GALLIUMDRIVERS_append_rpi = ",vc4"
 DRIDRIVERS_rpi = ""
diff --git a/meta-raspberrypi/recipes-graphics/piglit/piglit_%.bbappend b/meta-raspberrypi/recipes-graphics/piglit/piglit_%.bbappend
new file mode 100644
index 0000000..0503fd0
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/piglit/piglit_%.bbappend
@@ -0,0 +1,5 @@
+# mesa-demos need libgles1 and userland driver does not have it so remove it from piglit rdeps
+RDEPENDS_${PN}_remove_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'mesa-demos', d)}"
+# it needs EGL >= 11 but userland says it provided version 10, remove it from build
+# | --   Requested 'egl >= 11.0' but version of EGL is 10
+COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '(.*)', 'null', d)}"
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch b/meta-raspberrypi/recipes-graphics/userland/files/0001-Allow-applications-to-set-next-resource-handle.patch
similarity index 98%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0001-Allow-applications-to-set-next-resource-handle.patch
index 933f279..d6b2abb 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0001-Allow-applications-to-set-next-resource-handle.patch
@@ -1,7 +1,7 @@
-From 0a64dc61d3d7db69389157ae757203b4b3afdbfa Mon Sep 17 00:00:00 2001
+From 08d56c1174e27573ae8df2a7b9e6632afd0bfe86 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/16] Allow applications to set next resource handle
+Subject: [PATCH 01/18] Allow applications to set next resource handle
 
 This patch adds provisions in userland to
 let apps callers set the next rendereing dispmanx resource.
@@ -9,10 +9,10 @@
 ---
  interface/khronos/common/khrn_client_rpc.h |  2 ++
  interface/khronos/common/khrn_int_ids.h    |  2 ++
- interface/khronos/egl/egl_client.c         | 30 +++++++++++++++++++++++++++---
- interface/khronos/egl/egl_client_surface.c | 24 +++++++++++++++++++++++-
+ interface/khronos/egl/egl_client.c         | 30 +++++++++++++++++++---
+ interface/khronos/egl/egl_client_surface.c | 24 ++++++++++++++++-
  interface/khronos/egl/egl_client_surface.h |  3 ++-
- interface/khronos/egl/egl_int_impl.h       |  5 +++--
+ interface/khronos/egl/egl_int_impl.h       |  5 ++--
  6 files changed, 59 insertions(+), 7 deletions(-)
 
 diff --git a/interface/khronos/common/khrn_client_rpc.h b/interface/khronos/common/khrn_client_rpc.h
@@ -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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch b/meta-raspberrypi/recipes-graphics/userland/files/0002-wayland-Add-support-for-the-Wayland-winsys.patch
similarity index 82%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0002-wayland-Add-support-for-the-Wayland-winsys.patch
index 4613504..c41cde7 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0002-wayland-Add-support-for-the-Wayland-winsys.patch
@@ -1,7 +1,7 @@
-From 5608ec8002be8370e78c9dbb1e07cee4cfb18b58 Mon Sep 17 00:00:00 2001
+From da60a2a34a48e2b324fceae608964814488cc8fb 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/16] wayland: Add support for the Wayland winsys
+Subject: [PATCH 02/18] wayland: Add support for the Wayland winsys
 
 * Adds EGL_WL_bind_wayland_display extension
 * Adds wayland-egl library
@@ -16,38 +16,40 @@
 TODO: wl_dispmanx_server_buffer should probably be defined in a
 private header that can be included from EGL and vc_* instead of in
 vc_vchi_dispmanx.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
- .gitignore                                         |   1 +
- CMakeLists.txt                                     |  11 +
- README.md                                          |   4 +
- buildme                                            |  10 +-
- .../linux/apps/raspicam/CMakeLists.txt             |   2 +-
- interface/khronos/CMakeLists.txt                   |  53 ++++-
- interface/khronos/common/khrn_client.c             |  15 ++
- interface/khronos/common/khrn_client.h             |  10 +
- interface/khronos/common/khrn_client_mangle.h      |   3 +
- interface/khronos/common/khrn_client_platform.h    |   8 +
- interface/khronos/common/khrn_client_unmangle.h    |   3 +
- .../common/linux/khrn_client_platform_linux.c      | 115 ++++++++--
- interface/khronos/common/linux/khrn_wayland.c      | 215 ++++++++++++++++++
- .../common/linux/khrn_wayland.h}                   |  46 +---
- interface/khronos/egl/egl_client.c                 |  92 +++++---
- interface/khronos/egl/egl_client_get_proc.c        |  11 +
- interface/khronos/egl/egl_client_surface.c         |  42 +++-
- interface/khronos/egl/egl_client_surface.h         |  38 +++-
- interface/khronos/egl/egl_int_impl.h               |   2 +-
- interface/khronos/ext/egl_wayland.c                | 246 +++++++++++++++++++++
- interface/khronos/include/EGL/eglext.h             |  23 ++
- interface/khronos/wayland-egl/wayland-egl-priv.h   |  53 +++++
- interface/khronos/wayland-egl/wayland-egl.c        |  59 +++++
- interface/khronos/wayland-egl/wayland-egl.pc.in    |  10 +
- interface/vmcs_host/CMakeLists.txt                 |  21 +-
- interface/vmcs_host/vc_dispmanx.h                  |  10 +
- interface/vmcs_host/vc_vchi_dispmanx.c             |  42 ++++
- interface/vmcs_host/vc_vchi_dispmanx.h             |  15 ++
- interface/wayland/dispmanx.xml                     | 123 +++++++++++
- makefiles/cmake/Wayland.cmake                      |  72 ++++++
- 30 files changed, 1257 insertions(+), 98 deletions(-)
+ .gitignore                                    |   1 +
+ CMakeLists.txt                                |  11 +
+ README.md                                     |   4 +
+ buildme                                       |  10 +-
+ .../linux/apps/raspicam/CMakeLists.txt        |   2 +-
+ interface/khronos/CMakeLists.txt              |  54 +++-
+ interface/khronos/common/khrn_client.c        |  15 ++
+ interface/khronos/common/khrn_client.h        |  10 +
+ interface/khronos/common/khrn_client_mangle.h |   3 +
+ .../khronos/common/khrn_client_platform.h     |   8 +
+ .../khronos/common/khrn_client_unmangle.h     |   3 +
+ .../common/linux/khrn_client_platform_linux.c | 115 +++++++-
+ interface/khronos/common/linux/khrn_wayland.c | 215 +++++++++++++++
+ .../common/linux/khrn_wayland.h}              |  46 +---
+ interface/khronos/egl/egl_client.c            |  92 +++++--
+ interface/khronos/egl/egl_client_get_proc.c   |  11 +
+ interface/khronos/egl/egl_client_surface.c    |  42 ++-
+ interface/khronos/egl/egl_client_surface.h    |  38 ++-
+ interface/khronos/egl/egl_int_impl.h          |   2 +-
+ interface/khronos/ext/egl_wayland.c           | 246 ++++++++++++++++++
+ interface/khronos/include/EGL/eglext.h        |  23 ++
+ .../khronos/wayland-egl/wayland-egl-priv.h    |  53 ++++
+ interface/khronos/wayland-egl/wayland-egl.c   |  59 +++++
+ .../khronos/wayland-egl/wayland-egl.pc.in     |  10 +
+ interface/vmcs_host/CMakeLists.txt            |  21 +-
+ interface/vmcs_host/vc_dispmanx.h             |  10 +
+ interface/vmcs_host/vc_vchi_dispmanx.c        |  42 +++
+ interface/vmcs_host/vc_vchi_dispmanx.h        |  15 ++
+ interface/wayland/dispmanx.xml                | 123 +++++++++
+ makefiles/cmake/Wayland.cmake                 |  72 +++++
+ 30 files changed, 1257 insertions(+), 99 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
@@ -57,20 +59,20 @@
  create mode 100644 interface/wayland/dispmanx.xml
  create mode 100644 makefiles/cmake/Wayland.cmake
 
-Index: git/.gitignore
-===================================================================
---- git.orig/.gitignore
-+++ git/.gitignore
+diff --git a/.gitignore b/.gitignore
+index 63570f1..1459436 100644
+--- a/.gitignore
++++ b/.gitignore
 @@ -30,3 +30,4 @@ build/
  *.pts
  *.ppm
  *.mkv
 +*~
-Index: git/CMakeLists.txt
-===================================================================
---- git.orig/CMakeLists.txt
-+++ git/CMakeLists.txt
-@@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.
+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)
  include(makefiles/cmake/arm-linux.cmake)
  include(makefiles/cmake/vmcs.cmake)
  
@@ -88,11 +90,11 @@
  enable_language(ASM)
  
  # Global include paths
-Index: git/README.md
-===================================================================
---- git.orig/README.md
-+++ git/README.md
-@@ -6,3 +6,7 @@ Use buildme to build. It requires cmake
+diff --git a/README.md b/README.md
+index 94b93b8..50b90b1 100644
+--- a/README.md
++++ b/README.md
+@@ -6,3 +6,7 @@ Use buildme to build. It requires cmake to be installed and an arm cross compile
  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.
@@ -100,10 +102,10 @@
 +To build support for the Wayland winsys in EGL, execute the buildme script like this:
 +
 +$ BUILD_WAYLAND=1 ./buildme.
-Index: git/buildme
-===================================================================
---- git.orig/buildme
-+++ git/buildme
+diff --git a/buildme b/buildme
+index b8fd440..a780bb6 100755
+--- a/buildme
++++ b/buildme
 @@ -8,6 +8,10 @@ fi
  
  BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
@@ -130,23 +132,23 @@
  	make -j `nproc`
  
  	if [ "$1" != "" ]; then
-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
+diff --git a/host_applications/linux/apps/raspicam/CMakeLists.txt b/host_applications/linux/apps/raspicam/CMakeLists.txt
+index 42636e8..d47ad55 100644
+--- a/host_applications/linux/apps/raspicam/CMakeLists.txt
++++ b/host_applications/linux/apps/raspicam/CMakeLists.txt
+@@ -33,7 +33,7 @@ add_executable(raspividyuv  ${COMMON_SOURCES} RaspiVidYUV.c)
  
  set (MMAL_LIBS mmal_core mmal_util mmal_vc_client)
  
--target_link_libraries(raspistill ${MMAL_LIBS} vcos bcm_host brcmGLESv2 brcmEGL m)
-+target_link_libraries(raspistill ${MMAL_LIBS} vcos bcm_host brcmGLESv2 brcmEGL m ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES})
+-target_link_libraries(raspistill ${MMAL_LIBS} vcos bcm_host brcmGLESv2 brcmEGL m dl)
++target_link_libraries(raspistill ${MMAL_LIBS} vcos bcm_host brcmGLESv2 brcmEGL m dl ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES})
  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)
-Index: git/interface/khronos/CMakeLists.txt
-===================================================================
---- git.orig/interface/khronos/CMakeLists.txt
-+++ git/interface/khronos/CMakeLists.txt
+diff --git a/interface/khronos/CMakeLists.txt b/interface/khronos/CMakeLists.txt
+index 9ad615b..95c0e11 100644
+--- a/interface/khronos/CMakeLists.txt
++++ b/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.
@@ -216,7 +218,7 @@
  # 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 +121,7 @@ include_directories (../../host_applicat
+@@ -72,8 +121,7 @@ include_directories (../../host_applications/linux/libs/sm )
  set(VCSM_LIBS vcsm)
  add_definitions(-DKHRONOS_HAVE_VCSM)
  endif()
@@ -226,7 +228,7 @@
  target_link_libraries(GLESv2 EGL khrn_client vcos)
  target_link_libraries(WFC EGL)
  target_link_libraries(OpenVG EGL)
-@@ -87,7 +135,7 @@ add_library(brcmGLESv2 ${SHARED} ${GLES_
+@@ -87,7 +135,7 @@ add_library(brcmGLESv2 ${SHARED} ${GLES_SOURCE})
  add_library(brcmOpenVG ${SHARED} ${VG_SOURCE})
  add_library(brcmWFC ${SHARED} ${WFC_SOURCE})
  
@@ -235,11 +237,11 @@
  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
+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.
  #include "applications/vmcs/khronos/khronos_server.h"
  #endif
  
@@ -250,7 +252,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_PRO
+@@ -142,6 +146,10 @@ void client_try_unload_server(CLIENT_PROCESS_STATE_T *process)
  bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
  {
     if (!process->inited) {
@@ -261,7 +263,7 @@
        if (!khrn_pointer_map_init(&process->contexts, 64))
           return false;
  
-@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PR
+@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
        }
  #endif
  
@@ -275,10 +277,10 @@
        process->inited = true;
     }
  
-Index: git/interface/khronos/common/khrn_client.h
-===================================================================
---- git.orig/interface/khronos/common/khrn_client.h
-+++ git/interface/khronos/common/khrn_client.h
+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
 @@ -310,6 +310,16 @@ struct CLIENT_PROCESS_STATE {
  #ifdef RPC_LIBRARY
     KHRONOS_SERVER_CONNECTION_T khrn_connection;
@@ -296,11 +298,11 @@
  };
  
  extern bool client_process_state_init(CLIENT_PROCESS_STATE_T *process);
-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
+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.
  #define eglReleaseGlobalImageBRCM mangled_eglReleaseGlobalImageBRCM
  #define eglInitGlobalImageBRCM mangled_eglInitGlobalImageBRCM
  #define eglTermGlobalImageBRCM mangled_eglTermGlobalImageBRCM
@@ -310,11 +312,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-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
+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.
  #include "interface/khronos/common/vcos/khrn_client_platform_filler_vcos.h"
  #endif
  
@@ -334,11 +336,11 @@
 +#endif
 +
  #endif // KHRN_CLIENT_PLATFORM_H
-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
+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.
  #undef eglReleaseGlobalImageBRCM
  #undef eglInitGlobalImageBRCM
  #undef eglTermGlobalImageBRCM
@@ -348,11 +350,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-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
+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.
  #include "X11/Xlib.h"
  #endif
  
@@ -364,7 +366,7 @@
  extern VCOS_LOG_CAT_T khrn_client_log;
  
  extern void vc_vchi_khronos_init();
-@@ -464,14 +469,37 @@ EGLDisplay khrn_platform_set_display_id(
+@@ -464,13 +469,36 @@ EGLDisplay khrn_platform_set_display_id(EGLNativeDisplayType display_id)
  	   return EGL_NO_DISPLAY;
  }
  #else
@@ -392,19 +394,18 @@
 +#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
- static void dump_hierarchy(Window w, Window thisw, Window look, int level)
-@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_defa
+@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_default(EGLNativeWindowType win)
  void platform_get_dimensions(EGLDisplay dpy, EGLNativeWindowType win,
        uint32_t *width, uint32_t *height, uint32_t *swapchain_count)
  {
@@ -435,8 +436,8 @@
 +#ifdef BUILD_WAYLAND
 +   }
 +#endif
-+}
-+
+ }
+ 
 +#ifdef BUILD_WAYLAND
 +static DISPMANX_ELEMENT_HANDLE_T create_dummy_element()
 +{
@@ -467,9 +468,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);
@@ -498,10 +499,11 @@
  }
  
  #endif
-Index: git/interface/khronos/common/linux/khrn_wayland.c
-===================================================================
+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
 --- /dev/null
-+++ git/interface/khronos/common/linux/khrn_wayland.c
++++ b/interface/khronos/common/linux/khrn_wayland.c
 @@ -0,0 +1,215 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -718,72 +720,74 @@
 +
 +   return wl_dispmanx_client_buffer;
 +}
-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 @@
-+/*
+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
 +Copyright (c) 2013, Raspberry Pi Foundation
-+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.
-+*/
-+
+ 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
 +#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);
-Index: git/interface/khronos/egl/egl_client.c
-===================================================================
---- git.orig/interface/khronos/egl/egl_client.c
-+++ git/interface/khronos/egl/egl_client.c
+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
 @@ -153,6 +153,10 @@ by an attribute value"
  #include <stdlib.h>
  #include <string.h>
@@ -795,7 +799,7 @@
  
  #include "interface/khronos/egl/egl_client_cr.c"
  
-@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_P
+@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_PROCESS_STATE_T *process, EGL_CURRENT_T *
  void egl_gl_flush_callback(bool wait);
  void egl_vg_flush_callback(bool wait);
  
@@ -813,17 +817,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?)
-@@ -451,6 +444,9 @@ EGLAPI const char EGLAPIENTRY * eglQuery
+@@ -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 eglCreateW
+@@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig c
                                  false,
                                  EGL_NO_TEXTURE,
                                  EGL_NO_TEXTURE,
@@ -833,7 +837,7 @@
  
                 if (surface) {
                    if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
+@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig
                               mipmap_texture,
                               texture_format,
                               texture_target,
@@ -842,7 +846,7 @@
  
              if (surface) {
                 if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
+@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig c
                                     false,
                                     EGL_NO_TEXTURE,
                                     EGL_NO_TEXTURE,
@@ -851,7 +855,7 @@
  
                       if (surface) {
                          if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
+@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
     CLIENT_THREAD_STATE_T *thread;
     CLIENT_PROCESS_STATE_T *process;
     EGLBoolean result;
@@ -861,7 +865,7 @@
  
     vcos_log_trace("eglSwapBuffers start. dpy=%d. surf=%d.", (int)dpy, (int)surf);
  
-@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
+@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
  
                 vcos_log_trace("eglSwapBuffers server call");
  
@@ -932,11 +936,11 @@
                 RPC_CALL6(eglIntSwapBuffers_impl,
                       thread,
                       EGLINTSWAPBUFFERS_ID,
-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
+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)
        return (void(*)(void))eglQueryGlobalImageBRCM;
  #endif
  
@@ -954,11 +958,11 @@
     return (void(*)(void)) NULL;
  }
  
-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
+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.
  #include "interface/khronos/egl/egl_int_impl.h"
  #endif
  
@@ -1032,7 +1036,7 @@
           RPC_CALL15_OUT_CTRL(eglIntCreateSurface_impl,
                               thread,
                               EGLINTCREATESURFACE_ID,
-@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *sur
+@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *surface)
     if( surface->type == WINDOW ) {
        vcos_log_trace("egl_surface_free: calling platform_destroy_winhandle...");
        platform_destroy_winhandle( surface->win, surface->internal_handle );
@@ -1051,10 +1055,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
-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
+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
 @@ -288,6 +288,41 @@ typedef struct {
        type == PIXMAP
     */
@@ -1097,7 +1101,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,
@@ -1107,10 +1111,10 @@
  extern EGL_SURFACE_T *egl_surface_from_vg_image(
     VGImage vg_handle,
     EGLSurface name,
-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
+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
 @@ -57,7 +57,7 @@ FN(int, eglIntCreateSurface_impl, (
     uint32_t sem,
     uint32_t type,
@@ -1120,10 +1124,11 @@
  
  FN(int, eglIntCreatePbufferFromVGImage_impl, (
     VGImage vg_handle,
-Index: git/interface/khronos/ext/egl_wayland.c
-===================================================================
+diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
+new file mode 100644
+index 0000000..5730743
 --- /dev/null
-+++ git/interface/khronos/ext/egl_wayland.c
++++ b/interface/khronos/ext/egl_wayland.c
 @@ -0,0 +1,246 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -1371,11 +1376,11 @@
 +
 +   return EGL_FALSE;
 +}
-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
+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
  #endif
  
  
@@ -1405,10 +1410,11 @@
  #ifdef __cplusplus
  }
  #endif
-Index: git/interface/khronos/wayland-egl/wayland-egl-priv.h
-===================================================================
+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
 --- /dev/null
-+++ git/interface/khronos/wayland-egl/wayland-egl-priv.h
++++ b/interface/khronos/wayland-egl/wayland-egl-priv.h
 @@ -0,0 +1,53 @@
 +/* Copied from Mesa */
 +
@@ -1463,10 +1469,11 @@
 +#endif
 +
 +#endif
-Index: git/interface/khronos/wayland-egl/wayland-egl.c
-===================================================================
+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
 --- /dev/null
-+++ git/interface/khronos/wayland-egl/wayland-egl.c
++++ b/interface/khronos/wayland-egl/wayland-egl.c
 @@ -0,0 +1,59 @@
 +/* Copied from Mesa */
 +
@@ -1527,10 +1534,11 @@
 +	if (height)
 +		*height = egl_window->attached_height;
 +}
-Index: git/interface/khronos/wayland-egl/wayland-egl.pc.in
-===================================================================
+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
 --- /dev/null
-+++ git/interface/khronos/wayland-egl/wayland-egl.pc.in
++++ b/interface/khronos/wayland-egl/wayland-egl.pc.in
 @@ -0,0 +1,10 @@
 +prefix=@CMAKE_INSTALL_PREFIX@
 +exec_prefix=${prefix}
@@ -1542,10 +1550,10 @@
 +Version: @PROJECT_APIVER@
 +Libs: -L${libdir} -lwayland-egl
 +Cflags: -I${includedir}
-Index: git/interface/vmcs_host/CMakeLists.txt
-===================================================================
---- git.orig/interface/vmcs_host/CMakeLists.txt
-+++ git/interface/vmcs_host/CMakeLists.txt
+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
 @@ -9,13 +9,24 @@ add_definitions(-fno-strict-aliasing)
  
  include_directories(${VMCS_TARGET}/vcfiled)
@@ -1576,11 +1584,11 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
  # OpenMAX/IL component service
-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
+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.
  #ifdef __cplusplus
  extern "C" {
  #endif
@@ -1592,7 +1600,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_resourc
+@@ -135,6 +140,11 @@ VCHPRE_ int VCHPOST_ vc_dispmanx_resource_set_palette( DISPMANX_RESOURCE_HANDLE_
  // 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 );
  
@@ -1604,11 +1612,11 @@
  #ifdef __cplusplus
  }
  #endif
-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
+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 ) {
     }
     return 0;
  }
@@ -1654,10 +1662,35 @@
 +	buffer->in_use = in_use;
 +}
 +#endif
-Index: git/interface/wayland/dispmanx.xml
-===================================================================
+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
 --- /dev/null
-+++ git/interface/wayland/dispmanx.xml
++++ b/interface/wayland/dispmanx.xml
 @@ -0,0 +1,123 @@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<protocol name="dispmanx">
@@ -1782,10 +1815,11 @@
 +  </interface>
 +
 +</protocol>
-Index: git/makefiles/cmake/Wayland.cmake
-===================================================================
+diff --git a/makefiles/cmake/Wayland.cmake b/makefiles/cmake/Wayland.cmake
+new file mode 100644
+index 0000000..ad90d30
 --- /dev/null
-+++ git/makefiles/cmake/Wayland.cmake
++++ b/makefiles/cmake/Wayland.cmake
 @@ -0,0 +1,72 @@
 +#=============================================================================
 +# Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
@@ -1859,3 +1893,6 @@
 +    list(APPEND ${_sources} "${_server_header}")
 +    set(${_sources} ${${_sources}} PARENT_SCOPE)
 +endfunction()
+-- 
+2.19.1
+
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch b/meta-raspberrypi/recipes-graphics/userland/files/0003-wayland-Add-Wayland-example.patch
similarity index 98%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0003-wayland-Add-Wayland-example.patch
index e3a0cf2..d83a9e5 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0003-wayland-Add-Wayland-example.patch
Binary files differ
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch b/meta-raspberrypi/recipes-graphics/userland/files/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
similarity index 86%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
index 713fc3e..a42aa14 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
@@ -1,7 +1,7 @@
-From f17879b691984b5c4950e4b94ebf102c78797ede Mon Sep 17 00:00:00 2001
+From c379bd2dc575256084d9e36fc11a347e20660130 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/16] wayland-egl: Add bcm_host to dependencies
+Subject: [PATCH 04/18] 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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch b/meta-raspberrypi/recipes-graphics/userland/files/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
similarity index 88%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
index 8d78333..bbaadda 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
@@ -1,7 +1,7 @@
-From 0273b7b9d7a27d8fe7d3ad8680b799f997e75dca Mon Sep 17 00:00:00 2001
+From bd940c32878d401f311215270579ff513c2f3999 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/16] interface: remove faulty assert() to make weston happy
+Subject: [PATCH 05/18] 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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch b/meta-raspberrypi/recipes-graphics/userland/files/0006-zero-out-wl-buffers-in-egl_surface_free.patch
similarity index 87%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0006-zero-out-wl-buffers-in-egl_surface_free.patch
index 43eb7f0..1a5e14f 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0006-zero-out-wl-buffers-in-egl_surface_free.patch
@@ -1,7 +1,7 @@
-From 0d678cd2042551cc4e26ec42fa3aba7c72d033b4 Mon Sep 17 00:00:00 2001
+From 466f28ce302f68ac39be750f4b55285791f43ab1 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/16] zero-out wl buffers in egl_surface_free
+Subject: [PATCH 06/18] zero-out wl buffers in egl_surface_free
 
 origins from buildroot
 
@@ -29,5 +29,5 @@
  #endif
     }
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch b/meta-raspberrypi/recipes-graphics/userland/files/0007-initialize-front-back-wayland-buffers.patch
similarity index 88%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0007-initialize-front-back-wayland-buffers.patch
index 987740b..72264e4 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0007-initialize-front-back-wayland-buffers.patch
@@ -1,7 +1,7 @@
-From ec2e00989bf614b259bc9a47b5035f8586e8a214 Mon Sep 17 00:00:00 2001
+From b4a2967513f7d0f5f3caee8cf6cbc7a7a085ebac 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/16] initialize front back wayland buffers
+Subject: [PATCH 07/18] initialize front back wayland buffers
 
 origins from metrological wayland support
 
@@ -30,5 +30,5 @@
     }
  #endif
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch b/meta-raspberrypi/recipes-graphics/userland/files/0008-Remove-RPC_FLUSH.patch
similarity index 87%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0008-Remove-RPC_FLUSH.patch
index 4bf05c1..a100e39 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0008-Remove-RPC_FLUSH.patch
@@ -1,7 +1,7 @@
-From 59ba66c2ea17f7a57124b9fd6c9bdff4325ff5c9 Mon Sep 17 00:00:00 2001
+From 14c22987dfa9fec02794856cd15b2d64b4b81c32 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/16] Remove RPC_FLUSH
+Subject: [PATCH 08/18] Remove RPC_FLUSH
 
 Origins from buildroot
 
@@ -23,5 +23,5 @@
        }
  #endif
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch b/meta-raspberrypi/recipes-graphics/userland/files/0009-fix-cmake-dependency-race.patch
similarity index 95%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0009-fix-cmake-dependency-race.patch
index a2c1df5..4609455 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0009-fix-cmake-dependency-race.patch
@@ -1,7 +1,7 @@
-From 264d82387ea1e607b2e5c899ff6bd46807c7b185 Mon Sep 17 00:00:00 2001
+From e510be221276d06e630ab93452ecb712d3921790 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/16] fix cmake dependency race
+Subject: [PATCH 09/18] fix cmake dependency race
 
 Fixes errors like
 
@@ -74,5 +74,5 @@
  	struct wl_resource *resource;
  	struct wl_dispmanx *dispmanx;
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch b/meta-raspberrypi/recipes-graphics/userland/files/0010-Fix-for-framerate-with-nested-composition.patch
similarity index 94%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0010-Fix-for-framerate-with-nested-composition.patch
index a6c9a59..dd0b95e 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0010-Fix-for-framerate-with-nested-composition.patch
@@ -1,7 +1,7 @@
-From 7c51c2d37bfadaabbbf205237d932b685b09d34f Mon Sep 17 00:00:00 2001
+From 8e6cde08077eadfe563dc17c19995ebc48e30b97 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/16] Fix for framerate with nested composition
+Subject: [PATCH 10/18] 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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch b/meta-raspberrypi/recipes-graphics/userland/files/0011-build-shared-library-for-vchostif.patch
similarity index 84%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0011-build-shared-library-for-vchostif.patch
index 55a5be8..4bd5320 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0011-build-shared-library-for-vchostif.patch
@@ -1,7 +1,7 @@
-From fb3002f77a175633af31019c513754d2ef5f3ac0 Mon Sep 17 00:00:00 2001
+From 9a97d60262999093d6ce8cb688279506c210d802 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/16] build shared library for vchostif
+Subject: [PATCH 11/18] build shared library for vchostif
 
 Fixes #149
 
@@ -24,5 +24,5 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch b/meta-raspberrypi/recipes-graphics/userland/files/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
similarity index 92%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
index 28a5fc6..9684b4c 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
@@ -1,14 +1,14 @@
-From df8b9633a45069bdd1bf256d974636ef11aa39cb Mon Sep 17 00:00:00 2001
+From fedd7668152049c15ed58c7058e5f4a9c1fac7cb 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/16] implement buffer wrapping interface for dispmanx
+Subject: [PATCH 12/18] implement buffer wrapping interface for dispmanx
 
 Courtesy: Zan Dobersek
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
 ---
- interface/khronos/ext/egl_wayland.c | 42 +++++++++++++++++++++++++++++++++++++
- interface/wayland/dispmanx.xml      | 10 +++++++++
+ interface/khronos/ext/egl_wayland.c | 42 +++++++++++++++++++++++++++++
+ interface/wayland/dispmanx.xml      | 10 +++++++
  2 files changed, 52 insertions(+)
 
 diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
@@ -88,5 +88,5 @@
  
  </protocol>
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch b/meta-raspberrypi/recipes-graphics/userland/files/0013-Implement-triple-buffering-for-wayland.patch
similarity index 95%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0013-Implement-triple-buffering-for-wayland.patch
index ebff314..3052168 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0013-Implement-triple-buffering-for-wayland.patch
@@ -1,7 +1,7 @@
-From 2e0e331da8556fecd841349cfae294baf0f14485 Mon Sep 17 00:00:00 2001
+From 65f8bca55aead676cd06fc3210aeffef1f2158c6 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/16] Implement triple buffering for wayland
+Subject: [PATCH 13/18] 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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/files/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch b/meta-raspberrypi/recipes-graphics/userland/files/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
new file mode 100644
index 0000000..037d708
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
@@ -0,0 +1,35 @@
+From dc1d07d835e1fe70c957a655d6fbb8cde65775af 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/18] 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 | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/interface/khronos/include/GLES2/gl2ext.h b/interface/khronos/include/GLES2/gl2ext.h
+index 4eacf7f..b1acc9f 100644
+--- a/interface/khronos/include/GLES2/gl2ext.h
++++ b/interface/khronos/include/GLES2/gl2ext.h
+@@ -327,6 +327,14 @@ typedef void* GLeglImageOES;
+ #define GL_RGBX_BRCM                                            0x80EE
+ #endif
+ 
++#ifndef GL_EXT_texture_rg
++#define GL_EXT_texture_rg 1
++#define GL_RED_EXT                                              0x1903
++#define GL_RG_EXT                                               0x8227
++#define GL_R8_EXT                                               0x8229
++#define GL_RG8_EXT                                              0x822B
++#endif /* GL_EXT_texture_rg */
++
+ /* 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.19.1
+
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch b/meta-raspberrypi/recipes-graphics/userland/files/0015-EGL-glplatform.h-define-EGL_CAST.patch
similarity index 88%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0015-EGL-glplatform.h-define-EGL_CAST.patch
index 605d0c0..02cecb8 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0015-EGL-glplatform.h-define-EGL_CAST.patch
@@ -1,7 +1,7 @@
-From a2182e5437a6664cdb0f3330f6cbee873b6f975a Mon Sep 17 00:00:00 2001
+From b5fa294c0d8fcb6dd5bfbfb96a0885dd9f3ae609 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/16] EGL/glplatform.h: define EGL_CAST
+Subject: [PATCH 15/18] 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.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch b/meta-raspberrypi/recipes-graphics/userland/files/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
similarity index 95%
rename from meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
rename to meta-raspberrypi/recipes-graphics/userland/files/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
index d20ec82..34ad90c 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
@@ -1,7 +1,7 @@
-From 6b4c4d469d435bfcfb464356b6ccc9421c6b8fd5 Mon Sep 17 00:00:00 2001
+From bff03f92c0d8bae113e0c7234c719f8385808b38 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
+Subject: [PATCH 16/18] Allow multiple wayland compositor state data per
  process
 
 When eglBindWaylandDisplayWL is called store the wl_global
@@ -15,8 +15,8 @@
 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 ++++++++++++++++++++++++++++++----
+ 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
@@ -141,5 +141,5 @@
     CLIENT_UNLOCK();
  
 -- 
-2.16.1
+2.19.1
 
diff --git a/meta-raspberrypi/recipes-graphics/userland/files/0017-khronos-backport-typedef-for-EGL_EXT_image_dma_buf_i.patch b/meta-raspberrypi/recipes-graphics/userland/files/0017-khronos-backport-typedef-for-EGL_EXT_image_dma_buf_i.patch
new file mode 100644
index 0000000..546cd58
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0017-khronos-backport-typedef-for-EGL_EXT_image_dma_buf_i.patch
@@ -0,0 +1,38 @@
+From 8efd81e96bdd3be68063a6fd32be4755225e93b2 Mon Sep 17 00:00:00 2001
+From: Hugo Hromic <hhromic@gmail.com>
+Date: Sun, 13 May 2018 10:49:04 +0100
+Subject: [PATCH 17/18] khronos: backport typedef for
+ EGL_EXT_image_dma_buf_import
+
+The `gstreamer1.0-plugins-base` package version `1.14` uses `EGL_EXT_image_dma_buf_import`, which
+expects the `EGLuint64KHR` typedef that is present in recent versions of Khronos.
+However, the older version included in userland does not provide it.
+
+This patch backports the missing typedef from recent Khronos into userland.
+See: <https://www.khronos.org/registry/EGL/api/EGL/eglext.h>
+
+Submitted to userland in <https://github.com/raspberrypi/userland/pull/467>
+
+Upstream-Status: Submitted
+---
+ interface/khronos/include/EGL/eglext.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/interface/khronos/include/EGL/eglext.h b/interface/khronos/include/EGL/eglext.h
+index d7e5ba7..dcc90ce 100755
+--- a/interface/khronos/include/EGL/eglext.h
++++ b/interface/khronos/include/EGL/eglext.h
+@@ -190,6 +190,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSy
+ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+ #endif
+ 
++#ifndef EGL_KHR_uint64_typedef
++#define EGL_KHR_uint64_typedef 1
++typedef khronos_uint64_t EGLuint64KHR;
++#endif /* EGL_KHR_uint64_typedef */
+ 
+ #ifndef EGL_WL_bind_wayland_display
+ #define EGL_WL_bind_wayland_display 1
+-- 
+2.19.1
+
diff --git a/meta-raspberrypi/recipes-graphics/userland/files/0018-Add-EGL_IMG_context_priority-related-defines.patch b/meta-raspberrypi/recipes-graphics/userland/files/0018-Add-EGL_IMG_context_priority-related-defines.patch
new file mode 100644
index 0000000..f4d865e
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/userland/files/0018-Add-EGL_IMG_context_priority-related-defines.patch
@@ -0,0 +1,35 @@
+From 9cfea4761ba68776fd9bfac671b74c7174f99029 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 15 Jul 2018 00:48:38 -0700
+Subject: [PATCH 18/18] Add EGL_IMG_context_priority related defines
+
+These defines are needed for compiling weston 4.x
+taken from Khronos headers
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ interface/khronos/include/EGL/eglext.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/interface/khronos/include/EGL/eglext.h b/interface/khronos/include/EGL/eglext.h
+index dcc90ce..6842bf9 100755
+--- a/interface/khronos/include/EGL/eglext.h
++++ b/interface/khronos/include/EGL/eglext.h
+@@ -93,6 +93,14 @@ typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGL
+ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+ #endif
+ 
++#ifndef EGL_IMG_context_priority
++#define EGL_IMG_context_priority 1
++#define EGL_CONTEXT_PRIORITY_LEVEL_IMG		0x3102
++#define EGL_CONTEXT_PRIORITY_HIGH_IMG		0x3101
++#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG		0x3102
++#define EGL_CONTEXT_PRIORITY_LOW_IMG		0x3103
++#endif /* EGL_IMG_context_priority */
++
+ #ifndef EGL_KHR_vg_parent_image
+ #define EGL_KHR_vg_parent_image 1
+ #define EGL_VG_PARENT_IMAGE_KHR			0x30BA	/* eglCreateImageKHR target */
+-- 
+2.19.1
+
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch b/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
deleted file mode 100644
index 025b6bc..0000000
--- a/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-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/16] 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.16.1
-
diff --git a/meta-raspberrypi/recipes-graphics/userland/userland_git.bb b/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
index 7f2dca6..e6af4bf 100644
--- a/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
+++ b/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
@@ -5,20 +5,18 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=0448d6488ef8cc380632b1569ee6d196"
 
-PROVIDES = "virtual/libgles2 \
-            virtual/egl"
+PROVIDES += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "", "virtual/libgles2 virtual/egl", d)}"
 
-RPROVIDES_${PN} += "libgles2 egl libegl"
-
+RPROVIDES_${PN} += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "", "libgles2 egl libegl libegl1 libgl1 libglesv2-2", d)}"
 COMPATIBLE_MACHINE = "^rpi$"
 
 SRCBRANCH = "master"
 SRCFORK = "raspberrypi"
-SRCREV = "11389772c79685442e0ab8aa9be8ad0e32703f68"
+SRCREV = "d574b51a60a075baefe863670466ee24e6c4256e"
 
 # Use the date of the above commit as the package version. Update this when
 # SRCREV is changed.
-PV = "20180219"
+PV = "20181120"
 
 SRC_URI = "\
     git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
@@ -38,6 +36,8 @@
     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 \
+    file://0017-khronos-backport-typedef-for-EGL_EXT_image_dma_buf_i.patch \
+    file://0018-Add-EGL_IMG_context_priority-related-defines.patch \
 "
 S = "${WORKDIR}/git"
 
@@ -64,6 +64,14 @@
 		sed -i 's/include "vcos_futex_mutex.h"/include "pthreads\/vcos_futex_mutex.h"/g' ${f}
 		sed -i 's/include "vcos_platform_types.h"/include "pthreads\/vcos_platform_types.h"/g' ${f}
 	done
+	if [ "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" = "1" ]; then
+		rm -rf ${D}${libdir}/libEGL*
+		rm -rf ${D}${libdir}/libGLES*
+		rm -rf ${D}${libdir}/libwayland-*
+		rm -rf ${D}${libdir}/pkgconfig/egl.pc ${D}${libdir}/pkgconfig/glesv2.pc \
+			${D}${libdir}/pkgconfig/wayland-egl.pc
+		rm -rf ${D}${includedir}/EGL ${D}${includedir}/GLES* ${D}${includedir}/KHR
+	fi
 }
 
 # Shared libs from userland package  build aren't versioned, so we need
@@ -83,3 +91,4 @@
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 RDEPENDS_${PN} += "bash"
+RDEPENDS_${PN} += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "libegl1", "", d)}"
diff --git a/meta-raspberrypi/recipes-graphics/wayland/wayland_%.bbappend b/meta-raspberrypi/recipes-graphics/wayland/wayland_%.bbappend
new file mode 100644
index 0000000..e5bbf4a
--- /dev/null
+++ b/meta-raspberrypi/recipes-graphics/wayland/wayland_%.bbappend
@@ -0,0 +1,7 @@
+# until fully tested, prefer `libwayland-egl` provided by `userland` instead of `wayland` when not using vc4graphics
+do_install_append_rpi () {
+    if [ "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" = "0" ]; then
+        rm -f ${D}${libdir}/libwayland-egl*
+        rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
+    fi
+}
diff --git a/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf b/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf
deleted file mode 100644
index 1a562ea..0000000
--- a/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# 
-Section "Device"
-	Identifier "modeset"
-	Driver "modesetting"
-	Option "AccelMethod" "None"
-EndSection
diff --git a/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend b/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend
index 919e95e..71e0adc 100644
--- a/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend
+++ b/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_%.bbappend
@@ -3,19 +3,14 @@
 SRC_URI_append_rpi = " \
     file://xorg.conf.d/98-pitft.conf \
     file://xorg.conf.d/99-calibration.conf \
-    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
 }
 
 FILES_${PN}_rpi += "${sysconfdir}/X11/xorg.conf ${sysconfdir}/X11/xorg.conf.d/*"
diff --git a/meta-raspberrypi/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb b/meta-raspberrypi/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb
new file mode 100644
index 0000000..b16b2c1
--- /dev/null
+++ b/meta-raspberrypi/recipes-kernel/bluez-firmware-rpidistro/bluez-firmware-rpidistro_git.bb
@@ -0,0 +1,84 @@
+SUMMARY = "Linux kernel Bluetooth firmware files from Raspbian distribution"
+DESCRIPTION = "Updated Bluetooth firmware files for RaspberryPi hardware. \
+RPi-Distro obtains these directly from Cypress; they are not submitted \
+to linux-firmware for general use."
+HOMEPAGE = "https://github.com/RPi-Distro/bluez-firmware"
+SECTION = "kernel"
+
+# Upstream has provided[^1] licensing information in the Debian
+# copyright file.  The wording of the Cypress license subsequently
+# changed in linux-firmware.
+#
+# Rather than make assumptions about what's supposed to be what, we'll
+# use the license implied by the source of these files, named to avoid
+# conflicts with linux-firmware.
+#
+# [^1]: https://github.com/RPi-Distro/bluez-firmware/issues/1
+LICENSE = "Firmware-cypress-rpidistro"
+LIC_FILES_CHKSUM = "\
+    file://LICENCE.cypress-rpidistro;md5=852f9d10cbedba1f6c439729bd0617b4 \
+"
+
+# These are not common licenses, set NO_GENERIC_LICENSE for them
+# so that the license files will be copied from fetched source
+NO_GENERIC_LICENSE[Firmware-cypress-rpidistro] = "LICENCE.cypress-rpidistro"
+
+SRC_URI = "git://github.com/RPi-Distro/bluez-firmware"
+SRCREV = "ade2bae1aaaebede09abb8fb546f767a0e4c7804"
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit allarch
+
+CLEANBROKEN = "1"
+
+do_extract_lic() {
+    # Extract the license from the Debian copyright file
+    sed -e '1,23d' ${S}/debian/copyright > ${S}/LICENCE.cypress-rpidistro
+}
+# Must be before both do_install and do_populate_lic.  Putting it before
+# their common ancestor works; other approaches do not.
+addtask extract_lic after do_unpack before do_patch
+
+do_compile() {
+    :
+}
+
+do_install() {
+    install -d ${D}${nonarch_base_libdir}/firmware/brcm
+
+    cp LICENCE.cypress-rpidistro ${D}${nonarch_base_libdir}/firmware
+    install -m 0644 broadcom/BCM434*.hcd ${D}${nonarch_base_libdir}/firmware/brcm/
+}
+
+PACKAGES = "\
+    ${PN}-cypress-license \
+    ${PN}-bcm43430a1-hcd \
+    ${PN}-bcm4345c0-hcd \
+"
+
+LICENSE_${PN}-bcm43430a1-hcd = "Firmware-cypress-rpidistro"
+LICENSE_${PN}-bcm4345c0-hcd = "Firmware-cypress-rpidistro"
+LICENSE_${PN}-cypress-license = "Firmware-cypress-rpidistro"
+
+FILES_${PN}-cypress-license = "\
+    ${nonarch_base_libdir}/firmware/LICENCE.cypress-rpidistro \
+"
+FILES_${PN}-bcm43430a1-hcd = "\
+    ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.hcd \
+"
+FILES_${PN}-bcm4345c0-hcd = "\
+    ${nonarch_base_libdir}/firmware/brcm/BCM4345C0.hcd \
+"
+
+RDEPENDS_${PN}-bcm43430a1-hcd += "${PN}-cypress-license"
+RDEPENDS_${PN}-bcm4345c0-hcd += "${PN}-cypress-license"
+RCONFLICTS_${PN}-bcm43430a1-hcd = "linux-firmware-bcm43430a1-hcd"
+RREPLACES_${PN}-bcm43430a1-hcd = "linux-firmware-bcm43430a1-hcd"
+RCONFLICTS_${PN}-bcm43435c0-hcd = "linux-firmware-bcm4345c0-hcd"
+RREPLACES_${PN}-bcm43435c0-hcd = "linux-firmware-bcm4345c0-hcd"
+
+# Firmware files are generally not run on the CPU, so they can be
+# allarch despite being architecture specific
+INSANE_SKIP = "arch"
diff --git a/meta-raspberrypi/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb b/meta-raspberrypi/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb
new file mode 100644
index 0000000..1f63c32
--- /dev/null
+++ b/meta-raspberrypi/recipes-kernel/linux-firmware-rpidistro/linux-firmware-rpidistro_git.bb
@@ -0,0 +1,96 @@
+SUMMARY = "Linux kernel firmware files from Raspbian distribution"
+DESCRIPTION = "Updated firmware files for RaspberryPi hardware. \
+RPi-Distro obtains these directly from Cypress; they are not submitted \
+to linux-firmware for general use."
+HOMEPAGE = "https://github.com/RPi-Distro/firmware-nonfree"
+SECTION = "kernel"
+
+# In maintained upstream linux-firmware:
+# * brcmfmac43430-sdio falls under LICENCE.cypress
+# * brcmfmac43455-sdio falls under LICENCE.broadcom_bcm43xx
+#
+# It is likely[^1] that both of these should be under LICENCE.cypress.
+# Further, at this time the text of LICENCE.broadcom_bcm43xx is the same
+# in linux-firmware and RPi-Distro/firmware-nonfree, but this may
+# change.
+#
+# Rather than make assumptions about what's supposed to be what, we'll
+# use the license implied by the source of these files, named to avoid
+# conflicts with linux-firmware.
+#
+# [^1]: https://github.com/RPi-Distro/bluez-firmware/issues/1
+LICENSE = "\
+    Firmware-broadcom_bcm43xx-rpidistro \
+    & WHENCE \
+"
+LIC_FILES_CHKSUM = "\
+    file://LICENCE.broadcom_bcm43xx;md5=3160c14df7228891b868060e1951dfbc \
+    file://WHENCE;md5=a9c2c217f513c20e1d16b384b3e2c12d \
+"
+
+# These are not common licenses, set NO_GENERIC_LICENSE for them
+# so that the license files will be copied from fetched source
+NO_GENERIC_LICENSE[Firmware-broadcom_bcm43xx-rpidistro] = "LICENCE.broadcom_bcm43xx"
+NO_GENERIC_LICENSE[WHENCE] = "WHENCE"
+
+SRC_URI = "git://github.com/RPi-Distro/firmware-nonfree"
+SRCREV = "b518de45ced519e8f7a499f4778100173402ae43"
+PV = "0.0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit allarch
+
+CLEANBROKEN = "1"
+
+do_compile() {
+    :
+}
+
+do_install() {
+    install -d ${D}${nonarch_base_libdir}/firmware/brcm
+
+    cp ./LICENCE.broadcom_bcm43xx ${D}${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro
+
+    # Replace outdated linux-firmware files with updated ones from
+    # raspbian firmware-nonfree. Raspbian adds blobs and nvram
+    # definitions that are also necessary so copy those too.
+    for fw in brcmfmac43430-sdio brcmfmac43455-sdio ; do
+        install -m 0644 brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/
+    done
+}
+
+PACKAGES = "\
+    ${PN}-broadcom-license \
+    ${PN}-bcm43430 \
+    ${PN}-bcm43455 \
+"
+
+LICENSE_${PN}-bcm43430 = "Firmware-broadcom_bcm43xx-rpidistro"
+LICENSE_${PN}-bcm43455 = "Firmware-broadcom_bcm43xx-rpidistro"
+LICENSE_${PN}-broadcom-license = "Firmware-broadcom_bcm43xx-rpidistro"
+FILES_${PN}-broadcom-license = "${nonarch_base_libdir}/firmware/LICENCE.broadcom_bcm43xx-rpidistro"
+FILES_${PN}-bcm43430 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43430*"
+FILES_${PN}-bcm43455 = "${nonarch_base_libdir}/firmware/brcm/brcmfmac43455*"
+RDEPENDS_${PN}-bcm43430 += "${PN}-broadcom-license"
+RDEPENDS_${PN}-bcm43455 += "${PN}-broadcom-license"
+RCONFLICTS_${PN}-bcm43430 = "\
+    linux-firmware-bcm43430 \
+    linux-firmware-raspbian-bcm43430 \
+"
+RREPLACES_${PN}-bcm43430 = "\
+    linux-firmware-bcm43430 \
+    linux-firmware-raspbian-bcm43430 \
+"
+RCONFLICTS_${PN}-bcm43455 = "\
+    linux-firmware-bcm43455 \
+    linux-firmware-raspbian-bcm43455 \
+"
+RREPLACES_${PN}-bcm43455 = "\
+    linux-firmware-bcm43455 \
+    linux-firmware-raspbian-bcm43455 \
+"
+
+# Firmware files are generally not run on the CPU, so they can be
+# allarch despite being architecture specific
+INSANE_SKIP = "arch"
diff --git a/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
deleted file mode 100644
index c0f9e17..0000000
--- a/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
+++ /dev/null
@@ -1,69 +0,0 @@
-# Augments upstream linux-firmware with additional and updated images
-# from Raspbian:
-# https://github.com/RPi-Distro/firmware-nonfree
-# https://github.com/RPi-Distro/bluez-firmware
-
-SRC_URI_append_rpi = " \
-    git://github.com/RPi-Distro/firmware-nonfree;destsuffix=raspbian-nf;name=raspbian-nf \
-    git://github.com/RPi-Distro/bluez-firmware;destsuffix=raspbian-bluez;name=raspbian-bluez \
-"
-
-SRCREV_raspbian-nf = "86e88fbf0345da49555d0ec34c80b4fbae7d0cd3"
-SRCREV_raspbian-bluez = "e28cd7ee8615de33aa7ec2b41d556af61a4a2707"
-SRCREV_FORMAT_rpi = "default+raspbian-nf+raspbian-bluez"
-
-do_install_append_rpi() {
-    install -d ${D}${nonarch_base_libdir}/firmware/brcm/
-
-    # Replace outdated linux-firmware files with updated ones from
-    # raspbian firmware-nonfree. Raspbian adds blobs and nvram
-    # definitions that are also necessary so copy those too.
-    for fw in brcmfmac43430-sdio brcmfmac43455-sdio ; do
-        install -m 0644 ${WORKDIR}/raspbian-nf/brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/
-    done
-
-    # Add missing Cypress Bluetooth files from raspbian bluez-firmware
-    for fw in BCM43430A1.hcd BCM4345C0.hcd ; do
-        install -m 0644 ${WORKDIR}/raspbian-bluez/broadcom/${fw} ${D}${nonarch_base_libdir}/firmware/brcm/
-    done
-}
-
-# NB: Must prepend, else these become empty and their content is left in
-# the roll-up package which precedes them.
-PACKAGES_prepend_rpi = "\
-    ${PN}-bcm43430a1-hcd \
-    ${PN}-bcm4345c0-hcd \
-"
-
-# ${PN}-bcm43455 package and brcmfmac43455-sdio from linux-firmware
-# is already included in the oe-core recipe, so don't add it to PACKAGES
-# again, the version from raspbian-nf seems a bit newer:
-# $ strings ./1_0.0+gitAUTOINC+d114732723+86e88fbf03+e28cd7ee86-r0/git/brcm/brcmfmac43455-sdio.bin | grep Ver
-# Version: 7.45.18.0 CRC: d7226371 Date: Sun 2015-03-01 07:31:57 PST Ucode Ver: 1026.2 FWID: 01-6a2c8ad4
-# $ strings ./1_0.0+gitAUTOINC+d114732723+86e88fbf03+e28cd7ee86-r0/raspbian-nf/brcm/brcmfmac43455-sdio.bin | grep Ver
-# Version: 7.45.154 (r684107 CY) CRC: b1f79383 Date: Tue 2018-02-27 03:18:17 PST Ucode Ver: 1043.2105 FWID 01-4fbe0b04
-
-# For additional Broadcom
-LICENSE_${PN}-bcm43455 = "Firmware-broadcom_bcm43xx"
-
-FILES_${PN}-bcm43430_append_rpi = " \
-  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt \
-"
-FILES_${PN}-bcm43455 = " \
-  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \
-"
-
-RDEPENDS_${PN}-bcm43455 += "${PN}-broadcom-license"
-
-LICENSE_${PN}-bcm43430a1-hcd = "Firmware-cypress"
-LICENSE_${PN}-bcm4345c0-hcd = "Firmware-cypress"
-
-FILES_${PN}-bcm43430a1-hcd = " \
-  ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.hcd \
-"
-FILES_${PN}-bcm4345c0-hcd = " \
-  ${nonarch_base_libdir}/firmware/brcm/BCM4345C0.hcd \
-"
-
-RDEPENDS_${PN}-bcm43430a1-hcd += "${PN}-cypress-license"
-RDEPENDS_${PN}-bcm4345c0-hcd += "${PN}-cypress-license"
diff --git a/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-rt_4.14.bb b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-rt_4.14.bb
new file mode 100644
index 0000000..1a990fe
--- /dev/null
+++ b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-rt_4.14.bb
@@ -0,0 +1,9 @@
+LINUX_VERSION ?= "4.14.81"
+
+SRCREV = "acf578d07d57480674d5361df9171fe9528765cb"
+SRC_URI = " \
+    git://github.com/raspberrypi/linux.git;branch=rpi-4.14.y-rt \
+    file://0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch \
+    "
+
+require linux-raspberrypi.inc
diff --git a/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
index 03acfb4..01f2425 100644
--- a/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
+++ b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
@@ -35,8 +35,6 @@
 CMDLINE_DEBUG ?= ""
 CMDLINE_append = " ${CMDLINE_DEBUG}"
 
-KERNEL_INITRAMFS ?= '${@oe.utils.conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}'
-
 KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}"
 
 # A LOADADDR is needed when building a uImage format kernel. This value is not
@@ -101,7 +99,7 @@
     # Localversion
     kernel_configure_variable LOCALVERSION "\"\""
 
-    if [ ! -z "${KERNEL_INITRAMFS}" ]; then
+    if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
         kernel_configure_variable OVERLAY_FS y
         kernel_configure_variable SQUASHFS y
         kernel_configure_variable UBIFS_FS y
@@ -109,7 +107,7 @@
 
     # Activate the configuration options for VC4
     VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
-    if [ ${VC4GRAPHICS} = "1" ]; then
+    if [ "${VC4GRAPHICS}" = "1" ]; then
         kernel_configure_variable I2C_BCM2835 y
         kernel_configure_variable DRM y
         kernel_configure_variable DRM_FBDEV_EMULATION y
diff --git a/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
index 54936fa..d11b599 100644
--- a/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
+++ b/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
@@ -1,6 +1,6 @@
-LINUX_VERSION ?= "4.14.68"
+LINUX_VERSION ?= "4.14.79"
 
-SRCREV = "8c8666ff6c1254d325cfa300d16f9928b3f31fc0"
+SRCREV = "9ca74c53cbda1f104bce3b33850fd3bf33eb3793"
 SRC_URI = " \
     git://github.com/raspberrypi/linux.git;branch=rpi-4.14.y \
     file://0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch \
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
deleted file mode 100644
index 122ddb3..0000000
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From fc4773f36aa31b4ae0fc97d3aa3f94db0c88f194 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 11 Feb 2016 12:53:20 -0800
-
----
- omx/gstomx.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/omx/gstomx.c b/omx/gstomx.c
-index 0237f3c..45732c3 100644
---- a/omx/gstomx.c
-+++ b/omx/gstomx.c
-@@ -1538,8 +1538,8 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
-     last_error = OMX_ErrorNone;
-     gst_omx_component_handle_messages (comp);
-     while (signalled && last_error == OMX_ErrorNone && !port->flushed
--        && port->buffers
--        && port->buffers->len > g_queue_get_length (&port->pending_buffers)) {
-+     /* && port->buffers
-+        && port->buffers->len > g_queue_get_length (&port->pending_buffers) */) {
-       signalled = gst_omx_component_wait_message (comp, timeout);
-       if (signalled)
-         gst_omx_component_handle_messages (comp);
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
deleted file mode 100644
index fdfdd1b..0000000
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 0d2ad639e6158c8023c157e206ef3ff7abdc089c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
-Date: Fri, 4 Dec 2015 18:39:59 +0100
-Subject: [PATCH] Don't abort gst_omx_video_dec_set_format() if there's a
- timeout releasing the buffers taken by the egl_render out port
-
----
- omx/gstomxvideodec.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index bad6335..c63b972 100644
---- a/omx/gstomxvideodec.c
-+++ b/omx/gstomxvideodec.c
-@@ -1911,8 +1911,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
-               5 * GST_SECOND) != OMX_ErrorNone)
-         return FALSE;
-       if (gst_omx_port_wait_buffers_released (out_port,
--              1 * GST_SECOND) != OMX_ErrorNone)
-+              1 * GST_SECOND) != OMX_ErrorNone) {
-+#if !(defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL))
-         return FALSE;
-+#endif
-+      }
-       if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
-         return FALSE;
-       if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
similarity index 100%
rename from meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
rename to meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0001-config-files-path.patch
similarity index 100%
rename from meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
rename to meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0001-config-files-path.patch
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0003-no-timeout-on-get-state.patch
similarity index 100%
rename from meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch
rename to meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0003-no-timeout-on-get-state.patch
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0004-Properly-handle-drain-requests-while-flushing.patch
similarity index 77%
rename from meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
rename to meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0004-Properly-handle-drain-requests-while-flushing.patch
index b02072a..3c9dd2c 100644
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0004-Properly-handle-drain-requests-while-flushing.patch
@@ -10,11 +10,11 @@
  omx/gstomx.c | 7 +++++++
  1 file changed, 7 insertions(+)
 
-diff --git a/omx/gstomx.c b/omx/gstomx.c
-index 45732c3..784a5d7 100644
---- a/omx/gstomx.c
-+++ b/omx/gstomx.c
-@@ -737,6 +737,13 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
+Index: gst-omx-1.14.0/omx/gstomx.c
+===================================================================
+--- gst-omx-1.14.0.orig/omx/gstomx.c
++++ gst-omx-1.14.0/omx/gstomx.c
+@@ -837,6 +837,13 @@ gst_omx_component_new (GstObject * paren
  
    g_mutex_lock (&comp->lock);
    gst_omx_component_handle_messages (comp);
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
new file mode 100644
index 0000000..ed8645e
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.14/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
@@ -0,0 +1,24 @@
+From 0d2ad639e6158c8023c157e206ef3ff7abdc089c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
+Date: Fri, 4 Dec 2015 18:39:59 +0100
+Subject: [PATCH] Don't abort gst_omx_video_dec_set_format() if there's a
+ timeout releasing the buffers taken by the egl_render out port
+
+---
+ omx/gstomxvideodec.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+Index: gst-omx-1.14.0/omx/gstomxvideodec.c
+===================================================================
+--- gst-omx-1.14.0.orig/omx/gstomxvideodec.c
++++ gst-omx-1.14.0/omx/gstomxvideodec.c
+@@ -2214,7 +2214,9 @@ gst_omx_video_dec_disable (GstOMXVideoDe
+       return FALSE;
+     if (gst_omx_port_wait_buffers_released (out_port,
+             1 * GST_SECOND) != OMX_ErrorNone)
++#if !(defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL))
+       return FALSE;
++#endif
+     if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
+       return FALSE;
+     if (gst_omx_port_wait_enabled (out_port, 1 * GST_SECOND) != OMX_ErrorNone)
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
index 67e46de..f892c66 100644
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
@@ -1,9 +1,9 @@
+DEPENDS_append_rpi = " userland"
 GSTREAMER_1_0_OMX_TARGET_rpi = "rpi"
 GSTREAMER_1_0_OMX_CORE_NAME_rpi = "${libdir}/libopenmaxil.so"
-
-
 # How to make this RPI specific?
 EXTRA_OECONF_append_rpi  = " CFLAGS="$CFLAGS -I${STAGING_DIR_TARGET}/usr/include/IL -I${STAGING_DIR_TARGET}/usr/include/interface/vcos/pthreads -I${STAGING_DIR_TARGET}/usr/include/interface/vmcs_host/linux""
 #examples only build with GL but not GLES, so disable it for RPI
 EXTRA_OECONF_append_rpi = " --disable-examples"
 
+RDEPENDS_${PN}_append_rpi = " userland"
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.14%.bbappend
similarity index 78%
rename from meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend
rename to meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.14%.bbappend
index 93381a4..cb7986b 100644
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.14%.bbappend
@@ -4,10 +4,9 @@
 SRC_URI_append_rpi = " \
              file://0001-config-files-path.patch \
              file://0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch \
-             file://0002-fix-decoder-flushing.patch \
              file://0003-no-timeout-on-get-state.patch \
              file://0004-Properly-handle-drain-requests-while-flushing.patch \
              file://0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch \
 "
 
-FILESEXTRAPATHS_prepend := "${THISDIR}/gstreamer1.0-omx-1.12:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/gstreamer1.0-omx-1.14:"
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
index 7292f90..899a2d4 100644
--- a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
@@ -1,12 +1 @@
-EXTRA_OECONF_append_rpi = " CPPFLAGS='-I${STAGING_INCDIR}/interface/vcos/pthreads \
-                                   -I${STAGING_INCDIR}/interface/vmcs_host/linux'"
-
-# if using bcm driver enable dispmanx not when using VC4 driver
-
-PACKAGECONFIG_append_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' dispmanx', d)}"
-
-PACKAGECONFIG_GL_rpi = "egl gles2"
-
 PACKAGECONFIG_append_rpi = " hls libmms faad"
-
-PACKAGECONFIG[dispmanx] = "--enable-dispmanx,--disable-dispmanx,userland"
diff --git a/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend
new file mode 100644
index 0000000..9e86c00
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend
@@ -0,0 +1,10 @@
+EXTRA_OECONF_append_rpi = " CPPFLAGS='-I${STAGING_INCDIR}/interface/vcos/pthreads \
+                                   -I${STAGING_INCDIR}/interface/vmcs_host/linux'"
+
+# if using bcm driver enable dispmanx not when using VC4 driver
+
+PACKAGECONFIG_append_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' dispmanx', d)}"
+
+PACKAGECONFIG_GL_rpi = "egl gles2"
+
+PACKAGECONFIG[dispmanx] = "--enable-dispmanx,--disable-dispmanx,userland"
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Fix-build-with-vc4-driver.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Fix-build-with-vc4-driver.patch
new file mode 100644
index 0000000..37d0724
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Fix-build-with-vc4-driver.patch
@@ -0,0 +1,49 @@
+From 25302469b6ceb2fa10ac68c07da25c6068ffd218 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 7 Nov 2018 01:16:59 -0800
+Subject: [PATCH] Fix build with vc4 driver
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ SubtitleRenderer.cpp | 7 ++++++-
+ SubtitleRenderer.h   | 1 +
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/SubtitleRenderer.cpp b/SubtitleRenderer.cpp
+index 540162f..fcfc708 100644
+--- a/SubtitleRenderer.cpp
++++ b/SubtitleRenderer.cpp
+@@ -36,6 +36,11 @@
+ #include <algorithm>
+ 
+ #include "bcm_host.h"
++typedef struct {
++  DISPMANX_ELEMENT_HANDLE_T element;
++  int width;
++  int height;
++} EGL_DISPMANX_WINDOW_T;
+ 
+ class BoxRenderer {
+   VGPath path_;
+@@ -618,4 +623,4 @@ void SubtitleRenderer::set_rect(int x1, int y1, int x2, int y2) BOOST_NOEXCEPT
+     float font_size = height*font_size_;
+     ENFORCE(!FT_Set_Pixel_Sizes(ft_face_, 0, font_size));
+     ENFORCE(!FT_Set_Pixel_Sizes(ft_face_italic_, 0, font_size));
+-}
+\ No newline at end of file
++}
+diff --git a/SubtitleRenderer.h b/SubtitleRenderer.h
+index 3f60798..ebac9a1 100644
+--- a/SubtitleRenderer.h
++++ b/SubtitleRenderer.h
+@@ -26,6 +26,7 @@
+ // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ // DEALINGS IN THE SOFTWARE.
+ 
++#include <interface/vmcs_host/vc_dispmanx.h>
+ #include <EGL/egl.h>
+ #include <VG/openvg.h>
+ #include <ft2build.h>
+-- 
+2.19.1
+
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Remove-Makefile.include-which-includes-hardcoded.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Remove-Makefile.include-which-includes-hardcoded.patch
index 151c33c..0c8843e 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Remove-Makefile.include-which-includes-hardcoded.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Remove-Makefile.include-which-includes-hardcoded.patch
@@ -1,4 +1,4 @@
-From a2a28fb7c4e8354cc0f90454e9bd151c16a6bf8b Mon Sep 17 00:00:00 2001
+From 19c9bc5fd8f43d3e9117906c3c48a3891357f8bc Mon Sep 17 00:00:00 2001
 From: Andrei Gherzan <andrei@gherzan.ro>
 Date: Tue, 20 Aug 2013 16:10:51 +0300
 Subject: [PATCH] Remove Makefile.include which includes hardcoded
@@ -11,8 +11,15 @@
 
 Updated patch to apply to c0dd9502ed2c43c487674939195c69680f3d98b0 revision
 
+---
+ Makefile         |  1 -
+ Makefile.ffmpeg  |  1 -
+ Makefile.include | 40 ----------------------------------------
+ 3 files changed, 42 deletions(-)
+ delete mode 100644 Makefile.include
+
 diff --git a/Makefile b/Makefile
-index f348465..65f7637 100644
+index 2857e94..76ee9bf 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -1,4 +1,3 @@
@@ -21,7 +28,7 @@
  CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST
  
 diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
-index 083e214..3b31a82 100644
+index ea12aad..749f47f 100644
 --- a/Makefile.ffmpeg
 +++ b/Makefile.ffmpeg
 @@ -1,4 +1,3 @@
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch
new file mode 100644
index 0000000..82dfd3e
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch
@@ -0,0 +1,42 @@
+From 9b4b7f8726171e97f12c587d50e54bab0dc42da5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 12 Sep 2018 22:18:07 -0700
+Subject: [PATCH] Specify --cc, --cxx and --ld variables from environment
+
+This helps in compiling with non-gcc compilers
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile.ffmpeg | 22 ++++++++++++++--------
+ 1 file changed, 14 insertions(+), 8 deletions(-)
+
+Index: git/Makefile.ffmpeg
+===================================================================
+--- git.orig/Makefile.ffmpeg
++++ git/Makefile.ffmpeg
+@@ -22,12 +22,15 @@ configure:
+ 	CFLAGS="$(CFLAGS) ${INCLUDES}" \
+ 	LDFLAGS="" \
+   ./configure \
++			--ld="${CCLD}" \
++			--cc="${CC}" \
++			--cxx="${CXX}" \
+ 			--extra-cflags="$(FFMPEG_EXTRA_CFLAGS)" \
+ 			--extra-ldflags="$(FFMPEG_EXTRA_LDFLAGS)" \
+ 			--enable-shared \
+ 			--disable-static \
+ 			--arch=arm \
+-			--cpu=arm1176jzf-s \
++			--cpu=$(CPU) \
+ 			--target-os=linux \
+ 			--disable-hwaccels \
+ 			--enable-parsers \
+@@ -42,7 +45,7 @@ configure:
+ 			--enable-gpl \
+ 			--enable-version3 \
+ 			--enable-protocols \
+-			--enable-libsmbclient \
++			--disable-libsmbclient \
+ 			--enable-libssh \
+ 			--enable-nonfree \
+ 			--enable-openssl \
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch
index 203f34b..dd1d4f3 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch
@@ -1,4 +1,4 @@
-From 1e92da659375eae1622984d4cc0ffd2a7b082fcf Mon Sep 17 00:00:00 2001
+From e46208c4a3e35da461e0e8f662970339eae47fca Mon Sep 17 00:00:00 2001
 From: Andrei Gherzan <andrei@gherzan.ro>
 Date: Sun, 24 Aug 2014 00:13:13 +0200
 Subject: [PATCH] Libraries and headers from ffmpeg are installed in /usr.
@@ -9,6 +9,7 @@
 
 Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
 Signed-off-by: Jonathan Liu <net147@gmail.com>
+
 ---
  Makefile        | 6 +++---
  Makefile.ffmpeg | 2 +-
@@ -18,30 +19,42 @@
 ===================================================================
 --- git.orig/Makefile
 +++ git/Makefile
-@@ -1,9 +1,9 @@
- 
+@@ -2,9 +2,9 @@ CFLAGS=-pipe -mfloat-abi=hard -mcpu=arm1
  CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST
  
--LDFLAGS+=-L./ -Lffmpeg_compiled/usr/local/lib/ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
-+LDFLAGS+=-L./ -Lffmpeg_compiled/usr/lib/ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
+ LDFLAGS=-L$(SDKSTAGE)/opt/vc/lib/
+-LDFLAGS+=-L./ -Lffmpeg_compiled/usr/local/lib/ -lc -lbrcmGLESv2 -lbrcmEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
++LDFLAGS+=-L./ -Lffmpeg_compiled/usr/lib/ -lc -lbrcmGLESv2 -lbrcmEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
  
--INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include
-+INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/include/ -I=/usr/include/dbus-1.0
+-INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/freetype2 -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
++INCLUDES+=-I./ -Ilinux
  
  DIST ?= omxplayer-dist
- 
-@@ -88,5 +88,5 @@ dist: omxplayer.bin omxplayer.1
+ STRIP ?= strip
+@@ -90,7 +90,7 @@ dist: omxplayer.bin omxplayer.1
  	cp COPYING $(DIST)/usr/share/doc/omxplayer
  	cp README.md $(DIST)/usr/share/doc/omxplayer/README
  	cp omxplayer.1 $(DIST)/usr/share/man/man1
 -	cp -P ffmpeg_compiled/usr/local/lib/*.so* $(DIST)/usr/lib/omxplayer/
 +	cp -P ffmpeg_compiled/usr/lib/*.so* $(DIST)/usr/lib/omxplayer/
  	cd $(DIST); tar -czf ../$(DIST).tgz *
+ 
+ install:
 Index: git/Makefile.ffmpeg
 ===================================================================
 --- git.orig/Makefile.ffmpeg
 +++ git/Makefile.ffmpeg
-@@ -254,5 +254,5 @@ checkout:
+@@ -238,7 +238,8 @@ configure:
+ 			--disable-decoder=xbin \
+ 			--disable-decoder=idf \
+ 			--disable-decoder=hevc \
+-			--enable-decoder=opus
++			--enable-decoder=opus \
++			--disable-stripping
+ 
+ .PHONY : clean
+ clean:
+@@ -251,5 +252,5 @@ checkout:
  .PHONY : install
  install:
  	cd ffmpeg; make -j9 DESTDIR="$(WORK)/ffmpeg_compiled" install
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0003-Remove-strip-step-in-Makefile.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0003-Remove-strip-step-in-Makefile.patch
index 7f31330..0b6aafd 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0003-Remove-strip-step-in-Makefile.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0003-Remove-strip-step-in-Makefile.patch
@@ -1,4 +1,4 @@
-From b738724c6ca45ee5fecebed01c7ac91c92446123 Mon Sep 17 00:00:00 2001
+From 6975d8a902837dd6c604f7fdd2a2f977285855ed Mon Sep 17 00:00:00 2001
 From: Andrei Gherzan <andrei@gherzan.ro>
 Date: Sun, 24 Aug 2014 00:18:05 +0200
 Subject: [PATCH] Remove strip step in Makefile
@@ -10,30 +10,18 @@
 
 Upstream-Status: Inappropriate [embedded specific]
 Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+
 ---
  Makefile.ffmpeg | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
+ 1 files changed, 2 insertions(+), 3 deletions(-)
 
-diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
-index 9d66a85..00df197 100644
---- a/Makefile.ffmpeg
-+++ b/Makefile.ffmpeg
-@@ -243,7 +243,8 @@ configure:
- 			--disable-decoder=xbin \
- 			--disable-decoder=idf \
- 			--enable-decoder=opus \
--			--cross-prefix=$(HOST)-
-+			--cross-prefix=$(HOST)- \
-+			--disable-stripping
- 
- .PHONY : clean
- clean:
-@@ -256,5 +257,3 @@ checkout:
+Index: git/Makefile.ffmpeg
+===================================================================
+--- git.orig/Makefile.ffmpeg
++++ git/Makefile.ffmpeg
+@@ -252,5 +252,3 @@ checkout:
  .PHONY : install
  install:
  	cd ffmpeg; make -j9 DESTDIR="$(WORK)/ffmpeg_compiled" install
 -	$(HOST)-strip ffmpeg_compiled/usr/lib/*.so
 -
--- 
-1.9.3
-
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch
index ea8530d..383cdf7 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch
@@ -1,4 +1,4 @@
-From 100982ee1fc1cb571c7453d14f9acd60e67d4765 Mon Sep 17 00:00:00 2001
+From be007b01e7d91f5f83518c0388c16db8dab31d2e Mon Sep 17 00:00:00 2001
 From: Andrei Gherzan <andrei.gherzan@windriver.com>
 Date: Sun, 25 Jan 2015 11:13:51 +0200
 Subject: [PATCH] Add FFMPEG_EXTRA_CFLAGS and FFMPEG_EXTRA_LDFLAGS
@@ -8,16 +8,16 @@
 
 Upstream-Status: Inappropriate [embedded specific]
 Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+
 ---
- Makefile.ffmpeg | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
+ Makefile.ffmpeg | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
 
 Index: git/Makefile.ffmpeg
 ===================================================================
 --- git.orig/Makefile.ffmpeg
 +++ git/Makefile.ffmpeg
-@@ -1,6 +1,8 @@
- 
+@@ -1,5 +1,7 @@
  CFLAGS=-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_HAVE_SBRK -D_LARGEFILE64_SOURCE -DHAVE_CMAKE_CONFIG -DHAVE_VMCS_CONFIG -D_REENTRANT -DUSE_VCHIQ_ARM -DVCHI_BULK_ALIGN=1 -DVCHI_BULK_GRANULARITY=1 -DEGL_SERVER_DISPMANX -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__VIDEOCORE4__ -DGRAPHICS_X_VG=1 -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT
  
 +FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog
@@ -25,13 +25,13 @@
  WORK=$(PWD)
  
  .PHONY : all
-@@ -21,7 +23,8 @@ configure:
+@@ -20,7 +22,8 @@ configure:
  	CFLAGS="$(CFLAGS) ${INCLUDES}" \
  	LDFLAGS="" \
    ./configure \
--			--extra-cflags="-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog" \
+-			--extra-cflags="-mfpu=vfp -mfloat-abi=hard -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog" \
 +			--extra-cflags="$(FFMPEG_EXTRA_CFLAGS)" \
 +			--extra-ldflags="$(FFMPEG_EXTRA_LDFLAGS)" \
- 			--enable-cross-compile \
  			--enable-shared \
  			--disable-static \
+ 			--arch=arm \
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch
index 4f56ad2..f6abd7b 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch
@@ -1,4 +1,4 @@
-From 97cb9405f281f54d4083f3126d441c8b44eafb89 Mon Sep 17 00:00:00 2001
+From 81d1f8bc102b23bdfa63a01f252f3e4c74ae7da9 Mon Sep 17 00:00:00 2001
 From: Paul Barker <pbarker@toganlabs.com>
 Date: Thu, 7 Sep 2017 19:14:20 +0000
 Subject: [PATCH] Don't require internet connection during build
@@ -11,16 +11,17 @@
 
 Signed-off-by: Paul Barker <pbarker@toganlabs.com>
 Upstream-status: Inappropriate
+
 ---
  Makefile        | 6 ++----
  Makefile.ffmpeg | 2 +-
  2 files changed, 3 insertions(+), 5 deletions(-)
 
-diff --git a/Makefile b/Makefile
-index 60501b1..6471f0f 100644
---- a/Makefile
-+++ b/Makefile
-@@ -79,14 +79,12 @@ ffmpeg:
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile
++++ git/Makefile
+@@ -81,17 +81,14 @@ ffmpeg:
  	make -f Makefile.ffmpeg
  	make -f Makefile.ffmpeg install
  
@@ -36,13 +37,14 @@
 -	cp omxplayer.1 $(DIST)/usr/share/man/man1
  	cp -P ffmpeg_compiled/usr/lib/*.so* $(DIST)/usr/lib/omxplayer/
 -	tar -czf omxplayer-dist.tar.gz $(DIST)
-\ No newline at end of file
-+	tar -czf omxplayer-dist.tar.gz $(DIST)
-diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
-index 22d495c..8651724 100644
---- a/Makefile.ffmpeg
-+++ b/Makefile.ffmpeg
-@@ -6,7 +6,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstru
+ 
+ install:
+ 	cp -r $(DIST)/* /
+Index: git/Makefile.ffmpeg
+===================================================================
+--- git.orig/Makefile.ffmpeg
++++ git/Makefile.ffmpeg
+@@ -5,7 +5,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-a
  WORK=$(PWD)
  
  .PHONY : all
@@ -51,6 +53,3 @@
  
  .PHONY : copy
  copy:
--- 
-2.7.4
-
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch
index 3fac2d1..890adde 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch
@@ -1,4 +1,4 @@
-From 4a13419e3805b541fc58e57f1f27c4a388609ef5 Mon Sep 17 00:00:00 2001
+From f570b9985ff2d57d21c1e64ed08c43b6d89fd0b1 Mon Sep 17 00:00:00 2001
 From: Paul Barker <pbarker@toganlabs.com>
 Date: Thu, 7 Sep 2017 20:02:15 +0000
 Subject: [PATCH] Prevent ffmpeg configure/compile race condition
@@ -8,15 +8,16 @@
 
 Signed-off-by: Paul Barker <pbarker@toganlabs.com>
 Upstream-status: Pending
+
 ---
  Makefile.ffmpeg | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
-index 8651724..619c49a 100644
---- a/Makefile.ffmpeg
-+++ b/Makefile.ffmpeg
-@@ -6,7 +6,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstru
+Index: git/Makefile.ffmpeg
+===================================================================
+--- git.orig/Makefile.ffmpeg
++++ git/Makefile.ffmpeg
+@@ -5,7 +5,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-a
  WORK=$(PWD)
  
  .PHONY : all
@@ -25,15 +26,12 @@
  
  .PHONY : copy
  copy:
-@@ -14,7 +14,7 @@ copy:
+@@ -13,7 +13,7 @@ copy:
  	$(HOST)-strip *.so*
  
  .PHONY : compile
 -compile: 
 +compile: configure
- 	+$(MAKE) -C ffmpeg
+ 	+$(MAKE) -j$(shell nproc) -C ffmpeg
  
  .PHONY : configure
--- 
-2.7.4
-
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/cross-crompile-ffmpeg.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/cross-crompile-ffmpeg.patch
new file mode 100644
index 0000000..20ed7c7
--- /dev/null
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/cross-crompile-ffmpeg.patch
@@ -0,0 +1,12 @@
+Index: git/Makefile.ffmpeg
+===================================================================
+--- git.orig/Makefile.ffmpeg
++++ git/Makefile.ffmpeg
+@@ -22,6 +22,7 @@ configure:
+ 	CFLAGS="$(CFLAGS) ${INCLUDES}" \
+ 	LDFLAGS="" \
+   ./configure \
++			--enable-cross-compile \
+ 			--ld="${CCLD}" \
+ 			--cc="${CC}" \
+ 			--cxx="${CXX}" \
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/fix-tar-command-with-DIST.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/fix-tar-command-with-DIST.patch
index ab40e40..70859aa 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/fix-tar-command-with-DIST.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/fix-tar-command-with-DIST.patch
@@ -1,3 +1,8 @@
+From 23a97efde2aef171312000f7859ef4c573ce2ada Mon Sep 17 00:00:00 2001
+From: Andrei Gherzan <andrei@gherzan.ro>
+Date: Sun, 19 Jan 2014 20:35:29 +0200
+Subject: [PATCH] omxplayer: Update to remote HEAD
+
 Revert the tar command change introduced in:
 https://github.com/popcornmix/omxplayer/commit/201c77973155861e60492e45d35467b19b69c1c4
 
@@ -8,14 +13,20 @@
 Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
 Signed-off-by: Jonathan Liu <net147@gmail.com>
 
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
 Index: git/Makefile
 ===================================================================
 --- git.orig/Makefile
 +++ git/Makefile
-@@ -71,4 +71,4 @@ dist: omxplayer.bin
- 	cp COPYING $(DIST)/usr/share/doc/
- 	cp README.md $(DIST)/usr/share/doc/README
+@@ -91,7 +91,7 @@ dist: omxplayer.bin omxplayer.1
+ 	cp README.md $(DIST)/usr/share/doc/omxplayer/README
+ 	cp omxplayer.1 $(DIST)/usr/share/man/man1
  	cp -P ffmpeg_compiled/usr/lib/*.so* $(DIST)/usr/lib/omxplayer/
 -	cd $(DIST); tar -czf ../$(DIST).tgz *
 +	tar -czf omxplayer-dist.tar.gz $(DIST)
-\ No newline at end of file
+ 
+ install:
+ 	cp -r $(DIST)/* /
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/use-native-pkg-config.patch b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/use-native-pkg-config.patch
index ed81999..e580470 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/use-native-pkg-config.patch
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/use-native-pkg-config.patch
@@ -1,16 +1,25 @@
+From da6c24a2a87b8cf9692017e32be25d30c0cc7ef4 Mon Sep 17 00:00:00 2001
+From: Andrei Gherzan <andrei@gherzan.ro>
+Date: Tue, 10 Feb 2015 00:52:18 +0100
+Subject: [PATCH] omxplayer: Bump SRCREV
+
 Force the pkg-config native tool. Strangely ffmpeg prepends cross_prefix
 to the default value which obviously is wrong.
 
 Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
 
+---
+ Makefile.ffmpeg | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
 Index: git/Makefile.ffmpeg
 ===================================================================
 --- git.orig/Makefile.ffmpeg
 +++ git/Makefile.ffmpeg
-@@ -245,7 +245,8 @@ configure:
+@@ -242,7 +242,8 @@ configure:
  			--disable-decoder=idf \
+ 			--disable-decoder=hevc \
  			--enable-decoder=opus \
- 			--cross-prefix=$(HOST)- \
 -			--disable-stripping
 +			--disable-stripping \
 +			--pkg-config=pkg-config
diff --git a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
index 1df41a5..aad2fed 100644
--- a/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
+++ b/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
@@ -7,10 +7,11 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
-DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl libssh libomxil coreutils-native curl-native"
+DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl libssh libomxil coreutils-native curl-native userland"
+
 PR = "r4"
 
-SRCREV_default = "b8ff59dccd9307f10dad71bec2525a95bd6c603b"
+SRCREV_default = "b4bbef8fac5e8c2ddafa895f98456ba715b39c6b"
 
 # omxplayer builds its own copy of ffmpeg from source instead of using the
 # system's ffmpeg library. This isn't ideal but it's ok for now. We do however
@@ -18,12 +19,11 @@
 # fetching the latest commit on a release branch (which is what the checkout job
 # in Makefile.ffmpeg in the omxplayer source tree does).
 #
-# This SRCREV corresponds to the v3.1.10 release of ffmpeg.
-SRCREV_ffmpeg = "afa34cb36edca0ff809b7e58474bbce12271ecba"
+# This SRCREV corresponds to the v4.0.3 release of ffmpeg.
+SRCREV_ffmpeg = "fcbd117df3077bad495e99e20f01cf93737bce76"
 
 SRC_URI = "git://github.com/popcornmix/omxplayer.git;protocol=git;branch=master \
-           git://source.ffmpeg.org/ffmpeg;branch=release/3.1;protocol=git;depth=1;name=ffmpeg;destsuffix=git/ffmpeg \
-           file://0001-Remove-Makefile.include-which-includes-hardcoded.patch \
+           git://github.com/FFmpeg/FFmpeg;branch=release/4.0;protocol=git;depth=1;name=ffmpeg;destsuffix=git/ffmpeg \
            file://0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch \
            file://0003-Remove-strip-step-in-Makefile.patch \
            file://0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch \
@@ -31,12 +31,23 @@
            file://use-native-pkg-config.patch \
            file://0005-Don-t-require-internet-connection-during-build.patch \
            file://0006-Prevent-ffmpeg-configure-compile-race-condition.patch \
+           file://0001-Specify-cc-cxx-and-ld-variables-from-environment.patch \
+           file://cross-crompile-ffmpeg.patch \
            "
+
+SRC_URI_append = "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", " file://0001-Fix-build-with-vc4-driver.patch ", "", d)}"
+
 S = "${WORKDIR}/git"
 
-COMPATIBLE_MACHINE ?= "null"
-COMPATIBLE_MACHINE_rpi_aarch64 = "null"
-COMPATIBLE_MACHINE_rpi = "(.*)"
+COMPATIBLE_MACHINE = "^rpi$"
+
+def cpu(d):
+    for arg in (d.getVar('TUNE_CCARGS') or '').split():
+        if arg.startswith('-mcpu='):
+            return arg[6:]
+    return 'generic'
+
+export CPU = "${@cpu(d)}"
 
 inherit autotools-brokensep pkgconfig
 
@@ -55,11 +66,13 @@
 export FFMPEG_EXTRA_LDFLAGS  = "${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS}"
 
 # Needed in top Makefile
+
 export LDFLAGS = "-L${S}/ffmpeg_compiled/usr/lib \
                   -L${STAGING_DIR_HOST}/lib \
                   -L${STAGING_DIR_HOST}/usr/lib \
                  "
-export INCLUDES = "-isystem${STAGING_DIR_HOST}/usr/include/interface/vcos/pthreads \
+export INCLUDES = "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", " -D__GBM__", "", d)} \
+                   -isystem${STAGING_DIR_HOST}/usr/include/interface/vcos/pthreads \
                    -isystem${STAGING_DIR_HOST}/usr/include/freetype2 \
                    -isystem${STAGING_DIR_HOST}/usr/include/interface/vmcs_host/linux \
                    -isystem${STAGING_DIR_HOST}/usr/include/dbus-1.0 \
@@ -90,4 +103,4 @@
 
 FILES_${PN}-dev += "${libdir}/omxplayer/*.so"
 
-RDEPENDS_${PN} += "bash procps"
+RDEPENDS_${PN} += "bash procps userland"