debian/changelog                                 |   13 
 debian/patches/xmir-desktop-file-hint-flag.patch |   22 
 debian/patches/xmir.patch                        |  576 +++++++++++++++--------
 3 files changed, 410 insertions(+), 201 deletions(-)

New commits:
commit 6a23f1b3237dad65d3f1c3c3616ca91d1822bcf3
Author: Robert Ancell <robert.anc...@canonical.com>
Date:   Thu Nov 17 15:26:39 2016 +1300

    * debian/patches/xmir.patch:
    * debian/patches/xmir-desktop-file-hint-flag.patch:
      - Refresh
      - Fix warnings when built against lp:mir/0.25
      - Support both Mir 0.24 and 0.25 client APIs
      - Fix crashing on arm64 (LP: #1642297)

diff --git a/debian/changelog b/debian/changelog
index 5941a97..716e323 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
-xorg-server (2:1.18.99.902-1ubuntu1) UNRELEASED; urgency=medium
+xorg-server (2:1.18.99.902-1ubuntu2) UNRELEASED; urgency=medium
 
+  [ Timo Aaltonen ]
   * Merge from Debian experimental.
     - Patches refreshed
     - randr-adjust-masters-last-set-time.diff,
@@ -16,7 +17,15 @@ xorg-server (2:1.18.99.902-1ubuntu1) UNRELEASED; 
urgency=medium
     already, no need to carry a duplicate check.
   * xmir.patch: Don't check for aiglx enable flag, dropped upstream.
 
- -- Timo Aaltonen <tjaal...@debian.org>  Tue, 08 Nov 2016 12:48:29 +0200
+  [ Robert Ancell ]
+  * debian/patches/xmir.patch:
+  * debian/patches/xmir-desktop-file-hint-flag.patch:
+    - Refresh
+    - Fix warnings when built against lp:mir/0.25
+    - Support both Mir 0.24 and 0.25 client APIs
+    - Fix crashing on arm64 (LP: #1642297)
+
+ -- Robert Ancell <robert.anc...@canonical.com>  Thu, 17 Nov 2016 15:25:26 
+1300
 
 xorg-server (2:1.18.99.902-1) experimental; urgency=medium
 
diff --git a/debian/patches/xmir-desktop-file-hint-flag.patch 
b/debian/patches/xmir-desktop-file-hint-flag.patch
index 4930b55..d41afbc 100644
--- a/debian/patches/xmir-desktop-file-hint-flag.patch
+++ b/debian/patches/xmir-desktop-file-hint-flag.patch
@@ -1,22 +1,28 @@
-From de9e6e1d66680e717471df2c4032e590fd1b9ae0 Mon Sep 17 00:00:00 2001
+From 9d15629dd3cdddec47f873d7bb14ed5e27f621ca Mon Sep 17 00:00:00 2001
 From: Robert Ancell <robert.anc...@canonical.com>
 Date: Fri, 29 Apr 2016 14:58:28 +0200
 Subject: [PATCH xserver 2/3] xmir: Ignore --desktop_file_hint flag required by
  Unity8 to decide which application is starting
 
 ---
- hw/xmir/xmir.c | 3 +++
- 1 file changed, 3 insertions(+)
+ hw/xmir/xmir.c | 4 ++++
+ 1 file changed, 4 insertions(+)
 
+diff --git a/hw/xmir/xmir.c b/hw/xmir/xmir.c
+index 81b0b34..332e22e 100644
 --- a/hw/xmir/xmir.c
 +++ b/hw/xmir/xmir.c
-@@ -178,6 +178,9 @@ ddxProcessArgument(int argc, char *argv[
-     } else if (!strcmp(argv[i], "-novtswitch") ||
+@@ -180,6 +180,10 @@ ddxProcessArgument(int argc, char *argv[], int i)
+     else if (!strcmp(argv[i], "-novtswitch") ||
                 !strncmp(argv[i], "vt", 2)) {
          return 1;
 +    /* Bypass unity8 "security" */
-+    } else if (!strncmp(argv[i], "--desktop_file_hint=", 
strlen("--desktop_file_hint="))) {
++    }
++    else if (!strncmp(argv[i], "--desktop_file_hint=", 
strlen("--desktop_file_hint="))) {
 +        return 1;
-     } else if (!strcmp(argv[i], "-fd")) {
+     }
+     else if (!strcmp(argv[i], "-fd")) {
          if (!seen_shared)
-             NoListenAll = 1;
+-- 
+2.10.2
+
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index 1d9aa40..d4fbdb2 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -1,4 +1,4 @@
-From 8467ede06b3b40fae1d362d73cfa313737e0defc Mon Sep 17 00:00:00 2001
+From 4d62680bb8961651be15732cc815bf8cff2535ef Mon Sep 17 00:00:00 2001
 From: Robert Ancell <robert.anc...@canonical.com>
 Date: Fri, 29 Apr 2016 14:57:53 +0200
 Subject: [PATCH xserver 1/3] XMir DDX
@@ -16,20 +16,20 @@ Contributions from:
  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/dri2int.h      |   26 +
- hw/xmir/xmir-cursor.c       |  210 ++++++
+ hw/xmir/xmir-cursor.c       |  223 ++++++
  hw/xmir/xmir-cvt.c          |  304 ++++++++
- hw/xmir/xmir-dri2.c         |  551 ++++++++++++++
- hw/xmir/xmir-glamor.c       | 1164 +++++++++++++++++++++++++++++
- hw/xmir/xmir-input.c        |  611 +++++++++++++++
- hw/xmir/xmir-output.c       |  476 ++++++++++++
- hw/xmir/xmir-thread-proxy.c |  115 +++
- hw/xmir/xmir.c              | 1729 +++++++++++++++++++++++++++++++++++++++++++
+ hw/xmir/xmir-dri2.c         |  558 ++++++++++++++
+ hw/xmir/xmir-glamor.c       | 1174 ++++++++++++++++++++++++++++
+ hw/xmir/xmir-input.c        |  650 ++++++++++++++++
+ hw/xmir/xmir-output.c       |  505 ++++++++++++
+ hw/xmir/xmir-thread-proxy.c |  116 +++
+ hw/xmir/xmir.c              | 1789 +++++++++++++++++++++++++++++++++++++++++++
  hw/xmir/xmir.h              |  232 ++++++
- 18 files changed, 7971 insertions(+), 2 deletions(-)
+ 18 files changed, 8130 insertions(+), 2 deletions(-)
  create mode 100644 hw/xmir/.gitignore
  create mode 100644 hw/xmir/Makefile.am
  create mode 100644 hw/xmir/dri2/Makefile.am
@@ -47,8 +47,10 @@ Contributions from:
  create mode 100644 hw/xmir/xmir.c
  create mode 100644 hw/xmir/xmir.h
 
---- a/configure.ac
-+++ b/configure.ac
+Index: xorg-server/configure.ac
+===================================================================
+--- xorg-server.orig/configure.ac
++++ xorg-server/configure.ac
 @@ -654,6 +654,7 @@ AC_ARG_ENABLE(xvfb,              AS_HELP_ST
  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])
@@ -102,8 +104,10 @@ Contributions from:
  test/Makefile
  test/xi1/Makefile
  test/xi2/Makefile
---- a/hw/Makefile.am
-+++ b/hw/Makefile.am
+Index: xorg-server/hw/Makefile.am
+===================================================================
+--- xorg-server.orig/hw/Makefile.am
++++ xorg-server/hw/Makefile.am
 @@ -30,6 +30,10 @@ if XWAYLAND
  XWAYLAND_SUBDIRS = xwayland
  endif
@@ -128,13 +132,17 @@ Contributions from:
  
  relink:
        $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; 
done
+Index: xorg-server/hw/xmir/.gitignore
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/.gitignore
++++ xorg-server/hw/xmir/.gitignore
 @@ -0,0 +1 @@
 +Xmir
+Index: xorg-server/hw/xmir/Makefile.am
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/Makefile.am
-@@ -0,0 +1,60 @@
++++ xorg-server/hw/xmir/Makefile.am
+@@ -0,0 +1,59 @@
 +bin_PROGRAMS = Xmir
 +
 +if DRI2
@@ -188,15 +196,16 @@ Contributions from:
 +endif
 +
 +aiglx_lib = $(top_builddir)/glx/libglxdri.la
-+
 +if NO_UNDEFINED
 +aiglx_lib += $(LIBDRM_LIBS) $(PIXMAN_LIBS)
 +endif
 +
 +relink:
 +      $(AM_V_at)rm -f Xmir$(EXEEXT) && $(MAKE) Xmir$(EXEEXT)
+Index: xorg-server/hw/xmir/dri2/Makefile.am
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/dri2/Makefile.am
++++ xorg-server/hw/xmir/dri2/Makefile.am
 @@ -0,0 +1,14 @@
 +noinst_LTLIBRARIES = libdri2.la
 +
@@ -212,8 +221,10 @@ Contributions from:
 +      dri2ext.c \
 +      dri2int.h
 +
+Index: xorg-server/hw/xmir/dri2/dri2.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/dri2/dri2.c
++++ xorg-server/hw/xmir/dri2/dri2.c
 @@ -0,0 +1,1398 @@
 +/*
 + * Copyright © 2007, 2008 Red Hat, Inc.
@@ -1613,8 +1624,10 @@ Contributions from:
 +    *is_param_recognized = FALSE;
 +    return Success;
 +}
+Index: xorg-server/hw/xmir/dri2/dri2.h
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/dri2/dri2.h
++++ xorg-server/hw/xmir/dri2/dri2.h
 @@ -0,0 +1,364 @@
 +/*
 + * Copyright © 2007 Red Hat, Inc.
@@ -1980,8 +1993,10 @@ Contributions from:
 +extern Bool noDRI2Extension;
 +
 +#endif
+Index: xorg-server/hw/xmir/dri2/dri2ext.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/dri2/dri2ext.c
++++ xorg-server/hw/xmir/dri2/dri2ext.c
 @@ -0,0 +1,683 @@
 +/*
 + * Copyright © 2008 Red Hat, Inc.
@@ -2666,8 +2681,10 @@ Contributions from:
 +
 +    DRI2ModuleSetup();
 +}
+Index: xorg-server/hw/xmir/dri2/dri2int.h
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/dri2/dri2int.h
++++ xorg-server/hw/xmir/dri2/dri2int.h
 @@ -0,0 +1,26 @@
 +/*
 + * Copyright © 2011 Daniel Stone
@@ -2695,11 +2712,13 @@ Contributions from:
 + */
 +
 +extern Bool DRI2ModuleSetup(void);
+Index: xorg-server/hw/xmir/xmir-cursor.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-cursor.c
-@@ -0,0 +1,210 @@
++++ xorg-server/hw/xmir/xmir-cursor.c
+@@ -0,0 +1,223 @@
 +/*
-+ * Copyright © 2015 Canonical Ltd
++ * Copyright © 2015-2016 Canonical Ltd
 + *
 + * Permission to use, copy, modify, distribute, and sell this software
 + * and its documentation for any purpose is hereby granted without
@@ -2765,7 +2784,8 @@ Contributions from:
 +    return TRUE;
 +}
 +
-+static void xmir_input_set_cursor(struct xmir_input *xmir_input, CursorPtr 
cursor);
++static void xmir_input_set_cursor(struct xmir_input *xmir_input,
++                                  CursorPtr cursor);
 +
 +static Bool
 +xmir_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
@@ -2795,7 +2815,8 @@ Contributions from:
 +    if (!cursor) {
 +        config = mir_cursor_configuration_from_name(mir_disabled_cursor_name);
 +        goto apply;
-+    } else if (cursor == rootCursor) {
++    }
++    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;
@@ -2804,14 +2825,19 @@ Contributions from:
 +    stream = dixGetPrivate(&cursor->devPrivates, &xmir_cursor_private_key);
 +    if (stream) {
 +        mir_buffer_stream_get_graphics_region(stream, &region);
-+        if (region.width != cursor->bits->width || region.height != 
cursor->bits->height) {
++        if (region.width != cursor->bits->width ||
++            region.height != cursor->bits->height) {
 +            mir_buffer_stream_release_sync(stream);
 +            stream = NULL;
 +        }
 +    }
 +
 +    if (!stream) {
-+        stream = 
mir_connection_create_buffer_stream_sync(xmir_input->xmir_screen->conn, 
cursor->bits->width, cursor->bits->height, mir_pixel_format_argb_8888, 
mir_buffer_usage_software);
++        stream = 
mir_connection_create_buffer_stream_sync(xmir_input->xmir_screen->conn,
++                                                          cursor->bits->width,
++                                                          
cursor->bits->height,
++                                                          
mir_pixel_format_argb_8888,
++                                                          
mir_buffer_usage_software);
 +        dixSetPrivate(&cursor->devPrivates, &xmir_cursor_private_key, stream);
 +        mir_buffer_stream_get_graphics_region(stream, &region);
 +    }
@@ -2828,13 +2854,18 @@ Contributions from:
 +        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);
++    config = mir_cursor_configuration_from_buffer_stream(stream,
++                                                         cursor->bits->xhot,
++                                                         cursor->bits->yhot);
 +
 +apply:
-+    if (!xmir_input->xmir_screen->rootless)
-+        
mir_wait_for(mir_surface_configure_cursor(xmir_window_get(xmir_input->xmir_screen->screen->root)->surface,
 config));
++    if (!xmir_input->xmir_screen->rootless) {
++        struct xmir_window *w = 
xmir_window_get(xmir_input->xmir_screen->screen->root);
++        mir_wait_for(mir_surface_configure_cursor(w->surface, config));
++    }
 +    else if (xmir_input->focus_window)
-+        
mir_wait_for(mir_surface_configure_cursor(xmir_input->focus_window->surface, 
config));
++        
mir_wait_for(mir_surface_configure_cursor(xmir_input->focus_window->surface,
++                                                  config));
 +    mir_cursor_configuration_destroy(config);
 +}
 +
@@ -2901,15 +2932,18 @@ Contributions from:
 +Bool
 +xmir_screen_init_cursor(struct xmir_screen *xmir_screen)
 +{
-+    if (!dixRegisterPrivateKey(&xmir_cursor_private_key, PRIVATE_CURSOR_BITS, 
0))
++    if (!dixRegisterPrivateKey(&xmir_cursor_private_key,
++                               PRIVATE_CURSOR_BITS, 0))
 +        return FALSE;
 +
 +    return miPointerInitialize(xmir_screen->screen,
 +                               &xmir_pointer_sprite_funcs,
 +                               &xmir_pointer_screen_funcs, TRUE);
 +}
+Index: xorg-server/hw/xmir/xmir-cvt.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-cvt.c
++++ xorg-server/hw/xmir/xmir-cvt.c
 @@ -0,0 +1,304 @@
 +/* Copied from hw/xfree86/modes/xf86cvt.c into xmir DDX and
 + * changed to generate an RRMode */
@@ -3215,9 +3249,11 @@ Contributions from:
 +
 +    return RRModeGet(&modeinfo, name);
 +}
+Index: xorg-server/hw/xmir/xmir-dri2.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-dri2.c
-@@ -0,0 +1,551 @@
++++ xorg-server/hw/xmir/xmir-dri2.c
+@@ -0,0 +1,558 @@
 +/*
 + * Copyright © 2015 Canonical Ltd
 + *
@@ -3351,7 +3387,8 @@ Contributions from:
 +    if (xmir_window->surface) {
 +        buf->driverPrivate = xmir_glamor_win_get_back(xmir_screen, 
xmir_window, &xmir_window->window->drawable);
 +        xmir_pixmap = xmir_pixmap_get(buf->driverPrivate);
-+    } else {
++    }
++    else {
 +        struct xmir_window *xmir_window_parent = 
xmir_window_swappable_parent((WindowPtr)draw);
 +
 +        if (xmir_window_parent && xmir_window_parent->back_pixmap)
@@ -3457,7 +3494,8 @@ Contributions from:
 +            xmir_window = xmir_window_parent;
 +
 +        pixmap = screen->GetWindowPixmap((WindowPtr)pDraw);
-+    } else
++    }
++    else
 +        pixmap = (PixmapPtr)pDraw;
 +
 +    ret->attachment = attachment;
@@ -3549,7 +3587,8 @@ Contributions from:
 +        if (draw->type == DRAWABLE_WINDOW) {
 +            pixmap = screen->GetWindowPixmap((WindowPtr)draw);
 +            xmir_window = xmir_window_get((WindowPtr)draw);
-+        } else
++        }
++        else
 +            pixmap = (PixmapPtr)draw;
 +
 +        dx = draw->x - pixmap->screen_x;
@@ -3588,7 +3627,8 @@ Contributions from:
 +
 +        /* Make sure DRI2GetBuffers blocks, there is no updated buffer until 
the next flip */
 +        DRI2SwapLimit(draw, 1);
-+    } else {
++    }
++    else {
 +        pixmap = (PixmapPtr)draw;
 +        memset(target_msc, 0, sizeof(*target_msc));
 +    }
@@ -3620,7 +3660,8 @@ Contributions from:
 +            swap_pix = *xmir_pixmap;
 +            *xmir_pixmap = *xmir_pixmap_get(src->driverPrivate);
 +            *xmir_pixmap_get(src->driverPrivate) = swap_pix;
-+        } else {
++        }
++        else {
 +            PixmapPtr dsrc = src->driverPrivate;
 +            int dx = draw->x - pixmap->screen_x, dy = draw->y - 
pixmap->screen_y;
 +
@@ -3639,7 +3680,8 @@ Contributions from:
 +                                        dx, dy, xmir_window ? 
xmir_window->orientation : 0);
 +        }
 +        RegionTranslate(&region, draw->x, draw->y);
