Discussion:
[Linuxwacom-devel] [PATCH] Revert to Update properties with a timer func
Peter Hutterer
2017-02-22 23:47:27 UTC
Permalink
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 <***@who-t.net>
---
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
Jason Gerecke
2017-02-24 23:20:20 UTC
Permalink
Looks reasonable enough to me. Acked-by and pushed.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....



On Wed, Feb 22, 2017 at 3:47 PM, Peter Hutterer
Post by Peter Hutterer
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
---
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
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Loading...