debian/changelog | 4 debian/patches/series | 1 debian/patches/xmir-desktop-file-hint-flag.patch | 28 - debian/patches/xmir-fixes.diff | 6 debian/patches/xmir.patch | 497 +++++++++++------------ 5 files changed, 252 insertions(+), 284 deletions(-)
New commits: commit f52fc73b66af6e2f7730f85730b506f359f32088 Author: Timo Aaltonen <tjaal...@debian.org> Date: Mon Feb 27 15:43:28 2017 +0200 update xmir.patch, drop xmir-desktop-file-hint-flag.patch diff --git a/debian/changelog b/debian/changelog index 3040520..0745b1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,15 +15,13 @@ xorg-server (2:1.19.1-4ubuntu1) UNRELEASED; urgency=medium to confflags. * 232-xf86compatoutput-valgrind.patch: This was added upstream already, no need to carry a duplicate check. - * xmir.patch: Don't check for aiglx enable flag, dropped upstream. * xmir-fixes.diff: Port to new glamor api. [ 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 + - Support both Mir 0.24, 0.25 and 0.26 client APIs - Fix crashing on arm64 (LP: #1642297) -- Robert Ancell <robert.anc...@canonical.com> Thu, 17 Nov 2016 15:25:26 +1300 diff --git a/debian/patches/series b/debian/patches/series index 50dd8f2..a00f624 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -42,7 +42,6 @@ xf86-ignore-conflicting-rr-caps.patch disable-rotation-transform-gpuscreens.patch xmir.patch -xmir-desktop-file-hint-flag.patch xi2-resize-touch.patch randr-do-not-check-the-screen-size.diff xmir-fixes.diff diff --git a/debian/patches/xmir-desktop-file-hint-flag.patch b/debian/patches/xmir-desktop-file-hint-flag.patch deleted file mode 100644 index d41afbc..0000000 --- a/debian/patches/xmir-desktop-file-hint-flag.patch +++ /dev/null @@ -1,28 +0,0 @@ -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 | 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 -@@ -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="))) { -+ return 1; - } - else if (!strcmp(argv[i], "-fd")) { - if (!seen_shared) --- -2.10.2 - diff --git a/debian/patches/xmir-fixes.diff b/debian/patches/xmir-fixes.diff index 0424712..5500dcb 100644 --- a/debian/patches/xmir-fixes.diff +++ b/debian/patches/xmir-fixes.diff @@ -20,7 +20,7 @@ xmir_win->image = eglCreateImageKHR(xmir_screen->egl_display, xmir_screen->egl_context, EGL_GL_TEXTURE_2D_KHR, (EGLClientBuffer)(intptr_t)src_pixmap_priv->fbo->tex, attribs); if (!xmir_win->image) { -@@ -925,12 +919,6 @@ xmir_glamor_fini(struct xmir_screen *xmi +@@ -931,12 +925,6 @@ xmir_glamor_fini(struct xmir_screen *xmi free(xmir_screen->device_name); } @@ -33,7 +33,7 @@ static void xmir_glamor_get_name_from_bo(int drm_fd, struct gbm_bo *bo, int *name) { -@@ -1019,12 +1007,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenP +@@ -1025,12 +1013,6 @@ glamor_egl_dri3_fd_name_from_tex(ScreenP return fd; } @@ -46,7 +46,7 @@ static PixmapPtr xmir_glamor_create_pixmap(ScreenPtr screen, int width, int height, int depth, unsigned int hint) -@@ -1105,12 +1087,6 @@ free: +@@ -1111,12 +1093,6 @@ free: return glamor_create_pixmap(screen, width, height, depth, hint); } diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch index d4fbdb2..bd9ded9 100644 --- a/debian/patches/xmir.patch +++ b/debian/patches/xmir.patch @@ -11,25 +11,25 @@ Contributions from: Daniel van Vugt <daniel.van.v...@canonical.com> Chris Townsend <christopher.towns...@canonical.com> --- - configure.ac | 25 + - hw/Makefile.am | 9 +- - hw/xmir/.gitignore | 1 + - hw/xmir/Makefile.am | 61 ++ - hw/xmir/dri2/Makefile.am | 14 + + configure.ac | 25 + hw/Makefile.am | 9 + hw/xmir/.gitignore | 1 + hw/xmir/Makefile.am | 59 + + hw/xmir/dri2/Makefile.am | 14 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 | 223 ++++++ - hw/xmir/xmir-cvt.c | 304 ++++++++ - 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, 8130 insertions(+), 2 deletions(-) + hw/xmir/dri2/dri2.h | 364 ++++++++ + hw/xmir/dri2/dri2ext.c | 683 ++++++++++++++++ + hw/xmir/dri2/dri2int.h | 26 + hw/xmir/xmir-cursor.c | 225 +++++ + hw/xmir/xmir-cvt.c | 304 +++++++ + hw/xmir/xmir-dri2.c | 564 +++++++++++++ + hw/xmir/xmir-glamor.c | 1180 ++++++++++++++++++++++++++++ + hw/xmir/xmir-input.c | 650 +++++++++++++++ + hw/xmir/xmir-output.c | 501 ++++++++++++ + hw/xmir/xmir-thread-proxy.c | 110 ++ + hw/xmir/xmir.c | 1818 ++++++++++++++++++++++++++++++++++++++++++++ + hw/xmir/xmir.h | 234 +++++ + 18 files changed, 8163 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,10 +47,8 @@ Contributions from: create mode 100644 hw/xmir/xmir.c create mode 100644 hw/xmir/xmir.h -Index: xorg-server/configure.ac -=================================================================== ---- xorg-server.orig/configure.ac -+++ xorg-server/configure.ac +--- a/configure.ac ++++ b/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]) @@ -104,10 +102,8 @@ Index: xorg-server/configure.ac test/Makefile test/xi1/Makefile test/xi2/Makefile -Index: xorg-server/hw/Makefile.am -=================================================================== ---- xorg-server.orig/hw/Makefile.am -+++ xorg-server/hw/Makefile.am +--- a/hw/Makefile.am ++++ b/hw/Makefile.am @@ -30,6 +30,10 @@ if XWAYLAND XWAYLAND_SUBDIRS = xwayland endif @@ -132,16 +128,12 @@ Index: xorg-server/hw/Makefile.am relink: $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done -Index: xorg-server/hw/xmir/.gitignore -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/.gitignore ++++ b/hw/xmir/.gitignore @@ -0,0 +1 @@ +Xmir -Index: xorg-server/hw/xmir/Makefile.am -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/Makefile.am ++++ b/hw/xmir/Makefile.am @@ -0,0 +1,59 @@ +bin_PROGRAMS = Xmir + @@ -173,7 +165,7 @@ Index: xorg-server/hw/xmir/Makefile.am + +Xmir_LDADD = \ + $(glamor_lib) \ -+ $(aiglx_lib) \ ++ $(glxdri_lib) \ + $(XMIR_LIBS) \ + $(XMIR_SYS_LIBS) \ + $(XSERVER_SYS_LIBS) @@ -195,17 +187,15 @@ Index: xorg-server/hw/xmir/Makefile.am +Xmir_LDADD += dri2/libdri2.la +endif + -+aiglx_lib = $(top_builddir)/glx/libglxdri.la ++glxdri_lib = $(top_builddir)/glx/libglxdri.la +if NO_UNDEFINED -+aiglx_lib += $(LIBDRM_LIBS) $(PIXMAN_LIBS) ++glxdri_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 -+++ xorg-server/hw/xmir/dri2/Makefile.am ++++ b/hw/xmir/dri2/Makefile.am @@ -0,0 +1,14 @@ +noinst_LTLIBRARIES = libdri2.la + @@ -221,10 +211,8 @@ Index: xorg-server/hw/xmir/dri2/Makefile.am + dri2ext.c \ + dri2int.h + -Index: xorg-server/hw/xmir/dri2/dri2.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/dri2/dri2.c ++++ b/hw/xmir/dri2/dri2.c @@ -0,0 +1,1398 @@ +/* + * Copyright © 2007, 2008 Red Hat, Inc. @@ -1624,10 +1612,8 @@ Index: xorg-server/hw/xmir/dri2/dri2.c + *is_param_recognized = FALSE; + return Success; +} -Index: xorg-server/hw/xmir/dri2/dri2.h -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/dri2/dri2.h ++++ b/hw/xmir/dri2/dri2.h @@ -0,0 +1,364 @@ +/* + * Copyright © 2007 Red Hat, Inc. @@ -1993,10 +1979,8 @@ Index: xorg-server/hw/xmir/dri2/dri2.h +extern Bool noDRI2Extension; + +#endif -Index: xorg-server/hw/xmir/dri2/dri2ext.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/dri2/dri2ext.c ++++ b/hw/xmir/dri2/dri2ext.c @@ -0,0 +1,683 @@ +/* + * Copyright © 2008 Red Hat, Inc. @@ -2681,10 +2665,8 @@ Index: xorg-server/hw/xmir/dri2/dri2ext.c + + DRI2ModuleSetup(); +} -Index: xorg-server/hw/xmir/dri2/dri2int.h -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/dri2/dri2int.h ++++ b/hw/xmir/dri2/dri2int.h @@ -0,0 +1,26 @@ +/* + * Copyright © 2011 Daniel Stone @@ -2712,13 +2694,11 @@ Index: xorg-server/hw/xmir/dri2/dri2int.h + */ + +extern Bool DRI2ModuleSetup(void); -Index: xorg-server/hw/xmir/xmir-cursor.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-cursor.c -@@ -0,0 +1,223 @@ ++++ b/hw/xmir/xmir-cursor.c +@@ -0,0 +1,225 @@ +/* -+ * Copyright © 2015-2016 Canonical Ltd ++ * Copyright © 2015-2017 Canonical Ltd + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without @@ -2812,6 +2792,8 @@ Index: xorg-server/hw/xmir/xmir-cursor.c + MirCursorConfiguration *config; + MirBufferStream *stream; + ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + if (!cursor) { + config = mir_cursor_configuration_from_name(mir_disabled_cursor_name); + goto apply; @@ -2821,6 +2803,7 @@ Index: xorg-server/hw/xmir/xmir-cursor.c + config = mir_cursor_configuration_from_name(mir_arrow_cursor_name); + goto apply; + } ++#pragma GCC diagnostic pop + + stream = dixGetPrivate(&cursor->devPrivates, &xmir_cursor_private_key); + if (stream) { @@ -2861,11 +2844,10 @@ Index: xorg-server/hw/xmir/xmir-cursor.c +apply: + 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)); ++ mir_window_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_window_configure_cursor(xmir_input->focus_window->surface, config); + mir_cursor_configuration_destroy(config); +} + @@ -2940,10 +2922,8 @@ Index: xorg-server/hw/xmir/xmir-cursor.c + &xmir_pointer_sprite_funcs, + &xmir_pointer_screen_funcs, TRUE); +} -Index: xorg-server/hw/xmir/xmir-cvt.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-cvt.c ++++ b/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 */ @@ -3249,11 +3229,9 @@ Index: xorg-server/hw/xmir/xmir-cvt.c + + return RRModeGet(&modeinfo, name); +} -Index: xorg-server/hw/xmir/xmir-dri2.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-dri2.c -@@ -0,0 +1,558 @@ ++++ b/hw/xmir/xmir-dri2.c +@@ -0,0 +1,564 @@ +/* + * Copyright © 2015 Canonical Ltd + * @@ -3417,6 +3395,8 @@ Index: xorg-server/hw/xmir/xmir-dri2.c +static void +xmir_dri2_auth_magic_reply(MirConnection* con, MirPlatformMessage* reply, Bool* ret) +{ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + struct MirMesaAuthMagicResponse const* response; + unsigned int opcode = mir_platform_message_get_opcode(reply); + MirPlatformMessageData data = mir_platform_message_get_data(reply); @@ -3436,11 +3416,14 @@ Index: xorg-server/hw/xmir/xmir-dri2.c + if (response->status == 0) + *ret = 1; + mir_platform_message_release(reply); ++#pragma GCC diagnostic pop +} + +static Bool +xmir_dri2_auth_magic(ScreenPtr screen, uint32_t magic) +{ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + struct xmir_screen *xmir_screen = xmir_screen_get(screen); + Bool ret = 0; + MirPlatformMessage *msg = NULL; @@ -3465,6 +3448,7 @@ Index: xorg-server/hw/xmir/xmir-dri2.c + } + + return ret; ++#pragma GCC diagnostic pop +} + +static DRI2BufferPtr @@ -3812,13 +3796,11 @@ Index: xorg-server/hw/xmir/xmir-dri2.c + ret = DRI2ScreenInit(xmir_screen->screen, &xmir_screen->dri2); + return ret; +} -Index: xorg-server/hw/xmir/xmir-glamor.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-glamor.c -@@ -0,0 +1,1174 @@ ++++ b/hw/xmir/xmir-glamor.c +@@ -0,0 +1,1180 @@ +/* -+ * Copyright © 2015 Canonical Ltd ++ * Copyright © 2015-2017 Canonical Ltd + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without @@ -3937,7 +3919,7 @@ Index: xorg-server/hw/xmir/xmir-glamor.c + MirNativeBuffer *buffer; + struct gbm_import_fd_data gbm_data; + -+ mir_buffer_stream_get_current_buffer(mir_surface_get_buffer_stream(xmir_win->surface), &buffer); ++ mir_buffer_stream_get_current_buffer(mir_window_get_buffer_stream(xmir_win->surface), &buffer); + + gbm_data.fd = buffer->fd[0]; + gbm_data.width = buffer->width; @@ -4508,7 +4490,7 @@ Index: xorg-server/hw/xmir/xmir-glamor.c + if (xmir_screen->gbm) + return; + -+ egl_win = mir_buffer_stream_get_egl_native_window(mir_surface_get_buffer_stream(xmir_window->surface)); ++ egl_win = mir_buffer_stream_get_egl_native_window(mir_window_get_buffer_stream(xmir_window->surface)); + + xmir_window->egl_surface = eglCreateWindowSurface(xmir_screen->egl_display, eglconfig, (EGLNativeWindowType)egl_win, NULL); +} @@ -4566,7 +4548,10 @@ Index: xorg-server/hw/xmir/xmir-glamor.c +static void +xmir_drm_set_gbm_device_response(MirConnection *con, MirPlatformMessage* reply, void* context) +{ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + mir_platform_message_release(reply); ++#pragma GCC diagnostic pop +} + +static Bool @@ -4590,6 +4575,8 @@ Index: xorg-server/hw/xmir/xmir-glamor.c + + + if (xmir_screen->drm_fd > 0) { ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + struct MirMesaSetGBMDeviceRequest req = { + .device = gbm_create_device(xmir_screen->drm_fd) + }; @@ -4610,6 +4597,7 @@ Index: xorg-server/hw/xmir/xmir-glamor.c + &xmir_drm_set_gbm_device_response, + NULL)); + mir_platform_message_release(msg); ++#pragma GCC diagnostic pop + /* 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); @@ -4991,13 +4979,11 @@ Index: xorg-server/hw/xmir/xmir-glamor.c + + return TRUE; +} -Index: xorg-server/hw/xmir/xmir-input.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-input.c ++++ b/hw/xmir/xmir-input.c @@ -0,0 +1,650 @@ +/* -+ * Copyright © 2015-2016 Canonical Ltd ++ * Copyright © 2015-2017 Canonical Ltd + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without @@ -5543,11 +5529,11 @@ Index: xorg-server/hw/xmir/xmir-input.c + xmir_window, + mir_event_get_input_event(ev)); + break; -+ case mir_event_type_surface: { -+ const MirSurfaceEvent *surface = mir_event_get_surface_event(ev); ++ case mir_event_type_window: { ++ const MirWindowEvent *surface = mir_event_get_window_event(ev); + xmir_handle_surface_event(xmir_window, -+ mir_surface_event_get_attribute(surface), -+ mir_surface_event_get_attribute_value(surface)); ++ mir_window_event_get_attribute(surface), ++ mir_window_event_get_attribute_value(surface)); + } + break; + case mir_event_type_resize: { @@ -5572,10 +5558,10 @@ Index: xorg-server/hw/xmir/xmir-input.c + mir_orientation_event_get_direction(orientation)); + } + break; -+ case mir_event_type_close_surface: ++ case mir_event_type_close_window: + xmir_close_surface(xmir_window); + break; -+ case mir_event_type_surface_output: ++ case mir_event_type_window_output: + break; + case mir_event_type_keymap: + xmir_handle_keymap_event(xmir_input, mir_event_get_keymap_event(ev)); @@ -5590,7 +5576,7 @@ Index: xorg-server/hw/xmir/xmir-input.c +} + +void -+xmir_surface_handle_event(MirSurface *surface, MirEvent const* ev, ++xmir_surface_handle_event(MirWindow *surface, MirEvent const* ev, + void *context) +{ + struct xmir_window *xmir_window = context; @@ -5646,13 +5632,11 @@ Index: xorg-server/hw/xmir/xmir-input.c + + mieqFini(); +} -Index: xorg-server/hw/xmir/xmir-output.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-output.c -@@ -0,0 +1,505 @@ ++++ b/hw/xmir/xmir-output.c +@@ -0,0 +1,501 @@ +/* -+ * Copyright © 2015-2016 Canonical Ltd ++ * Copyright © 2015-2017 Canonical Ltd + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without @@ -5685,34 +5669,6 @@ Index: xorg-server/hw/xmir/xmir-output.c +#include "glamor_priv.h" +#include "mipointer.h" + -+static const char* -+xmir_get_output_type_str(MirDisplayOutput *mir_output) -+{ -+ const char *str = "Invalid"; -+ -+ switch(mir_output->type) -+ { -+ case mir_display_output_type_vga: str = "VGA"; break; -+ case mir_display_output_type_dvii: str = "DVI"; break; -+ case mir_display_output_type_dvid: str = "DVI"; break; -+ case mir_display_output_type_dvia: str = "DVI"; break; -+ case mir_display_output_type_composite: str = "Composite"; break; -+ case mir_display_output_type_svideo: str = "TV"; break; -+ case mir_display_output_type_lvds: str = "LVDS"; break; -+ case mir_display_output_type_component: str = "CTV"; break; -+ case mir_display_output_type_ninepindin: str = "DIN"; break; -+ case mir_display_output_type_displayport: str = "DP"; break; -+ case mir_display_output_type_hdmia: str = "HDMI"; break; -+ case mir_display_output_type_hdmib: str = "HDMI"; break; -+ case mir_display_output_type_tv: str = "TV"; break; -+ case mir_display_output_type_edp: str = "eDP"; break; -+ case mir_display_output_type_unknown: str = "None"; break; -+ default: break; -+ } -+ -+ return str; -+} -+ +static Rotation +to_rr_rotation(MirOrientation orient) +{ @@ -5727,11 +5683,12 @@ Index: xorg-server/hw/xmir/xmir-output.c +Bool +xmir_output_dpms(struct xmir_screen *xmir_screen, int mode) +{ -+ MirDisplayConfiguration *display_config = xmir_screen->display; ++ MirDisplayConfig *display_config = xmir_screen->display; + MirPowerMode mir_mode = mir_power_mode_on; + Bool unchanged = TRUE; ++ int num_outputs; + -+ if (xmir_screen->rootless) ++ if (xmir_screen->rootless || xmir_screen->windowed) + return FALSE; + + switch (mode) { @@ -5743,54 +5700,65 @@ Index: xorg-server/hw/xmir/xmir-output.c + + DebugF("Setting DPMS mode to %d\n", mode); + -+ for (int i = 0; i < display_config->num_outputs; i++) { -+ if (display_config->outputs[i].power_mode != mir_mode) { -+ display_config->outputs[i].power_mode = mir_mode; ++ num_outputs = mir_display_config_get_num_outputs(display_config); ++ for (int i = 0; i < num_outputs; i++) { ++ MirOutput *output = mir_display_config_get_mutable_output(display_config, i); ++ MirPowerMode power_mode = mir_output_get_power_mode(output); ++ if (power_mode != mir_mode) { ++ mir_output_set_power_mode(output, mir_mode); + unchanged = FALSE; + } + } + + if (!unchanged) -+ mir_wait_for(mir_connection_apply_display_config(xmir_screen->conn, -+ xmir_screen->display)); ++ mir_connection_apply_session_display_config(xmir_screen->conn, ++ xmir_screen->display); + + return TRUE; +} + +static void -+xmir_output_update(struct xmir_output *xmir_output, MirDisplayOutput *mir_output) ++xmir_output_update(struct xmir_output *xmir_output, MirOutput const *mir_output) +{ ++ MirOutputConnectionState connection_state; ++ bool output_is_connected; ++ ++ connection_state = mir_output_get_connection_state(mir_output); ++ output_is_connected = !(connection_state == mir_output_connection_state_disconnected); ++ + RROutputSetConnection(xmir_output->randr_output, -+ mir_output->connected ? RR_Connected : RR_Disconnected); ++ output_is_connected ? RR_Connected : RR_Disconnected); + RROutputSetSubpixelOrder(xmir_output->randr_output, SubPixelUnknown); + -+ if (mir_output->connected && mir_output->used) { -+ MirDisplayMode *mode = &mir_output->modes[mir_output->current_mode]; ++ if (output_is_connected) { ++ MirOutputMode const *mode = mir_output_get_current_mode(mir_output); + RRModePtr randr_mode; ++ double refresh_rate; + -+ xmir_output->width = mode->horizontal_resolution; -+ xmir_output->height = mode->vertical_resolution; -+ xmir_output->x = mir_output->position_x; -+ xmir_output->y = mir_output->position_y; ++ xmir_output->width = mir_output_mode_get_width(mode); ++ xmir_output->height = mir_output_mode_get_height(mode); ++ xmir_output->x = mir_output_get_position_x(mir_output); ++ xmir_output->y = mir_output_get_position_y(mir_output); + ++ refresh_rate = mir_output_mode_get_refresh_rate(mode); + randr_mode = xmir_cvt(xmir_output->width, xmir_output->height, -+ mode->refresh_rate, 0, 0); ++ 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; ++ randr_mode->mode.width = mir_output_mode_get_width(mode); ++ randr_mode->mode.height = mir_output_mode_get_height(mode); + sprintf(randr_mode->name, "%dx%d", + randr_mode->mode.width, + randr_mode->mode.height); + + RROutputSetPhysicalSize(xmir_output->randr_output, -+ mir_output->physical_width_mm, -+ mir_output->physical_height_mm); ++ mir_output_get_physical_width_mm(mir_output), ++ mir_output_get_physical_height_mm(mir_output)); + 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), ++ to_rr_rotation(mir_output_get_orientation(mir_output)), + NULL, 1, &xmir_output->randr_output); + } + else { @@ -5905,25 +5873,31 @@ Index: xorg-server/hw/xmir/xmir-output.c +static void +xmir_update_config(struct xmir_screen *xmir_screen) +{ -+ MirDisplayConfiguration *new_config; -+ MirDisplayOutput **mir_output; ++ MirDisplayConfig *new_config; + struct xmir_output *xmir_output; ++ int old_num_outputs, new_num_outputs; ++ MirOutput const *mir_output; ++ int i; + + if (xmir_screen->windowed) + return; + -+ new_config = mir_connection_create_display_config(xmir_screen->conn); -+ if (new_config->num_outputs != xmir_screen->display->num_outputs) ++ new_config = mir_connection_create_display_configuration(xmir_screen->conn); ++ new_num_outputs = mir_display_config_get_num_outputs(new_config); ++ old_num_outputs = mir_display_config_get_num_outputs(xmir_screen->display); ++ if (new_num_outputs != old_num_outputs) + FatalError("Number of outputs changed on update.\n"); + -+ mir_display_config_destroy(xmir_screen->display); ++ mir_display_config_release(xmir_screen->display); + xmir_screen->display = new_config; + -+ mir_output = &new_config->outputs; ++ i = 0; + xorg_list_for_each_entry(xmir_output, &xmir_screen->output_list, link) { -+ xmir_output_update(xmir_output, *mir_output); -+ mir_output++; ++ mir_output = mir_display_config_get_output(new_config, i); ++ xmir_output_update(xmir_output, mir_output); ++ ++i; + } ++ + xmir_output_screen_resized(xmir_screen); +} + @@ -5952,7 +5926,7 @@ Index: xorg-server/hw/xmir/xmir-output.c + DeviceIntPtr pDev; + + MirOrientation old = xmir_window->orientation; -+ xmir_window->orientation = mir_surface_get_orientation(xmir_window->surface); ++ xmir_window->orientation = mir_window_get_orientation(xmir_window->surface); + + if (width < 0 && height < 0) { + if (old % 180 == xmir_window->orientation % 180) { @@ -6015,6 +5989,7 @@ Index: xorg-server/hw/xmir/xmir-output.c + } + + xmir_screen->windowed = xmir_output_create(xmir_screen, "Windowed"); ++ xmir_disable_screensaver(xmir_screen); + } + + XMIR_DEBUG(("Output resized %ix%i with rotation %i\n", @@ -6117,7 +6092,8 @@ Index: xorg-server/hw/xmir/xmir-output.c +{ + rrScrPrivPtr rp; + int i; -+ MirDisplayConfiguration *display_config = xmir_screen->display; ++ MirDisplayConfig *display_config = xmir_screen->display; ++ int num_outputs; + int output_type_count[mir_display_output_type_edp + 1] = {}; + + if (!RRScreenInit(xmir_screen->screen)) @@ -6127,18 +6103,22 @@ Index: xorg-server/hw/xmir/xmir-output.c + &xmir_display_config_callback, + xmir_screen); + -+ for (i = 0; i < display_config->num_outputs; i++) { ++ num_outputs = mir_display_config_get_num_outputs(display_config); ++ for (i = 0; i < num_outputs; i++) { + char name[32]; -+ MirDisplayOutput *mir_output = &display_config->outputs[i]; ++ int type_count; ++ MirOutput const *mir_output; ++ MirOutputType output_type; ++ const char* output_type_str; + struct xmir_output *xmir_output; -+ 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) -+ type_count = output_type_count[mir_output->type]++; + ++ mir_output = mir_display_config_get_output(display_config, i); ++ output_type = mir_output_get_type(mir_output); ++ output_type_str = mir_output_type_name(output_type); ++ if (output_type_str) ++ type_count = output_type_count[output_type]++; + snprintf(name, sizeof name, "%s-%d", output_type_str, type_count); ++ + xmir_output = xmir_output_create(xmir_screen, name); + if (!xmir_output) + return FALSE; @@ -6156,13 +6136,11 @@ Index: xorg-server/hw/xmir/xmir-output.c + + return TRUE; +} -Index: xorg-server/hw/xmir/xmir-thread-proxy.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir-thread-proxy.c -@@ -0,0 +1,116 @@ ++++ b/hw/xmir/xmir-thread-proxy.c +@@ -0,0 +1,110 @@ +/* -+ * Copyright © 2012-2016 Canonical Ltd ++ * Copyright © 2012-2017 Canonical Ltd + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- @@ -6213,10 +6191,9 @@ Index: xorg-server/hw/xmir/xmir-thread-proxy.c +static int pipefds[2]; + +static void -+xmir_wakeup_handler(void* data, int err, void* read_mask) ++xmir_socket_ready(int fd, int ready, void *data) +{ -+ if (err >= 0 && FD_ISSET(pipefds[0], (fd_set *)read_mask)) -+ xmir_process_from_eventloop(); ++ xmir_process_from_eventloop(); +} + +void @@ -6233,18 +6210,13 @@ Index: xorg-server/hw/xmir/xmir-thread-proxy.c + */ + fcntl(pipefds[0], F_SETFL, O_NONBLOCK); + -+ AddGeneralSocket(pipefds[0]); -+ RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, -+ xmir_wakeup_handler, -+ NULL); ++ SetNotifyFd(pipefds[0], xmir_socket_ready, X_NOTIFY_READ, NULL); +} + +void +xmir_fini_thread_to_eventloop(void) +{ -+ RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, -+ xmir_wakeup_handler, NULL); -+ RemoveGeneralSocket(pipefds[0]); ++ RemoveNotifyFd(pipefds[0]); + close(pipefds[1]); + close(pipefds[0]); +} @@ -6277,13 +6249,11 @@ Index: xorg-server/hw/xmir/xmir-thread-proxy.c +{ + xmir_process_from_eventloop_except(NULL); +} -Index: xorg-server/hw/xmir/xmir.c -=================================================================== --- /dev/null -+++ xorg-server/hw/xmir/xmir.c -@@ -0,0 +1,1789 @@ ++++ b/hw/xmir/xmir.c +@@ -0,0 +1,1818 @@ +/* -+ * Copyright © 2015-2016 Canonical Ltd ++ * Copyright © 2015-2017 Canonical Ltd + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without @@ -6392,6 +6362,21 @@ Index: xorg-server/hw/xmir/xmir.c + return &rec; +} + ++/* Required by GLX module */ ++void ++xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo) ++{ ++} ++ ++/* Required by GLX module */ ++const char * ++xf86GetOptValString(const OptionInfoRec *table, int token) ++{ ++ /* This may bite us in the bum since it sends up hardcoding "mesa" as the GL ++ * vendor, but... */ ++ return NULL; ++} ++ +void +ddxGiveUp(enum ExitCode error) +{ @@ -6464,6 +6449,10 @@ Index: xorg-server/hw/xmir/xmir.c + 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="))) { ++ return 1; + } + else if (!strcmp(argv[i], "-fd")) { + if (!seen_shared) @@ -6689,7 +6678,7 @@ Index: xorg-server/hw/xmir/xmir.c + MirGraphicsRegion region; + + mir_buffer_stream_get_graphics_region( -+ mir_surface_get_buffer_stream(xmir_win->surface), ®ion); ++ mir_window_get_buffer_stream(xmir_win->surface), ®ion); + + /* + * Our window region (and hence damage region) might be a little ahead of @@ -6727,7 +6716,7 @@ Index: xorg-server/hw/xmir/xmir.c +{ + MirBufferPackage *package; + MirGraphicsRegion reg; -+ MirBufferStream *stream = mir_surface_get_buffer_stream(xmir_win->surface); ++ MirBufferStream *stream = mir_window_get_buffer_stream(xmir_win->surface); + + switch (xmir_screen->glamor) { + case glamor_off: @@ -6755,7 +6744,7 @@ Index: xorg-server/hw/xmir/xmir.c +static void +xmir_swap(struct xmir_screen *xmir_screen, struct xmir_window *xmir_win) +{ -+ MirBufferStream *stream = mir_surface_get_buffer_stream(xmir_win->surface); ++ MirBufferStream *stream = mir_window_get_buffer_stream(xmir_win->surface); + struct xmir_swap *swap = calloc(sizeof(struct xmir_swap), 1); + swap->server_generation = serverGeneration; + swap->xmir_screen = xmir_screen; @@ -6814,11 +6803,11 @@ Index: xorg-server/hw/xmir/xmir.c + if (named && + xmir_get_window_name(named, wm_name, sizeof wm_name) && + strcmp(wm_name, xmir_win->wm_name)) { -+ MirSurfaceSpec *rename = -+ mir_connection_create_spec_for_changes(xmir_screen->conn); -+ mir_surface_spec_set_name(rename, wm_name); -+ mir_surface_apply_spec(xmir_win->surface, rename); -+ mir_surface_spec_release(rename); ++ MirWindowSpec *rename = ++ mir_create_window_spec(xmir_screen->conn); ++ mir_window_spec_set_name(rename, wm_name); ++ mir_window_apply_spec(xmir_win->surface, rename); ++ mir_window_spec_release(rename); + strncpy(xmir_win->wm_name, wm_name, sizeof(xmir_win->wm_name)); + } + @@ -6855,7 +6844,7 @@ Index: xorg-server/hw/xmir/xmir.c + int buf_width, buf_height; + Bool xserver_lagging, xclient_lagging; + -+ if (!xmir_win->damage || !mir_surface_is_valid(xmir_win->surface)) { ++ if (!xmir_win->damage || !mir_window_is_valid(xmir_win->surface)) { + if (xmir_win->damage) + ErrorF("Buffer-available recieved for invalid surface?\n"); + return; @@ -6961,9 +6950,9 @@ Index: xorg-server/hw/xmir/xmir.c + Atom wm_type = 0; + int mir_width = window->drawable.width / (1 + xmir_screen->doubled); + int mir_height = window->drawable.height / (1 + xmir_screen->doubled); -+ MirSurfaceSpec* spec = NULL; ++ MirWindowSpec* spec = NULL; + WindowPtr wm_transient_for = NULL, positioning_parent = NULL; -+ MirPersistentId *persistent_id = NULL; ++ MirWindowId *persistent_id = NULL; + XWMHints *wm_hints = NULL; + char wm_name[1024]; + @@ -7078,7 +7067,7 @@ Index: xorg-server/hw/xmir/xmir.c + } + + if (xmir_screen->neverclosed) { -+ spec = mir_connection_create_spec_for_changes(xmir_screen->conn); ++ spec = mir_create_window_spec(xmir_screen->conn); + } + else if (positioning_parent) { + struct xmir_window *rel = xmir_window_get(positioning_parent); @@ -7090,8 +7079,8 @@ Index: xorg-server/hw/xmir/xmir.c + if (wm_type == GET_ATOM(_NET_WM_WINDOW_TYPE_TOOLTIP)) { + /* Why doesn't the API version match the Mir version?! */ +#if MIR_CLIENT_VERSION >= MIR_VERSION_NUMBER(3,4,0) -+ spec = mir_connection_create_spec_for_tip( -+ xmir_screen->conn, mir_width, mir_height, pixel_format, ++ spec = mir_create_tip_window_spec( ++ xmir_screen->conn, mir_width, mir_height, + rel->surface, &placement, mir_edge_attachment_any); +#else + spec = mir_connection_create_spec_for_tooltip( @@ -7100,17 +7089,17 @@ Index: xorg-server/hw/xmir/xmir.c +#endif + } + else if (wm_type == GET_ATOM(_NET_WM_WINDOW_TYPE_DIALOG)) { -+ spec = mir_connection_create_spec_for_modal_dialog( -+ xmir_screen->conn, mir_width, mir_height, pixel_format, ++ spec = mir_create_modal_dialog_window_spec( ++ xmir_screen->conn, mir_width, mir_height, + rel->surface); + } + else { /* Probably a menu. If not, still close enough... */ + MirEdgeAttachment edge = mir_edge_attachment_any; + if (wm_type == GET_ATOM(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)) + edge = mir_edge_attachment_vertical; -+ spec = mir_connection_create_spec_for_menu( ++ spec = mir_create_menu_window_spec( + xmir_screen->conn, -+ mir_width, mir_height, pixel_format, rel->surface, ++ mir_width, mir_height, rel->surface, + &placement, edge); + } + } @@ -7118,62 +7107,62 @@ Index: xorg-server/hw/xmir/xmir.c + + if (!spec) { + if (wm_type == GET_ATOM(_NET_WM_WINDOW_TYPE_DIALOG)) { -+ spec = mir_connection_create_spec_for_dialog( -+ xmir_screen->conn, mir_width, mir_height, pixel_format); ++ spec = mir_create_dialog_window_spec( ++ xmir_screen->conn, mir_width, mir_height); + } + else { -+ spec = mir_connection_create_spec_for_normal_surface( -+ xmir_screen->conn, mir_width, mir_height, pixel_format); ++ spec = mir_create_normal_window_spec( ++ xmir_screen->conn, mir_width, mir_height); + } + } + + if (strcmp(xmir_screen->title, get_title_from_top_window)) -+ mir_surface_spec_set_name(spec, xmir_screen->title); ++ mir_window_spec_set_name(spec, xmir_screen->title); + else if (xmir_screen->rootless) -+ mir_surface_spec_set_name(spec, wm_name); ++ mir_window_spec_set_name(spec, wm_name); + + xmir_window->surface_width = mir_width; + xmir_window->surface_height = mir_height; + xmir_window->buf_width = mir_width; + xmir_window->buf_height = mir_height; + ++ mir_window_spec_set_pixel_format(spec, pixel_format); + if (xmir_screen->neverclosed) { -+ mir_surface_spec_set_width(spec, mir_width); -+ mir_surface_spec_set_height(spec, mir_height); -+ mir_surface_spec_set_pixel_format(spec, pixel_format); ++ mir_window_spec_set_width(spec, mir_width); ++ mir_window_spec_set_height(spec, mir_height);