-+    } else {
++    }
++    else {
 +        if (!xmir_window->surface)
 +            xmir_window = xmir_window_get(screen->root);
 +
@@ -3687,7 +3729,8 @@ Contributions from:
 +    if (type != DRI2_FLIP_COMPLETE) {
 +        DamageDamageRegion(draw, &region);
 +        RegionUninit(&region);
-+    } else
++    }
++    else
 +        DamageReportDamage(xmir_window->damage, &xmir_window->region);
 +
 +    return 1;
@@ -3769,9 +3812,11 @@ Contributions from:
 +    ret = DRI2ScreenInit(xmir_screen->screen, &xmir_screen->dri2);
 +    return ret;
 +}
+Index: xorg-server/hw/xmir/xmir-glamor.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-glamor.c
-@@ -0,0 +1,1164 @@
++++ xorg-server/hw/xmir/xmir-glamor.c
+@@ -0,0 +1,1174 @@
 +/*
 + * Copyright © 2015 Canonical Ltd
 + *
@@ -3902,7 +3947,8 @@ Contributions from:
 +
 +        bo = gbm_bo_import(xmir_screen->gbm, GBM_BO_IMPORT_FD, &gbm_data, 
GBM_BO_USE_RENDERING);
 +        xmir_pixmap->fake_back = false;
-+    } else {
++    }
++    else {
 +        bo = gbm_bo_create(xmir_screen->gbm, draw->width, draw->height,
 +                           GBM_FORMAT_ARGB8888,
 +                           GBM_BO_USE_RENDERING);
@@ -4030,7 +4076,8 @@ Contributions from:
 +        if (reflect_x) {
 +            dbox.x1 = box->x2 + dstx;
 +            dbox.x2 = box->x1 + dstx;
-+        } else {
++        }
++        else {
 +            dbox.x1 = box->x1 + dstx;
 +            dbox.x2 = box->x2 + dstx;
 +        }
@@ -4038,7 +4085,8 @@ Contributions from:
 +        if (reflect_y) {
 +            dbox.y1 = box->y2 + dsty;
 +            dbox.y2 = box->y1 + dsty;
-+        } else {
++        }
++        else {
 +            dbox.y1 = box->y1 + dsty;
 +            dbox.y2 = box->y2 + dsty;
 +        }
@@ -4064,13 +4112,15 @@ Contributions from:
 +        /* bottom left */
 +        vertices[6] = _tx1;
 +        vertices[7] = _ty2;
