summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: ce53fae)
raw | patch | inline | side by side (from parent 1: ce53fae)
author | Chase Douglas <chase.douglas@ubuntu.com> | |
Wed, 20 Jun 2012 16:12:44 +0000 (09:12 -0700) | ||
committer | Xavier Boudet <x-boudet@ti.com> | |
Tue, 3 Jul 2012 16:57:27 +0000 (18:57 +0200) |
debian/changelog | patch | blob | history | |
debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch | [new file with mode: 0644] | patch | blob |
debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch | [new file with mode: 0644] | patch | blob |
debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch | [new file with mode: 0644] | patch | blob |
debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch | [new file with mode: 0644] | patch | blob |
debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch | [new file with mode: 0644] | patch | blob |
debian/patches/515-dix-disable-all-devices-before-shutdown.patch | [new file with mode: 0644] | patch | blob |
debian/patches/series | patch | blob | history |
diff --git a/debian/changelog b/debian/changelog
index bc906d22872b7521843a4bf7fd5df2535dc4858e..e052fc10d54d06cda1ee4254e4bf63bee64ab37a 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
+xorg-server (2:1.11.4-0ubuntu10.3) precise-proposed; urgency=low
+
+ [ Maarten Lankhorst ]
+ * Add upstream patches for proper device disabling (LP: #1009629)
+ - 510-dix-return-early-from-DisableDevice-if-the-device-is.patch
+ - 511-dix-move-freeing-the-sprite-into-a-function.patch
+ - 512-dix-free-the-sprite-when-disabling-the-device.patch
+ - 513-dix-disable-non-sprite-owners-first-when-disabling-p.patch
+ - 514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch
+ - 515-dix-disable-all-devices-before-shutdown.patch
+
+ -- Chase Douglas <chase.douglas@ubuntu.com> Wed, 20 Jun 2012 09:12:44 -0700
+
xorg-server (2:1.11.4-0ubuntu10.2) precise-proposed; urgency=low
* Release buttons when device is disabled on suspend (LP: #968845)
diff --git a/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch b/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch
--- /dev/null
@@ -0,0 +1,29 @@
+From 46adcefb0e08515195d8e49985a4e210395700b3 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 10 May 2012 12:10:12 +1000
+Subject: [PATCH 07/12] dix: return early from DisableDevice if the device is
+ already disabled
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+ dix/devices.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/dix/devices.c b/dix/devices.c
+index df46497..6acff4f 100644
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -428,6 +428,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
+ BOOL enabled;
+ int flags[MAXDEVICES] = { 0 };
+
++ if (!dev->enabled)
++ return TRUE;
++
+ for (prev = &inputInfo.devices;
+ *prev && (*prev != dev); prev = &(*prev)->next);
+ if (*prev != dev)
+--
+1.7.9.5
+
diff --git a/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch b/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch
--- /dev/null
@@ -0,0 +1,62 @@
+From e57d6a89027c55fef987cdc259668c48a8b4ea1b Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 10 May 2012 15:32:20 +1000
+Subject: [PATCH 08/12] dix: move freeing the sprite into a function
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+ dix/devices.c | 7 +------
+ dix/events.c | 12 ++++++++++++
+ include/dix.h | 2 ++
+ 3 files changed, 15 insertions(+), 6 deletions(-)
+
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -949,12 +949,7 @@
+ free(classes);
+ }
+
+- if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+- if (dev->spriteInfo->sprite->current)
+- FreeCursor(dev->spriteInfo->sprite->current, None);
+- free(dev->spriteInfo->sprite->spriteTrace);
+- free(dev->spriteInfo->sprite);
+- }
++ FreeSprite(dev);
+
+ /* a client may have the device set as client pointer */
+ for (j = 0; j < currentMaxClients; j++)
+--- a/dix/events.c
++++ b/dix/events.c
+@@ -3323,6 +3323,18 @@
+ #endif
+ }
+
++void FreeSprite(DeviceIntPtr dev)
++{
++ if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
++ if (dev->spriteInfo->sprite->current)
++ FreeCursor(dev->spriteInfo->sprite->current, None);
++ free(dev->spriteInfo->sprite->spriteTrace);
++ free(dev->spriteInfo->sprite);
++ }
++ dev->spriteInfo->sprite = NULL;
++}
++
++
+ /**
+ * Update the mouse sprite info when the server switches from a pScreen to another.
+ * Otherwise, the pScreen of the mouse sprite is never updated when we switch
+--- a/include/dix.h
++++ b/include/dix.h
+@@ -417,6 +417,9 @@
+ DeviceIntPtr /* pDev */,
+ WindowPtr /* pWin */);
+
++extern void FreeSprite(
++ DeviceIntPtr /* pDev */);
++
+ extern void UpdateSpriteForScreen(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScreen */);
diff --git a/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch b/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch
--- /dev/null
@@ -0,0 +1,31 @@
+From df1704365e700d3cf1d36a241bdfc479159a8df7 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 10 May 2012 15:33:15 +1000
+Subject: [PATCH 09/12] dix: free the sprite when disabling the device
+
+Disabled devices don't need sprites (they can't send events anyway) and the
+device init process is currently geared to check for whether sprite is
+present to check if the device should be paired/attached.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+ dix/devices.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/dix/devices.c b/dix/devices.c
+index a280dee..f134f31 100644
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -465,6 +465,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
+ (void) (*dev->deviceProc) (dev, DEVICE_OFF);
+ dev->enabled = FALSE;
+
++ FreeSprite(dev);
++
+ /* now that the device is disabled, we can reset the signal handler's
+ * last.slave */
+ OsBlockSignals();
+--
+1.7.9.5
+
diff --git a/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch b/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch
--- /dev/null
@@ -0,0 +1,41 @@
+From e433d1046c222f9d969c2c28a4651ff9097614f4 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 10 May 2012 12:42:59 +1000
+Subject: [PATCH 10/12] dix: disable non-sprite-owners first when disabling
+ paired devices
+
+If a sprite-owner is to be disabled but still paired, disable the paired
+device first. i.e. disabling a master pointer will disable the master
+keyboard first.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+Altered to apply to stable
+
+ dix/devices.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -477,15 +477,14 @@
+ {
+ for (other = inputInfo.devices; other; other = other->next)
+ {
+- if (other->spriteInfo->paired == dev)
+- {
+- ErrorF("[dix] cannot disable device, still paired. "
+- "This is a bug. \n");
+- return FALSE;
+- }
++ if (other->spriteInfo->paired == dev && !other->spriteInfo->spriteOwner)
++ DisableDevice(other, sendevent);
+ }
+ }
+
++ if (dev->spriteInfo->paired)
++ dev->spriteInfo->paired = NULL;
++
+ (void)(*dev->deviceProc)(dev, DEVICE_OFF);
+ dev->enabled = FALSE;
+
diff --git a/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch b/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch
--- /dev/null
@@ -0,0 +1,33 @@
+From 9c0e820216cd1631f75b037b7908d55ac091692c Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 10 May 2012 12:55:44 +1000
+Subject: [PATCH 11/12] Xi: drop forced unpairing when changing the hierarchy
+
+Devices are unpaired as needed on DisableDevice now.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+ Xi/xichangehierarchy.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
+index 756aaac..89f16d8 100644
+--- a/Xi/xichangehierarchy.c
++++ b/Xi/xichangehierarchy.c
+@@ -293,12 +293,6 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
+ }
+ }
+
+- /* can't disable until we removed pairing */
+- keybd->spriteInfo->paired = NULL;
+- ptr->spriteInfo->paired = NULL;
+- XTestptr->spriteInfo->paired = NULL;
+- XTestkeybd->spriteInfo->paired = NULL;
+-
+ /* disable the remove the devices, XTest devices must be done first
+ else the sprites they rely on will be destroyed */
+ DisableDevice(XTestptr, FALSE);
+--
+1.7.9.5
+
diff --git a/debian/patches/515-dix-disable-all-devices-before-shutdown.patch b/debian/patches/515-dix-disable-all-devices-before-shutdown.patch
--- /dev/null
@@ -0,0 +1,85 @@
+From 4c68f5d395c66f28b56e488cb3cd12f36820357b Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed, 9 May 2012 09:21:28 +1000
+Subject: [PATCH 12/12] dix: disable all devices before shutdown
+
+f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server
+shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
+are usually still down) sending a raw event will segfault the server. The
+the root windows are set to NULL before calling CloseDownDevices().
+
+Avoid this by disabling all devices first when shutting down. Disabled
+devices won't send events anymore.
+
+Master keyboards must be disabled first, otherwise disabling the pointer
+will trigger DisableDevice(keyboard) and the keyboard is removed from the
+inputInfo.devices list and moved to inputInfo.off_devices. A regular loop
+through inputInfo.devices would thus jump to off_devices and not recover.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Acked-by: Chase Douglas <chase.douglas@canonical.com>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+ dix/devices.c | 20 ++++++++++++++++++++
+ dix/main.c | 4 ++++
+ include/input.h | 2 +-
+ 3 files changed, 25 insertions(+), 1 deletion(-)
+
+--- a/dix/devices.c
++++ b/dix/devices.c
+@@ -524,6 +524,26 @@
+ return TRUE;
+ }
+
++void
++DisableAllDevices(void)
++{
++ DeviceIntPtr dev, tmp;
++
++ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
++ if (!IsMaster(dev))
++ DisableDevice(dev, FALSE);
++ }
++ /* master keyboards need to be disabled first */
++ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
++ if (dev->enabled && IsMaster(dev) && IsKeyboardDevice(dev))
++ DisableDevice(dev, FALSE);
++ }
++ nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
++ if (dev->enabled)
++ DisableDevice(dev, FALSE);
++ }
++}
++
+ /**
+ * Initialise a new device through the driver and tell all clients about the
+ * new device.
+--- a/dix/main.c
++++ b/dix/main.c
+@@ -105,6 +105,7 @@
+ #include "privates.h"
+ #include "registry.h"
+ #include "client.h"
++#include "exevents.h"
+ #ifdef PANORAMIX
+ #include "panoramiXsrv.h"
+ #else
+@@ -294,6 +295,7 @@
+ #endif
+
+ UndisplayDevices();
++ DisableAllDevices();
+
+ /* Now free up whatever must be freed */
+ if (screenIsSaved == SCREEN_SAVER_ON)
+--- a/include/input.h
++++ b/include/input.h
+@@ -280,7 +280,7 @@
+ extern _X_EXPORT Bool DisableDevice(
+ DeviceIntPtr /*device*/,
+ BOOL /* sendevent */);
+-
++extern void DisableAllDevices(void);
+ extern int InitAndStartDevices(void);
+
+ extern void CloseDownDevices(void);
diff --git a/debian/patches/series b/debian/patches/series
index 1b863e7ccfa108fc4f45b4760946cebb26a3829d..775d106ab7d1f7d8e32b593948b78cc0bede07f7 100644 (file)
--- a/debian/patches/series
+++ b/debian/patches/series
506_touchscreen_pointer_emulation_checks.patch
507_touchscreen_fixes.patch
508_device_off_release_buttons.patch
+
+# Upstream patches
+510-dix-return-early-from-DisableDevice-if-the-device-is.patch
+511-dix-move-freeing-the-sprite-into-a-function.patch
+512-dix-free-the-sprite-when-disabling-the-device.patch
+513-dix-disable-non-sprite-owners-first-when-disabling-p.patch
+514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch
+515-dix-disable-all-devices-before-shutdown.patch