summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Smith <msmith@cbnco.com>2009-12-15 15:01:29 -0500
committerPeter Hutterer <peter.hutterer@who-t.net>2009-12-16 08:53:55 +1000
commitb9531248d1b5d00b2ba941f576fc160ea5e1444b (patch)
tree2e76d30fa43d3263a4a9fa98e62015ed80f04e81
parent60927fee86100e803f438036daeb94ba0b8e5db7 (diff)
xf86EloReadInput(): fix xserver unresponsiveness during touch
The fix for bug #14109 ensures all bytes are emptied from the OS buffer by looping until xf86WaitForInput returns 0. This patch just changes the timeout from 1 millisecond to 0: we don't want the X server to block if there's no more serial data. It also removes the Vmin and Vtime options, which were making the calls to read() block until a complete 10-byte packet buffer could be filled. At 9600 bps, this could pause the X server for up to 9 ms. The code can already handle partial buffers, so all we have to do is get rid of the Vmin. Also, if xf86EloGetPacket() returns !Success, we should continue rather than break so the xf86WaitForInput call can decide whether to exit, in case there's more data in the buffer. Before the fix, glxgears was giving me about 390 FPS normally and down to 140 FPS when dragging an empty area of the touchscreen. Now it's basically unchanged when the touchscreen is in use (390 -> 385 FPS). X.Org Bug 14109 <https://bugs.freedesktop.org/show_bug.cgi?id=14109> Signed-off-by: Michael Smith <msmith@cbnco.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/xf86Elo.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/xf86Elo.c b/src/xf86Elo.c
index ad88621..dbe1747 100644
--- a/src/xf86Elo.c
+++ b/src/xf86Elo.c
@@ -421,15 +421,17 @@ xf86EloReadInput(LocalDevicePtr local)
#endif
DBG(4, ErrorF("Entering ReadInput\n"));
+
/*
- * Try to get a packet.
+ * Read bytes until there's no data left. We may have more or less than
+ * one packet worth of data in the OS buffer.
*/
- while (xf86WaitForInput(local->fd, ELO_MAX_WAIT/100) > 0) {
+ do {
if(xf86EloGetPacket(priv->packet_buf,
&priv->packet_buf_p,
&priv->checksum,
local->fd) != Success)
- break;
+ continue;
/*
* Process only ELO_TOUCHs here.
@@ -488,6 +490,7 @@ xf86EloReadInput(LocalDevicePtr local)
(state == ELO_PRESS) ? "Press" : ((state == ELO_RELEASE) ? "Release" : "Stream")));
}
}
+ while (xf86WaitForInput(local->fd, 0) > 0); /* don't wait, just check */
}
@@ -1059,8 +1062,6 @@ static const char *default_options[] = {
"StopBits", "1",
"DataBits", "8",
"Parity", "None",
- "Vmin", "10",
- "Vtime", "1",
"FlowControl", "None",
NULL
};