-+    } else {
++    }
++    else {
 +        float _tx1, _tx2, _ty1, _ty2;
 +
 +        if (reflect_x) {
 +            dbox.y1 = box->x2 + dstx;
 +            dbox.y2 = box->x1 + dstx;
-+        } else {
++        }
++        else {
 +            dbox.y1 = box->x1 + dstx;
 +            dbox.y2 = box->x2 + dstx;
 +        }
@@ -4078,7 +4128,8 @@ Contributions from:
 +        if (reflect_y) {
 +            dbox.x1 = box->y2 + dsty;
 +            dbox.x2 = box->y1 + dsty;
-+        } else {
++        }
++        else {
 +            dbox.x1 = box->y1 + dsty;
 +            dbox.x2 = box->y2 + dsty;
 +        }
@@ -4138,7 +4189,8 @@ Contributions from:
 +        glBlitFramebuffer(ext->x1, ext->y2, ext->x2, ext->y1,
 +                          ext->x1 + dx, ext->y2 + dy, ext->x2 + dx, ext->y1 + 
dy,
 +                          GL_COLOR_BUFFER_BIT, GL_LINEAR);
-+    } else
++    }
++    else
 +        xmir_glamor_copy_egl_tex(0, src, src_pixmap, src_pixmap_priv, ext, 
width, height, dx, dy, orientation);
 +}
 +
