SynapticsHwStruct (SHS) will soon include ValuatorMasks, which can only be allocated on the heap. The input driver callbacks are called in signal context, so we can't instantiate a new SHS when that occurs. Since we only ever need one SHS, allocate one at device init time and use it in place of local SHS instances.
Signed-off-by: Chase Douglas <[email protected]> --- src/synaptics.c | 23 ++++++++++++++++------- src/synapticsstr.h | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/synaptics.c b/src/synaptics.c index 48fa519..6213f84 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -934,6 +934,8 @@ DeviceClose(DeviceIntPtr dev) TimerFree(priv->timer); priv->timer = NULL; free_shm_data(priv); + SynapticsHwStateFree(priv->local_hw_state); + priv->local_hw_state = NULL; return RetValue; } @@ -1179,8 +1181,15 @@ no_touch: free(axes_labels); + priv->local_hw_state = SynapticsHwStateAlloc(priv); + if (!priv->local_hw_state) + return !Success; + if (!alloc_shm_data(pInfo)) + { + free(priv->local_hw_state); return !Success; + } InitDeviceProperties(pInfo); XIRegisterPropertyHandler(pInfo->dev, SetProperty, NULL, NULL); @@ -1310,15 +1319,15 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) { InputInfoPtr pInfo = arg; SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); - struct SynapticsHwState hw; + struct SynapticsHwState *hw = priv->local_hw_state; int delay; int sigstate; sigstate = xf86BlockSIGIO(); priv->hwState.millis += now - priv->timer_time; - hw = priv->hwState; - delay = HandleState(pInfo, &hw, hw.millis, TRUE); + *hw = priv->hwState; + delay = HandleState(pInfo, hw, hw->millis, TRUE); priv->timer_time = now; priv->timer = TimerSet(priv->timer, 0, delay, timerFunc, pInfo); @@ -1353,13 +1362,13 @@ static void ReadInput(InputInfoPtr pInfo) { SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); - struct SynapticsHwState hw; + struct SynapticsHwState *hw = priv->local_hw_state; int delay = 0; Bool newDelay = FALSE; - while (SynapticsGetHwState(pInfo, priv, &hw)) { - priv->hwState = hw; - delay = HandleState(pInfo, &hw, hw.millis, FALSE); + while (SynapticsGetHwState(pInfo, priv, hw)) { + priv->hwState = *hw; + delay = HandleState(pInfo, hw, hw->millis, FALSE); newDelay = TRUE; } diff --git a/src/synapticsstr.h b/src/synapticsstr.h index d3b8607..fff159c 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -201,6 +201,8 @@ typedef struct _SynapticsPrivateRec struct CommData comm; + struct SynapticsHwState *local_hw_state; /* used in place of local hw state variables */ + Bool absolute_events; /* post absolute motion events instead of relative */ SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY]; /* movement history */ int hist_index; /* Last added entry in move_hist[] */ -- 1.7.8.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
