--- /dev/null
+From 7857e5aa2459b2746e062ae59ae0240c4af7af5d Mon Sep 17 00:00:00 2001
+From: Tom Hochstein <tom.hochstein@nxp.com>
+Date: Mon, 29 Oct 2018 21:40:32 +0000
+Subject: [PATCH] g2d-renderer: Fix open function build break
+
+|                  from ../git/libweston/g2d-renderer.c:40:
+| In function 'open',
+|     inlined from 'g2d_renderer_create' at ../git/libweston/g2d-renderer.c:1629:2:
+| /home/r60874/upstream/fsl-xwayland/tmp/work/cortexa9t2hf-neon-mx6qdl-fsl-linux-gnueabi/weston/4.0.0.imx-r0/recipe-                                                                        sysroot/usr/include/bits/fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute error: open wit                                                                        h O_CREAT or O_TMPFILE in second argument needs 3 arguments
+|     __open_missing_mode ();
+|     ^~~~~~~~~~~~~~~~~~~~~~
+| Makefile:5266: recipe for target 'libweston/g2d_renderer_la-g2d-renderer.lo' failed
+
+Upstream-Status: Inappropriate [i.MX-specific]
+
+Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
+---
+ libweston/g2d-renderer.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: git/libweston/g2d-renderer.c
+===================================================================
+--- git.orig/libweston/g2d-renderer.c
++++ git/libweston/g2d-renderer.c
+@@ -1626,7 +1626,7 @@ g2d_renderer_create(struct weston_compos
+       path = malloc(strlen(dir) + 40);
+       strcpy(path, dir);
+       strcat(path, "/use-g2d-renderer");
+-      close(open(path, O_CREAT | O_RDWR));
++      close(open(path, O_CREAT | O_RDWR, 0600));
+       free(path);
+ 
+       return 0;
 
-From d5fb8567868866665502106def90017243a968a8 Mon Sep 17 00:00:00 2001
+From b98b9dbda902225cdd972b5bff6a641c36cc7e90 Mon Sep 17 00:00:00 2001
 From: Tom Hochstein <tom.hochstein@nxp.com>
 Date: Wed, 22 Feb 2017 15:53:30 +0200
 Subject: [PATCH] weston-launch: Provide a default version that doesn't require PAM
  2 files changed, 27 insertions(+), 2 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
-index 8f6b80d..603fcb3 100644
+index dc9c802..48cf5cb 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -494,13 +494,17 @@ AC_ARG_ENABLE(resize-optimization,
+@@ -451,13 +451,17 @@ AC_ARG_ENABLE(resize-optimization,
  AS_IF([test "x$enable_resize_optimization" = "xyes"],
        [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
  
  fi
  
  AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes")
-@@ -748,6 +752,7 @@ AC_MSG_RESULT([
+@@ -702,6 +706,7 @@ AC_MSG_RESULT([
        Enable developer documentation  ${enable_devdocs}
  
        weston-launch utility           ${enable_weston_launch}
        systemd notify support          ${enable_systemd_notify}
  
 diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
-index 9064439..c6abe92 100644
+index 166bf3b..6fb9232 100644
 --- a/libweston/weston-launch.c
 +++ b/libweston/weston-launch.c
 @@ -51,7 +51,9 @@
        int tty;
        int ttynr;
        int sock[2];
-@@ -191,6 +195,7 @@ weston_launch_allowed(struct weston_launch *wl)
+@@ -189,6 +193,7 @@ weston_launch_allowed(struct weston_launch *wl)
        return false;
  }
  
  static int
  pam_conversation_fn(int msg_count,
                    const struct pam_message **messages,
-@@ -231,6 +236,7 @@ setup_pam(struct weston_launch *wl)
+@@ -229,6 +234,7 @@ setup_pam(struct weston_launch *wl)
  
        return 0;
  }
  
  static int
  setup_launcher_socket(struct weston_launch *wl)
-@@ -424,6 +430,7 @@ quit(struct weston_launch *wl, int status)
+@@ -422,6 +428,7 @@ quit(struct weston_launch *wl, int status)
        close(wl->signalfd);
        close(wl->sock[0]);
  
        if (wl->new_user) {
                err = pam_close_session(wl->ph, 0);
                if (err)
-@@ -431,6 +438,7 @@ quit(struct weston_launch *wl, int status)
+@@ -429,6 +436,7 @@ quit(struct weston_launch *wl, int status)
                                err, pam_strerror(wl->ph, err));
                pam_end(wl->ph, err);
        }
  
        if (ioctl(wl->tty, KDSKBMUTE, 0) &&
            ioctl(wl->tty, KDSKBMODE, wl->kb_mode))
-@@ -610,6 +618,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
+@@ -608,6 +616,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
        setenv("HOME", wl->pw->pw_dir, 1);
        setenv("SHELL", wl->pw->pw_shell, 1);
  
        env = pam_getenvlist(wl->ph);
        if (env) {
                for (i = 0; env[i]; ++i) {
-@@ -618,6 +627,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
+@@ -616,6 +625,7 @@ setup_session(struct weston_launch *wl, char **child_argv)
                }
                free(env);
        }
  
        /*
         * We open a new session, so it makes sense
-@@ -685,8 +695,10 @@ static void
+@@ -683,8 +693,10 @@ static void
  help(const char *name)
  {
        fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name);
        fprintf(stderr, "  -t, --tty       Start session on alternative tty,\n"
                        "                  e.g. -t /dev/tty4, requires -u option.\n");
        fprintf(stderr, "  -v, --verbose   Be verbose\n");
-@@ -700,7 +712,9 @@ main(int argc, char *argv[])
+@@ -698,7 +710,9 @@ main(int argc, char *argv[])
        int i, c;
        char *tty = NULL;
        struct option opts[] = {
                { "tty",     required_argument, NULL, 't' },
                { "verbose", no_argument,       NULL, 'v' },
                { "help",    no_argument,       NULL, 'h' },
-@@ -712,9 +726,13 @@ main(int argc, char *argv[])
+@@ -710,9 +724,13 @@ main(int argc, char *argv[])
        while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) {
                switch (c) {
                case 'u':
                        break;
                case 't':
                        tty = optarg;
-@@ -755,8 +773,10 @@ main(int argc, char *argv[])
+@@ -753,8 +771,10 @@ main(int argc, char *argv[])
        if (setup_tty(&wl, tty) < 0)
                exit(EXIT_FAILURE);