xorg-server: Changes to 'ubuntu'
debian/changelog | 9
debian/patches/series | 1
debian/patches/xmir-rootless.patch | 296 -------
debian/patches/xmir.patch | 1549 ++++++++++++++++++++++++++-----------
4 files changed, 1109 insertions(+), 746 deletions(-)
New commits:
commit d607125530d7e0589f16dd7e4db57838fdc1352f
Author: Robert Ancell <robert.ancell@canonical.com>
Date: Tue Nov 3 10:24:20 2015 +1300
* debian/patches/xmir.patch:
- Update to latest version
* debian/patches/xmir-rootless.patch:
- Merged into xmir.patch
diff --git a/debian/changelog b/debian/changelog
index 7ea1038..a1f463a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+xorg-server (2:1.17.3-2ubuntu1) xenial; urgency=medium
+
+ * debian/patches/xmir.patch:
+ - Update to latest version
+ * debian/patches/xmir-rootless.patch:
+ - Merged into xmir.patch
+
+ -- Robert Ancell <robert.ancell@canonical.com> Tue, 03 Nov 2015 10:23:16 +1300
+
xorg-server (2:1.17.3-2) unstable; urgency=medium
* Finalize xserver-xorg-core.NEWS. Thanks, Michael Biebl!
diff --git a/debian/patches/series b/debian/patches/series
index 6945191..75b075f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -48,7 +48,6 @@ disable-rotation-transform-gpuscreens.patch
fix-ftbfs-ppc64el.patch
xmir.patch
-xmir-rootless.patch
xmir-desktop-file-hint-flag.patch
drm_device_keep_trying.patch
xi2-resize-touch.patch
diff --git a/debian/patches/xmir-rootless.patch b/debian/patches/xmir-rootless.patch
deleted file mode 100644
index f3bef1e..0000000
--- a/debian/patches/xmir-rootless.patch
+++ /dev/null
@@ -1,296 +0,0 @@
-From a7b78b9c0eee1a53e0fed309474aa6cc76656ffc Mon Sep 17 00:00:00 2001
-From: Robert Ancell <robert.ancell@canonical.com>
-Date: Thu, 9 Jul 2015 14:03:49 +1200
-Subject: [PATCH 2/4] xmir: Support rootless
-
-Contributions from:
- Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
- Robert Ancell <robert.ancell@canonical.com>
----
- composite/compalloc.c | 6 ++++++
- composite/compositeext.h | 3 +++
- hw/xmir/xmir-cursor.c | 5 ++++-
- hw/xmir/xmir-dri2.c | 4 ++++
- hw/xmir/xmir-input.c | 34 ++++++++++++++++++++++++++++++++++
- hw/xmir/xmir-output.c | 8 ++++++++
- hw/xmir/xmir.c | 48 +++++++++++++++++++++++++++++++++++++++---------
- hw/xmir/xmir.h | 2 +-
- 8 files changed, 99 insertions(+), 11 deletions(-)
-
-diff --git a/composite/compalloc.c b/composite/compalloc.c
-index 8daded0..fb1b476 100644
---- a/composite/compalloc.c
-+++ b/composite/compalloc.c
-@@ -46,6 +46,7 @@
- #endif
-
- #include "compint.h"
-+#include "compositeext.h"
-
- static void
- compScreenUpdate(ScreenPtr pScreen)
-@@ -411,6 +412,11 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
- return Success;
- }
-
-+int CompositeRedirectSubwindows (WindowPtr pWin, int update)
-+{
-+ return compRedirectSubwindows (serverClient, pWin, update);
-+}
-+
- /*
- * Free one of the per-client per-subwindows resources,
- * which frees one redirect per subwindow
-diff --git a/composite/compositeext.h b/composite/compositeext.h
-index b96cb1d..f279013 100644
---- a/composite/compositeext.h
-+++ b/composite/compositeext.h
-@@ -35,6 +35,9 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
- VisualID * vids,
- int nVisuals);
-
-+extern _X_EXPORT int CompositeRedirectSubwindows(WindowPtr pWin,
-+ int update);
-+
- extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
- VisualID parentVisual,
- VisualID winVisual);
-diff --git a/hw/xmir/xmir-cursor.c b/hw/xmir/xmir-cursor.c
-index 459f9ac..c311d88 100644
---- a/hw/xmir/xmir-cursor.c
-+++ b/hw/xmir/xmir-cursor.c
-@@ -134,7 +134,10 @@ xmir_input_set_cursor(struct xmir_input *xmir_input)
- config = mir_cursor_configuration_from_buffer_stream(stream, cursor->bits->xhot, cursor->bits->yhot);
-
- apply:
-- mir_wait_for(mir_surface_configure_cursor(xmir_window_get(xmir_input->xmir_screen->screen->root)->surface, config));
-+ if (!xmir_input->xmir_screen->rootless)
-+ mir_wait_for(mir_surface_configure_cursor(xmir_window_get(xmir_input->xmir_screen->screen->root)->surface, config));
-+ else if (xmir_input->focus_window)
-+ mir_wait_for(mir_surface_configure_cursor(xmir_input->focus_window->surface, config));
- mir_cursor_configuration_destroy(config);
-
- if (stream)
-diff --git a/hw/xmir/xmir-dri2.c b/hw/xmir/xmir-dri2.c
-index 1f7c1b0..4f95006 100644
---- a/hw/xmir/xmir-dri2.c
-+++ b/hw/xmir/xmir-dri2.c
-@@ -90,8 +90,12 @@ static struct xmir_window *
- xmir_window_swappable_parent(WindowPtr win)
- {
- ScreenPtr screen = win->drawable.pScreen;
-+ struct xmir_screen *xmir_screen = xmir_screen_get(screen);
- PixmapPtr root, pixmap;
-
-+ if (xmir_screen->rootless)
-+ return NULL;
-+
- root = screen->GetScreenPixmap(screen);
- pixmap = screen->GetWindowPixmap(win);
-
-diff --git a/hw/xmir/xmir-input.c b/hw/xmir/xmir-input.c
-index 855b6d3..4de3fe0 100644
---- a/hw/xmir/xmir-input.c
-+++ b/hw/xmir/xmir-input.c
-@@ -307,6 +307,37 @@ DDXRingBell(int volume, int pitch, int duration)
- {
- }
-
-+static WindowPtr
-+xmir_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
-+{
-+ struct xmir_input *xmir_input = NULL;
-+ DeviceIntPtr device;
-+
-+ for (device = inputInfo.devices; device; device = device->next) {
-+ if (device->deviceProc == xmir_pointer_proc &&
-+ device->spriteInfo->sprite == sprite) {
-+ xmir_input = device->public.devicePrivate;
-+ break;
-+ }
-+ }
-+
-+ if (xmir_input == NULL) {
-+ /* XTEST device */
-+ sprite->spriteTraceGood = 1;
-+ return sprite->spriteTrace[0];
-+ }
-+
-+ if (xmir_input->focus_window) {
-+ sprite->spriteTraceGood = 2;
-+ sprite->spriteTrace[1] = xmir_input->focus_window->window;
-+ return miSpriteTrace(sprite, x, y);
-+ }
-+ else {
-+ sprite->spriteTraceGood = 1;
-+ return sprite->spriteTrace[0];
-+ }
-+}
-+
- static void
- fake_touch_move(struct xmir_input *xmir_input, struct xmir_window *xmir_window, int sx, int sy)
- {
-@@ -476,6 +507,9 @@ InitInput(int argc, char *argv[])
- struct xmir_screen *xmir_screen = xmir_screen_get(pScreen);
- struct xmir_input *xmir_input;
-
-+ if (xmir_screen->rootless)
-+ pScreen->XYToWindow = xmir_xy_to_window;
-+
- mieqInit();
-
- xmir_input = calloc(1, sizeof(*xmir_input));
-diff --git a/hw/xmir/xmir-output.c b/hw/xmir/xmir-output.c
-index f958e87..c1770d5 100644
---- a/hw/xmir/xmir-output.c
-+++ b/hw/xmir/xmir-output.c
-@@ -78,6 +78,9 @@ xmir_output_dpms(struct xmir_screen *xmir_screen, int mode)
- MirPowerMode mir_mode = mir_power_mode_on;
- Bool unchanged = TRUE;
-
-+ if (xmir_screen->rootless)
-+ return FALSE;
-+
- switch (mode) {
- case DPMSModeOn:
- mir_mode = mir_power_mode_on;
-@@ -306,6 +309,11 @@ xmir_output_handle_resize(struct xmir_window *xmir_window, int width, int height
- xmir_window->image = NULL;
- }
-
-+ if (xmir_screen->rootless) {
-+ screen->ResizeWindow(window, window->drawable.x, window->drawable.y, window_width, window_height, NULL);
-+ return;
-+ }
-+
- if (!xmir_screen->windowed) {
- xmir_screen->windowed = 1;
-
-diff --git a/hw/xmir/xmir.c b/hw/xmir/xmir.c
-index 4afd66e..13224aa 100644
---- a/hw/xmir/xmir.c
-+++ b/hw/xmir/xmir.c
-@@ -33,6 +33,7 @@
- #include <selection.h>
- #include <micmap.h>
- #include <misyncshm.h>
-+#include <compositeext.h>
- #include <glx_extinit.h>
-
- #include <mir_toolkit/mir_surface.h>
-@@ -91,6 +92,7 @@ ddxBeforeReset(void)
- void
- ddxUseMsg(void)
- {
-+ ErrorF("-rootless run rootless, requires wm support\n");
- ErrorF("-sw disable glamor rendering\n");
- ErrorF("-egl force use of EGL calls, disables DRI2 pass-through\n");
- ErrorF("-egl_sync same as -egl, but with synchronous page flips.\n");
-@@ -107,7 +109,8 @@ ddxProcessArgument(int argc, char *argv[], int i)
- {
- static int seen_shared;
-
-- if (strcmp(argv[i], "-sw") == 0 ||
-+ if (strcmp(argv[i], "-rootless") == 0 ||
-+ strcmp(argv[i], "-sw") == 0 ||
- strcmp(argv[i], "-egl") == 0 ||
- strcmp(argv[i], "-egl_sync") == 0 ||
- strcmp(argv[i], "-2x") == 0 ||
-@@ -425,8 +428,21 @@ xmir_realize_window(WindowPtr window)
- xmir_screen->RealizeWindow = screen->RealizeWindow;
- screen->RealizeWindow = xmir_realize_window;
-
-- if (window->parent)
-- return ret;
-+ if (xmir_screen->rootless && !window->parent) {
-+ RegionNull(&window->clipList);
-+ RegionNull(&window->borderClip);
-+ RegionNull(&window->winSize);
-+ }
-+
-+ if (xmir_screen->rootless) {
-+ CompositeRedirectSubwindows(window, /*CompositeRedirectManual*/TRUE); // WTF? Where is this defined
-+ if (window->redirectDraw != RedirectDrawManual)
-+ return ret;
-+ }
-+ else {
-+ if (window->parent)
-+ return ret;
-+ }
-
- mir_connection_get_available_surface_formats (xmir_screen->conn, formats, 1024, &n_formats);
- for (i = 0; i < n_formats && pixel_format == mir_pixel_format_invalid; i++) {
-@@ -546,8 +562,15 @@ xmir_handle_surface_event(struct xmir_window *xmir_window, MirSurfaceAttrib attr
- void
- xmir_close_surface(struct xmir_window *xmir_window)
- {
-- ErrorF("Root window closed, shutting down Xmir\n");
-- GiveUp(0);
-+ WindowPtr window = xmir_window->window;
-+ struct xmir_screen *xmir_screen = xmir_screen_get(window->drawable.pScreen);
-+
-+ if (!xmir_screen->rootless) {
-+ ErrorF("Root window closed, shutting down Xmir\n");
-+ GiveUp(0);
-+ }
-+
-+ DeleteWindow(window, 1);
- }
-
- static void
-@@ -679,7 +702,8 @@ xmir_is_unblank(int mode)
- Bool
- DPMSSupported(void)
- {
-- return TRUE;
-+ struct xmir_screen *xmir_screen = xmir_screen_get(screenInfo.screens[0]);
-+ return !xmir_screen->rootless;
- }
-
- int
-@@ -748,12 +772,16 @@ xmir_create_screen_resources(ScreenPtr screen)
- if (!ret)
- return ret;
-
-- screen->devPrivate = screen->CreatePixmap(screen, screen->width, screen->height, screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
-+ if (!xmir_screen->rootless)
-+ screen->devPrivate = screen->CreatePixmap(screen, screen->width, screen->height, screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
-+ else
-+ screen->devPrivate = fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
-+
- if (!screen->devPrivate)
- return FALSE;
-
- #ifdef GLAMOR_HAS_GBM
-- if (xmir_screen->glamor) {
-+ if (xmir_screen->glamor && !xmir_screen->rootless) {
- glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(screen->devPrivate);
-
- glBindFramebuffer(GL_FRAMEBUFFER, pixmap_priv->base.fbo->fb);
-@@ -835,7 +863,9 @@ xmir_screen_init(ScreenPtr pScreen, int argc, char **argv)
- xmir_screen->glamor = 1;
-
- for (i = 1; i < argc; i++) {
-- if (strcmp(argv[i], "-mir") == 0) {
-+ if (strcmp(argv[i], "-rootless") == 0) {
-+ xmir_screen->rootless = 1;
-+ } else if (strcmp(argv[i], "-mir") == 0) {
- appid = argv[++i];
- } else if (strcmp(argv[i], "-mirSocket") == 0) {
- socket = argv[++i];
-diff --git a/hw/xmir/xmir.h b/hw/xmir/xmir.h
-index e43fa40..b67f3a1 100644
---- a/hw/xmir/xmir.h
-+++ b/hw/xmir/xmir.h
-@@ -53,7 +53,7 @@
- struct xmir_screen {
- ScreenPtr screen;
-
-- int depth, windowed, glamor, doubled;
-+ int depth, rootless, windowed, glamor, doubled;
-
- CreateScreenResourcesProcPtr CreateScreenResources;
- CloseScreenProcPtr CloseScreen;
---
-2.5.0
-
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index 3a471c2..79b7d1c 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -1,33 +1,34 @@
-From 288ecd8208dadaf661639559192373874cad9f20 Mon Sep 17 00:00:00 2001
+From debdda3bfd737885c4fbbbcff06518c507009077 Mon Sep 17 00:00:00 2001
From: Robert Ancell <robert.ancell@canonical.com>
Date: Fri, 15 May 2015 14:58:59 +1200
-Subject: [PATCH 1/4] XMir DDX
+Subject: [PATCH 1/3] XMir DDX
Contributions from:
Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Robert Ancell <robert.ancell@canonical.com>
Andreas Pokorny <andreas.pokorny@canonical.com>
+ Daniel van Vugt <daniel.van.vugt@canonical.com>
---
configure.ac | 25 +
hw/Makefile.am | 9 +-
hw/xmir/.gitignore | 1 +
hw/xmir/Makefile.am | 61 ++
hw/xmir/dri2/Makefile.am | 14 +
- hw/xmir/dri2/dri2.c | 1398 +++++++++++++++++++++++++++++++++++++++++++
+ hw/xmir/dri2/dri2.c | 1398 +++++++++++++++++++++++++++++++++++++++
hw/xmir/dri2/dri2.h | 364 +++++++++++
- hw/xmir/dri2/dri2ext.c | 683 +++++++++++++++++++++
+ hw/xmir/dri2/dri2ext.c | 683 +++++++++++++++++++
hw/xmir/dri2/dri2int.h | 26 +
- hw/xmir/xmir-cursor.c | 214 +++++++
- hw/xmir/xmir-cvt.c | 304 ++++++++++
- hw/xmir/xmir-dri2.c | 529 ++++++++++++++++
- hw/xmir/xmir-glamor.c | 1184 ++++++++++++++++++++++++++++++++++++
- hw/xmir/xmir-input.c | 505 ++++++++++++++++
- hw/xmir/xmir-output.c | 444 ++++++++++++++
- hw/xmir/xmir-thread-proxy.c | 132 ++++
- hw/xmir/xmir.c | 999 +++++++++++++++++++++++++++++++
- hw/xmir/xmir.h | 211 +++++++
- 18 files changed, 7101 insertions(+), 2 deletions(-)
+ hw/xmir/xmir-cursor.c | 210 ++++++
+ hw/xmir/xmir-cvt.c | 304 +++++++++
+ hw/xmir/xmir-dri2.c | 545 ++++++++++++++++
+ hw/xmir/xmir-glamor.c | 1173 +++++++++++++++++++++++++++++++++
+ hw/xmir/xmir-input.c | 577 ++++++++++++++++
+ hw/xmir/xmir-output.c | 456 +++++++++++++
+ hw/xmir/xmir-thread-proxy.c | 109 ++++
+ hw/xmir/xmir.c | 1518 +++++++++++++++++++++++++++++++++++++++++++
+ hw/xmir/xmir.h | 225 +++++++
+ 18 files changed, 7696 insertions(+), 2 deletions(-)
create mode 100644 hw/xmir/.gitignore
create mode 100644 hw/xmir/Makefile.am
create mode 100644 hw/xmir/dri2/Makefile.am
@@ -45,9 +46,11 @@ Contributions from:
create mode 100644 hw/xmir/xmir.c
create mode 100644 hw/xmir/xmir.h
+diff --git a/configure.ac b/configure.ac
+index d8f0e74..56355fd 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -629,6 +629,7 @@ AC_ARG_ENABLE(xvfb, AS_HELP_ST
+@@ -624,6 +624,7 @@ AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xwayland, AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto])
@@ -55,7 +58,7 @@ Contributions from:
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: no)]), [GLAMOR=$enableval], [GLAMOR=no])
-@@ -750,6 +751,7 @@ case $host_os in
+@@ -745,6 +746,7 @@ case $host_os in
XVFB=no
XNEST=no
XWAYLAND=no
@@ -63,7 +66,7 @@ Contributions from:
COMPOSITE=no
DGA=no
-@@ -2498,6 +2500,27 @@ if test "x$XWAYLAND" = xyes; then
+@@ -2474,6 +2476,27 @@ if test "x$XWAYLAND" = xyes; then
[${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
fi
@@ -91,7 +94,7 @@ Contributions from:
dnl and the rest of these are generic, so they're in config.h
dnl
-@@ -2646,6 +2669,8 @@ hw/kdrive/fbdev/Makefile
+@@ -2622,6 +2645,8 @@ hw/kdrive/fbdev/Makefile
hw/kdrive/linux/Makefile
hw/kdrive/src/Makefile
hw/xwayland/Makefile
@@ -100,6 +103,8 @@ Contributions from:
test/Makefile
test/xi1/Makefile
test/xi2/Makefile
+diff --git a/hw/Makefile.am b/hw/Makefile.am
+index 19895dc..b7b958c 100644
--- a/hw/Makefile.am
+++ b/hw/Makefile.am
@@ -30,6 +30,10 @@ if XWAYLAND
@@ -126,10 +131,16 @@ Contributions from:
relink:
$(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done
+diff --git a/hw/xmir/.gitignore b/hw/xmir/.gitignore
+new file mode 100644
+index 0000000..b6a16d4
--- /dev/null
+++ b/hw/xmir/.gitignore
@@ -0,0 +1 @@
+Xmir
+diff --git a/hw/xmir/Makefile.am b/hw/xmir/Makefile.am
+new file mode 100644
+index 0000000..be5225e
--- /dev/null
+++ b/hw/xmir/Makefile.am
@@ -0,0 +1,61 @@
@@ -194,6 +205,9 @@ Contributions from:
+
+relink:
+ $(AM_V_at)rm -f Xmir$(EXEEXT) && $(MAKE) Xmir$(EXEEXT)
+diff --git a/hw/xmir/dri2/Makefile.am b/hw/xmir/dri2/Makefile.am
+new file mode 100644
+index 0000000..696240c
--- /dev/null
+++ b/hw/xmir/dri2/Makefile.am
@@ -0,0 +1,14 @@
@@ -211,6 +225,9 @@ Contributions from:
+ dri2ext.c \
+ dri2int.h
+
+diff --git a/hw/xmir/dri2/dri2.c b/hw/xmir/dri2/dri2.c
+new file mode 100644
+index 0000000..6aa19ba
--- /dev/null
+++ b/hw/xmir/dri2/dri2.c
@@ -0,0 +1,1398 @@
@@ -1612,6 +1629,9 @@ Contributions from:
+ *is_param_recognized = FALSE;
+ return Success;
+}
+diff --git a/hw/xmir/dri2/dri2.h b/hw/xmir/dri2/dri2.h
+new file mode 100644
+index 0000000..318898b
--- /dev/null
+++ b/hw/xmir/dri2/dri2.h
@@ -0,0 +1,364 @@
@@ -1979,6 +1999,9 @@ Contributions from:
+extern Bool noDRI2Extension;
+
+#endif
+diff --git a/hw/xmir/dri2/dri2ext.c b/hw/xmir/dri2/dri2ext.c
+new file mode 100644
+index 0000000..befbb82
--- /dev/null
+++ b/hw/xmir/dri2/dri2ext.c
@@ -0,0 +1,683 @@
@@ -2665,6 +2688,9 @@ Contributions from:
+
+ DRI2ModuleSetup();
+}
+diff --git a/hw/xmir/dri2/dri2int.h b/hw/xmir/dri2/dri2int.h
+new file mode 100644
+index 0000000..7f53eba
--- /dev/null
+++ b/hw/xmir/dri2/dri2int.h
@@ -0,0 +1,26 @@
@@ -2694,9 +2720,12 @@ Contributions from:
+ */
+
+extern Bool DRI2ModuleSetup(void);
+diff --git a/hw/xmir/xmir-cursor.c b/hw/xmir/xmir-cursor.c
+new file mode 100644
+index 0000000..81873a4
--- /dev/null
+++ b/hw/xmir/xmir-cursor.c
-@@ -0,0 +1,214 @@
+@@ -0,0 +1,210 @@
+/*
+ * Copyright © 2015 Canonical Ltd
+ *
@@ -2761,15 +2790,11 @@ Contributions from:
+static Bool
+xmir_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
-+ struct xmir_input *xmir_input = device->public.devicePrivate;
-+
-+ if (xmir_input) {
-+ xmir_input->x_cursor = cursor;
-+ xmir_input_set_cursor(xmir_input);
-+ }
+ return TRUE;
+}
+
++static void xmir_input_set_cursor(struct xmir_input *xmir_input, CursorPtr cursor);
++
+static Bool
+xmir_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
@@ -2779,34 +2804,33 @@ Contributions from:
+ stream = dixGetPrivate(&cursor->devPrivates, &xmir_cursor_private_key);
+ dixSetPrivate(&cursor->devPrivates, &xmir_cursor_private_key, NULL);
+
++ if (xmir_input)
++ xmir_input_set_cursor(xmir_input, rootCursor);
++
+ if (stream)
+ mir_buffer_stream_release_sync(stream);
+
-+ if (!xmir_input)
-+ return TRUE;
-+
-+ xmir_input->x_cursor = NULL;
-+ xmir_input_set_cursor(xmir_input);
-+
+ return TRUE;
+}
+
-+void
-+xmir_input_set_cursor(struct xmir_input *xmir_input)
++static void
++xmir_input_set_cursor(struct xmir_input *xmir_input, CursorPtr cursor)
+{
-+ CursorPtr cursor;
+ MirGraphicsRegion region;
+ MirCursorConfiguration *config;
+ MirBufferStream *stream;
+
-+ cursor = xmir_input->x_cursor;
-+
+ if (!cursor) {
-+ /* Hide cursor */
+ config = mir_cursor_configuration_from_name(mir_disabled_cursor_name);
-+ stream = NULL;
+ goto apply;
-+ } else if ((stream = dixGetPrivate(&cursor->devPrivates, &xmir_cursor_private_key))) {
++ } else if (cursor == rootCursor) {
++ /* Avoid using the old style X default black cross cursor */
++ config = mir_cursor_configuration_from_name(mir_arrow_cursor_name);
++ goto apply;
++ }
++
++ stream = dixGetPrivate(&cursor->devPrivates, &xmir_cursor_private_key);
++ if (stream) {
+ mir_buffer_stream_get_graphics_region(stream, ®ion);
+ if (region.width != cursor->bits->width || region.height != cursor->bits->height) {
+ mir_buffer_stream_release_sync(stream);
@@ -2825,19 +2849,21 @@ Contributions from:
+
+ stride = cursor->bits->width * 4;
+ for (y = 0; y < cursor->bits->height; y++)
-+ memcpy(region.vaddr + y * region.stride, cursor->bits->argb + y * stride, stride);
++ memcpy(region.vaddr + y * region.stride,
++ (char*)cursor->bits->argb + y * stride, stride);
+ }
+ else
+ expand_source_and_mask(cursor, region.vaddr);
+
++ mir_buffer_stream_swap_buffers(stream, NULL, NULL);
+ config = mir_cursor_configuration_from_buffer_stream(stream, cursor->bits->xhot, cursor->bits->yhot);
+
+apply:
-+ mir_wait_for(mir_surface_configure_cursor(xmir_window_get(xmir_input->xmir_screen->screen->root)->surface, config));
++ if (!xmir_input->xmir_screen->rootless)
++ mir_wait_for(mir_surface_configure_cursor(xmir_window_get(xmir_input->xmir_screen->screen->root)->surface, config));
++ else if (xmir_input->focus_window)
++ mir_wait_for(mir_surface_configure_cursor(xmir_input->focus_window->surface, config));
+ mir_cursor_configuration_destroy(config);
-+
-+ if (stream)
-+ mir_buffer_stream_swap_buffers_sync(stream);
+}
+
+static void
@@ -2850,8 +2876,7 @@ Contributions from:
+ if (xmir_input == NULL)
+ return;
+
-+ xmir_input->x_cursor = cursor;
-+ xmir_input_set_cursor(xmir_input);
++ xmir_input_set_cursor(xmir_input, cursor);
+}
+
+static void
@@ -2911,6 +2936,9 @@ Contributions from:
+ &xmir_pointer_sprite_funcs,
+ &xmir_pointer_screen_funcs, TRUE);
+}
+diff --git a/hw/xmir/xmir-cvt.c b/hw/xmir/xmir-cvt.c
+new file mode 100644
+index 0000000..6070d77
--- /dev/null
+++ b/hw/xmir/xmir-cvt.c
@@ -0,0 +1,304 @@
@@ -3218,9 +3246,12 @@ Contributions from:
+
+ return RRModeGet(&modeinfo, name);
+}
+diff --git a/hw/xmir/xmir-dri2.c b/hw/xmir/xmir-dri2.c
+new file mode 100644
+index 0000000..b24d4b9
--- /dev/null
+++ b/hw/xmir/xmir-dri2.c
-@@ -0,0 +1,529 @@
+@@ -0,0 +1,545 @@
+/*
+ * Copyright © 2015 Canonical Ltd
+ *
@@ -3260,6 +3291,7 @@ Contributions from:
+#include <epoxy/egl.h>
+#include <epoxy/gl.h>
+#include <mir_toolkit/mir_connection.h>
++/* FIXME: This should not be mandatory, especially on Android (LP: #1502794) */
+#include <mir_toolkit/mesa/platform_operation.h>
+
+/* XMir dri2 support:
@@ -3313,8 +3345,12 @@ Contributions from:
+xmir_window_swappable_parent(WindowPtr win)
+{
+ ScreenPtr screen = win->drawable.pScreen;
++ struct xmir_screen *xmir_screen = xmir_screen_get(screen);
+ PixmapPtr root, pixmap;
+
++ if (xmir_screen->rootless)
++ return NULL;
++
+ root = screen->GetScreenPixmap(screen);
+ pixmap = screen->GetWindowPixmap(win);
+
@@ -3416,6 +3452,7 @@ Contributions from:
+ return ret;
+
+ mir_platform_message_set_data(msg, &req, sizeof req);
++/* FIXME: This should not be mandatory, especially on Android (LP: #1502794) */
+ mir_wait_for(mir_connection_platform_operation(
+ xmir_screen->conn,
+ msg,
@@ -3704,6 +3741,15 @@ Contributions from:
+ return TRUE;
+}
+
++static int xmir_dri_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
++{
++ /* TODO: Implement this?
++ * At least doing nothing like this is enough to shut up Chromium
++ * error messages.
++ */
++ return Success;
++}
++
+Bool
+xmir_dri2_screen_init(struct xmir_screen *xmir_screen)
+{
@@ -3738,6 +3784,7 @@ Contributions from:
+ xmir_screen->dri2.ReuseBufferNotify = xmir_dri2_reusebuffer_notify;
+ xmir_screen->dri2.SwapLimitValidate = xmir_dri2_swap_limit_validate;
+ xmir_screen->dri2.ScheduleSwap = xmir_dri2_schedule_swap;
++ xmir_screen->dri2.GetMSC = xmir_dri_get_msc;
+
+ /* 8 */
+ xmir_screen->dri2.AuthMagic2 = xmir_dri2_auth_magic;
@@ -3750,9 +3797,12 @@ Contributions from:
+ ret = DRI2ScreenInit(xmir_screen->screen, &xmir_screen->dri2);
+ return ret;
+}
+diff --git a/hw/xmir/xmir-glamor.c b/hw/xmir/xmir-glamor.c
+new file mode 100644
+index 0000000..2438013
--- /dev/null
+++ b/hw/xmir/xmir-glamor.c
-@@ -0,0 +1,1184 @@
+@@ -0,0 +1,1173 @@
+/*
+ * Copyright © 2015 Canonical Ltd
+ *
@@ -3871,19 +3921,15 @@ Contributions from:
+
+ if (xmir_win && xmir_win->surface) {
+ MirNativeBuffer *buffer;
-+
-+ struct gbm_import_fd_data gbm_data = {
-+ 0,
-+ draw->width,
-+ draw->height,
-+ 0,
-+ GBM_FORMAT_ARGB8888
-+ };
++ struct gbm_import_fd_data gbm_data;
+
+ mir_buffer_stream_get_current_buffer(mir_surface_get_buffer_stream(xmir_win->surface), &buffer);
+
+ gbm_data.fd = buffer->fd[0];
++ gbm_data.width = buffer->width;
++ gbm_data.height = buffer->height;
+ gbm_data.stride = buffer->stride;
++ gbm_data.format = GBM_FORMAT_ARGB8888; /* TODO: detect this properly */
+
+ bo = gbm_bo_import(xmir_screen->gbm, GBM_BO_IMPORT_FD, &gbm_data, GBM_BO_USE_RENDERING);
+ xmir_pixmap->fake_back = false;
@@ -4299,7 +4345,8 @@ Contributions from:
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ xorg_list_del(&xmir_win->flip.entry);
-+ xmir_post_to_eventloop(xmir_screen->submit_rendering_handler, &xmir_win);
++ xmir_post_to_eventloop(xmir_handle_buffer_available, xmir_screen,
++ xmir_win, 0);
+ }
+ }
+ glDeleteTextures(1, &tex);
@@ -4320,8 +4367,7 @@ Contributions from:
+ glamor_pixmap_private *src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
+
+ BoxPtr ext = RegionExtents(dirty);
-+ EGLint height = src_pixmap->drawable.height;
-+ EGLint width = src_pixmap->drawable.width;
++ EGLint width, height;
+
+ lastGLContext = xmir_screen->egl_context;
+
@@ -4337,12 +4383,6 @@ Contributions from:
+ eglQuerySurface(xmir_screen->egl_display, xmir_win->egl_surface, EGL_WIDTH, &width);
+ xmir_glamor_copy_egl_common(&window->drawable, src_pixmap, src_pixmap_priv, ext, width, height, 0, 0, xmir_win->orientation);
+ eglSwapBuffers(xmir_screen->egl_display, xmir_win->egl_surface);
-+
-+ xmir_win->damage_index = (xmir_win->damage_index + 1) % MIR_MAX_BUFFER_AGE;
-+
-+ eglQuerySurface(xmir_screen->egl_display, xmir_win->egl_surface, EGL_HEIGHT, &height);
-+ eglQuerySurface(xmir_screen->egl_display, xmir_win->egl_surface, EGL_WIDTH, &width);
-+ xmir_output_handle_resize(xmir_win, width, height);
+}
+
+static void
@@ -4577,7 +4617,7 @@ Contributions from:
+
+ version = eglQueryString(xmir_screen->egl_display, EGL_VERSION);
+ ErrorF("glamor EGL version: %s\n", version);
-+ ErrorF("glamor EGL extensions: %s:\n", eglQueryString(xmir_screen->egl_display, EGL_EXTENSIONS));
++ ErrorF("glamor EGL extensions: %s\n", eglQueryString(xmir_screen->egl_display, EGL_EXTENSIONS));
+
+ egl_config = xmir_glamor_get_egl_config(xmir_screen);
+
@@ -4611,7 +4651,7 @@ Contributions from:
+ return FALSE;
+ }
+
-+ if (!xmir_screen->gbm && xmir_screen->glamor != 3) {
++ if (!xmir_screen->gbm && xmir_screen->glamor != glamor_egl_sync) {
+ xmir_screen->swap_context = eglCreateContext(xmir_screen->egl_display, egl_config, EGL_NO_CONTEXT, gles2_attribs);
+ if (!xmir_screen->swap_context) {
+ ErrorF("Failed to create EGL context: %i/%x\n", eglGetError(), eglGetError());
@@ -4648,7 +4688,7 @@ Contributions from:
+
+ if (xmir_screen->platform.fd_items >= 1 &&
+ !xmir_screen->doubled &&
-+ xmir_screen->glamor == 1 &&
++ xmir_screen->glamor == glamor_dri &&
+ !xmir_screen_init_glamor_drm(xmir_screen))
+ return FALSE;
+
@@ -4932,14 +4972,16 @@ Contributions from:
+ * of pixmaps.
+ */
+ glamor_enable_dri3(screen);
-+ } else
-+ xmir_screen->damage_all = 1;
++ }
+
+ return TRUE;
+}
+diff --git a/hw/xmir/xmir-input.c b/hw/xmir/xmir-input.c
+new file mode 100644
+index 0000000..2c3bb77
--- /dev/null
+++ b/hw/xmir/xmir-input.c
-@@ -0,0 +1,505 @@
+@@ -0,0 +1,577 @@
+/*
+ * Copyright © 2015 Canonical Ltd
+ *
@@ -5146,7 +5188,6 @@ Contributions from:
+ }
+
+ xmir_input->focus_window = xmir_window;
-+ xmir_input_set_cursor(xmir_input);
+
+ pointer_convert_xy(xmir_input, xmir_window, &sx, &sy);
+
@@ -5163,10 +5204,10 @@ Contributions from:
+{
+ int sx = mir_pointer_event_axis_value(pev, mir_pointer_axis_x);
+ int sy = mir_pointer_event_axis_value(pev, mir_pointer_axis_y);
++ int vscroll = 0;
+ ValuatorMask mask;
+
-+ if (pointer_ensure_focus(xmir_input, xmir_window, xmir_input->pointer, sx, sy))
-+ return;
++ pointer_ensure_focus(xmir_input, xmir_window, xmir_input->pointer, sx, sy);
+
+ pointer_convert_xy(xmir_input, xmir_window, &sx, &sy);
+
@@ -5176,6 +5217,15 @@ Contributions from:
+
+ QueuePointerEvents(xmir_input->pointer, MotionNotify, 0,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
++
++ /* Mouse wheel: Moving the wheel is a press+release of button 4/5 */
++ vscroll = mir_pointer_event_axis_value(pev, mir_pointer_axis_vscroll);
++ if (vscroll) {
++ int button = vscroll < 0 ? 5 : 4;
++ valuator_mask_zero(&mask);
++ QueuePointerEvents(xmir_input->pointer, ButtonPress, button, 0, &mask);
++ QueuePointerEvents(xmir_input->pointer, ButtonRelease, button, 0, &mask);
++ }
+}
+
+static void
@@ -5184,18 +5234,26 @@ Contributions from:
+ MirPointerEvent const *pev)
+{
+ DeviceIntPtr dev = xmir_input->pointer;
-+ int map[4] = { 0, 1, 3, 2 };
++ struct {MirPointerButton mir_button; int x_button;} map[3] =
++ {
++ {mir_pointer_button_primary, 1}, /* Usually left button */
++ {mir_pointer_button_secondary, 3}, /* Middle button */
++ {mir_pointer_button_tertiary, 2}, /* Right button */
++ };
+ int i;
+ ValuatorMask mask;
+ valuator_mask_zero(&mask);
+
-+ for (i = 1; i <= 3; ++i) {
-+ int swap = map[i];
-+ int oldstate = BitIsOn(dev->button->down, swap) ? ButtonPress : ButtonRelease;
-+ int newstate = mir_pointer_event_button_state(pev, i) ? ButtonPress : ButtonRelease;
++ for (i = 0; i < 3; ++i) {
++ MirPointerButton mir_button = map[i].mir_button;
++ int x_button = map[i].x_button;
++ int oldstate = BitIsOn(dev->button->down, x_button) ?
++ ButtonPress : ButtonRelease;
++ int newstate = mir_pointer_event_button_state(pev, mir_button) ?
++ ButtonPress : ButtonRelease;
+
+ if (oldstate != newstate)
-+ QueuePointerEvents(dev, newstate, swap, 0, &mask);
++ QueuePointerEvents(dev, newstate, x_button, 0, &mask);
+ }
+
+ /* XXX: Map rest of input buttons too! */
@@ -5249,6 +5307,37 @@ Contributions from:
+{
+}
+
++static WindowPtr
++xmir_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
++{
++ struct xmir_input *xmir_input = NULL;
++ DeviceIntPtr device;
++
++ for (device = inputInfo.devices; device; device = device->next) {
++ if (device->deviceProc == xmir_pointer_proc &&
++ device->spriteInfo->sprite == sprite) {
++ xmir_input = device->public.devicePrivate;
++ break;
++ }
++ }
++
++ if (xmir_input == NULL) {
++ /* XTEST device */
++ sprite->spriteTraceGood = 1;
++ return sprite->spriteTrace[0];
++ }
++
++ if (xmir_input->focus_window) {
++ sprite->spriteTraceGood = 2;
++ sprite->spriteTrace[1] = xmir_input->focus_window->window;
++ return miSpriteTrace(sprite, x, y);
++ }
++ else {
++ sprite->spriteTraceGood = 1;
++ return sprite->spriteTrace[0];
++ }
++}
++
+static void
+fake_touch_move(struct xmir_input *xmir_input, struct xmir_window *xmir_window, int sx, int sy)
+{
@@ -5291,21 +5380,25 @@ Contributions from:
+
+ tev = mir_input_event_get_touch_event(ev);
+ count = mir_touch_event_point_count(tev);
++
++ /* Do we really need this multifinger tracking at all?... */
+ if (count < 1) {
+ xmir_input->touch_id = -1;
+ break;
+ }
+
-+ if (xmir_input->touch_id != -1)
++ if (xmir_input->touch_id != -1) {
+ for (i = 0; i < count; ++i)
+ if (mir_touch_event_id(tev, i) == xmir_input->touch_id)
+ break;
-+ else
++ }
++ if (i >= count) {
+ for (i = 0; i < count; ++i)
+ if (mir_touch_event_action(tev, i) == mir_touch_action_down)
+ break;
++ }
+
-+ if (i == count)
++ if (i >= count)
+ break;
+
+ sx = mir_touch_event_axis_value(tev, i, mir_touch_axis_x);
@@ -5357,39 +5450,62 @@ Contributions from:
+ }
+}
+
-+void
-+xmir_handle_input_in_main_thread(void *vctx)
++static void
++xmir_handle_surface_event_in_main_thread(struct xmir_screen *xmir_screen,
++ struct xmir_window *xmir_window,
++ void *arg)
+{
-+ XMirEventContext *ctx = (XMirEventContext *)vctx;
-+ const MirEvent *ev = ctx->ev;
-+ struct xmir_input *xmir_input = xorg_list_first_entry(&ctx->xmir_screen->input_list, struct xmir_input, link);
++ const MirEvent *ev = arg;
++ struct xmir_input *xmir_input = xorg_list_first_entry(&xmir_screen->input_list, struct xmir_input, link);
+
+ switch (mir_event_get_type(ev))
+ {
+ case mir_event_type_input:
-+ xmir_window_handle_input_event(xmir_input, ctx->xmir_window, mir_event_get_input_event(ev));
++ xmir_window_handle_input_event(xmir_input, xmir_window, mir_event_get_input_event(ev));
+ break;
+ case mir_event_type_surface:
-+ xmir_handle_surface_event(ctx->xmir_window, mir_surface_event_get_attribute(mir_event_get_surface_event(ev)), mir_surface_event_get_attribute_value(mir_event_get_surface_event(ev)));
++ xmir_handle_surface_event(xmir_window, mir_surface_event_get_attribute(mir_event_get_surface_event(ev)), mir_surface_event_get_attribute_value(mir_event_get_surface_event(ev)));
+ break;
-+ case mir_event_type_resize:
-+ ErrorF("Resize requested to %ix%i\n", mir_resize_event_get_width(mir_event_get_resize_event(ev)), mir_resize_event_get_height(mir_event_get_resize_event(ev)));
-+ if (ctx->xmir_window->damage)
-+ DamageDamageRegion(&ctx->xmir_window->window->drawable, &ctx->xmir_window->region);
++ case mir_event_type_resize: {
++ WindowPtr window = xmir_window->window;
++ const MirResizeEvent *resize = mir_event_get_resize_event(ev);
++ unsigned future_width = mir_resize_event_get_width(resize);
Reply to: