From 42c9b4cc037a3946f80ab63c8a9e12754a3da82b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 23 Feb 2017 09:51:12 +1000 Subject: [PATCH] Don't update properties from within the input thread --- ...-update-properties-with-a-timer-func.patch | 108 ++++++++++++++++++ xorg-x11-drv-wacom.spec | 8 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 0001-Revert-to-update-properties-with-a-timer-func.patch diff --git a/0001-Revert-to-update-properties-with-a-timer-func.patch b/0001-Revert-to-update-properties-with-a-timer-func.patch new file mode 100644 index 0000000..1599e1b --- /dev/null +++ b/0001-Revert-to-update-properties-with-a-timer-func.patch @@ -0,0 +1,108 @@ +From cd53371e9a4a7ea64ba805dafa92f2e48528a938 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Thu, 23 Feb 2017 09:33:24 +1000 +Subject: [PATCH] Revert to update properties with a timer func + +This was required when we only had the SIGIO handler because sending events +allocates memory and things break. Now with the input thread we *can* send +events from within the thread but it can mess up other delivery. + +https://bugs.freedesktop.org/show_bug.cgi?id=99887 + +Signed-off-by: Peter Hutterer +--- + src/wcmXCommand.c | 29 +++++++++++++---------------- + 1 file changed, 13 insertions(+), 16 deletions(-) + +diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c +index df7fcea..0e1d657 100644 +--- a/src/wcmXCommand.c ++++ b/src/wcmXCommand.c +@@ -656,20 +656,22 @@ wcmSetHWTouchProperty(InputInfoPtr pInfo) + prop->size, &prop_value, TRUE); + } + +-#if !HAVE_THREADED_INPUT + static CARD32 + touchTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) + { + InputInfoPtr pInfo = arg; ++#if !HAVE_THREADED_INPUT + int sigstate = xf86BlockSIGIO(); ++#endif + + wcmSetHWTouchProperty(pInfo); + ++#if !HAVE_THREADED_INPUT + xf86UnblockSIGIO(sigstate); ++#endif + + return 0; + } +-#endif + + /** + * Update HW touch property when its state is changed by touch switch +@@ -684,14 +686,10 @@ wcmUpdateHWTouchProperty(WacomDevicePtr priv, int hw_touch) + + common->wcmHWTouchSwitchState = hw_touch; + +-#if HAVE_THREADED_INPUT +- wcmSetHWTouchProperty(priv->pInfo); +-#else +- /* This function is called during SIGIO. Schedule timer for property +- * event delivery outside of signal handler. */ ++ /* This function is called during SIGIO/InputThread. Schedule timer ++ * for property event delivery by the main thread. */ + priv->touch_timer = TimerSet(priv->touch_timer, 0 /* reltime */, + 1, touchTimerFunc, priv->pInfo); +-#endif + } + + /** +@@ -1074,20 +1072,23 @@ wcmSetSerialProperty(InputInfoPtr pInfo) + prop->size, prop_value, TRUE); + } + +-#if !HAVE_THREADED_INPUT + static CARD32 + serialTimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) + { + InputInfoPtr pInfo = arg; ++ ++#if !HAVE_THREADED_INPUT + int sigstate = xf86BlockSIGIO(); ++#endif + + wcmSetSerialProperty(pInfo); + ++#if !HAVE_THREADED_INPUT + xf86UnblockSIGIO(sigstate); ++#endif + + return 0; + } +-#endif + + void + wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id) +@@ -1100,14 +1101,10 @@ wcmUpdateSerial(InputInfoPtr pInfo, unsigned int serial, int id) + priv->cur_serial = serial; + priv->cur_device_id = id; + +-#if HAVE_THREADED_INPUT +- wcmSetSerialProperty(pInfo); +-#else +- /* This function is called during SIGIO. Schedule timer for property +- * event delivery outside of signal handler. */ ++ /* This function is called during SIGIO/InputThread. Schedule timer ++ * for property event delivery by the main thread. */ + priv->serial_timer = TimerSet(priv->serial_timer, 0 /* reltime */, + 1, serialTimerFunc, pInfo); +-#endif + } + + static void +-- +2.9.3 + diff --git a/xorg-x11-drv-wacom.spec b/xorg-x11-drv-wacom.spec index c7e6f63..88acaeb 100644 --- a/xorg-x11-drv-wacom.spec +++ b/xorg-x11-drv-wacom.spec @@ -9,7 +9,7 @@ Summary: Xorg X11 wacom input driver Name: xorg-x11-drv-wacom Version: 0.34.0 -Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} URL: http://www.x.org License: GPLv2+ Group: User Interface/X Hardware Support @@ -22,6 +22,8 @@ Source2: commitid Source0: http://prdownloads.sourceforge.net/linuxwacom/xf86-input-wacom-%{version}.tar.bz2 %endif +Patch01: 0001-Revert-to-update-properties-with-a-timer-func.patch + ExcludeArch: s390 s390x BuildRequires: xorg-x11-server-devel >= 1.10.99.902 @@ -41,6 +43,7 @@ X.Org X11 wacom input driver for Wacom tablets. %prep %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}} +%patch01 -p1 %build autoreconf --force -v --install || exit 1 @@ -93,6 +96,9 @@ X.Org X11 wacom input driver development files. %{_bindir}/isdv4-serial-debugger %changelog +* Thu Feb 23 2017 Peter Hutterer 0.34.0-3 +- Don't update properties from within the input thread + * Sat Feb 11 2017 Fedora Release Engineering - 0.34.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild