debian/changelog | 7 debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch | 29 ++ debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch | 70 ++++++ debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch | 31 ++ debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch | 45 ++++ debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch | 33 +++ debian/patches/515-dix-disable-all-devices-before-shutdown.patch | 104 ++++++++++ debian/patches/series | 8 8 files changed, 327 insertions(+)
New commits: commit 65e8e82dd7069543858872ca63911abfd23d2b59 Author: Maarten Lankhorst <[email protected]> Date: Wed Jun 20 17:01:37 2012 +0200 Add upstream patches for proper device disabling * Add upstream patches for proper device disabling: - 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 diff --git a/debian/changelog b/debian/changelog index 6800c19..135c501 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,13 @@ xorg-server (2:1.12.1.902-1ubuntu1) UNRELEASED; urgency=medium - 507_touchscreen_fixes.patch * Non-trivial refresh of 500_pointer_barrier_thresholds.diff, based on xorg-edgers * Rest was refreshed with patch-x-indent.sh to survive coding style changes + * Add upstream patches for proper device disabling: + - 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 [ Bryce Harrington ] * Drop 209_add_legacy_bgnone_option.patch: lightdm and other *dm's have 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 new file mode 100644 index 0000000..87ae244 --- /dev/null +++ b/debian/patches/510-dix-return-early-from-DisableDevice-if-the-device-is.patch @@ -0,0 +1,29 @@ +From 46adcefb0e08515195d8e49985a4e210395700b3 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- + 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 new file mode 100644 index 0000000..cd4db33 --- /dev/null +++ b/debian/patches/511-dix-move-freeing-the-sprite-into-a-function.patch @@ -0,0 +1,70 @@ +From e57d6a89027c55fef987cdc259668c48a8b4ea1b Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- + dix/devices.c | 7 +------ + dix/events.c | 12 ++++++++++++ + include/dix.h | 2 ++ + 3 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/dix/devices.c b/dix/devices.c +index 6acff4f..a280dee 100644 +--- a/dix/devices.c ++++ b/dix/devices.c +@@ -918,12 +918,7 @@ CloseDevice(DeviceIntPtr dev) + 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++) { +diff --git a/dix/events.c b/dix/events.c +index 83ae5c9..49894fa 100644 +--- a/dix/events.c ++++ b/dix/events.c +@@ -3192,6 +3192,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) + #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 +diff --git a/include/dix.h b/include/dix.h +index 5dc2ac5..3d8b0e5 100644 +--- a/include/dix.h ++++ b/include/dix.h +@@ -395,6 +395,8 @@ DeliverTouchEvents(DeviceIntPtr /* dev */ , + extern void + InitializeSprite(DeviceIntPtr /* pDev */ , + WindowPtr /* pWin */ ); ++extern void ++FreeSprite(DeviceIntPtr pDev); + + extern void + UpdateSpriteForScreen(DeviceIntPtr /* pDev */ , +-- +1.7.9.5 + 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 new file mode 100644 index 0000000..0ba5be4 --- /dev/null +++ b/debian/patches/512-dix-free-the-sprite-when-disabling-the-device.patch @@ -0,0 +1,31 @@ +From df1704365e700d3cf1d36a241bdfc479159a8df7 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- + 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 new file mode 100644 index 0000000..0f7301a --- /dev/null +++ b/debian/patches/513-dix-disable-non-sprite-owners-first-when-disabling-p.patch @@ -0,0 +1,45 @@ +From e433d1046c222f9d969c2c28a4651ff9097614f4 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- +Altered to apply to stable + + dix/devices.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/dix/devices.c b/dix/devices.c +index f134f31..c5a713f 100644 +--- a/dix/devices.c ++++ b/dix/devices.c +@@ -455,13 +455,13 @@ + + if (IsMaster(dev) && dev->spriteInfo->sprite) { + 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; + +-- +1.7.9.5 + 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 new file mode 100644 index 0000000..19e3d8a --- /dev/null +++ b/debian/patches/514-Xi-drop-forced-unpairing-when-changing-the-hierarchy.patch @@ -0,0 +1,33 @@ +From 9c0e820216cd1631f75b037b7908d55ac091692c Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- + 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 new file mode 100644 index 0000000..b368b6e --- /dev/null +++ b/debian/patches/515-dix-disable-all-devices-before-shutdown.patch @@ -0,0 +1,104 @@ +From 4c68f5d395c66f28b56e488cb3cd12f36820357b Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <[email protected]> +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 <[email protected]> +Acked-by: Chase Douglas <[email protected]> +Reviewed-by: Chase Douglas <[email protected]> +--- + dix/devices.c | 20 ++++++++++++++++++++ + dix/main.c | 4 ++++ + include/input.h | 2 +- + 3 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/dix/devices.c b/dix/devices.c +index c5a713f..08875bc 100644 +--- a/dix/devices.c ++++ b/dix/devices.c +@@ -501,6 +501,26 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) + 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. +diff --git a/dix/main.c b/dix/main.c +index 70dcc94..df9023e 100644 +--- a/dix/main.c ++++ b/dix/main.c +@@ -104,6 +104,7 @@ Equipment Corporation. + #include "privates.h" + #include "registry.h" + #include "client.h" ++#include "exevents.h" + #ifdef PANORAMIX + #include "panoramiXsrv.h" + #else +@@ -295,6 +296,7 @@ main(int argc, char *argv[], char *envp[]) + #endif + + UndisplayDevices(); ++ DisableAllDevices(); + + /* Now free up whatever must be freed */ + if (screenIsSaved == SCREEN_SAVER_ON) +@@ -318,7 +320,9 @@ main(int argc, char *argv[], char *envp[]) + + for (i = 0; i < screenInfo.numScreens; i++) + screenInfo.screens[i]->root = NullWindow; ++ + CloseDownDevices(); ++ + CloseDownEvents(); + + for (i = screenInfo.numScreens - 1; i >= 0; i--) { +diff --git a/include/input.h b/include/input.h +index bcf98a6..5747f3c 100644 +--- a/include/input.h ++++ b/include/input.h +@@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device */ , + + extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ , + BOOL /* sendevent */ ); +- ++extern void DisableAllDevices(void); + extern int InitAndStartDevices(void); + + extern void CloseDownDevices(void); +-- +1.7.9.5 + diff --git a/debian/patches/series b/debian/patches/series index 291778c..bf823d8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -26,3 +26,11 @@ # Temporary, until it's reviewed & accepted upstream 500_pointer_barrier_thresholds.diff 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 -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

