diff -Naur ../xserver-1.20.5-orig/hw/xwayland/ashmem.h ./hw/xwayland/ashmem.h
--- ../xserver-1.20.5-orig/hw/xwayland/ashmem.h	1970-01-01 02:00:00.000000000 +0200
+++ ./hw/xwayland/ashmem.h	2019-07-12 15:00:25.712211695 +0300
@@ -0,0 +1,47 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _LINUX_ASHMEM_H
+#define _LINUX_ASHMEM_H
+
+#include <linux/limits.h>
+#include <linux/ioctl.h>
+#include <stdint.h>
+
+#define ASHMEM_NAME_LEN 256
+
+#define ASHMEM_NAME_DEF "dev/ashmem"
+
+#define ASHMEM_NOT_PURGED 0
+#define ASHMEM_WAS_PURGED 1
+
+#define ASHMEM_IS_UNPINNED 0
+#define ASHMEM_IS_PINNED 1
+
+struct ashmem_pin {
+ uint32_t offset;
+ uint32_t len;
+};
+
+#define __ASHMEMIOC 0x77
+
+#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
+#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
+#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
+#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
+#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
+#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
+#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
+#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
+#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
+#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+
+#endif
diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-cursor.c ./hw/xwayland/xwayland-cursor.c
--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-cursor.c	2019-07-12 15:14:26.885076932 +0300
+++ ./hw/xwayland/xwayland-cursor.c	2019-07-12 14:57:25.217524468 +0300
@@ -66,7 +66,8 @@
     PixmapPtr pixmap;
 
     pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width,
-                                   cursor->bits->height, 32, 0);
+                                   cursor->bits->height, 32,
+                                   CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
     dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap);
 
     return TRUE;
diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-glamor-gbm.c ./hw/xwayland/xwayland-glamor-gbm.c
--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-glamor-gbm.c	2019-07-12 15:14:26.885076932 +0300
+++ ./hw/xwayland/xwayland-glamor-gbm.c	2019-07-12 14:57:38.836704786 +0300
@@ -212,9 +212,9 @@
     PixmapPtr pixmap = NULL;
 
     if (width > 0 && height > 0 && depth >= 15 &&
-        (hint == 0 ||
-         hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP ||
-         hint == CREATE_PIXMAP_USAGE_SHARED)) {
+        (hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP ||
+         hint == CREATE_PIXMAP_USAGE_SHARED ||
+         (xwl_screen->rootless && hint == 0))) {
         uint32_t format = gbm_format_for_depth(depth);
 
 #ifdef GBM_BO_WITH_MODIFIERS
diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-output.c ./hw/xwayland/xwayland-output.c
--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-output.c	2019-07-12 15:14:26.889075146 +0300
+++ ./hw/xwayland/xwayland-output.c	2019-07-12 14:54:13.242596617 +0300
@@ -171,6 +171,40 @@
         return 25.4 / DEFAULT_DPI;
 }
 
+static int
+xwl_set_pixmap_visit_window(WindowPtr window, void *data)
+{
+    ScreenPtr screen = window->drawable.pScreen;
+
+    if (screen->GetWindowPixmap(window) == data) {
+        screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen));
+        return WT_WALKCHILDREN;
+    }
+
+    return WT_DONTWALKCHILDREN;
+}
+
+static void
+update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height)
+{
+    ScreenPtr pScreen = xwl_screen->screen;
+    WindowPtr pRoot = pScreen->root;
+    PixmapPtr old_pixmap, new_pixmap;
+
+    old_pixmap = pScreen->GetScreenPixmap(pScreen);
+    new_pixmap = pScreen->CreatePixmap(pScreen, width, height,
+                                       pScreen->rootDepth,
+                                       CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+    pScreen->SetScreenPixmap(new_pixmap);
+
+    if (old_pixmap) {
+        TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap);
+        pScreen->DestroyPixmap(old_pixmap);
+    }
+
+    pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL);
+}
+
 static void
 update_screen_size(struct xwl_output *xwl_output, int width, int height)
 {
@@ -180,6 +214,9 @@
     if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
         SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
 
+    if (!xwl_screen->rootless && xwl_screen->screen->root)
+        update_backing_pixmaps (xwl_screen, width, height);
+
     xwl_screen->width = width;
     xwl_screen->height = height;
     xwl_screen->screen->width = width;
diff -Naur ../xserver-1.20.5-orig/hw/xwayland/xwayland-shm.c ./hw/xwayland/xwayland-shm.c
--- ../xserver-1.20.5-orig/hw/xwayland/xwayland-shm.c	2019-07-12 15:14:26.889075146 +0300
+++ ./hw/xwayland/xwayland-shm.c	2019-07-12 15:28:09.124589333 +0300
@@ -40,12 +40,17 @@
 #include <string.h>
 #include <stdlib.h>
 
+#ifdef __ANDROID__
+#include "ashmem.h"
+#endif
+
 struct xwl_pixmap {
     struct wl_buffer *buffer;
     void *data;
     size_t size;
 };
 
+#ifndef __ANDROID__
 #ifndef HAVE_MKOSTEMP
 static int
 set_cloexec_or_close(int fd)
@@ -172,6 +177,37 @@
     return fd;
 }
 
+#else // __ANDROID__
+
+static int
+os_create_anonymous_file(off_t size) {
+	int fd, ret;
+    long flags;
+
+	fd = open("/dev/ashmem", O_RDWR);
+	if (fd < 0)
+		return fd;
+
+	ret = ioctl(fd, ASHMEM_SET_SIZE, size);
+	if (ret < 0)
+		goto err;
+
+    flags = fcntl(fd, F_GETFD);
+    if (flags == -1)
+        goto err;
+
+    if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+        goto err;
+
+	return fd;
+
+err:
+	close(fd);
+	return ret;
+}
+
+#endif // __ANDROID__
+
 static uint32_t
 shm_format_for_depth(int depth)
 {
@@ -202,6 +238,7 @@
     int fd;
 
     if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE ||
+        (!xwl_screen->rootless && hint != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) ||
         (width == 0 && height == 0) || depth < 15)
         return fbCreatePixmap(screen, width, height, depth, hint);
 
--- ./miext/sync/meson.build.orig	2019-07-21 03:56:18.960672711 +0300
+++ ./miext/sync/meson.build	2019-07-21 04:02:55.926796439 +0300
@@ -1,6 +1,7 @@
 srcs_miext_sync = [
     'misync.c',
     'misyncfd.c',
+    'misyncshm.c',
 ]
 
 hdrs_miext_sync = [
@@ -10,10 +11,6 @@
     'misyncstr.h',
 ]
 
-if build_dri3
-    srcs_miext_sync += 'misyncshm.c'
-endif
-
 libxserver_miext_sync = static_library('libxserver_miext_sync',
     srcs_miext_sync,
     include_directories: inc,