@@ -4176,7 +4228,8 @@ Contributions from:
 +
 +        xmir_win->front_pixmap = back;
 +        glBindFramebuffer(GL_FRAMEBUFFER, 0);
-+    } else {
++    }
++    else {
 +        xmir_win->front_pixmap = xmir_win->back_pixmap;
 +        xmir_win->back_pixmap = NULL;
 +    }
@@ -4560,7 +4613,8 @@ Contributions from:
 +        /* In GBM mode no mir functions are used in any way.
 +         * This means using the GBM device directly is safe.. */
 +        xmir_screen->egl_display = eglGetDisplay(xmir_screen->gbm);
-+    } else
++    }
++    else
 +        xmir_screen->egl_display = 
eglGetDisplay(mir_connection_get_egl_native_display(xmir_screen->conn));
 +
 +    if (xmir_screen->egl_display == EGL_NO_DISPLAY) {
@@ -4591,7 +4645,8 @@ Contributions from:
 +
 +    if (!epoxy_has_egl_extension(xmir_screen->egl_display, 
"EGL_KHR_surfaceless_context")) {
 +        xmir_screen->egl_surface = 
eglCreatePbufferSurface(xmir_screen->egl_display, egl_config, pbuffer_attribs);
-+    } else
++    }
++    else
 +        xmir_screen->egl_surface = EGL_NO_SURFACE;
 +
 +    if (!eglMakeCurrent(xmir_screen->egl_display,
@@ -4936,11 +4991,13 @@ Contributions from:
 +
 +    return TRUE;
 +}
+Index: xorg-server/hw/xmir/xmir-input.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-input.c
-@@ -0,0 +1,611 @@
++++ xorg-server/hw/xmir/xmir-input.c
+@@ -0,0 +1,650 @@
 +/*
-+ * Copyright © 2015 Canonical Ltd
++ * Copyright © 2015-2016 Canonical Ltd
 + *
 + * Permission to use, copy, modify, distribute, and sell this software
 + * and its documentation for any purpose is hereby granted without
@@ -5100,7 +5157,8 @@ Contributions from:
 +    /* reflection test parameters */
 +    bool magic_x_invert = false, magic_y_invert = false;
 +
-+    DebugF("Raw input %i,%i in window (%i,%i)->(%i,%i) orientation %i and 
scale %i\n", *x, *y, dx, dy, dx + w, dy + h, xmir_window->orientation, scale);
++    DebugF("Raw input %i,%i in window (%i,%i)->(%i,%i) orientation %i and 
scale %i\n",
++           *x, *y, dx, dy, dx + w, dy + h, xmir_window->orientation, scale);
 +
 +    if (magic_x_invert)
 +        reflect_x = !reflect_x;
@@ -5110,17 +5168,24 @@ Contributions from:
 +
 +    switch (xmir_window->orientation) {
 +    case 90:
-+        reflect_x = !reflect_x; swap_xy = true; break;
++        reflect_x = !reflect_x;
++        swap_xy = true;
++        break;
 +    case 180:
-+        reflect_x = !reflect_x; reflect_y = !reflect_y; break;
++        reflect_x = !reflect_x;
++        reflect_y = !reflect_y;
++        break;
 +    case 270:
-+        reflect_y = !reflect_y; swap_xy = true; break;
++        reflect_y = !reflect_y;
++        swap_xy = true;
++        break;
 +    }
 +
 +    if (!swap_xy) {
 +        sx = *x;
 +        sy = *y;
-+    } else {
++    }
++    else {
 +        sx = *y;
 +        sy = *x;
 +    }
@@ -5200,16 +5265,18 @@ Contributions from:
 +                      MirPointerEvent const *pev)
 +{
 +    DeviceIntPtr dev = xmir_input->pointer;
-+    struct {MirPointerButton mir_button; int x_button;} map[3] =
-+    {
++    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);
 +
++    valuator_mask_zero(&mask);
 +    for (i = 0; i < 3; ++i) {
 +        MirPointerButton mir_button = map[i].mir_button;
 +        int x_button = map[i].x_button;
@@ -5305,7 +5372,9 @@ Contributions from:
 +}
 +
 +static void
-+fake_touch_move(struct xmir_input *xmir_input, struct xmir_window 
*xmir_window, int sx, int sy)
++fake_touch_move(struct xmir_input *xmir_input,
++                struct xmir_window *xmir_window,
++                int sx, int sy)
 +{
 +    ValuatorMask mask;
 +
@@ -5326,9 +5395,13 @@ Contributions from:
 +{
 +    switch (mir_input_event_get_type(ev)) {
 +    case mir_input_event_type_key: {
-+        MirKeyboardEvent const *kev = mir_input_event_get_keyboard_event(ev);
-+        MirKeyboardAction action = mir_keyboard_event_action(kev);
-+        int code = mir_keyboard_event_scan_code(kev) + 8;
++        MirKeyboardEvent const *kev;
++        MirKeyboardAction action;
++        int code;
++
++        kev = mir_input_event_get_keyboard_event(ev);
++        action = mir_keyboard_event_action(kev);
++        code = mir_keyboard_event_scan_code(kev) + 8;
 +
 +        /*
 +         * Note: mir_keyboard_action_repeat must KeyRelease then KeyPress
@@ -5385,13 +5458,18 @@ Contributions from:
 +            break;
 +        case mir_touch_action_down:
 +            xmir_input->touch_id = mir_touch_event_id(tev, i);
-+            if (!pointer_ensure_focus(xmir_input, xmir_window, 
xmir_input->touch, sx, sy))
++            if (!pointer_ensure_focus(xmir_input,
++                                      xmir_window,
++                                      xmir_input->touch,
++                                      sx, sy))
 +                fake_touch_move(xmir_input, xmir_window, sx, sy);
 +            QueuePointerEvents(xmir_input->touch, ButtonPress, 1, 0, &mask);
 +            break;
 +        case mir_touch_action_change:
 +            fake_touch_move(xmir_input, xmir_window, sx, sy);
 +            break;
++        default:
++            break;
 +        }
 +        break;
 +
@@ -5424,7 +5502,7 @@ Contributions from:
 +
 +static void
 +xmir_handle_keymap_event(struct xmir_input *xmir_input,
-+                                MirKeymapEvent const* ev)
++                         MirKeymapEvent const* ev)
 +{
 +    char * buffer = NULL;
 +    size_t length = 0;
@@ -5453,15 +5531,24 @@ Contributions from:
 +                                         void *arg)
 +{
 +    const MirEvent *ev = arg;
-+    struct xmir_input *xmir_input = 
xorg_list_first_entry(&xmir_screen->input_list, struct xmir_input, link);
++    struct xmir_input *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, 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(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)));
++    case mir_event_type_surface: {
++        const MirSurfaceEvent *surface = mir_event_get_surface_event(ev);
++        xmir_handle_surface_event(xmir_window,
++                                  mir_surface_event_get_attribute(surface),
++                                  
mir_surface_event_get_attribute_value(surface));
++        }
 +        break;
 +    case mir_event_type_resize: {
 +        WindowPtr window = xmir_window->window;
@@ -5479,8 +5566,11 @@ Contributions from:
 +    case mir_event_type_prompt_session_state_change:
 +        ErrorF("No idea about prompt_session_state_change\n");
 +        break;
-+    case mir_event_type_orientation:
-+        xmir_output_handle_orientation(xmir_window, 
mir_orientation_event_get_direction(mir_event_get_orientation_event(ev)));
++    case mir_event_type_orientation: {
++        const MirOrientationEvent *orientation = 
mir_event_get_orientation_event(ev);
++        xmir_output_handle_orientation(xmir_window,
++                                       
mir_orientation_event_get_direction(orientation));
++        }
 +        break;
 +    case mir_event_type_close_surface:
 +        xmir_close_surface(xmir_window);
@@ -5532,9 +5622,15 @@ Contributions from:
 +    xmir_input->xmir_screen = xmir_screen;
 +    xorg_list_add(&xmir_input->link, &xmir_screen->input_list);
 +    xmir_input->touch_id = -1;
-+    xmir_input->pointer = add_device(xmir_input, "xmir-pointer", 
xmir_pointer_proc);
-+    xmir_input->touch = add_device(xmir_input, "xmir-fake-touch-pointer", 
xmir_pointer_proc);
-+    xmir_input->keyboard = add_device(xmir_input, "xmir-keyboard", 
xmir_keyboard_proc);
++    xmir_input->pointer = add_device(xmir_input,
++                                     "xmir-pointer",
++                                     xmir_pointer_proc);
++    xmir_input->touch = add_device(xmir_input,
++                                   "xmir-fake-touch-pointer",
++                                   xmir_pointer_proc);
++    xmir_input->keyboard = add_device(xmir_input,
++                                      "xmir-keyboard",
++                                      xmir_keyboard_proc);
 +}
 +
 +void
@@ -5550,11 +5646,13 @@ Contributions from:
 +
 +    mieqFini();
 +}
+Index: xorg-server/hw/xmir/xmir-output.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-output.c
-@@ -0,0 +1,476 @@
++++ xorg-server/hw/xmir/xmir-output.c
+@@ -0,0 +1,505 @@
 +/*
-+ * Copyright © 2015 Canonical Ltd
++ * Copyright © 2015-2016 Canonical Ltd
 + *
 + * Permission to use, copy, modify, distribute, and sell this software
 + * and its documentation for any purpose is hereby granted without
@@ -5653,7 +5751,8 @@ Contributions from:
 +    }
 +
 +    if (!unchanged)
-+        mir_wait_for(mir_connection_apply_display_config(xmir_screen->conn, 
xmir_screen->display));
++        mir_wait_for(mir_connection_apply_display_config(xmir_screen->conn,
++                                                         
xmir_screen->display));
 +
 +    return TRUE;
 +}
@@ -5661,7 +5760,8 @@ Contributions from:
 +static void
 +xmir_output_update(struct xmir_output *xmir_output, MirDisplayOutput 
*mir_output)
 +{
-+    RROutputSetConnection(xmir_output->randr_output, mir_output->connected ? 
RR_Connected : RR_Disconnected);
++    RROutputSetConnection(xmir_output->randr_output,
++                          mir_output->connected ? RR_Connected : 
RR_Disconnected);
 +    RROutputSetSubpixelOrder(xmir_output->randr_output, SubPixelUnknown);
 +
 +    if (mir_output->connected && mir_output->used) {
@@ -5673,22 +5773,31 @@ Contributions from:
 +        xmir_output->x = mir_output->position_x;
 +        xmir_output->y = mir_output->position_y;
 +
-+        randr_mode = xmir_cvt(xmir_output->width, xmir_output->height, 
mode->refresh_rate, 0, 0);
++        randr_mode = xmir_cvt(xmir_output->width, xmir_output->height,
++                              mode->refresh_rate, 0, 0);
 +        /* Odd resolutions like 1366x768 don't show correctly otherwise */
 +        randr_mode->mode.width = mode->horizontal_resolution;
 +        randr_mode->mode.height = mode->vertical_resolution;
 +        sprintf(randr_mode->name, "%dx%d",
-+                randr_mode->mode.width, randr_mode->mode.height);
++                randr_mode->mode.width,
++                randr_mode->mode.height);
 +
-+        RROutputSetPhysicalSize(xmir_output->randr_output, 
mir_output->physical_width_mm, mir_output->physical_height_mm);
++        RROutputSetPhysicalSize(xmir_output->randr_output,
++                                mir_output->physical_width_mm,
++                                mir_output->physical_height_mm);
 +        RROutputSetModes(xmir_output->randr_output, &randr_mode, 1, 1);
 +
 +        /* TODO: Hook up subpixel order when available (LP: #1393578) */
 +        RRCrtcNotify(xmir_output->randr_crtc, randr_mode,
 +                     xmir_output->x, xmir_output->y,
-+                     to_rr_rotation(mir_output->orientation), NULL, 1, 
&xmir_output->randr_output);
-+    } else {
-+        xmir_output->width = xmir_output->height = xmir_output->x = 
xmir_output->y = 0;
++                     to_rr_rotation(mir_output->orientation),
++                     NULL, 1, &xmir_output->randr_output);
++    }
++    else {
++        xmir_output->width = 0;
++        xmir_output->height = 0;
++        xmir_output->x = 0;
++        xmir_output->y = 0;
 +
 +        RROutputSetPhysicalSize(xmir_output->randr_output, 0, 0);
 +        RROutputSetModes(xmir_output->randr_output, NULL, 0, 0);
@@ -5761,7 +5870,9 @@ Contributions from:
 +
 +    xmir_output->xmir_screen = xmir_screen;
 +    xmir_output->randr_crtc = RRCrtcCreate(xmir_screen->screen, xmir_output);
-+    xmir_output->randr_output = RROutputCreate(xmir_screen->screen, name, 
strlen(name), xmir_output);
++    xmir_output->randr_output = RROutputCreate(xmir_screen->screen,
++                                               name, strlen(name),
++                                               xmir_output);
 +
 +    RRCrtcGammaSetSize(xmir_output->randr_crtc, 256);
 +    RROutputSetCrtcs(xmir_output->randr_output, &xmir_output->randr_crtc, 1);
@@ -5817,7 +5928,8 @@ Contributions from:
 +}
 +
 +void
-+xmir_output_handle_orientation(struct xmir_window *xmir_window, 
MirOrientation dir)
++xmir_output_handle_orientation(struct xmir_window *xmir_window,
++                               MirOrientation dir)
 +{
 +    XMIR_DEBUG(("Orientation: %i\n", dir));
 +
@@ -5825,7 +5937,8 @@ Contributions from:
 +}
 +
 +void
-+xmir_output_handle_resize(struct xmir_window *xmir_window, int width, int 
height)
++xmir_output_handle_resize(struct xmir_window *xmir_window,
++                          int width, int height)
 +{
 +    WindowPtr window = xmir_window->window;
 +    ScreenPtr screen = window->drawable.pScreen;
@@ -5845,14 +5958,17 @@ Contributions from:
 +        if (old % 180 == xmir_window->orientation % 180) {
 +            window_width = window->drawable.width;
 +            window_height = window->drawable.height;
-+        } else {
++        }
++        else {
 +            window_width = window->drawable.height;
 +            window_height = window->drawable.width;
 +        }
-+    } else if (xmir_window->orientation == 0 || xmir_window->orientation == 
180) {
++    }
++    else if (xmir_window->orientation == 0 || xmir_window->orientation == 
180) {
 +        window_width = width * (1 + xmir_screen->doubled);
 +        window_height = height * (1 + xmir_screen->doubled);
-+    } else {
++    }
++    else {
 +        window_width = height * (1 + xmir_screen->doubled);
 +        window_height = width * (1 + xmir_screen->doubled);
 +    }
@@ -5887,7 +6003,11 @@ Contributions from:
 +        XMIR_DEBUG(("Root resized, removing all outputs and inserting fake 
output\n"));
 +
 +        while (!xorg_list_is_empty(&xmir_screen->output_list)) {
-+            struct xmir_output *xmir_output = 
xorg_list_first_entry(&xmir_screen->output_list, typeof(*xmir_output), link);
++            struct xmir_output *xmir_output;
++
++            xmir_output = xorg_list_first_entry(&xmir_screen->output_list,
++                                                typeof(*xmir_output),
++                                                link);
 +
 +            RRCrtcDestroy(xmir_output->randr_crtc);
 +            RROutputDestroy(xmir_output->randr_output);
@@ -5900,7 +6020,10 @@ Contributions from:
 +    XMIR_DEBUG(("Output resized %ix%i with rotation %i\n",
 +                width, height, xmir_window->orientation));
 +
-+    pixmap = screen->CreatePixmap(screen, window_width, window_height, 
screen->rootDepth, CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
++    pixmap = screen->CreatePixmap(screen,
++                                  window_width, window_height,
++                                  screen->rootDepth,
++                                  CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
 +
 +    copy_box.x1 = copy_box.y1 = 0;
 +    copy_box.x2 = min(window_width, oldroot->width);
@@ -5914,7 +6037,8 @@ Contributions from:
 +        glamor_copy(&screen->root->drawable, &pixmap->drawable,
 +                              NULL, &copy_box, 1, 0, 0, FALSE, FALSE, 0, 
NULL);
 +        glBindFramebuffer(GL_FRAMEBUFFER, 0);
-+    } else {
++    }
++    else {
 +        PixmapPtr old_pixmap = screen->GetWindowPixmap(window);
 +        int src_stride = old_pixmap->devKind;
 +        int dst_stride = pixmap->devKind;
@@ -5999,7 +6123,9 @@ Contributions from:
 +    if (!RRScreenInit(xmir_screen->screen))
 +        return FALSE;
 +
-+    mir_connection_set_display_config_change_callback(xmir_screen->conn, 
&xmir_display_config_callback, xmir_screen);
++    mir_connection_set_display_config_change_callback(xmir_screen->conn,
++                                                      
&xmir_display_config_callback,
++                                                      xmir_screen);
 +
 +    for (i = 0; i < display_config->num_outputs; i++) {
 +        char name[32];
@@ -6008,7 +6134,8 @@ Contributions from:
 +        const char* output_type_str = xmir_get_output_type_str(mir_output);
 +        int type_count = i;
 +
-+        if (mir_output->type >= 0 && mir_output->type <= 
mir_display_output_type_edp)
++        if (mir_output->type >= 0 &&
++            mir_output->type <= mir_display_output_type_edp)
 +            type_count = output_type_count[mir_output->type]++;
 +
 +        snprintf(name, sizeof name, "%s-%d", output_type_str, type_count);
@@ -6029,11 +6156,13 @@ Contributions from:
 +
 +    return TRUE;
 +}
+Index: xorg-server/hw/xmir/xmir-thread-proxy.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir-thread-proxy.c
-@@ -0,0 +1,115 @@
++++ xorg-server/hw/xmir/xmir-thread-proxy.c
+@@ -0,0 +1,116 @@
 +/*
-+ * Copyright © 2012-2015 Canonical Ltd
++ * Copyright © 2012-2016 Canonical Ltd
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the "Soft-
@@ -6093,30 +6222,31 @@ Contributions from:
 +void
 +xmir_init_thread_to_eventloop(void)
 +{
-+      int err = pipe(pipefds);
-+      if (err == -1)
-+              FatalError("[XMIR] Failed to create thread-proxy pipes: %s\n", 
strerror(errno));
++    int err = pipe(pipefds);
++    if (err == -1)
++        FatalError("[XMIR] Failed to create thread-proxy pipes: %s\n",
++                   strerror(errno));
 +
-+      /* Set the read end to not block; we'll pull from this in the event loop
-+       * We don't need to care about the write end, as that'll be written to
-+       * from its own thread
-+       */
-+      fcntl(pipefds[0], F_SETFL, O_NONBLOCK);
++    /* Set the read end to not block; we'll pull from this in the event loop
++     * We don't need to care about the write end, as that'll be written to
++     * from its own thread
++     */
++    fcntl(pipefds[0], F_SETFL, O_NONBLOCK);
 +
-+      AddGeneralSocket(pipefds[0]);
-+      RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
-+                                     xmir_wakeup_handler,
-+                                     NULL);
++    AddGeneralSocket(pipefds[0]);
++    RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
++                                   xmir_wakeup_handler,
++                                   NULL);
 +}
 +
 +void
 +xmir_fini_thread_to_eventloop(void)
 +{
-+      RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
-+                                   xmir_wakeup_handler, NULL);
-+      RemoveGeneralSocket(pipefds[0]);
-+      close(pipefds[1]);
-+      close(pipefds[0]);
++    RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
++                                 xmir_wakeup_handler, NULL);
++    RemoveGeneralSocket(pipefds[0]);
++    close(pipefds[1]);
++    close(pipefds[0]);
 +}
 +
 +void
@@ -6147,11 +6277,13 @@ Contributions from:
 +{
 +    xmir_process_from_eventloop_except(NULL);
 +}
+Index: xorg-server/hw/xmir/xmir.c
+===================================================================
 --- /dev/null
-+++ b/hw/xmir/xmir.c
-@@ -0,0 +1,1729 @@
++++ xorg-server/hw/xmir/xmir.c
+@@ -0,0 +1,1789 @@
 +/*
-+ * Copyright © 2015 Canonical Ltd
++ * Copyright © 2015-2016 Canonical Ltd

Reply via email to