From owner-svn-src-user@FreeBSD.ORG Tue Oct 29 00:52:03 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 65D40BA7; Tue, 29 Oct 2013 00:52:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 387CC2C7D; Tue, 29 Oct 2013 00:52:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9T0q3Fn015127; Tue, 29 Oct 2013 00:52:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9T0q3qp015126; Tue, 29 Oct 2013 00:52:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201310290052.r9T0q3qp015126@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 29 Oct 2013 00:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257294 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Oct 2013 00:52:03 -0000 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;