xorg-server: Changes to 'ubuntu'
debian/changelog | 19
debian/control | 2
debian/patches/os-use-libunwind-to-generate-backtraces.patch | 206 ------
debian/patches/series | 1
debian/patches/xmir.patch | 374 ++++++++---
5 files changed, 318 insertions(+), 284 deletions(-)
New commits:
commit 8d91c3e2302b05068f5564a7aaac889c29d859fc
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Thu Sep 26 08:30:03 2013 -0700
Drop vestigial libatomic-ops dependency.
diff --git a/debian/changelog b/debian/changelog
index 6e031b5..32e9e3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xorg-server (2:1.14.2.901-2ubuntu6) saucy; urgency=low
+
+ * xmir.patch: Drop vestigial libatomic-ops dependency, fixing
+ driver FTBFS.
+
+ -- Christopher James Halse Rogers <raof@ubuntu.com> Thu, 26 Sep 2013 08:29:44 -0700
+
xorg-server (2:1.14.2.901-2ubuntu5) saucy; urgency=low
* xmir.patch: Drop input on loss of focus. Fixes "I'm sending all my
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index bfd4f52..6c82d8f 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -15,11 +15,11 @@ index c6ecba4..07d02d0 100644
fi
+if test "x$XMIR" != xno; then
-+ PKG_CHECK_MODULES([XMIR], [mirclient atomic_ops], [XMIR=yes], [XMIR=no])
++ PKG_CHECK_MODULES([XMIR], [mirclient], [XMIR=yes], [XMIR=no])
+ AC_SUBST([XMIR_LIBS])
+ AC_SUBST([XMIR_CFLAGS])
+ AC_DEFINE(XMIR, 1, [Support Mir nested mode])
-+ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES mirclient atomic_ops"
++ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES mirclient"
+fi
+AM_CONDITIONAL(XMIR, [test "x$XMIR" = xyes])
+
commit 4562fa27a0339e522a973249fc00ab1f83984bf8
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Tue Sep 24 08:59:49 2013 -0700
Drop os-use-libunwind-to-generate-backtraces
This hasn't actually been enabled until now, due to libunwind8-dev not shipping a pkg-config
file. Now that it's enabled, it causes a FTBFS on armhf, so drop it for now.
diff --git a/debian/changelog b/debian/changelog
index fcf3947..6e031b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,11 @@ xorg-server (2:1.14.2.901-2ubuntu5) saucy; urgency=low
passwords to IRC when I switch to a VT" with associated
unity-system-compositor change. (LP: #1192843)
* xmir.patch: Add DPMS support (LP: #1193222)
+ * Drop os-use-libunwind-to-generate-backtraces.patch; this was not enabled
+ due to libunwind8-dev not shipping a pkg-config file. Now that it does,
+ this causes FTBFS on armhf.
- -- Christopher James Halse Rogers <raof@ubuntu.com> Wed, 18 Sep 2013 10:19:51 -0400
+ -- Christopher James Halse Rogers <raof@ubuntu.com> Tue, 24 Sep 2013 08:58:45 -0700
xorg-server (2:1.14.2.901-2ubuntu4) saucy; urgency=low
diff --git a/debian/control b/debian/control
index 9baf33b..95fe273 100644
--- a/debian/control
+++ b/debian/control
@@ -54,7 +54,6 @@ Build-Depends:
libdbus-1-dev [kfreebsd-any],
libhal-dev [kfreebsd-any],
libudev-dev (>= 151-3) [linux-any],
- libunwind8-dev,
libselinux1-dev (>= 2.0.80) [linux-any],
libaudit-dev [linux-any],
x11proto-xf86dri-dev (>= 2.1.0),
diff --git a/debian/patches/os-use-libunwind-to-generate-backtraces.patch b/debian/patches/os-use-libunwind-to-generate-backtraces.patch
deleted file mode 100644
index 261bb7d..0000000
--- a/debian/patches/os-use-libunwind-to-generate-backtraces.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-From cae16adcfea6d12c72c48b9091b7f562fcb6a925 Mon Sep 17 00:00:00 2001
-From: Marcin Slusarz <marcin.slusarz@gmail.com>
-Date: Thu, 21 Feb 2013 09:02:44 +1000
-Subject: [PATCH] os: use libunwind to generate backtraces
-
-Libunwind generates backtraces much more reliably than glibc's "backtrace".
-
-Before:
-0: /opt/xserver/bin/X (0x400000+0x18ce36) [0x58ce36]
-1: /opt/xserver/bin/X (xorg_backtrace+0x9) [0x58d119]
-2: /opt/xserver/bin/X (0x400000+0x190d69) [0x590d69]
-3: /lib64/libpthread.so.0 (0x7fb904268000+0x10a90) [0x7fb904278a90]
-4: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
-5: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
-6: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
-7: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
-8: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (0x7fb90220e000+0x76f3) [0x7fb9022156f3]
-9: /opt/xserver/lib/xorg/modules/libexa.so (0x7fb9019c7000+0xbae0) [0x7fb9019d2ae0]
-10: /opt/xserver/bin/X (0x400000+0x17d2b3) [0x57d2b3]
-11: /opt/xserver/bin/X (0x400000+0xc9930) [0x4c9930]
-12: /opt/xserver/bin/X (0x400000+0x3a81a) [0x43a81a]
-13: /opt/xserver/bin/X (0x400000+0x3d6a1) [0x43d6a1]
-14: /opt/xserver/bin/X (0x400000+0x2c2ca) [0x42c2ca]
-15: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
-16: /opt/xserver/bin/X (0x400000+0x2c60d) [0x42c60d]
-17: ?? [0x0]
-
-After:
-0: /opt/xserver/bin/X (OsSigHandler+0x39) [0x590d69]
-1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x7fb904278a8f]
-2: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
-3: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
-4: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
-5: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
-6: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (nouveau_exa_download_from_screen+0x1a3) [0x7fb9022156f3]
-7: /opt/xserver/lib/xorg/modules/libexa.so (exaGetImage+0x1f0) [0x7fb9019d2ae0]
-8: /opt/xserver/bin/X (miSpriteGetImage+0x173) [0x57d2b3]
-9: /opt/xserver/bin/X (compGetImage+0xb0) [0x4c9930]
-10: /opt/xserver/bin/X (ProcGetImage+0x55a) [0x43a81a]
-11: /opt/xserver/bin/X (Dispatch+0x341) [0x43d6a1]
-12: /opt/xserver/bin/X (main+0x3ba) [0x42c2ca]
-13: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
-14: /opt/xserver/bin/X (_start+0x29) [0x42c60d]
-15: ? (?+0x29) [0x29]
-
-Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
-Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-Tested-by: Knut Petersen <knut.petersen@t-online.de>
-(cherry picked from commit e21e183059df5975e7086850d1931edb2c1bbd06)
----
- configure.ac | 9 +++++-
- include/dix-config.h.in | 3 ++
- os/Makefile.am | 5 ++++
- os/backtrace.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 91 insertions(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index bc4f22e..fc766ab 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -309,6 +309,13 @@ AC_CHECK_HEADER([execinfo.h],[
- ])]
- )
-
-+PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
-+if test "x$HAVE_LIBUNWIND" = xyes; then
-+ AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
-+fi
-+AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes])
-+
-+
- dnl ---------------------------------------------------------------------------
- dnl Bus options and CPU capabilities. Replaces logic in
- dnl hw/xfree86/os-support/bus/Makefile.am, among others.
-@@ -1337,7 +1344,7 @@ AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
-
- if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
- DIX_LIB='$(top_builddir)/dix/dix.O'
-- OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
-+ OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
- else
- DIX_LIB='$(top_builddir)/dix/libdix.la'
- OS_LIB='$(top_builddir)/os/libos.la'
-diff --git a/include/dix-config.h.in b/include/dix-config.h.in
-index 578f249..5102263 100644
---- a/include/dix-config.h.in
-+++ b/include/dix-config.h.in
-@@ -60,6 +60,9 @@
- /* Has backtrace support */
- #undef HAVE_BACKTRACE
-
-+/* Has libunwind support */
-+#undef HAVE_LIBUNWIND
-+
- /* Define to 1 if you have the <byteswap.h> header file. */
- #undef HAVE_BYTESWAP_H
-
-diff --git a/os/Makefile.am b/os/Makefile.am
-index 8891485..364b6da 100644
---- a/os/Makefile.am
-+++ b/os/Makefile.am
-@@ -34,6 +34,11 @@ if XDMCP
- libos_la_SOURCES += $(XDMCP_SRCS)
- endif
-
-+if HAVE_LIBUNWIND
-+AM_CFLAGS += $(LIBUNWIND_CFLAGS)
-+libos_la_LIBADD += $(LIBUNWIND_LIBS)
-+endif
-+
- EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
-
- if SPECIAL_DTRACE_OBJECTS
-diff --git a/os/backtrace.c b/os/backtrace.c
-index daac60c..426f9b1 100644
---- a/os/backtrace.c
-+++ b/os/backtrace.c
-@@ -30,6 +30,80 @@
- #include <errno.h>
- #include <string.h>
-
-+#ifdef HAVE_LIBUNWIND
-+
-+#define UNW_LOCAL_ONLY
-+#include <libunwind.h>
-+
-+#ifndef _GNU_SOURCE
-+#define _GNU_SOURCE
-+#endif
-+#include <dlfcn.h>
-+
-+void
-+xorg_backtrace(void)
-+{
-+ unw_cursor_t cursor;
-+ unw_context_t context;
-+ unw_word_t off;
-+ unw_proc_info_t pip;
-+ int ret, i = 0;
-+ char procname[256];
-+ const char *filename;
-+ Dl_info dlinfo;
-+
-+ pip.unwind_info = NULL;
-+ ret = unw_getcontext(&context);
-+ if (ret) {
-+ ErrorFSigSafe("unw_getcontext failed: %s [%d]\n", unw_strerror(ret),
-+ ret);
-+ return;
-+ }
-+
-+ ret = unw_init_local(&cursor, &context);
-+ if (ret) {
-+ ErrorFSigSafe("unw_init_local failed: %s [%d]\n", unw_strerror(ret),
-+ ret);
-+ return;
-+ }
-+
-+ ErrorFSigSafe("\n");
-+ ErrorFSigSafe("Backtrace:\n");
-+ ret = unw_step(&cursor);
-+ while (ret > 0) {
-+ ret = unw_get_proc_info(&cursor, &pip);
-+ if (ret) {
-+ ErrorFSigSafe("unw_get_proc_info failed: %s [%d]\n",
-+ unw_strerror(ret), ret);
-+ break;
-+ }
-+
-+ ret = unw_get_proc_name(&cursor, procname, 256, &off);
-+ if (ret && ret != -UNW_ENOMEM) {
-+ if (ret != -UNW_EUNSPEC)
-+ ErrorFSigSafe("unw_get_proc_name failed: %s [%d]\n",
-+ unw_strerror(ret), ret);
-+ procname[0] = '?';
-+ procname[1] = 0;
-+ }
-+
-+ if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
-+ *dlinfo.dli_fname)
-+ filename = dlinfo.dli_fname;
-+ else
-+ filename = "?";
-+
-+ ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
-+ ret == -UNW_ENOMEM ? "..." : "", (int)off,
-+ (void *)(pip.start_ip + off));
-+
-+ ret = unw_step(&cursor);
-+ if (ret < 0)
-+ ErrorFSigSafe("unw_step failed: %s [%d]\n", unw_strerror(ret), ret);
-+ }
-+ ErrorFSigSafe("\n");
-+}
-+#else /* HAVE_LIBUNWIND */
- #ifdef HAVE_BACKTRACE
- #ifndef _GNU_SOURCE
- #define _GNU_SOURCE
-@@ -246,3 +320,4 @@ xorg_backtrace(void)
-
- #endif
- #endif
-+#endif
---
-1.8.1.2
-
diff --git a/debian/patches/series b/debian/patches/series
index 5002d3e..82df08d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -39,7 +39,6 @@ no-nv.patch
# Probably is just papering over issue; needs further analysis
## upstream patches
-os-use-libunwind-to-generate-backtraces.patch
# hybrid graphics fixes for xserver 1.13
228_autobind_gpu.patch
commit c78e9c73c0daa5993cdc88dcf5e373adc7368dcd
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Wed Sep 18 14:40:55 2013 -0400
Release to Saucy
diff --git a/debian/changelog b/debian/changelog
index 93d3201..fcf3947 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xorg-server (2:1.14.2.901-2ubuntu5) UNRELEASED; urgency=low
+xorg-server (2:1.14.2.901-2ubuntu5) saucy; urgency=low
* xmir.patch: Drop input on loss of focus. Fixes "I'm sending all my
passwords to IRC when I switch to a VT" with associated
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index 72499fd..bfd4f52 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -1254,7 +1254,7 @@ index 0000000..e0acceb
+
diff --git a/hw/xfree86/xmir/xmir-window.c b/hw/xfree86/xmir/xmir-window.c
new file mode 100644
-index 0000000..6fe2cfe
+index 0000000..a5e97c7
--- /dev/null
+++ b/hw/xfree86/xmir/xmir-window.c
@@ -0,0 +1,343 @@
@@ -1401,8 +1401,8 @@ index 0000000..6fe2cfe
+{
+ RegionPtr tracking;
+
-+ if (!xmir_screen_get(xmir_win->win->drawable.pScreen)->dmps_on)
-+ return;
++ if (!xmir_screen_get(xmir_win->win->drawable.pScreen)->dpms_on)
++ return Success;
+
+ xmir_win->has_free_buffer = FALSE;
+ tracking = damage_region_for_current_buffer(xmir_win);
@@ -1603,10 +1603,10 @@ index 0000000..6fe2cfe
+}
diff --git a/hw/xfree86/xmir/xmir.c b/hw/xfree86/xmir/xmir.c
new file mode 100644
-index 0000000..569044e
+index 0000000..bb2bd59
--- /dev/null
+++ b/hw/xfree86/xmir/xmir.c
-@@ -0,0 +1,262 @@
+@@ -0,0 +1,263 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -1719,6 +1719,7 @@ index 0000000..569044e
+ return NULL;
+
+ xmir->scrn = scrn;
++ xmir->dpms_on = TRUE;
+
+ return xmir;
+}
commit 1aa5eb90d04a6a021d7f856f5e1a370f781e33b7
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Wed Sep 18 10:20:37 2013 -0400
Add DPMS support.
Also apply Daniel's miscellaneous warning fixes
diff --git a/debian/changelog b/debian/changelog
index f5e4a33..93d3201 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,11 @@
xorg-server (2:1.14.2.901-2ubuntu5) UNRELEASED; urgency=low
* xmir.patch: Drop input on loss of focus. Fixes "I'm sending all my
- passwords to IRC when I switch to a VT" (LP: #1192843)
+ passwords to IRC when I switch to a VT" with associated
+ unity-system-compositor change. (LP: #1192843)
+ * xmir.patch: Add DPMS support (LP: #1193222)
- -- Christopher James Halse Rogers <raof@ubuntu.com> Mon, 02 Sep 2013 11:19:45 +1000
+ -- Christopher James Halse Rogers <raof@ubuntu.com> Wed, 18 Sep 2013 10:19:51 -0400
xorg-server (2:1.14.2.901-2ubuntu4) saucy; urgency=low
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index f5fd263..72499fd 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -328,10 +328,10 @@ index 0000000..80715f8
+sdk_HEADERS = xmir.h
diff --git a/hw/xfree86/xmir/xmir-output.c b/hw/xfree86/xmir/xmir-output.c
new file mode 100644
-index 0000000..41696b5
+index 0000000..8fd8640
--- /dev/null
+++ b/hw/xfree86/xmir/xmir-output.c
-@@ -0,0 +1,571 @@
+@@ -0,0 +1,678 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -380,9 +380,86 @@ index 0000000..41696b5
+ MirDisplayConfiguration *config;
+};
+
++static const char *
++xmir_mir_dpms_mode_description(MirPowerMode mode)
++{
++ switch (mode)
++ {
++ case mir_power_mode_on:
++ return "mir_power_mode_on";
++ case mir_power_mode_standby:
++ return "mir_power_mode_standby";
++ case mir_power_mode_suspend:
++ return "mir_power_mode_suspend";
++ case mir_power_mode_off:
++ return "mir_power_mode_off";
++ default:
++ return "OMGUNKNOWN!";
++ }
++}
++
+static void
-+crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode)
++xmir_crtc_dpms(xf86CrtcPtr crtc, int mode)
++{
++ xf86CrtcConfigPtr crtc_cfg = XF86_CRTC_CONFIG_PTR(crtc->scrn);
++ struct xmir_crtc *xmir_crtc = crtc->driver_private;
++
++ for (int i = 0; i < crtc_cfg->num_output; i++) {
++ /* If this output should be driven by our "CRTC", set DPMS mode */
++ MirDisplayOutput *output = crtc_cfg->output[i]->driver_private;
++ if (crtc_cfg->output[i]->crtc == crtc) {
++ xf86Msg(X_INFO, "Setting DPMS mode for output %d to %d\n", i, mode);
++ switch (mode) {
++ case DPMSModeOn:
++ output->power_mode = mir_power_mode_on;
++ xmir_crtc->xmir->dpms_on = TRUE;
++ break;
++ case DPMSModeStandby:
++ output->power_mode = mir_power_mode_standby;
++ xmir_crtc->xmir->dpms_on = FALSE;
++ break;
++ case DPMSModeSuspend:
++ output->power_mode = mir_power_mode_suspend;
++ xmir_crtc->xmir->dpms_on = FALSE;
++ break;
++ case DPMSModeOff:
++ output->power_mode = mir_power_mode_off;
++ xmir_crtc->xmir->dpms_on = FALSE;
++ break;
++ }
++ }
++ }
++ mir_wait_for(mir_connection_apply_display_config(xmir_connection_get(),
++ xmir_crtc->config));
++}
++
++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 void
@@ -402,12 +479,33 @@ index 0000000..41696b5
+ xf86output->subpixel_order = SubPixelUnknown;
+}
+
-+static Bool
-+xmir_mir_mode_matches(MirDisplayMode *mir_mode, DisplayModePtr X_mode)
++static DisplayModePtr
++xmir_create_xf86mode(const struct MirDisplayMode *mir_mode)
+{
-+ return (mir_mode->vertical_resolution == X_mode->VDisplay &&
-+ mir_mode->horizontal_resolution == X_mode->HDisplay /*&&
-+ fabs(mir_mode->refresh_rate - X_mode->VRefresh) < 0.01*/);
++ DisplayModePtr mode;
++
++ mode = xf86CVTMode(mir_mode->horizontal_resolution,
++ mir_mode->vertical_resolution,
++ mir_mode->refresh_rate,
++ FALSE, FALSE);
++
++ /*
++ * And now, because the CVT standard doesn't support such common
++ * resolutions as 1366x768...
++ */
++ mode->VDisplay = mir_mode->vertical_resolution;
++ mode->HDisplay = mir_mode->horizontal_resolution;
++
++ xf86SetModeDefaultName(mode);
++
++ return mode;
++}
++
++static void
++xmir_free_xf86mode(DisplayModePtr mode)
++{
++ free(mode->name);
++ free(mode);
+}
+
+static Bool
@@ -415,10 +513,18 @@ index 0000000..41696b5
+ DisplayModePtr mode)
+{
+ for (int i = 0; i < output->num_modes; i++) {
-+ xf86Msg(X_INFO, "Checking against mode (%dx%d)\n",
++ Bool modes_equal = FALSE;
++ DisplayModePtr mir_mode = NULL;
++ xf86Msg(X_INFO, "Checking against mode (%dx%d)@%.2f\n",
+ output->modes[i].horizontal_resolution,
-+ output->modes[i].vertical_resolution);
-+ if (xmir_mir_mode_matches(&output->modes[i], mode)) {
++ output->modes[i].vertical_resolution,
++ output->modes[i].refresh_rate);
++
++ mir_mode = xmir_create_xf86mode(&output->modes[i]);
++ modes_equal = xf86ModesEqual(mode, mir_mode);
++ xmir_free_xf86mode(mir_mode);
++
++ if (modes_equal) {
+ output->current_mode = i;
+ output->used = 1;
+ xf86Msg(X_INFO, "Matched mode %d\n", i);
@@ -468,7 +574,7 @@ index 0000000..41696b5
+{
+ for (int i = 0; i < config->num_outputs; i++)
+ {
-+ xf86Msg(X_INFO, "Output %d (%s, %s) has mode %d (%d x %d @ %.2f), position (%d,%d)\n",
++ xf86Msg(X_INFO, "Output %d (%s, %s) has mode %d (%d x %d @ %.2f), position (%d,%d), dpms: %s\n",
+ config->outputs[i].output_id,
+ config->outputs[i].connected ? "connected" : "disconnected",
+ config->outputs[i].used ? "enabled" : "disabled",
@@ -477,7 +583,17 @@ index 0000000..41696b5
+ config->outputs[i].used ? config->outputs[i].modes[config->outputs[i].current_mode].vertical_resolution : 0,
+ config->outputs[i].used ? config->outputs[i].modes[config->outputs[i].current_mode].refresh_rate : 0,
+ config->outputs[i].position_x,
-+ config->outputs[i].position_y);
++ config->outputs[i].position_y,
++ xmir_mir_dpms_mode_description(config->outputs[i].power_mode));
++ for (int m = 0; m < config->outputs[i].num_modes; m++)
++ {
++ xf86Msg(X_INFO, " mode %d: (%d x %d @ %.2f)\n",
++ m,
++ config->outputs[i].modes[m].horizontal_resolution,
++
++ config->outputs[i].modes[m].vertical_resolution,
++ config->outputs[i].modes[m].refresh_rate);
++ }
+ }
+}
+
@@ -502,6 +618,8 @@ index 0000000..41696b5
+ /* TODO: Ensure that the order actually matches up */
+ xmir_output_populate(crtc_cfg->output[i], new_config->outputs + i);
+ }
++ xf86Msg(X_INFO, "Recieved updated config from Mir:\n");
++ xmir_dump_config(new_config);
+}
+
+static void
@@ -541,10 +659,10 @@ index 0000000..41696b5
+ if (mode->HDisplay == 0 || mode->VDisplay == 0)
+ return FALSE;
+
-+ xf86Msg(X_INFO, "Initial configuration:\n");
++ xf86Msg(X_INFO, "Initial configuration for crtc %p:\n", crtc);
+ xmir_dump_config(xmir_crtc->config);
+
-+ xf86Msg(X_INFO, "Setting mode to %dx%d (%.2f)", mode->HDisplay, mode->VDisplay, mode->VRefresh);
++ xf86Msg(X_INFO, "Setting mode to %dx%d (%.2f)\n", mode->HDisplay, mode->VDisplay, mode->VRefresh);
+ output_id = xmir_update_outputs_for_crtc(crtc, mode, x, y);
+ xmir_disable_unused_outputs(crtc);
+
@@ -561,10 +679,8 @@ index 0000000..41696b5
+ /* TODO: Restore correct config cache */
+ }
+
-+ xmir_update_config(XF86_CRTC_CONFIG_PTR(crtc->scrn));
-+
+ xf86Msg(X_INFO, "Post-modeset config:\n");
-+ xmir_dump_config(xmir_crtc->config);
++ xmir_update_config(XF86_CRTC_CONFIG_PTR(crtc->scrn));
+
+ if (output_id == mir_display_output_id_invalid) {
+ if (xmir_crtc->root_fragment->surface != NULL)
@@ -652,7 +768,7 @@ index 0000000..41696b5
+}
+
+static const xf86CrtcFuncsRec crtc_funcs = {
-+ .dpms = crtc_dpms,
++ .dpms = xmir_crtc_dpms,
+ .set_mode_major = xmir_crtc_set_mode_major,
+ .set_cursor_colors = crtc_set_cursor_colors,
+ .set_cursor_position = crtc_set_cursor_position,
@@ -688,31 +804,15 @@ index 0000000..41696b5
+xmir_output_get_modes(xf86OutputPtr xf86output)
+{
+ MirDisplayOutput *mir_output = xf86output->driver_private;
-+ DisplayModePtr modes = NULL, mode = NULL;
++ DisplayModePtr modes = NULL;
+
+ for (int i = 0; i < mir_output->num_modes; i++) {
-+ /* Check if mode differs only by refresh rate from previous mode and reject */
-+ /* TODO: Remove this check and instead handle refresh rate correctly */
-+ if (mode != NULL)
-+ if (xmir_mir_mode_matches((mir_output->modes + i), mode))
-+ continue;
-+
-+ char *mode_name = malloc(32);
-+ mode = xf86CVTMode(mir_output->modes[i].horizontal_resolution,
-+ mir_output->modes[i].vertical_resolution,
-+ 60.0f,
-+ FALSE, FALSE);
-+ /* And now, because the CVT standard doesn't support such common resolutions as 1366x768... */
-+ mode->VDisplay = mir_output->modes[i].vertical_resolution;
-+ mode->HDisplay = mir_output->modes[i].horizontal_resolution;
++ DisplayModePtr mode = xmir_create_xf86mode(&mir_output->modes[i]);
+
+ mode->type = M_T_DRIVER;
-+ /* TODO: Get preferred mode from Mir, or get a guarantee that the first mode is preferred */
-+ if (i == 0)
++ if (i == mir_output->preferred_mode)
+ mode->type |= M_T_PREFERRED;
+
-+ snprintf(mode_name, 32, "%dx%d", mode->HDisplay, mode->VDisplay);
-+ mode->name = mode_name;
+ modes = xf86ModesAdd(modes, mode);
+ }
+ /* TODO: Get Mir to send us the EDID blob and add that */
@@ -837,6 +937,9 @@ index 0000000..41696b5
+ int i;
+ MirDisplayConfiguration *display_config;
+ xf86CrtcPtr xf86crtc;
++ int output_type_count[mir_display_output_type_edp + 1];
++
++ memset(output_type_count, 0, sizeof output_type_count);
+
+ /* Set up CRTC config functions */
+ xf86CrtcConfigInit(scrn, &config_funcs);
@@ -858,9 +961,9 @@ index 0000000..41696b5
+ display_config =
+ mir_connection_create_display_config(xmir_connection_get());
+
-+ xmir->root_window_fragments = malloc((display_config->num_outputs + 1) *
++ xmir->root_window_fragments = malloc((display_config->cards[0].max_simultaneous_outputs + 1) *
+ sizeof(xmir_window *));
-+ xmir->root_window_fragments[display_config->num_outputs] = NULL;
++ xmir->root_window_fragments[display_config->cards[0].max_simultaneous_outputs] = NULL;
+
+ if (xmir->root_window_fragments == NULL)
+ return FALSE;
@@ -868,16 +971,20 @@ index 0000000..41696b5
+ for (i = 0; i < display_config->num_outputs; i++) {
+ xf86OutputPtr xf86output;
+ char name[32];
++ MirDisplayOutput *mir_output = &display_config->outputs[i];
++ const char* output_type_str = xmir_get_output_type_str(mir_output);
++ int type_count = i;
+
-+ snprintf(name, sizeof name, "XMIR-%d", i);
++ 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);
+ xf86output = xf86OutputCreate(scrn, &xmir_output_funcs, name);
+
-+ xmir_output_populate(xf86output, display_config->outputs + i);
++ xmir_output_populate(xf86output, mir_output);
+ }
+
-+ /* TODO: Get the number of CRTCs from Mir */
-+ for (i = 0; i < display_config->num_outputs; i++) {
++ for (i = 0; i < display_config->cards[0].max_simultaneous_outputs; i++) {
+ struct xmir_crtc *xmir_crtc = malloc(sizeof *xmir_crtc);
+ if (xmir_crtc == NULL)
+ return FALSE;
@@ -905,10 +1012,10 @@ index 0000000..41696b5
+}
diff --git a/hw/xfree86/xmir/xmir-private.h b/hw/xfree86/xmir/xmir-private.h
new file mode 100644
-index 0000000..9b144eb
+index 0000000..15d89f0
--- /dev/null
+++ b/hw/xfree86/xmir/xmir-private.h
-@@ -0,0 +1,107 @@
+@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -944,7 +1051,6 @@ index 0000000..9b144eb
+#ifndef _XMIR_PRIVATE_H
+#define _XMIR_PRIVATE_H
+
-+#include <atomic_ops.h>
+#include <mir_toolkit/mir_client_library.h>
+#include "xmir.h"
+#include "xf86str.h"
@@ -964,9 +1070,9 @@ index 0000000..9b144eb
+ xmir_marshall_handler *submit_rendering_handler;
+ xmir_marshall_handler *hotplug_event_handler;
+ xmir_marshall_handler *focus_event_handler;
-+ AO_t focus_count;
+ struct xorg_list damage_list;
+ struct xmir_window **root_window_fragments; /* NULL terminated array of xmir_window * */
++ unsigned int dpms_on:1; /* Until Mir is less stupid about DPMS */
+};
+
+struct xmir_window {
@@ -1018,10 +1124,10 @@ index 0000000..9b144eb
+ #endif /* _MIR_PRIVATE_H */
diff --git a/hw/xfree86/xmir/xmir-thread-proxy.c b/hw/xfree86/xmir/xmir-thread-proxy.c
new file mode 100644
-index 0000000..7464644
+index 0000000..e0acceb
--- /dev/null
+++ b/hw/xfree86/xmir/xmir-thread-proxy.c
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,124 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -1058,7 +1164,9 @@ index 0000000..7464644
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
++#include <errno.h>
+
++#include "xf86.h"
+#include "xmir-private.h"
+
+struct xmir_marshall_handler {
@@ -1079,7 +1187,9 @@ index 0000000..7464644
+void
+xmir_init_thread_to_eventloop(void)
+{
-+ pipe(pipefds);
++ 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
@@ -1113,12 +1223,15 @@ index 0000000..7464644
+void
+xmir_post_to_eventloop(xmir_marshall_handler *handler, void *msg)
+{
++ ssize_t written;
+ const int total_size = sizeof *handler + handler->msg_size;
+ /* We require the total size to be less than PIPE_BUF to ensure an atomic write */
+ assert(total_size < PIPE_BUF);
+
+ memcpy(handler->msg, msg, handler->msg_size);
-+ write(pipefds[1], handler, total_size);
++ written = write(pipefds[1], handler, total_size);
++ if (written != total_size)
++ xf86Msg(X_ERROR, "[XMIR] Failed to proxy message to mainloop\n");
+}
+
+void
@@ -1141,10 +1254,10 @@ index 0000000..7464644
+
diff --git a/hw/xfree86/xmir/xmir-window.c b/hw/xfree86/xmir/xmir-window.c
new file mode 100644
-index 0000000..89c5448
+index 0000000..6fe2cfe
--- /dev/null
+++ b/hw/xfree86/xmir/xmir-window.c
-@@ -0,0 +1,340 @@
+@@ -0,0 +1,343 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -1223,13 +1336,13 @@ index 0000000..89c5448
+static void
+xmir_handle_buffer_available(void *ctx)
+{
++ xmir_screen *xmir;
+ xmir_window *mir_win = *(xmir_window **)ctx;
+
+ if (mir_win->surface == NULL)
+ return;
+
-+ xmir_screen *xmir =
-+ xmir_screen_get(xmir_window_to_windowptr(mir_win)->drawable.pScreen);
++ xmir = xmir_screen_get(xmir_window_to_windowptr(mir_win)->drawable.pScreen);
+
+ mir_win->has_free_buffer = TRUE;
+ mir_win->damage_index = (mir_win->damage_index + 1) % MIR_MAX_BUFFER_AGE;
@@ -1288,9 +1401,12 @@ index 0000000..89c5448
+{
+ RegionPtr tracking;
+
++ if (!xmir_screen_get(xmir_win->win->drawable.pScreen)->dmps_on)
++ return;
++
+ xmir_win->has_free_buffer = FALSE;
-+ mir_surface_swap_buffers(xmir_win->surface, &handle_buffer_received, xmir_win);
+ tracking = damage_region_for_current_buffer(xmir_win);
++ mir_surface_swap_buffers(xmir_win->surface, &handle_buffer_received, xmir_win);
+
+ if (region == NULL)
+ RegionEmpty(tracking);
@@ -1316,9 +1432,9 @@ index 0000000..89c5448
+ return (RegionPtr)&xmir_empty_region;
+
+ if (xmir_win->damaged) {
++ int i;
+ RegionPtr damage = DamageRegion(xmir_win->damage);
+ RegionIntersect(damage, damage, &xmir_win->region);
-+ int i;
+
+ for (i = 0; i < MIR_MAX_BUFFER_AGE; i++) {
+ RegionUnion(&xmir_win->past_damage[i],
@@ -1487,10 +1603,10 @@ index 0000000..89c5448
+}
diff --git a/hw/xfree86/xmir/xmir.c b/hw/xfree86/xmir/xmir.c
new file mode 100644
-index 0000000..a294793
+index 0000000..569044e
--- /dev/null
+++ b/hw/xfree86/xmir/xmir.c
-@@ -0,0 +1,267 @@
+@@ -0,0 +1,262 @@
+/*
+ * Copyright © 2012 Canonical, Inc
+ *
@@ -1725,7 +1841,6 @@ index 0000000..a294793
+xMirSetup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
-+ const char *socket = "/tmp/mir_socket";
+
+ if (setupDone) {
+ if (errmaj)
@@ -1733,11 +1848,7 @@ index 0000000..a294793
+ return NULL;
+ }
+
-+
-+ if (mirSocket != NULL)
-+ socket = mirSocket;
-+
-+ conn = mir_connect_sync(socket, mirID);
++ conn = mir_connect_sync(mirSocket, mirID);
+
+ if (!mir_connection_is_valid(conn)) {
+ if (errmaj)
commit b7c62df832d9f4a87dce727c8f4e5db31a22ceff
Author: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Date: Mon Sep 2 15:40:41 2013 +1000
Fix thingy
diff --git a/debian/changelog b/debian/changelog
index 7b907ee..f5e4a33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+xorg-server (2:1.14.2.901-2ubuntu5) UNRELEASED; urgency=low
+
+ * xmir.patch: Drop input on loss of focus. Fixes "I'm sending all my
+ passwords to IRC when I switch to a VT" (LP: #1192843)
+
+ -- Christopher James Halse Rogers <raof@ubuntu.com> Mon, 02 Sep 2013 11:19:45 +1000
+
xorg-server (2:1.14.2.901-2ubuntu4) saucy; urgency=low
* xmir.patch: Add XRandR support
diff --git a/debian/control b/debian/control
index 9f7252e..9baf33b 100644
--- a/debian/control
+++ b/debian/control
@@ -85,6 +85,7 @@ Build-Depends:
libbsd-dev [kfreebsd-any],
# XMir
libmirclient-dev (>= 0.0.8+13.10.20130803) [!arm64 !powerpc],
+ libatomic-ops-dev,
Standards-Version: 3.9.3
Vcs-Git: git://git.debian.org/git/pkg-xorg/xserver/xorg-server
Vcs-Browser: http://git.debian.org/?p=pkg-xorg/xserver/xorg-server.git
diff --git a/debian/patches/xmir.patch b/debian/patches/xmir.patch
index 746fba3..f5fd263 100644
--- a/debian/patches/xmir.patch
+++ b/debian/patches/xmir.patch
@@ -1,5 +1,5 @@
diff --git a/configure.ac b/configure.ac
-index c6ecba4..cbba229 100644
+index c6ecba4..07d02d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,6 +635,7 @@ AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin w
@@ -15,11 +15,11 @@ index c6ecba4..cbba229 100644
fi
+if test "x$XMIR" != xno; then
-+ PKG_CHECK_MODULES([XMIR], [mirclient], [XMIR=yes], [XMIR=no])
++ PKG_CHECK_MODULES([XMIR], [mirclient atomic_ops], [XMIR=yes], [XMIR=no])
+ AC_SUBST([XMIR_LIBS])
+ AC_SUBST([XMIR_CFLAGS])
+ AC_DEFINE(XMIR, 1, [Support Mir nested mode])
-+ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES mirclient"
++ SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES mirclient atomic_ops"
+fi
+AM_CONDITIONAL(XMIR, [test "x$XMIR" = xyes])
+
@@ -91,6 +91,46 @@ index 74d5ed3..538ba4b 100644
if (xf86configptr->conf_modules) {
/* Walk the disable list and let people know what we've parsed to
* not be loaded
+diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
+index 7a949fd..4d416b4 100644
+--- a/hw/xfree86/common/xf86Events.c
++++ b/hw/xfree86/common/xf86Events.c
+@@ -105,8 +105,6 @@ extern fd_set EnabledDevices;
+ extern void (*xf86OSPMClose) (void);
+ #endif
+
+-static void xf86VTSwitch(void);
+-
+ /*
+ * Allow arbitrary drivers or other XFree86 code to register with our main
+ * Wakeup handler.
+@@ -410,7 +408,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
+ * xf86VTSwitch --
+ * Handle requests for switching the vt.
+ */
+-static void
++_X_EXPORT void
+ xf86VTSwitch(void)
+ {
+ int i;
+@@ -466,7 +464,7 @@ xf86VTSwitch(void)
+
+ xf86AccessLeave(); /* We need this here, otherwise */
+
+- if (!xf86VTSwitchAway()) {
++ if (!xorgMir && !xf86VTSwitchAway()) {
+ /*
+ * switch failed
+ */
+@@ -522,7 +520,7 @@ xf86VTSwitch(void)
+ }
+ else {
+ DebugF("xf86VTSwitch: Entering\n");
+- if (!xf86VTSwitchTo())
++ if (!xorgMir && !xf86VTSwitchTo())
+ return;
+
+ #ifdef XF86PM
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 7df7a80..17ed7c6 100644
--- a/hw/xfree86/common/xf86Globals.c
@@ -200,7 +240,7 @@ index 91ec4c8..0508e8d 100644
xf86UseMsg();
ErrorF("\n");
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
-index 58cfe0a..4630e9e 100644
Reply to: