svn commit: r257294 - user/ed/newcons/sys/dev/vt
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Tue Oct 29 00:52:03 UTC 2013
Author: nwhitehorn
Date: Tue Oct 29 00:52:02 2013
New Revision: 257294
URL: http://svnweb.freebsd.org/changeset/base/257294
Log:
It is perfectly possible for keyboard drivers to queue up more than one
key press per notification call. Loop until there are no more queued
key presses, like syscons did. This fixes stuttering observed in particular
on key repeats with ADB and USB keyboards.
Modified:
user/ed/newcons/sys/dev/vt/vt_core.c
Modified: user/ed/newcons/sys/dev/vt/vt_core.c
==============================================================================
--- user/ed/newcons/sys/dev/vt/vt_core.c Tue Oct 29 00:18:11 2013 (r257293)
+++ user/ed/newcons/sys/dev/vt/vt_core.c Tue Oct 29 00:52:02 2013 (r257294)
@@ -79,14 +79,14 @@ const struct terminal_class vt_termclass
};
/*
- * Use a constant timer of 25 Hz to redraw the screen.
+ * Use a constant timer of 50 Hz to redraw the screen.
*
* XXX: In theory we should only fire up the timer when there is really
* activity. Unfortunately we cannot always start timers. We really
* don't want to process kernel messages synchronously, because it
* really slows down the system.
*/
-#define VT_TIMERFREQ 25
+#define VT_TIMERFREQ 50
/* Bell pitch/duration. */
#define VT_BELLDURATION ((5 * hz + 99) / 100)
@@ -380,27 +380,11 @@ vt_scrollmode_kbdevent(struct vt_window
}
static int
-vt_kbdevent(keyboard_t *kbd, int event, void *arg)
+vt_processkey(keyboard_t *kbd, struct vt_device *vd, int c)
{
- struct vt_device *vd = arg;
struct vt_window *vw = vd->vd_curwindow;
- int c, state;
-
- state = 0;
- switch (event) {
- case KBDIO_KEYINPUT:
- break;
- case KBDIO_UNLOADING:
- mtx_lock(&Giant);
- vd->vd_keyboard = -1;
- kbd_release(kbd, (void *)&vd->vd_keyboard);
- mtx_unlock(&Giant);
- return (0);
- default:
- return (EINVAL);
- }
+ int state = 0;
- c = kbdd_read_char(kbd, 0);
if (c & RELKEY)
return (0);
@@ -491,6 +475,31 @@ vt_kbdevent(keyboard_t *kbd, int event,
}
static int
+vt_kbdevent(keyboard_t *kbd, int event, void *arg)
+{
+ struct vt_device *vd = arg;
+ int c;
+
+ switch (event) {
+ case KBDIO_KEYINPUT:
+ break;
+ case KBDIO_UNLOADING:
+ mtx_lock(&Giant);
+ vd->vd_keyboard = -1;
+ kbd_release(kbd, (void *)&vd->vd_keyboard);
+ mtx_unlock(&Giant);
+ return (0);
+ default:
+ return (EINVAL);
+ }
+
+ while ((c = kbdd_read_char(kbd, 0)) != NOKEY)
+ vt_processkey(kbd, vd, c);
+
+ return (0);
+}
+
+static int
vt_allocate_keyboard(struct vt_device *vd)
{
int idx0, idx;
More information about the svn-src-user
mailing list