From f3b303024e34cabb98896b4d8b11e3860c76203d Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Oct 2012 11:25:42 +1000 Subject: [PATCH 1/4] Add touchscreen fixes (including pointer emulation) #871064 --- ...er-memory-allocation-with-population.patch | 36 +++++++++++ ...viceState-after-the-first-emulated-m.patch | 60 +++++++++++++++++++ ...t-check-for-TOUCH_END-it-s-never-set.patch | 36 +++++++++++ ...-TouchEnd-to-a-client-waiting-for-To.patch | 37 ++++++++++++ xorg-x11-server.spec | 11 +++- 5 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 0001-Sync-TouchListener-memory-allocation-with-population.patch create mode 100644 0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch create mode 100644 0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch create mode 100644 0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch diff --git a/0001-Sync-TouchListener-memory-allocation-with-population.patch b/0001-Sync-TouchListener-memory-allocation-with-population.patch new file mode 100644 index 0000000..a2672e4 --- /dev/null +++ b/0001-Sync-TouchListener-memory-allocation-with-population.patch @@ -0,0 +1,36 @@ +From bbf4fe102fb67ed43fe57df085c40de525b8f4c0 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Thu, 25 Oct 2012 15:03:50 +0200 +Subject: [PATCH] Sync TouchListener memory allocation with population in + TouchSetupListeners() + +The allocated TouchListener array may fall short by 1 if hitting the worst case +situation where there's an active grab, passive grabs on each window in the +sprite trace and event selection for touch in one of the windows. This may lead +to memory corruptions as the array is overflown. + +Signed-off-by: Carlos Garnacho +Reviewed-by: Peter Hutterer +Signed-off-by: Peter Hutterer +--- + dix/touch.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dix/touch.c b/dix/touch.c +index e64a626..5f77be5 100644 +--- a/dix/touch.c ++++ b/dix/touch.c +@@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, + return FALSE; + + /* Mark which grabs/event selections we're delivering to: max one grab per +- * window plus the bottom-most event selection. */ +- ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners)); ++ * window plus the bottom-most event selection, plus any active grab. */ ++ ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners)); + if (!ti->listeners) { + sprite->spriteTraceGood = 0; + return FALSE; +-- +1.7.11.7 + diff --git a/0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch b/0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch new file mode 100644 index 0000000..91fd638 --- /dev/null +++ b/0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch @@ -0,0 +1,60 @@ +From 0068a5ae02c6b9ba3a7c8e83de452b6383222b8d Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 29 Oct 2012 18:33:50 +0100 +Subject: [PATCH] Xi: Call UpdateDeviceState() after the first emulated motion + event + +The emulated motion event that happens before TouchBegin/ButtonPress should +contain no buttons set in the mask, as it virtually happens at a time when +the button is not yet pressed. This is known to confuse GTK+ and Abiword +to different degrees, as enclosing button press/release events are expected +around changes in the button mask. + +Signed-off-by: Carlos Garnacho +Signed-off-by: Peter Hutterer +--- + Xi/exevents.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 4cbeb37..769bb41 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -1568,15 +1568,16 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) + else + touchid = ev->device_event.touchid; + +- if (emulate_pointer) +- UpdateDeviceState(dev, &ev->device_event); +- + if (type == ET_TouchBegin) { + ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid, + emulate_pointer); + } +- else ++ else { ++ if (emulate_pointer) ++ UpdateDeviceState(dev, &ev->device_event); ++ + ti = TouchFindByClientID(dev, touchid); ++ } + + /* Under the following circumstances we create a new touch record for an + * existing touch: +@@ -1615,8 +1616,12 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev) + /* if emulate_pointer is set, emulate the motion event right + * here, so we can ignore it for button event emulation. TouchUpdate + * events which _only_ emulate motion just work normally */ +- if (emulate_pointer && ev->any.type != ET_TouchUpdate) ++ if (emulate_pointer && ev->any.type != ET_TouchUpdate) { + DeliverEmulatedMotionEvent(dev, ti, ev); ++ ++ if (ev->any.type == ET_TouchBegin) ++ UpdateDeviceState(dev, &ev->device_event); ++ } + if (emulate_pointer && IsMaster(dev)) + CheckMotion(&ev->device_event, dev); + +-- +1.7.11.7 + diff --git a/0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch b/0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch new file mode 100644 index 0000000..7cb6326 --- /dev/null +++ b/0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch @@ -0,0 +1,36 @@ +From 3e6358ee6c33979329b78fe2097a1fdf76fb69cd Mon Sep 17 00:00:00 2001 +From: Daniel Drake +Date: Fri, 7 Sep 2012 21:48:35 -0400 +Subject: [PATCH] Xi: Don't check for TOUCH_END, it's never set + +This flag is never set, so checking for it here means that we'll +never release the simulated mouse button press after the user touches +(and releases) the touchscreen for the first time. + +Fixes a problem where the XO laptop touchpad became totally +unusable after touching the screen for the first time (since X then +behaved as if the mouse button was held down all the time). + +Signed-off-by: Daniel Drake +Reviewed-by: Chase Douglas +Signed-off-by: Peter Hutterer +--- + Xi/exevents.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 494d07e..6ed4991 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -949,8 +949,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event) + + if (!(event->flags & TOUCH_POINTER_EMULATED)) + return DONT_PROCESS; +- if (!(event->flags & TOUCH_END)) +- return DONT_PROCESS; + + DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask, + &t->state); +-- +1.7.11.7 + diff --git a/0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch b/0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch new file mode 100644 index 0000000..143fc7a --- /dev/null +++ b/0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch @@ -0,0 +1,37 @@ +From 676447190190d8546165e21be242cf16dd69f5ae Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 17 Oct 2012 14:13:29 +1000 +Subject: [PATCH] Xi: don't deliver TouchEnd to a client waiting for + TouchBegin (#55738) + +If a client is still waiting for the TouchBegin, don't deliver a TouchEnd +event. + +X.Org Bug 55738 + +Signed-off-by: Peter Hutterer +Tested-by: Thomas Jaeger +Reviewed-by: Keith Packard +--- + Xi/exevents.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 6ed4991..4cbeb37 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -1862,6 +1862,11 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev, + goto out; + } + ++ if (listener->state == LISTENER_AWAITING_BEGIN) { ++ listener->state = LISTENER_HAS_END; ++ goto out; ++ } ++ + /* Event in response to reject */ + if (ev->device_event.flags & TOUCH_REJECT) { + if (listener->state != LISTENER_HAS_END) +-- +1.7.11.7 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 4a671e2..36c0f2e 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -43,7 +43,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.13.0 -Release: 5%{?gitdate:.%{gitdate}}%{dist} +Release: 6%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -119,6 +119,12 @@ Patch7054: 0001-config-udev-ignore-change-on-drm-devices.patch # device (ie virtual machine usb tablet) Patch7055: 0001-dix-set-the-device-transformation-matrix.patch +# Bug 871064 - Add touchscreen fixes for F18 +Patch7056: 0001-Sync-TouchListener-memory-allocation-with-population.patch +Patch7057: 0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch +Patch7058: 0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch +Patch7059: 0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch + %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -591,6 +597,9 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Tue Oct 30 2012 Peter Hutterer 1.13.0-6 +- Add touchscreen fixes (including pointer emulation) #871064 + * Thu Sep 20 2012 Peter Hutterer 1.13.0-5 - Set the transformation matrix to the unity matrix to avoid spurious cursor jumps (#852841) From 41e970ccc4fa1c00cddbb00248f2df67abfe27e8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 31 Oct 2012 12:22:15 +1000 Subject: [PATCH 2/4] Fix build issues on new kernels caused by removal of _INPUT_H --- ...ix-build-against-recent-Linux-kernel.patch | 35 +++++++++++++++++++ xorg-x11-server.spec | 8 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 0001-xf86-Fix-build-against-recent-Linux-kernel.patch diff --git a/0001-xf86-Fix-build-against-recent-Linux-kernel.patch b/0001-xf86-Fix-build-against-recent-Linux-kernel.patch new file mode 100644 index 0000000..db59b9f --- /dev/null +++ b/0001-xf86-Fix-build-against-recent-Linux-kernel.patch @@ -0,0 +1,35 @@ +From c5396ec05a5c6cab6608ba677f703c5227b1de13 Mon Sep 17 00:00:00 2001 +From: Thierry Reding +Date: Wed, 17 Oct 2012 12:11:49 +0200 +Subject: [PATCH] xf86: Fix build against recent Linux kernel + +Recent Linux kernels reworked the linux/input.h header file, which is +now part of the "user-space API". The include guard therefore has an +additional additional _UAPI prefix. + +Instead of adding another case to the #ifdef, drop any include guard +checks and instead always undefine the BUS_* definitions on Linux. + +Signed-off-by: Thierry Reding +Reviewed-by: Peter Hutterer +Signed-off-by: Peter Hutterer +--- + hw/xfree86/common/xf86str.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h +index 0590262..4c2d147 100644 +--- a/hw/xfree86/common/xf86str.h ++++ b/hw/xfree86/common/xf86str.h +@@ -347,7 +347,7 @@ typedef struct _DriverRec { + */ + + /* Tolerate prior #include */ +-#if defined(linux) && defined(_INPUT_H) ++#if defined(linux) + #undef BUS_NONE + #undef BUS_PCI + #undef BUS_SBUS +-- +1.7.11.7 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 36c0f2e..aa2decd 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -43,7 +43,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.13.0 -Release: 6%{?gitdate:.%{gitdate}}%{dist} +Release: 7%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -125,6 +125,9 @@ Patch7057: 0001-Xi-Call-UpdateDeviceState-after-the-first-emulated-m.patch Patch7058: 0001-Xi-Don-t-check-for-TOUCH_END-it-s-never-set.patch Patch7059: 0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch +# kernel doesn't use _INPUT_H anymore +Patch7060: 0001-xf86-Fix-build-against-recent-Linux-kernel.patch + %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -597,6 +600,9 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Wed Oct 31 2012 Peter Hutterer 1.13.0-7 +- Fix build issues on new kernels caused by removal of _INPUT_H + * Tue Oct 30 2012 Peter Hutterer 1.13.0-6 - Add touchscreen fixes (including pointer emulation) #871064 From db986136c7c63a80ecb972d188c15144eaf9fb25 Mon Sep 17 00:00:00 2001 From: Jiri Kastner Date: Tue, 27 Nov 2012 11:54:21 +0100 Subject: [PATCH 3/4] Fix for non-PCI configuration-less setups --- ...ix-non-PCI-configuration-less-setups.patch | 53 +++++++++++++++++++ xorg-x11-server.spec | 8 ++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 v2-xf86-Fix-non-PCI-configuration-less-setups.patch diff --git a/v2-xf86-Fix-non-PCI-configuration-less-setups.patch b/v2-xf86-Fix-non-PCI-configuration-less-setups.patch new file mode 100644 index 0000000..5afa39a --- /dev/null +++ b/v2-xf86-Fix-non-PCI-configuration-less-setups.patch @@ -0,0 +1,53 @@ +From patchwork Wed Oct 17 10:06:47 2012 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [v2] xf86: Fix non-PCI configuration-less setups +Date: Wed, 17 Oct 2012 10:06:47 -0000 +From: Thierry Reding +X-Patchwork-Id: 12233 +Message-Id: <1350468407-27681-1-git-send-email-thierry.reding@avionic-design.de> +To: xorg-devel@lists.x.org +Cc: Dave Airlie + +For non-PCI video devices, such as those found on many ARM embedded +systems, the X server currently requires the BusID option to specify the +full path to the DRM device's sysfs node in order to properly match it +against the probed platform devices. + +In order to allow X to start up properly if either the BusID option was +omitted or no configuration is present at all, the first video device is +used by default. + +Signed-off-by: Thierry Reding + +--- +Changes in v2: +- Add additional checks for safety (I don't think numDevs will ever be 0 + since a default will be generated if no configuration is present, but + it doesn't hurt to check anyway). Without these checks there is a + possibility of the X server crashing if no platform devices have been + found. + + hw/xfree86/common/xf86platformBus.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c +index 0525e39..599d84a 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -377,6 +377,14 @@ xf86platformProbeDev(DriverPtr drvp) + continue; + } + ++ /* ++ * If all of the above fails, which can happen if X was started without ++ * configuration or if BusID wasn't set for non-PCI devices, use the first ++ * device by default. ++ */ ++ if (!foundScreen && xf86_num_platform_devices > 0 && numDevs > 0) ++ foundScreen = probeSingleDevice(&xf86_platform_devices[0], drvp, devList[0], 0); ++ + /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */ + if (xf86Info.autoAddGPU && numDevs) { + for (j = 0; j < xf86_num_platform_devices; j++) { diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index aa2decd..030ba11 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -43,7 +43,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.13.0 -Release: 7%{?gitdate:.%{gitdate}}%{dist} +Release: 8%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -128,6 +128,9 @@ Patch7059: 0001-Xi-don-t-deliver-TouchEnd-to-a-client-waiting-for-To.patch # kernel doesn't use _INPUT_H anymore Patch7060: 0001-xf86-Fix-build-against-recent-Linux-kernel.patch +# Fix non-PCI configuration-less setups +Patch7061: v2-xf86-Fix-non-PCI-configuration-less-setups.patch + %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -600,6 +603,9 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Tue Nov 27 2012 Jiri Kastner 1.13.0-8 +- Fix for non-PCI configuration-less setups + * Wed Oct 31 2012 Peter Hutterer 1.13.0-7 - Fix build issues on new kernels caused by removal of _INPUT_H From 45aae11391849e651876ab8c508f314301992b11 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Nov 2012 08:48:32 +1000 Subject: [PATCH 4/4] Fix server crash when a XI 1.x device grab is activated on a disabled synaptics touchpad is disabled --- ...-XI-1.x-grabs-on-disabled-devices.-5.patch | 60 +++++++++++++++++++ xorg-x11-server.spec | 9 ++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch diff --git a/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch b/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch new file mode 100644 index 0000000..02db1ca --- /dev/null +++ b/0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch @@ -0,0 +1,60 @@ +From 9d6b8365702e4648e793fea21ad22f7174558680 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 28 Sep 2012 11:49:29 +1000 +Subject: [PATCH] dix: fix crash on XI 1.x grabs on disabled devices. + (#54934) + +If the device is disabled, the sprite window is NULL and dereferencing +crashes the server. + +This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would +trigger another code path, creating a sprite for the disabled device as if +detaching it (which is wrong and fixed with this patch too). + +Grabbing a disabled device doesn't make sense as it won't send events +anyway. However, the protocol specs do not prohibit it, so we need to keep +it working. +Luckily, oldWin is only used for focus out events, which aren't necessary +given that the device is disabled. + +X.Org Bug 54934 + +Signed-off-by: Peter Hutterer +Reviewed-by: Chase Douglas +--- + dix/events.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/dix/events.c b/dix/events.c +index 3b40446..c0e330b 100644 +--- a/dix/events.c ++++ b/dix/events.c +@@ -1555,11 +1555,13 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, + WindowPtr oldWin; + + /* slave devices need to float for the duration of the grab. */ +- if (grab->grabtype == XI2 && ++ if (grab->grabtype == XI2 && keybd->enabled && + !(passive & ImplicitGrabMask) && !IsMaster(keybd)) + DetachFromMaster(keybd); + +- if (grabinfo->grab) ++ if (!keybd->enabled) ++ oldWin = NULL; ++ else if (grabinfo->grab) + oldWin = grabinfo->grab->window; + else if (keybd->focus) + oldWin = keybd->focus->win; +@@ -1569,7 +1571,8 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, + oldWin = keybd->focus->win; + if (keybd->valuator) + keybd->valuator->motionHintWindow = NullWindow; +- DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); ++ if (oldWin) ++ DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); + if (syncEvents.playingEvents) + grabinfo->grabTime = syncEvents.time; + else +-- +1.7.11.7 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 030ba11..98d07e9 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -43,7 +43,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.13.0 -Release: 8%{?gitdate:.%{gitdate}}%{dist} +Release: 9%{?gitdate:.%{gitdate}}%{dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -131,6 +131,9 @@ Patch7060: 0001-xf86-Fix-build-against-recent-Linux-kernel.patch # Fix non-PCI configuration-less setups Patch7061: v2-xf86-Fix-non-PCI-configuration-less-setups.patch +# fdo Bug 54934 - Crash on XGrabDevice() of deactivated synaptics device - +Patch7062: 0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch + %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri %global sdkdir %{_includedir}/xorg @@ -603,6 +606,10 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Wed Nov 28 2012 Peter Hutterer 1.13.0-9 +- Fix server crash when a XI 1.x device grab is activated on a disabled + synaptics touchpad is disabled + * Tue Nov 27 2012 Jiri Kastner 1.13.0-8 - Fix for non-PCI configuration-less setups