CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Mon Jun 7 16:37:34 UTC 2021 Modified Files: src/sys/dev/wscons: wsemul_vt100.c Log Message: fix the NetBSD tag. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.47 src/sys/dev/wscons/wsemul_vt100.c:1.48 --- src/sys/dev/wscons/wsemul_vt100.c:1.47 Mon Jun 7 11:52:08 2021 +++ src/sys/dev/wscons/wsemul_vt100.c Mon Jun 7 12:37:34 2021 @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_vt100.c,v 1.28 2011/08/04 04:18:42 miod Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.48 2021/06/07 16:37:34 christos Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.47 2021/06/07 15:52:08 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.48 2021/06/07 16:37:34 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h"
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Mon Jun 7 15:52:08 UTC 2021 Modified Files: src/sys/dev/wscons: wsemul_vt100.c Log Message: PR/56223: David Shao ^[]8;;^G make console unresponsive. From OpenBSD: In `string' state, accept bell (^G) as an end of sequence in addition to `ESC \', as supported by xterm; some third-party software such as ncmpcpp rely upon this. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.46 src/sys/dev/wscons/wsemul_vt100.c:1.47 --- src/sys/dev/wscons/wsemul_vt100.c:1.46 Sun Nov 10 16:16:38 2019 +++ src/sys/dev/wscons/wsemul_vt100.c Mon Jun 7 11:52:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.46 2019/11/10 21:16:38 chs Exp $ */ +/* $OpenBSD: wsemul_vt100.c,v 1.28 2011/08/04 04:18:42 miod Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.46 2019/11/10 21:16:38 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.47 2021/06/07 15:52:08 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -429,7 +429,13 @@ wsemul_vt100_output_c0c1(struct wsemul_v /* ignore */ break; case ASCII_BEL: - wsdisplay_emulbell(vd->cbcookie); + if (edp->state == VT100_EMUL_STATE_STRING) { + /* acts as an equivalent to the ``ESC \'' string end */ + wsemul_vt100_handle_dcs(vd); + edp->state = VT100_EMUL_STATE_NORMAL; + } else { + wsdisplay_emulbell(vd->cbcookie); + } break; case ASCII_BS: if (vd->ccol > 0) { @@ -489,7 +495,7 @@ wsemul_vt100_output_c0c1(struct wsemul_v break; case ST: /* string end 8-bit */ /* XXX only in VT100_EMUL_STATE_STRING */ - wsemul_vt100_handle_dcs(edp); + wsemul_vt100_handle_dcs(vd); edp->state = VT100_EMUL_STATE_NORMAL; break; #endif
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: riastradh Date: Tue Jun 1 23:28:07 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_compat_usl.c Log Message: wsdisplay(4): Use C99 initializer for usl_syncops. Avoid sketchy function pointer cast while here. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/wscons/wsdisplay_compat_usl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_compat_usl.c diff -u src/sys/dev/wscons/wsdisplay_compat_usl.c:1.53 src/sys/dev/wscons/wsdisplay_compat_usl.c:1.54 --- src/sys/dev/wscons/wsdisplay_compat_usl.c:1.53 Sat May 23 23:42:42 2020 +++ src/sys/dev/wscons/wsdisplay_compat_usl.c Tue Jun 1 23:28:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.53 2020/05/23 23:42:42 ad Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.54 2021/06/01 23:28:07 riastradh Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.53 2020/05/23 23:42:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.54 2021/06/01 23:28:07 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_freebsd.h" @@ -80,13 +80,13 @@ static void usl_detachtimeout(void *); static int usl_attachproc(void *, int, void (*)(void *, int, int), void *); static int usl_attachack(struct usl_syncdata *, int); static void usl_attachtimeout(void *); +static void usl_sync_destroy(void *); static const struct wscons_syncops usl_syncops = { - usl_detachproc, - usl_attachproc, - usl_sync_check, -#define _usl_sync_destroy ((void (*)(void *))usl_sync_done) - _usl_sync_destroy + .detach = usl_detachproc, + .attach = usl_attachproc, + .check = usl_sync_check, + .destroy = usl_sync_destroy, }; #ifndef WSCOMPAT_USL_SYNCTIMEOUT @@ -294,6 +294,14 @@ usl_attachtimeout(void *arg) (void) usl_sync_check(sd); } +static void +usl_sync_destroy(void *cookie) +{ + struct usl_syncdata *sd = cookie; + + usl_sync_done(sd); +} + int wsdisplay_usl_ioctl1(device_t dv, u_long cmd, void *data, int flag, struct lwp *l)
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:46:38 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Try to guess attributes better. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.52 src/sys/dev/wscons/wsdisplay_vcons.c:1.53 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.52 Sun May 16 08:44:26 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:46:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $"); #include #include @@ -1404,6 +1404,7 @@ vcons_getwschar(struct vcons_screen *scr int offset; long attr; struct rasops_info *ri; + int fg, bg, ul; KASSERT(scr != NULL && wsc != NULL); @@ -1433,18 +1434,38 @@ vcons_getwschar(struct vcons_screen *scr wsc->letter = scr->scr_chars[offset]; attr = scr->scr_attrs[offset]; +#ifdef VCONS_DEBUG + printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, + wsc->col, wsc->letter, attr); +#endif + /* * this is ugly. We need to break up an attribute into colours and * flags but there's no rasops method to do that so we must rely on * the 'canonical' encoding. */ -#ifdef VCONS_DEBUG - printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, - wsc->col, wsc->letter, attr); -#endif - wsc->foreground = (attr >> 24) & 0xff; - wsc->background = (attr >> 16) & 0xff; - wsc->flags = attr & 0xff; + + /* only fetches underline attribute */ + /* rasops_unpack_attr(attr, , , ); */ + fg = (attr >> 24) & 0xf; + bg = (attr >> 16) & 0xf; + ul = (attr & 1); + + wsc->foreground = fg; + wsc->background = bg; + + /* clear trashed bits and restore underline flag */ + attr &= ~(WSATTR_HILIT | WSATTR_BLINK | WSATTR_UNDERLINE); + if (ul) + attr |= WSATTR_UNDERLINE; + + /* restore highlight boost */ + if (attr & WSATTR_HILIT) + if (wsc->foreground >= 8) + wsc->foreground -= 8; + + /* we always use colors, even when not stored */ + attr |= WSATTR_WSCOLORS; return 0; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:44:26 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: No need to check cell count. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.51 src/sys/dev/wscons/wsdisplay_vcons.c:1.52 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.51 Thu Jan 28 17:40:00 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:44:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); #include #include @@ -1630,9 +1630,6 @@ vcons_invalidate_cache(struct vcons_data { int i; - if (vd->cells == 0) - return; - for (i = 0; i < vd->cells; i++) { vd->chars[i] = -1; vd->attrs[i] = -1;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Thu Jan 28 17:40:00 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: fix logic botch from previous - if we're asked to draw the cursor somewhere else and it's still visible we need to clear it To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.50 src/sys/dev/wscons/wsdisplay_vcons.c:1.51 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.50 Tue Jan 26 16:24:17 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Thu Jan 28 17:40:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $"); #include #include @@ -1334,7 +1334,7 @@ vcons_cursor_noread(void *cookie, int on #endif ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; if ((ri->ri_flg & RI_CURSOR) && - ((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ)) { + (((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ) || on)) { scr->putchar(cookie, ri->ri_crow, ri->ri_ccol, scr->scr_chars[ofs], scr->scr_attrs[ofs]); ri->ri_flg &= ~RI_CURSOR;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Tue Jan 26 16:24:18 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: - refactor vcons_cursor_noread() a bit so it works the same way as the other _noread() methods instead of duplicating half of vcons_cursor() - skip clearing the cursor only if we use all _noread() methods - clear RI_CURSOR in all copy*_noread() methods as well if we overwrite the cursor To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.49 src/sys/dev/wscons/wsdisplay_vcons.c:1.50 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.49 Mon Jan 25 02:11:41 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Tue Jan 26 16:24:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.49 2021/01/25 02:11:41 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.49 2021/01/25 02:11:41 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $"); #include #include @@ -320,6 +320,7 @@ vcons_init_screen(struct vcons_data *vd, scr->scr_cookie = vd->cookie; scr->scr_vd = scr->scr_origvd = vd; scr->scr_busy = 0; + if (scr->scr_type == NULL) scr->scr_type = vd->defaulttype; @@ -336,7 +337,6 @@ vcons_init_screen(struct vcons_data *vd, vd->eraserows = ri->ri_ops.eraserows; vd->erasecols = ri->ri_ops.erasecols; scr->putchar = ri->ri_ops.putchar; - vd->cursor= ri->ri_ops.cursor; if (scr->scr_flags & VCONS_NO_COPYCOLS) { vd->copycols = vcons_copycols_noread; @@ -350,15 +350,16 @@ vcons_init_screen(struct vcons_data *vd, vd->copyrows = ri->ri_ops.copyrows; } - ri->ri_ops.eraserows = vcons_eraserows; - ri->ri_ops.erasecols = vcons_erasecols; - ri->ri_ops.putchar = vcons_putchar; if (scr->scr_flags & VCONS_NO_CURSOR) { - ri->ri_ops.cursor= vcons_cursor_noread; + vd->cursor = vcons_cursor_noread; } else { - ri->ri_ops.cursor= vcons_cursor; + vd->cursor = ri->ri_ops.cursor; } + ri->ri_ops.eraserows = vcons_eraserows; + ri->ri_ops.erasecols = vcons_erasecols; + ri->ri_ops.putchar = vcons_putchar; + ri->ri_ops.cursor= vcons_cursor; ri->ri_ops.copycols = vcons_copycols; ri->ri_ops.copyrows = vcons_copyrows; @@ -471,14 +472,17 @@ vcons_load_font(void *v, void *cookie, s vd->copyrows = ri->ri_ops.copyrows; } + if (scr->scr_flags & VCONS_NO_CURSOR) { + vd->cursor = vcons_cursor_noread; + } else { + vd->cursor = ri->ri_ops.cursor; + } + /* and put our wrappers back */ ri->ri_ops.eraserows = vcons_eraserows; ri->ri_ops.erasecols = vcons_erasecols; ri->ri_ops.putchar = vcons_putchar; - if (scr->scr_flags & VCONS_NO_CURSOR) { - ri->ri_ops.cursor= vcons_cursor_noread; - } else - ri->ri_ops.cursor= vcons_cursor; + ri->ri_ops.cursor= vcons_cursor; ri->ri_ops.copycols = vcons_copycols; ri->ri_ops.copyrows = vcons_copyrows; vcons_unlock(vd->active); @@ -955,6 +959,9 @@ vcons_copycols_noread(void *cookie, int pos++; ppos++; } + if (ri->ri_crow == row && + (ri->ri_ccol >= dstcol && ri->ri_ccol < (dstcol + ncols ))) + ri->ri_flg &= ~RI_CURSOR; } vcons_unlock(scr); } @@ -1130,6 +1137,8 @@ vcons_copyrows_noread(void *cookie, int ppos++; } } + if (ri->ri_crow >= dstrow && ri->ri_crow < (dstrow + nrows)) + ri->ri_flg &= ~RI_CURSOR; } vcons_unlock(scr); } @@ -1318,53 +1327,33 @@ vcons_cursor_noread(void *cookie, int on { struct rasops_info *ri = cookie; struct vcons_screen *scr = ri->ri_hw; - int offset = 0; - -#if defined(VCONS_DRAW_INTR) - if (scr->scr_vd->use_intr) { - vcons_lock(scr); - if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) { - scr->scr_ri.ri_crow = row; - scr->scr_ri.ri_ccol = col; - atomic_inc_uint(>scr_dirty); - } - vcons_unlock(scr); - return; - } -#endif - - vcons_lock(scr); + int offset = 0, ofs; #ifdef WSDISPLAY_SCROLLSUPPORT offset = scr->scr_current_offset; #endif - if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { - int ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; - if (on && (ri->ri_flg & RI_CURSOR)) { - scr->putchar(cookie, ri->ri_crow, ri->ri_ccol, - scr->scr_chars[ofs], scr->scr_attrs[ofs]); - ri->ri_flg &= ~RI_CURSOR; - } - ri->ri_crow = row; - ri->ri_ccol = col; - ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; - if (on) { - scr->putchar(cookie, row, col, scr->scr_chars[ofs], + ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; + if ((ri->ri_flg & RI_CURSOR) && + ((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ)) {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Mon Jan 25 02:11:41 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: clear the RI_CURSOR flag when we overwrite the cursor so we can skip clearing it when asked to do it later on saves a bunch of framebuffer writes To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.48 src/sys/dev/wscons/wsdisplay_vcons.c:1.49 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.48 Thu Jan 21 21:45:42 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Mon Jan 25 02:11:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.48 2021/01/21 21:45:42 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.49 2021/01/25 02:11:41 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.48 2021/01/21 21:45:42 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.49 2021/01/25 02:11:41 macallan Exp $"); #include #include @@ -1273,6 +1273,9 @@ vcons_putchar(void *cookie, int row, int #ifdef VCONS_DRAW_INTR vcons_putchar_cached(cookie, row, col, c, attr); #else + if (row == ri->ri_crow && col == ri->ri_ccol) { + ri->ri_flg &= ~RI_CURSOR; + } scr->putchar(cookie, row, col, c, attr); #endif } @@ -1337,7 +1340,7 @@ vcons_cursor_noread(void *cookie, int on #endif if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { int ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; - if (ri->ri_flg & RI_CURSOR) { + if (on && (ri->ri_flg & RI_CURSOR)) { scr->putchar(cookie, ri->ri_crow, ri->ri_ccol, scr->scr_chars[ofs], scr->scr_attrs[ofs]); ri->ri_flg &= ~RI_CURSOR;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Thu Jan 21 21:45:42 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h Log Message: introduce a putchar() based implementation of cursor() in order to avoid framebuffer reads quite a speedup on arm64 / genfb To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/wscons/wsdisplay_vcons.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.47 src/sys/dev/wscons/wsdisplay_vcons.c:1.48 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.47 Sun Jan 17 19:03:32 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Thu Jan 21 21:45:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.48 2021/01/21 21:45:42 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.48 2021/01/21 21:45:42 macallan Exp $"); #include #include @@ -103,6 +103,7 @@ static void vcons_eraserows_cached(void static void vcons_putchar_cached(void *, int, int, u_int, long); #endif static void vcons_cursor(void *, int, int, int); +static void vcons_cursor_noread(void *, int, int, int); /* * methods that avoid framebuffer reads @@ -352,7 +353,12 @@ vcons_init_screen(struct vcons_data *vd, ri->ri_ops.eraserows = vcons_eraserows; ri->ri_ops.erasecols = vcons_erasecols; ri->ri_ops.putchar = vcons_putchar; - ri->ri_ops.cursor= vcons_cursor; + if (scr->scr_flags & VCONS_NO_CURSOR) { + ri->ri_ops.cursor= vcons_cursor_noread; + } else { + ri->ri_ops.cursor= vcons_cursor; + } + ri->ri_ops.copycols = vcons_copycols; ri->ri_ops.copyrows = vcons_copyrows; @@ -469,7 +475,10 @@ vcons_load_font(void *v, void *cookie, s ri->ri_ops.eraserows = vcons_eraserows; ri->ri_ops.erasecols = vcons_erasecols; ri->ri_ops.putchar = vcons_putchar; - ri->ri_ops.cursor= vcons_cursor; + if (scr->scr_flags & VCONS_NO_CURSOR) { + ri->ri_ops.cursor= vcons_cursor_noread; + } else + ri->ri_ops.cursor= vcons_cursor; ri->ri_ops.copycols = vcons_copycols; ri->ri_ops.copyrows = vcons_copyrows; vcons_unlock(vd->active); @@ -609,8 +618,8 @@ vcons_redraw_screen(struct vcons_screen if (c == ' ') { /* * if we already erased the background - * and this blank uses the same colour - * and flags we don't need to do + * and if this blank uses the same + * colour and flags we don't need to do * anything here */ if (acmp == cmp && start == -1) @@ -1301,6 +1310,60 @@ vcons_cursor(void *cookie, int on, int r vcons_unlock(scr); } +static void +vcons_cursor_noread(void *cookie, int on, int row, int col) +{ + struct rasops_info *ri = cookie; + struct vcons_screen *scr = ri->ri_hw; + int offset = 0; + +#if defined(VCONS_DRAW_INTR) + if (scr->scr_vd->use_intr) { + vcons_lock(scr); + if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) { + scr->scr_ri.ri_crow = row; + scr->scr_ri.ri_ccol = col; + atomic_inc_uint(>scr_dirty); + } + vcons_unlock(scr); + return; + } +#endif + + vcons_lock(scr); + +#ifdef WSDISPLAY_SCROLLSUPPORT + offset = scr->scr_current_offset; +#endif + if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { + int ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; + if (ri->ri_flg & RI_CURSOR) { + scr->putchar(cookie, ri->ri_crow, ri->ri_ccol, + scr->scr_chars[ofs], scr->scr_attrs[ofs]); + ri->ri_flg &= ~RI_CURSOR; + } + ri->ri_crow = row; + ri->ri_ccol = col; + ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; + if (on) { + scr->putchar(cookie, row, col, scr->scr_chars[ofs], +#ifdef VCONS_DEBUG_CURSOR_NOREAD + /* draw a red cursor so we can tell which cursor() + * implementation is being used */ + ((scr->scr_attrs[ofs] & 0xff00) ^ 0x0f00) | + 0x0001); +#else + scr->scr_attrs[ofs] ^ 0x0f0f); +#endif + ri->ri_flg |= RI_CURSOR; + } + } else { + scr->scr_ri.ri_crow = row; + scr->scr_ri.ri_ccol = col; + } + vcons_unlock(scr); +} + /* methods to read/write characters via ioctl() */ static int Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.30 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.31 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.30 Sun Jan 17 19:03:32 2021 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Thu Jan 21 21:45:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.30 2021/01/17 19:03:32 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.31 2021/01/21 21:45:42 macallan Exp $ */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 19:03:32 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h Log Message: Revert previous and introduce vcons_earlyinit, which is like vcons_init except it does not setup a vcons_intr thread. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/wscons/wsdisplay_vcons.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.46 src/sys/dev/wscons/wsdisplay_vcons.c:1.47 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.46 Sun Jan 17 16:51:12 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Jan 17 19:03:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.47 2021/01/17 19:03:32 jmcneill Exp $"); #include #include @@ -121,17 +121,18 @@ static void vcons_unlock(struct vcons_sc #ifdef VCONS_DRAW_INTR static void vcons_intr(void *); static void vcons_softintr(void *); -static int vcons_intr_enable(device_t); +static void vcons_init_thread(void *); #endif -int -vcons_init(struct vcons_data *vd, void *cookie, struct wsscreen_descr *def, -struct wsdisplay_accessops *ao) +static int +vcons_init_common(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao, +int enable_intr) { /* zero out everything so we can rely on untouched fields being 0 */ memset(vd, 0, sizeof(struct vcons_data)); - + vd->cookie = cookie; vd->init_screen = vcons_dummy_init_screen; @@ -174,26 +175,37 @@ vcons_init(struct vcons_data *vd, void * vd->switch_poll_count = 0; #endif #ifdef VCONS_DRAW_INTR - vd->intr_softint = softint_establish(SOFTINT_SERIAL, - vcons_softintr, vd); - callout_init(>intr, CALLOUT_MPSAFE); - callout_setfunc(>intr, vcons_intr, vd); - vd->intr_valid = 1; - - /* - * Defer intr drawing until after autoconfiguration has completed - * to serialize device attachment messages w/ the initial screen - * redraw as a workaround for the lack of MP-safeness in this - * subsystem. To register with autoconf, we need to create a fake - * device_t and pass that in as a handle to config_interrupts. - */ - snprintf(vd->fake_dev.dv_xname, sizeof(vd->fake_dev.dv_xname), "vcons"); - vd->fake_dev.dv_private = vd; - config_finalize_register(>fake_dev, vcons_intr_enable); + if (enable_intr) { + vd->intr_softint = softint_establish(SOFTINT_SERIAL, + vcons_softintr, vd); + callout_init(>intr, CALLOUT_MPSAFE); + callout_setfunc(>intr, vcons_intr, vd); + vd->intr_valid = 1; + + if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, + NULL, "vcons_init") != 0) { + printf("%s: unable to create thread.\n", __func__); + return -1; + } + } #endif return 0; } +int +vcons_init(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao) +{ + return vcons_init_common(vd, cookie, def, ao, 1); +} + +int +vcons_earlyinit(struct vcons_data *vd, void *cookie, +struct wsscreen_descr *def, struct wsdisplay_accessops *ao) +{ + return vcons_init_common(vd, cookie, def, ao, 0); +} + static void vcons_lock(struct vcons_screen *scr) { @@ -1498,15 +1510,14 @@ vcons_softintr(void *cookie) callout_schedule(>intr, mstohz(33)); } -static int -vcons_intr_enable(device_t fake_dev) +static void +vcons_init_thread(void *cookie) { - struct vcons_data *vd = device_private(fake_dev); + struct vcons_data *vd = (struct vcons_data *)cookie; vd->use_intr = 2; callout_schedule(>intr, mstohz(33)); - - return 0; + kthread_exit(0); } #endif /* VCONS_DRAW_INTR */ Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.30 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 Sun Jan 17 15:13:15 2021 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sun Jan 17 19:03:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.29 2021/01/17 15:13:15 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.30 2021/01/17 19:03:32 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -143,7 +143,9 @@ struct vcons_data { #endif }; -int vcons_init(struct vcons_data *, void *cookie, struct wsscreen_descr *, +int vcons_init(struct vcons_data *, void *, struct wsscreen_descr *, +struct wsdisplay_accessops *); +int vcons_earlyinit(struct vcons_data *, void *, struct wsscreen_descr *, struct wsdisplay_accessops
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 16:51:12 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: The change from config_interrupts to a kthread for VCONS_DRAW_INTR init unfortunately makes it easier to trigger a race that results in characters not being erased properly at boot. Work around the original issue a different way by creating a fake device_t and defer initialization until we are sure that config_interrupt threads are done. This is not ideal and the race is still present but fixing this properly would require a rewrite to make this code MP-safe. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.45 src/sys/dev/wscons/wsdisplay_vcons.c:1.46 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.45 Sat Jan 2 03:00:56 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Jan 17 16:51:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.46 2021/01/17 16:51:12 jmcneill Exp $"); #include #include @@ -121,7 +121,7 @@ static void vcons_unlock(struct vcons_sc #ifdef VCONS_DRAW_INTR static void vcons_intr(void *); static void vcons_softintr(void *); -static void vcons_init_thread(void *); +static int vcons_intr_enable(device_t); #endif int @@ -180,11 +180,16 @@ vcons_init(struct vcons_data *vd, void * callout_setfunc(>intr, vcons_intr, vd); vd->intr_valid = 1; - if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, NULL, - "vcons_init") != 0) { - printf("%s: unable to create thread.\n", __func__); - return -1; - } + /* + * Defer intr drawing until after autoconfiguration has completed + * to serialize device attachment messages w/ the initial screen + * redraw as a workaround for the lack of MP-safeness in this + * subsystem. To register with autoconf, we need to create a fake + * device_t and pass that in as a handle to config_interrupts. + */ + snprintf(vd->fake_dev.dv_xname, sizeof(vd->fake_dev.dv_xname), "vcons"); + vd->fake_dev.dv_private = vd; + config_finalize_register(>fake_dev, vcons_intr_enable); #endif return 0; } @@ -1493,14 +1498,15 @@ vcons_softintr(void *cookie) callout_schedule(>intr, mstohz(33)); } -static void -vcons_init_thread(void *cookie) +static int +vcons_intr_enable(device_t fake_dev) { - struct vcons_data *vd = (struct vcons_data *)cookie; + struct vcons_data *vd = device_private(fake_dev); vd->use_intr = 2; callout_schedule(>intr, mstohz(33)); - kthread_exit(0); + + return 0; } #endif /* VCONS_DRAW_INTR */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 15:13:15 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vconsvar.h Log Message: Add appropriate memory barriers around sc_busy accesses. Fixes an issue where character cells are sometimes not erased properly on aarch64 at boot. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 Sat Jan 16 23:19:50 2021 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sun Jan 17 15:13:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.28 2021/01/16 23:19:50 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.29 2021/01/17 15:13:15 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -34,6 +34,8 @@ #include "opt_vcons.h" #endif +#include + struct vcons_data; struct vcons_screen { @@ -84,10 +86,10 @@ struct vcons_screen { }; #define SCREEN_IS_VISIBLE(scr) (((scr)->scr_status & VCONS_IS_VISIBLE) != 0) -#define SCREEN_IS_BUSY(scr) ((scr)->scr_busy != 0) +#define SCREEN_IS_BUSY(scr) (membar_consumer(), (scr)->scr_busy != 0) #define SCREEN_CAN_DRAW(scr) (((scr)->scr_flags & VCONS_DONT_DRAW) == 0) -#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1) -#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0) +#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1, membar_producer()) +#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0, membar_producer()) #define SCREEN_VISIBLE(scr) ((scr)->scr_status |= VCONS_IS_VISIBLE) #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE) #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Jan 17 00:35:46 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons_util.c Log Message: trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/wscons/wsdisplay_vcons_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons_util.c diff -u src/sys/dev/wscons/wsdisplay_vcons_util.c:1.3 src/sys/dev/wscons/wsdisplay_vcons_util.c:1.4 --- src/sys/dev/wscons/wsdisplay_vcons_util.c:1.3 Wed Jan 30 11:24:48 2019 +++ src/sys/dev/wscons/wsdisplay_vcons_util.c Sun Jan 17 00:35:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons_util.c,v 1.3 2019/01/30 11:24:48 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vcons_util.c,v 1.4 2021/01/17 00:35:46 jmcneill Exp $ */ /*- * Copyright (c) 2009 Michael Lorenz @@ -46,7 +46,7 @@ #include -void +void vcons_replay_msgbuf(struct vcons_screen *scr) { int status = scr->scr_status;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sat Jan 16 23:19:50 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vconsvar.h Log Message: Instead of defining VCONS_DONT_READ as the raw value of 0x30, instead define it as (VCONS_NO_COPYCOLS|VCONS_NO_COPYROWS) for clarify. NFC. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.27 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.27 Fri Nov 30 05:20:34 2018 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sat Jan 16 23:19:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.27 2018/11/30 05:20:34 msaitoh Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.28 2021/01/16 23:19:50 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -63,7 +63,8 @@ struct vcons_screen { */ #define VCONS_NO_COPYCOLS 0x10 /* use putchar() based copycols() */ #define VCONS_NO_COPYROWS 0x20 /* use putchar() based copyrows() */ -#define VCONS_DONT_READ 0x30 /* avoid framebuffer reads */ +#define VCONS_DONT_READ (VCONS_NO_COPYCOLS|VCONS_NO_COPYROWS) + /* avoid framebuffer reads */ #define VCONS_LOADFONT 0x40 /* driver can load_font() */ /* status flags used by vcons */ uint32_t scr_status;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Sat Jan 2 03:00:56 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: be more careful when optimizing stretches of blanks into erasecols() now testpat's output is redrawn properly To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.44 src/sys/dev/wscons/wsdisplay_vcons.c:1.45 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.44 Mon Dec 28 00:14:18 2020 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sat Jan 2 03:00:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $"); #include #include @@ -596,7 +596,7 @@ vcons_redraw_screen(struct vcons_screen * and flags we don't need to do * anything here */ - if (acmp == cmp) + if (acmp == cmp && start == -1) goto next; /* * see if we can optimize things a
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Mon Dec 28 00:14:18 UTC 2020 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: provide (bug)compatibility with vga in WSDISPLAYIO_{PUT|GET}WSCHAR if row == 0 treat col as linear index into the text / attribute buffer, transform into proper coordinates as needed for putchar() with this wsmoused works as expected To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.43 src/sys/dev/wscons/wsdisplay_vcons.c:1.44 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.43 Wed Dec 23 05:50:51 2020 +++ src/sys/dev/wscons/wsdisplay_vcons.c Mon Dec 28 00:14:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $"); #include #include @@ -1297,25 +1297,33 @@ vcons_putwschar(struct vcons_screen *scr ri = >scr_ri; - if (__predict_false((unsigned int)wsc->col > ri->ri_cols || - (unsigned int)wsc->row > ri->ri_rows)) + /* allow col as linear index if row == 0 */ + if (wsc->row == 0) { + if (wsc->col < 0 || wsc->col > (ri->ri_cols * ri->ri_rows)) + return EINVAL; + int rem; + rem = wsc->col % ri->ri_cols; + wsc->row = wsc->col / ri->ri_cols; + DPRINTF("off %d -> %d, %d\n", wsc->col, rem, wsc->row); + wsc->col = rem; + } else { + if (__predict_false(wsc->col < 0 || wsc->col >= ri->ri_cols)) return (EINVAL); - if ((wsc->row >= 0) && (wsc->row < ri->ri_rows) && (wsc->col >= 0) && - (wsc->col < ri->ri_cols)) { + if (__predict_false(wsc->row < 0 || wsc->row >= ri->ri_rows)) + return (EINVAL); + } - error = ri->ri_ops.allocattr(ri, wsc->foreground, - wsc->background, wsc->flags, ); - if (error) - return error; - vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr); + error = ri->ri_ops.allocattr(ri, wsc->foreground, + wsc->background, wsc->flags, ); + if (error) + return error; + vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr); #ifdef VCONS_DEBUG - printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col, - wsc->letter, attr); + printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col, + wsc->letter, attr); #endif - return 0; - } else - return EINVAL; + return 0; } static int @@ -1329,31 +1337,43 @@ vcons_getwschar(struct vcons_screen *scr ri = >scr_ri; - if ((wsc->row >= 0) && (wsc->row < ri->ri_rows) && (wsc->col >= 0) && - (wsc->col < ri->ri_cols)) { + /* allow col as linear index if row == 0 */ + if (wsc->row == 0) { + if (wsc->col < 0 || wsc->col > (ri->ri_cols * ri->ri_rows)) + return EINVAL; + int rem; + rem = wsc->col % ri->ri_cols; + wsc->row = wsc->col / ri->ri_cols; + DPRINTF("off %d -> %d, %d\n", wsc->col, rem, wsc->row); + wsc->col = rem; + } else { + if (__predict_false(wsc->col < 0 || wsc->col >= ri->ri_cols)) + return (EINVAL); + + if (__predict_false(wsc->row < 0 || wsc->row >= ri->ri_rows)) + return (EINVAL); + } - offset = ri->ri_cols * wsc->row + wsc->col; + offset = ri->ri_cols * wsc->row + wsc->col; #ifdef WSDISPLAY_SCROLLSUPPORT - offset += scr->scr_offset_to_zero; + offset += scr->scr_offset_to_zero; #endif - wsc->letter = scr->scr_chars[offset]; - attr = scr->scr_attrs[offset]; + wsc->letter = scr->scr_chars[offset]; + attr = scr->scr_attrs[offset]; - /* - * this is ugly. We need to break up an attribute into colours and - * flags but there's no rasops method to do that so we must rely on - * the 'canonical' encoding. - */ + /* + * this is ugly. We need to break up an attribute into colours and + * flags but there's no rasops method to do that so we must rely on + * the 'canonical' encoding. + */ #ifdef VCONS_DEBUG - printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, - wsc->col, wsc->letter, attr); + printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, + wsc->col, wsc->letter, attr); #endif - wsc->foreground = (attr >> 24) & 0xff; - wsc->background = (attr >> 16) & 0xff; - wsc->flags = attr & 0xff; - return 0; - } else - return EINVAL; + wsc->foreground = (attr >> 24) & 0xff; + wsc->background = (attr >> 16) & 0xff; + wsc->flags = attr & 0xff; + return 0; } #ifdef WSDISPLAY_SCROLLSUPPORT
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: tsutsui Date: Sun Dec 27 16:09:33 UTC 2020 Modified Files: src/sys/dev/wscons: wsbell.c wsdisplay.c wskbd.c wsmouse.c Log Message: Explicitly include generated ioconf.h for struct cfdrivers. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsbell.c cvs rdiff -u -r1.161 -r1.162 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.143 -r1.144 src/sys/dev/wscons/wskbd.c cvs rdiff -u -r1.68 -r1.69 src/sys/dev/wscons/wsmouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.12 src/sys/dev/wscons/wsbell.c:1.13 --- src/sys/dev/wscons/wsbell.c:1.12 Sat Jun 22 08:03:01 2019 +++ src/sys/dev/wscons/wsbell.c Sun Dec 27 16:09:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.12 2019/06/22 08:03:01 isaki Exp $ */ +/* $NetBSD: wsbell.c,v 1.13 2020/12/27 16:09:33 tsutsui Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss @@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.12 2019/06/22 08:03:01 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.13 2020/12/27 16:09:33 tsutsui Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -174,8 +174,6 @@ static int wsbell_do_ioctl(struct wsbel CFATTACH_DECL_NEW(wsbell, sizeof (struct wsbell_softc), wsbell_match, wsbell_attach, wsbell_detach, wsbell_activate); -extern struct cfdriver wsbell_cd; - extern dev_type_open(spkropen); extern dev_type_close(spkrclose); extern dev_type_ioctl(spkrioctl); Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.161 src/sys/dev/wscons/wsdisplay.c:1.162 --- src/sys/dev/wscons/wsdisplay.c:1.161 Fri Dec 25 21:12:15 2020 +++ src/sys/dev/wscons/wsdisplay.c Sun Dec 27 16:09:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.162 2020/12/27 16:09:33 tsutsui Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c, #include #include "locators.h" +#include "ioconf.h" #ifdef WSDISPLAY_MULTICONS static bool wsdisplay_multicons_enable = true; @@ -177,8 +178,6 @@ struct wsdisplay_scroll_data wsdisplay_d }; #endif -extern struct cfdriver wsdisplay_cd; - /* Autoconfiguration definitions. */ static int wsdisplay_emul_match(device_t , cfdata_t, void *); static void wsdisplay_emul_attach(device_t, device_t, void *); Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.143 src/sys/dev/wscons/wskbd.c:1.144 --- src/sys/dev/wscons/wskbd.c:1.143 Tue Feb 5 10:04:49 2019 +++ src/sys/dev/wscons/wskbd.c Sun Dec 27 16:09:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $ */ +/* $NetBSD: wskbd.c,v 1.144 2020/12/27 16:09:33 tsutsui Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.144 2020/12/27 16:09:33 tsutsui Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -143,11 +143,14 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1. #include #include #include +#include #ifdef KGDB #include #endif +#include "ioconf.h" + #ifdef WSKBD_DEBUG #define DPRINTF(x) if (wskbddebug) printf x int wskbddebug = 0; @@ -155,8 +158,6 @@ int wskbddebug = 0; #define DPRINTF(x) #endif -#include - struct wskbd_internal { const struct wskbd_mapdata *t_keymap; @@ -290,8 +291,6 @@ static int wskbd_do_ioctl(device_t, u_lo CFATTACH_DECL_NEW(wskbd, sizeof (struct wskbd_softc), wskbd_match, wskbd_attach, wskbd_detach, wskbd_activate); -extern struct cfdriver wskbd_cd; - dev_type_open(wskbdopen); dev_type_close(wskbdclose); dev_type_read(wskbdread); Index: src/sys/dev/wscons/wsmouse.c diff -u src/sys/dev/wscons/wsmouse.c:1.68 src/sys/dev/wscons/wsmouse.c:1.69 --- src/sys/dev/wscons/wsmouse.c:1.68 Fri Nov 3 19:49:23 2017 +++ src/sys/dev/wscons/wsmouse.c Sun Dec 27 16:09:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $ */ +/* $NetBSD: wsmouse.c,v 1.69 2020/12/27 16:09:33 tsutsui Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.69 2020/12/27 16:09:33 tsutsui Exp $"); #include "wsmouse.h" #include "wsdisplay.h" @@ -130,6 +130,8 @@ __KERNEL_RCSID(0, "$NetBSD:
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: tsutsui Date: Fri Dec 25 21:12:15 UTC 2020 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Use C99 designated initializers for struct consdev. To generate a diff of this commit: cvs rdiff -u -r1.160 -r1.161 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.160 src/sys/dev/wscons/wsdisplay.c:1.161 --- src/sys/dev/wscons/wsdisplay.c:1.160 Fri Dec 6 07:12:39 2019 +++ src/sys/dev/wscons/wsdisplay.c Fri Dec 25 21:12:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.160 2019/12/06 07:12:39 maxv Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.160 2019/12/06 07:12:39 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.161 2020/12/25 21:12:15 tsutsui Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -255,8 +255,11 @@ static int (*wsdisplay_cons_kbd_getc)(de static void (*wsdisplay_cons_kbd_pollc)(dev_t, int); static struct consdev wsdisplay_cons = { - NULL, NULL, wsdisplay_getc, wsdisplay_cnputc, - wsdisplay_pollc, NULL, NULL, NULL, NODEV, CN_NORMAL + .cn_getc = wsdisplay_getc, + .cn_putc = wsdisplay_cnputc, + .cn_pollc = wsdisplay_pollc, + .cn_dev = NODEV, + .cn_pri = CN_NORMAL }; #ifndef WSDISPLAY_DEFAULTSCREENS
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Wed Dec 23 05:50:51 UTC 2020 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: fix tpyo spotted by RVP, thanks! To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.42 src/sys/dev/wscons/wsdisplay_vcons.c:1.43 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.42 Sat Nov 21 11:26:55 2020 +++ src/sys/dev/wscons/wsdisplay_vcons.c Wed Dec 23 05:50:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.43 2020/12/23 05:50:51 macallan Exp $"); #include #include @@ -1541,7 +1541,7 @@ vcons_invalidate_cache(struct vcons_data if (vd->cells == 0) return; - for (i = 0; i > vd->cells; i++) { + for (i = 0; i < vd->cells; i++) { vd->chars[i] = -1; vd->attrs[i] = -1; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: thorpej Date: Fri Dec 18 01:41:23 UTC 2020 Modified Files: src/sys/dev/wscons: wsevent.c Log Message: Use sel{record,remove}_knote(). To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/wscons/wsevent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsevent.c diff -u src/sys/dev/wscons/wsevent.c:1.45 src/sys/dev/wscons/wsevent.c:1.46 --- src/sys/dev/wscons/wsevent.c:1.45 Sat May 23 23:42:42 2020 +++ src/sys/dev/wscons/wsevent.c Fri Dec 18 01:41:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.45 2020/05/23 23:42:42 ad Exp $ */ +/* $NetBSD: wsevent.c,v 1.46 2020/12/18 01:41:23 thorpej Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.45 2020/05/23 23:42:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.46 2020/12/18 01:41:23 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -303,7 +303,7 @@ filt_wseventrdetach(struct knote *kn) int s; s = splwsevent(); - SLIST_REMOVE(>sel.sel_klist, kn, knote, kn_selnext); + selremove_knote(>sel, kn); splx(s); } @@ -335,12 +335,10 @@ static const struct filterops wsevent_fi int wsevent_kqfilter(struct wseventvar *ev, struct knote *kn) { - struct klist *klist; int s; switch (kn->kn_filter) { case EVFILT_READ: - klist = >sel.sel_klist; kn->kn_fop = _filtops; break; @@ -351,7 +349,7 @@ wsevent_kqfilter(struct wseventvar *ev, kn->kn_hook = ev; s = splwsevent(); - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + selrecord_knote(>sel, kn); splx(s); return (0);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sat Nov 21 11:26:55 UTC 2020 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Fix previous and tag the right callout... To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.41 src/sys/dev/wscons/wsdisplay_vcons.c:1.42 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.41 Sat Nov 21 11:23:22 2020 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sat Nov 21 11:26:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.42 2020/11/21 11:26:55 mlelstv Exp $"); #include #include @@ -156,7 +156,7 @@ vcons_init(struct vcons_data *vd, void * vd->wanted = NULL; vd->currenttype = def; vd->defaulttype = def; - callout_init(>switch_callout, CALLOUT_MPSAFE); + callout_init(>switch_callout, 0); callout_setfunc(>switch_callout, vcons_do_switch, vd); #ifdef VCONS_DRAW_INTR vd->cells = 0; @@ -176,7 +176,7 @@ vcons_init(struct vcons_data *vd, void * #ifdef VCONS_DRAW_INTR vd->intr_softint = softint_establish(SOFTINT_SERIAL, vcons_softintr, vd); - callout_init(>intr, 0); + callout_init(>intr, CALLOUT_MPSAFE); callout_setfunc(>intr, vcons_intr, vd); vd->intr_valid = 1;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sat Nov 21 11:23:23 UTC 2020 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Run callout without kernel lock, the softint itself is still protected. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.40 src/sys/dev/wscons/wsdisplay_vcons.c:1.41 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.40 Wed Jul 31 14:29:54 2019 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sat Nov 21 11:23:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.40 2019/07/31 14:29:54 rin Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.40 2019/07/31 14:29:54 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.41 2020/11/21 11:23:22 mlelstv Exp $"); #include #include @@ -156,7 +156,7 @@ vcons_init(struct vcons_data *vd, void * vd->wanted = NULL; vd->currenttype = def; vd->defaulttype = def; - callout_init(>switch_callout, 0); + callout_init(>switch_callout, CALLOUT_MPSAFE); callout_setfunc(>switch_callout, vcons_do_switch, vd); #ifdef VCONS_DRAW_INTR vd->cells = 0;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nia Date: Thu Oct 29 09:08:35 UTC 2020 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: wscons(4): WSKBD_TYPE_PC_AT is automatically translated to WSKBD_TYPE_PC_XT in modern kernels To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.123 src/sys/dev/wscons/wsconsio.h:1.124 --- src/sys/dev/wscons/wsconsio.h:1.123 Fri May 24 14:28:48 2019 +++ src/sys/dev/wscons/wsconsio.h Thu Oct 29 09:08:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.123 2019/05/24 14:28:48 nonaka Exp $ */ +/* $NetBSD: wsconsio.h,v 1.124 2020/10/29 09:08:35 nia Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -87,7 +87,7 @@ struct wscons_event { #define WSKBD_TYPE_LK201 1 /* lk-201 */ #define WSKBD_TYPE_LK401 2 /* lk-401 */ #define WSKBD_TYPE_PC_XT 3 /* PC-ish, XT scancode */ -#define WSKBD_TYPE_PC_AT 4 /* PC-ish, AT scancode */ +#define WSKBD_TYPE_PC_AT 4 /* PC-ish, AT scancode, not used by modern kernels */ #define WSKBD_TYPE_USB 5 /* USB, XT scancode */ #define WSKBD_TYPE_NEXT 6 /* NeXT keyboard */ #define WSKBD_TYPE_HPC_KBD 7 /* HPC bultin keyboard */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sat Oct 17 10:28:10 UTC 2020 Modified Files: src/sys/dev/wscons: wsksymdef.h Log Message: Correct KB_NEXT value. No impact since KB_NEXT isn't used anywhere. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/wscons/wsksymdef.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsksymdef.h diff -u src/sys/dev/wscons/wsksymdef.h:1.74 src/sys/dev/wscons/wsksymdef.h:1.75 --- src/sys/dev/wscons/wsksymdef.h:1.74 Sat Aug 29 22:42:53 2020 +++ src/sys/dev/wscons/wsksymdef.h Sat Oct 17 10:28:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsksymdef.h,v 1.74 2020/08/29 22:42:53 macallan Exp $ */ +/* $NetBSD: wsksymdef.h,v 1.75 2020/10/17 10:28:10 mlelstv Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -685,7 +685,7 @@ action(KB_UA, 0, 0x1200, "ua", , "Ukrain /* Define all the KB_xx numeric values using above table */ #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value, -enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1800 }; +enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1d00 }; /* Define list of KB_xxx and country codes for array initialisation */ #define KBF_ENCTAB(tag, tagf, value, cc, ccf, country) { tag, cc },
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nia Date: Mon Jul 13 09:50:12 UTC 2020 Modified Files: src/sys/dev/wscons: wsksymdef.h Log Message: Clarify that KB_TR is the "Q" layout - there's two standards for Turkish. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/wscons/wsksymdef.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsksymdef.h diff -u src/sys/dev/wscons/wsksymdef.h:1.72 src/sys/dev/wscons/wsksymdef.h:1.73 --- src/sys/dev/wscons/wsksymdef.h:1.72 Mon Jul 13 09:44:48 2020 +++ src/sys/dev/wscons/wsksymdef.h Mon Jul 13 09:50:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsksymdef.h,v 1.72 2020/07/13 09:44:48 nia Exp $ */ +/* $NetBSD: wsksymdef.h,v 1.73 2020/07/13 09:50:12 nia Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -678,7 +678,7 @@ action(KB_ES, 0, 0x0b00, "es", , "Spanis action(KB_SV, 0, 0x0900, "sv", , "Swedish") \ action(KB_SF, 0, 0x1000, "sf", , "Swiss French") \ action(KB_SG, 0, 0x0f00, "sg", , "Swiss German") \ -action(KB_TR, 0, 0x1700, "tr", , "Turkish") \ +action(KB_TR, 0, 0x1700, "tr", , "Turkish (Q-Layout)") \ action(KB_UA, 0, 0x1200, "ua", , "Ukrainian") #define KB_NONE 0x
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Sat Apr 4 13:07:12 UTC 2020 Modified Files: src/sys/dev/wscons: wsevent.c Log Message: KNF (Format block comment) NFCI To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wscons/wsevent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsevent.c diff -u src/sys/dev/wscons/wsevent.c:1.43 src/sys/dev/wscons/wsevent.c:1.44 --- src/sys/dev/wscons/wsevent.c:1.43 Sat Apr 4 07:33:18 2020 +++ src/sys/dev/wscons/wsevent.c Sat Apr 4 13:07:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.43 2020/04/04 07:33:18 mlelstv Exp $ */ +/* $NetBSD: wsevent.c,v 1.44 2020/04/04 13:07:11 pgoyette Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.43 2020/04/04 07:33:18 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.44 2020/04/04 13:07:11 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -164,7 +164,8 @@ wsevent_init(struct wseventvar *ev, stru #endif return; } - /* For binary compat set default version and either build with + /* + * For binary compat set default version and either build with * COMPAT_50 or load COMPAT_50 module to include the compatibility * code. */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sat Apr 4 07:33:18 UTC 2020 Modified Files: src/sys/dev/wscons: wsevent.c Log Message: Make default protocol version used by wscons selectable and default to the current version. Fixes PR 55103. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wscons/wsevent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsevent.c diff -u src/sys/dev/wscons/wsevent.c:1.42 src/sys/dev/wscons/wsevent.c:1.43 --- src/sys/dev/wscons/wsevent.c:1.42 Fri Mar 1 11:06:57 2019 +++ src/sys/dev/wscons/wsevent.c Sat Apr 4 07:33:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $ */ +/* $NetBSD: wsevent.c,v 1.43 2020/04/04 07:33:18 mlelstv Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.43 2020/04/04 07:33:18 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v #include #include #include +#include #include #include @@ -138,6 +139,8 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v sizeof(struct owscons_event)) #define EVARRAY(ev, idx) (&(ev)->q[(idx)]) +static int wsevent_default_version = WSEVENT_VERSION; + /* * Priority of code managing wsevent queues. PWSEVENT is set just above * PSOCK, which is just above TTIPRI, on the theory that mouse and keyboard @@ -161,8 +164,16 @@ wsevent_init(struct wseventvar *ev, stru #endif return; } - /* For binary compat. New code must call WSxxxIO_SETVERSION */ - ev->version = 0; + /* For binary compat set default version and either build with + * COMPAT_50 or load COMPAT_50 module to include the compatibility + * code. + */ + if (wsevent_default_version >= 0 && + wsevent_default_version < WSEVENT_VERSION) + ev->version = wsevent_default_version; + else + ev->version = WSEVENT_VERSION; + ev->get = ev->put = 0; ev->q = kmem_alloc(WSEVENT_QSIZE * sizeof(*ev->q), KM_SLEEP); selinit(>sel); @@ -445,3 +456,22 @@ wsevent_setversion(struct wseventvar *ev ev->version = vers; return 0; } + +SYSCTL_SETUP(sysctl_wsevent_setup, "sysctl hw.wsevent subtree setup") +{ +const struct sysctlnode *node = NULL; + +if (sysctl_createv(clog, 0, NULL, , +CTLFLAG_PERMANENT, +CTLTYPE_NODE, "wsevent", NULL, +NULL, 0, NULL, 0, +CTL_HW, CTL_CREATE, CTL_EOL) != 0) +return; + +sysctl_createv(clog, 0, , NULL, +CTLFLAG_READWRITE, +CTLTYPE_INT, "default_version", +SYSCTL_DESCR("Set default event version for compatibility"), +NULL, 0, _default_version, 0, +CTL_CREATE, CTL_EOL); +}
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: isaki Date: Thu Apr 18 14:01:28 UTC 2019 Modified Files: src/sys/dev/wscons: wsbell.c Log Message: Fix the bell period. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/wscons/wsbell.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.10 src/sys/dev/wscons/wsbell.c:1.11 --- src/sys/dev/wscons/wsbell.c:1.10 Thu Apr 18 13:01:38 2019 +++ src/sys/dev/wscons/wsbell.c Thu Apr 18 14:01:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.10 2019/04/18 13:01:38 isaki Exp $ */ +/* $NetBSD: wsbell.c,v 1.11 2019/04/18 14:01:28 isaki Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss @@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.10 2019/04/18 13:01:38 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.11 2019/04/18 14:01:28 isaki Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -424,7 +424,11 @@ bell_thread(void *arg) } tone.frequency = vb->pitch; - tone.duration = vb->period; + /* + * period (derived from wskbd) is in msec. + * duration (derived from spkr) is in units of 10msec. + */ + tone.duration = vb->period / 10; vol = vb->volume; mutex_exit(>sc_bellock); @@ -442,7 +446,7 @@ spkr_audio_play(struct wsbell_softc *sc, mutex_enter(>sc_bellock); sc->sc_bell_args.pitch = pitch; - sc->sc_bell_args.period = period / 5; + sc->sc_bell_args.period = period; sc->sc_bell_args.volume = volume; cv_broadcast(>sc_bellcv);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: tnn Date: Sun Mar 17 00:30:55 UTC 2019 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: allocate wsdisplay type 66 for ssdfb(4) To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.121 src/sys/dev/wscons/wsconsio.h:1.122 --- src/sys/dev/wscons/wsconsio.h:1.121 Thu Aug 31 19:55:43 2017 +++ src/sys/dev/wscons/wsconsio.h Sun Mar 17 00:30:55 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.121 2017/08/31 19:55:43 jmcneill Exp $ */ +/* $NetBSD: wsconsio.h,v 1.122 2019/03/17 00:30:55 tnn Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -341,6 +341,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_TEGRA 63 /* NVIDIA Tegra ARM SoC */ #define WSDISPLAY_TYPE_PLATINUM 64 /* onboard fb in PowerMac 7200 */ #define WSDISPLAY_TYPE_PLFB 65 /* ARM PrimeCell PL11x */ +#define WSDISPLAY_TYPE_SSDFB 66 /* ssdfb(4) */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Thu Feb 7 06:10:29 UTC 2019 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: be consistent in checking cn_getc return value. To generate a diff of this commit: cvs rdiff -u -r1.153 -r1.154 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.153 src/sys/dev/wscons/wsdisplay.c:1.154 --- src/sys/dev/wscons/wsdisplay.c:1.153 Sun Feb 3 03:19:28 2019 +++ src/sys/dev/wscons/wsdisplay.c Thu Feb 7 06:10:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.153 2019/02/03 03:19:28 mrg Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.154 2019/02/07 06:10:29 mlelstv Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.153 2019/02/03 03:19:28 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.154 2019/02/07 06:10:29 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -289,9 +289,9 @@ wsscreen_getc_poll(void *priv) struct tty *tp = scr->scr_tty; do { c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev); - if (c != -1) + if (c >= 0) (*tp->t_linesw->l_rint)((unsigned char)c, tp); - } while (c != -1); + } while (c >= 0); } callout_schedule(>scr_getc_ch, mstohz(10));
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mrg Date: Tue Feb 5 10:04:50 UTC 2019 Modified Files: src/sys/dev/wscons: wskbd.c Log Message: - call update_modifier() explicitly for the scrolling keys up event. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.142 src/sys/dev/wscons/wskbd.c:1.143 --- src/sys/dev/wscons/wskbd.c:1.142 Tue Sep 18 06:19:28 2018 +++ src/sys/dev/wscons/wskbd.c Tue Feb 5 10:04:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.142 2018/09/18 06:19:28 mrg Exp $ */ +/* $NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.142 2018/09/18 06:19:28 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.143 2019/02/05 10:04:49 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1547,7 +1547,9 @@ internal_command(struct wskbd_softc *sc, } else { return (0); } - } + } else + update_modifier(sc->id, *type, 0, MOD_COMMAND); + break; case KS_Cmd_ScrollSlowUp: case KS_Cmd_ScrollSlowDown: @@ -1566,7 +1568,9 @@ internal_command(struct wskbd_softc *sc, } else { return (0); } - } + } else + update_modifier(sc->id, *type, 0, MOD_COMMAND); + break; #endif case KS_Cmd:
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Wed Jan 30 11:24:48 UTC 2019 Modified Files: src/sys/dev/wscons: wsdisplay.c wsdisplay_vcons_util.c wsdisplayvar.h Log Message: Suspend multicons output to the old console device while replaying the vcons msgbuf. To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/wscons/wsdisplay_vcons_util.c cvs rdiff -u -r1.54 -r1.55 src/sys/dev/wscons/wsdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.151 src/sys/dev/wscons/wsdisplay.c:1.152 --- src/sys/dev/wscons/wsdisplay.c:1.151 Wed Jan 30 10:54:52 2019 +++ src/sys/dev/wscons/wsdisplay.c Wed Jan 30 11:24:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.151 2019/01/30 10:54:52 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.152 2019/01/30 11:24:48 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.151 2019/01/30 10:54:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.152 2019/01/30 11:24:48 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c, #ifdef WSDISPLAY_MULTICONS static bool wsdisplay_multicons_enable = true; +static bool wsdisplay_multicons_suspended = false; #endif /* Console device before replaced by wsdisplay */ @@ -2301,7 +2302,8 @@ wsdisplay_cnputc(dev_t dev, int i) (*dc->wsemul->output)(dc->wsemulcookie, , 1, 1); #ifdef WSDISPLAY_MULTICONS - if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_putc) + if (!wsdisplay_multicons_suspended && + wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_putc) wsdisplay_ocn->cn_putc(wsdisplay_ocn->cn_dev, i); #endif } @@ -2318,7 +2320,8 @@ wsdisplay_getc(dev_t dev) } #ifdef WSDISPLAY_MULTICONS - if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_getc) { + if (!wsdisplay_multicons_suspended && + wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_getc) { c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev); if (c >= 0) return c; @@ -2345,7 +2348,8 @@ wsdisplay_pollc(dev_t dev, int on) #ifdef WSDISPLAY_MULTICONS /* notify to old console driver */ - if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_pollc) + if (!wsdisplay_multicons_suspended && + wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_pollc) wsdisplay_ocn->cn_pollc(wsdisplay_ocn->cn_dev, on); #endif } @@ -2368,6 +2372,14 @@ wsdisplay_unset_cons_kbd(void) } #ifdef WSDISPLAY_MULTICONS +void +wsdisplay_multicons_suspend(bool suspend) +{ + wsdisplay_multicons_suspended = suspend; +} +#endif + +#ifdef WSDISPLAY_MULTICONS SYSCTL_SETUP(sysctl_hw_wsdisplay_setup, "sysctl hw.wsdisplay subtree setup") { const struct sysctlnode *wsdisplay_node; Index: src/sys/dev/wscons/wsdisplay_vcons_util.c diff -u src/sys/dev/wscons/wsdisplay_vcons_util.c:1.2 src/sys/dev/wscons/wsdisplay_vcons_util.c:1.3 --- src/sys/dev/wscons/wsdisplay_vcons_util.c:1.2 Wed May 25 06:01:39 2011 +++ src/sys/dev/wscons/wsdisplay_vcons_util.c Wed Jan 30 11:24:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons_util.c,v 1.2 2011/05/25 06:01:39 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons_util.c,v 1.3 2019/01/30 11:24:48 jmcneill Exp $ */ /*- * Copyright (c) 2009 Michael Lorenz @@ -26,6 +26,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef _KERNEL_OPT +#include "opt_wsdisplay_compat.h" +#endif + /* some utility functions for use with vcons */ #include #include @@ -48,6 +52,10 @@ vcons_replay_msgbuf(struct vcons_screen int status = scr->scr_status; int rptr = msgbufp->msg_bufr; +#ifdef WSDISPLAY_MULTICONS + wsdisplay_multicons_suspend(true); +#endif + scr->scr_status &= ~VCONS_IS_VISIBLE; while (rptr != msgbufp->msg_bufx) { cnputc(msgbufp->msg_bufc[rptr]); @@ -57,4 +65,8 @@ vcons_replay_msgbuf(struct vcons_screen } scr->scr_status = status; vcons_update_screen(scr); + +#ifdef WSDISPLAY_MULTICONS + wsdisplay_multicons_suspend(false); +#endif } Index: src/sys/dev/wscons/wsdisplayvar.h diff -u src/sys/dev/wscons/wsdisplayvar.h:1.54 src/sys/dev/wscons/wsdisplayvar.h:1.55 --- src/sys/dev/wscons/wsdisplayvar.h:1.54 Tue Dec 4 09:27:59 2018 +++ src/sys/dev/wscons/wsdisplayvar.h Wed Jan 30 11:24:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplayvar.h,v 1.54 2018/12/04 09:27:59 mlelstv Exp $ */ +/* $NetBSD: wsdisplayvar.h,v 1.55 2019/01/30 11:24:48 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -173,6 +173,7 @@ void wsdisplay_cnattach(const struct wss void wsdisplay_preattach(const struct wsscreen_descr *, void *, int, int,
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Wed Jan 30 10:54:52 UTC 2019 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Revert previous as it does not completely solve the problem of detaching a wsdisplay device To generate a diff of this commit: cvs rdiff -u -r1.150 -r1.151 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.150 src/sys/dev/wscons/wsdisplay.c:1.151 --- src/sys/dev/wscons/wsdisplay.c:1.150 Wed Jan 30 02:43:47 2019 +++ src/sys/dev/wscons/wsdisplay.c Wed Jan 30 10:54:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.150 2019/01/30 02:43:47 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.151 2019/01/30 10:54:52 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.150 2019/01/30 02:43:47 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.151 2019/01/30 10:54:52 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -966,12 +966,10 @@ wsdisplay_preattach(const struct wsscree void wsdisplay_cndetach(void) { - if (wsdisplay_console_initted > 0) { - cn_tab = wsdisplay_ocn; - wsdisplay_console_initted = 0; - wsdisplay_console_attached = 0; - wsdisplay_console_device = NULL; - } + KASSERT(wsdisplay_console_initted == 2); + + cn_tab = wsdisplay_ocn; + wsdisplay_console_initted = 0; } /*
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Wed Jan 30 02:43:47 UTC 2019 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Remove KASSERT in wsdisplay_cndetach. The caller likely doesn't know the state of the console, so simply do cleanup if a previous console has been attached. To generate a diff of this commit: cvs rdiff -u -r1.149 -r1.150 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.149 src/sys/dev/wscons/wsdisplay.c:1.150 --- src/sys/dev/wscons/wsdisplay.c:1.149 Thu Nov 29 23:18:40 2018 +++ src/sys/dev/wscons/wsdisplay.c Wed Jan 30 02:43:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.150 2019/01/30 02:43:47 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.150 2019/01/30 02:43:47 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -966,10 +966,12 @@ wsdisplay_preattach(const struct wsscree void wsdisplay_cndetach(void) { - KASSERT(wsdisplay_console_initted == 2); - - cn_tab = wsdisplay_ocn; - wsdisplay_console_initted = 0; + if (wsdisplay_console_initted > 0) { + cn_tab = wsdisplay_ocn; + wsdisplay_console_initted = 0; + wsdisplay_console_attached = 0; + wsdisplay_console_device = NULL; + } } /*
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sat Dec 15 22:05:24 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay_compat_usl.c Log Message: - Use kmem_intr_{alloc,free}, because on time out we need to free from an interrupt context. - Remove parens from returns and useless casts from void. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplay_compat_usl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_compat_usl.c diff -u src/sys/dev/wscons/wsdisplay_compat_usl.c:1.51 src/sys/dev/wscons/wsdisplay_compat_usl.c:1.52 --- src/sys/dev/wscons/wsdisplay_compat_usl.c:1.51 Fri Nov 3 21:52:09 2017 +++ src/sys/dev/wscons/wsdisplay_compat_usl.c Sat Dec 15 17:05:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.52 2018/12/15 22:05:23 christos Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.52 2018/12/15 22:05:23 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_freebsd.h" @@ -101,7 +101,7 @@ usl_sync_init(struct wsscreen *scr, stru struct usl_syncdata *sd; int res; - sd = kmem_alloc(sizeof(*sd), KM_SLEEP); + sd = kmem_intr_alloc(sizeof(*sd), KM_SLEEP); sd->s_scr = scr; sd->s_proc = p; @@ -116,11 +116,11 @@ usl_sync_init(struct wsscreen *scr, stru callout_setfunc(>s_detach_ch, usl_detachtimeout, sd); res = wsscreen_attach_sync(scr, _syncops, sd); if (res) { - kmem_free(sd, sizeof(*sd)); - return (res); + kmem_intr_free(sd, sizeof(*sd)); + return res; } *sdp = sd; - return (0); + return 0; } static void @@ -135,7 +135,7 @@ usl_sync_done(struct usl_syncdata *sd) (*sd->s_callback)(sd->s_cbarg, ENXIO, 0); } wsscreen_detach_sync(sd->s_scr); - kmem_free(sd, sizeof(*sd)); + kmem_intr_free(sd, sizeof(*sd)); } static int @@ -148,13 +148,13 @@ usl_sync_check_sig(struct usl_syncdata * if (sig) psignal(sd->s_proc, sig); mutex_exit(proc_lock); - return (1); + return 1; } mutex_exit(proc_lock); - printf("usl_sync_check: process %d died\n", sd->s_pid); + printf("%s: process %d died\n", __func__, sd->s_pid); usl_sync_done(sd); - return (0); + return 0; } static int @@ -171,8 +171,8 @@ usl_sync_get(struct wsscreen *scr) void *sd; if (wsscreen_lookup_sync(scr, _syncops, )) - return (0); - return (struct usl_syncdata *)sd; + return 0; + return sd; } static int @@ -183,7 +183,7 @@ usl_detachproc(void *cookie, int waitok, /* we really need a callback */ if (!callback) - return (EINVAL); + return EINVAL; /* * Normally, this is called from the controlling process. @@ -194,19 +194,19 @@ usl_detachproc(void *cookie, int waitok, sd->s_cbarg = cbarg; if (waitok) { if (!usl_sync_check_sig(sd, sd->s_relsig, SF_DETACHPENDING)) - return (0); + return 0; } callout_schedule(>s_detach_ch, wscompat_usl_synctimeout * hz); - return (EAGAIN); + return EAGAIN; } static int usl_detachack(struct usl_syncdata *sd, int ack) { if (!(sd->s_flags & SF_DETACHPENDING)) { - printf("usl_detachack: not detaching\n"); - return (EINVAL); + printf("%s: not detaching\n", __func__); + return EINVAL; } callout_stop(>s_detach_ch); @@ -215,7 +215,7 @@ usl_detachack(struct usl_syncdata *sd, i if (sd->s_callback) (*sd->s_callback)(sd->s_cbarg, (ack ? 0 : EIO), 1); - return (0); + return 0; } static void @@ -223,10 +223,10 @@ usl_detachtimeout(void *arg) { struct usl_syncdata *sd = arg; - printf("usl_detachtimeout\n"); + printf("%s\n", __func__); if (!(sd->s_flags & SF_DETACHPENDING)) { - printf("usl_detachtimeout: not detaching\n"); + printf("%s: not detaching\n", __func__); return; } @@ -246,23 +246,23 @@ usl_attachproc(void *cookie, int waitok, /* we really need a callback */ if (!callback) - return (EINVAL); + return EINVAL; sd->s_callback = callback; sd->s_cbarg = cbarg; if (!usl_sync_check_sig(sd, sd->s_acqsig, SF_ATTACHPENDING)) - return (0); + return 0; callout_schedule(>s_attach_ch, wscompat_usl_synctimeout * hz); - return (EAGAIN); + return EAGAIN; } static int usl_attachack(struct usl_syncdata *sd, int ack) { if (!(sd->s_flags & SF_ATTACHPENDING)) { - printf("usl_attachack: not attaching\n"); - return (EINVAL); + printf("%s: not attaching\n", __func__); + return EINVAL; } callout_stop(>s_attach_ch); @@ -271,7 +271,7 @@ usl_attachack(struct usl_syncdata *sd, i if (sd->s_callback) (*sd->s_callback)(sd->s_cbarg, (ack ? 0 : EIO), 1); - return (0); + return 0; } static void @@ -279,10 +279,10 @@ usl_attachtimeout(void *arg) { struct usl_syncdata *sd = arg; - printf("usl_attachtimeout\n"); +
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: uwe Date: Thu Dec 6 01:42:20 UTC 2018 Modified Files: src/sys/dev/wscons: wsemul_vt100_subr.c Log Message: #ifdef _KERNEL_OPT To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/wscons/wsemul_vt100_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100_subr.c diff -u src/sys/dev/wscons/wsemul_vt100_subr.c:1.23 src/sys/dev/wscons/wsemul_vt100_subr.c:1.24 --- src/sys/dev/wscons/wsemul_vt100_subr.c:1.23 Mon Sep 3 16:29:34 2018 +++ src/sys/dev/wscons/wsemul_vt100_subr.c Thu Dec 6 01:42:20 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100_subr.c,v 1.23 2018/09/03 16:29:34 riastradh Exp $ */ +/* $NetBSD: wsemul_vt100_subr.c,v 1.24 2018/12/06 01:42:20 uwe Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.23 2018/09/03 16:29:34 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.24 2018/12/06 01:42:20 uwe Exp $"); #include #include @@ -38,7 +38,9 @@ __KERNEL_RCSID(0, "$NetBSD: wsemul_vt100 #include #include +#ifdef _KERNEL_OPT #include "opt_wsemul.h" +#endif static int vt100_selectattribute(struct vt100base_data *, int, int, int, long *, long *);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: msaitoh Date: Sat Dec 1 00:28:45 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Don't abuse config_interrupts()'s first argument. Use kthread instead of config_interrupt(). OK'd by jmcneill and macallan. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.38 src/sys/dev/wscons/wsdisplay_vcons.c:1.39 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.38 Fri Jun 2 19:33:51 2017 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sat Dec 1 00:28:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.39 2018/12/01 00:28:45 msaitoh Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.39 2018/12/01 00:28:45 msaitoh Exp $"); #include #include @@ -121,7 +121,7 @@ static void vcons_unlock(struct vcons_sc #ifdef VCONS_DRAW_INTR static void vcons_intr(void *); static void vcons_softintr(void *); -static void vcons_intr_enable(device_t); +static void vcons_init_thread(void *); #endif int @@ -180,8 +180,11 @@ vcons_init(struct vcons_data *vd, void * callout_setfunc(>intr, vcons_intr, vd); vd->intr_valid = 1; - /* XXX assume that the 'dev' arg is never dereferenced */ - config_interrupts((device_t)vd, vcons_intr_enable); + if (kthread_create(PRI_NONE, 0, NULL, vcons_init_thread, vd, NULL, + "vcons_init") != 0) { + printf("%s: unable to create thread.\n", __func__); + return -1; + } #endif return 0; } @@ -1456,12 +1459,13 @@ vcons_softintr(void *cookie) } static void -vcons_intr_enable(device_t dev) +vcons_init_thread(void *cookie) { - /* the 'dev' arg we pass to config_interrupts isn't a device_t */ - struct vcons_data *vd = (struct vcons_data *)dev; + struct vcons_data *vd = (struct vcons_data *)cookie; + vd->use_intr = 2; callout_schedule(>intr, mstohz(33)); + kthread_exit(0); } #endif /* VCONS_DRAW_INTR */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: msaitoh Date: Fri Nov 30 05:20:34 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay_vconsvar.h Log Message: Remove extra whitespaces. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.26 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.27 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.26 Fri Jun 2 19:33:51 2017 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Fri Nov 30 05:20:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.26 2017/06/02 19:33:51 macallan Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.27 2018/11/30 05:20:34 msaitoh Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -57,7 +57,7 @@ struct vcons_screen { * drawing */ #define VCONS_DONT_DRAW 8 /* don't draw on this screen at all */ /* - * the following flags are for drivers which either can't accelerate (all) copy + * the following flags are for drivers which either can't accelerate (all) copy * operations or where drawing characters is faster than the blitter * for example, Sun's Creator boards can't accelerate copycols() */ @@ -97,13 +97,13 @@ struct vcons_screen { struct vcons_data { /* usually the drivers softc */ void *cookie; - + /* * setup the rasops part of the passed vcons_screen, like * geometry, framebuffer address, font, characters, acceleration. * we pass the cookie as 1st parameter */ - void (*init_screen)(void *, struct vcons_screen *, int, + void (*init_screen)(void *, struct vcons_screen *, int, long *); /* accessops */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Thu Nov 29 23:18:40 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Add hw.wsdisplay.multicons sysctl that can be used to disable mirroring wsdisplay output to serial port. To generate a diff of this commit: cvs rdiff -u -r1.148 -r1.149 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.148 src/sys/dev/wscons/wsdisplay.c:1.149 --- src/sys/dev/wscons/wsdisplay.c:1.148 Thu Nov 15 13:50:51 2018 +++ src/sys/dev/wscons/wsdisplay.c Thu Nov 29 23:18:40 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.149 2018/11/29 23:18:40 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c, #include #include #include +#include #include #include @@ -71,6 +72,10 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c, #include "locators.h" +#ifdef WSDISPLAY_MULTICONS +static bool wsdisplay_multicons_enable = true; +#endif + /* Console device before replaced by wsdisplay */ static struct consdev *wsdisplay_ocn; @@ -277,7 +282,8 @@ wsscreen_getc_poll(void *priv) struct wsscreen *scr = priv; int c; - if (wsdisplay_ocn && wsdisplay_ocn->cn_getc && + if (wsdisplay_multicons_enable && + wsdisplay_ocn && wsdisplay_ocn->cn_getc && WSSCREEN_HAS_EMULATOR(scr) && WSSCREEN_HAS_TTY(scr)) { struct tty *tp = scr->scr_tty; do { @@ -1670,7 +1676,8 @@ wsdisplaystart(struct tty *tp) (*scr->scr_dconf->wsemul->output)(scr->scr_dconf->wsemulcookie, tbuf, n, 0); #ifdef WSDISPLAY_MULTICONS - if (scr->scr_dconf == _console_conf && + if (wsdisplay_multicons_enable && + scr->scr_dconf == _console_conf && wsdisplay_ocn && wsdisplay_ocn->cn_putc) { for (int i = 0; i < n; i++) wsdisplay_ocn->cn_putc( @@ -1689,7 +1696,8 @@ wsdisplaystart(struct tty *tp) (scr->scr_dconf->wsemulcookie, tbuf, n, 0); #ifdef WSDISPLAY_MULTICONS - if (scr->scr_dconf == _console_conf && + if (wsdisplay_multicons_enable && + scr->scr_dconf == _console_conf && wsdisplay_ocn && wsdisplay_ocn->cn_putc) { for (int i = 0; i < n; i++) wsdisplay_ocn->cn_putc( @@ -2293,7 +2301,7 @@ wsdisplay_cnputc(dev_t dev, int i) (*dc->wsemul->output)(dc->wsemulcookie, , 1, 1); #ifdef WSDISPLAY_MULTICONS - if (wsdisplay_ocn && wsdisplay_ocn->cn_putc) + if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_putc) wsdisplay_ocn->cn_putc(wsdisplay_ocn->cn_dev, i); #endif } @@ -2310,7 +2318,7 @@ wsdisplay_getc(dev_t dev) } #ifdef WSDISPLAY_MULTICONS - if (wsdisplay_ocn && wsdisplay_ocn->cn_getc) { + if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_getc) { c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev); if (c >= 0) return c; @@ -2337,7 +2345,7 @@ wsdisplay_pollc(dev_t dev, int on) #ifdef WSDISPLAY_MULTICONS /* notify to old console driver */ - if (wsdisplay_ocn && wsdisplay_ocn->cn_pollc) + if (wsdisplay_multicons_enable && wsdisplay_ocn && wsdisplay_ocn->cn_pollc) wsdisplay_ocn->cn_pollc(wsdisplay_ocn->cn_dev, on); #endif } @@ -2358,3 +2366,24 @@ wsdisplay_unset_cons_kbd(void) wsdisplay_cons_kbd_getc = NULL; wsdisplay_cons_kbd_pollc = NULL; } + +#ifdef WSDISPLAY_MULTICONS +SYSCTL_SETUP(sysctl_hw_wsdisplay_setup, "sysctl hw.wsdisplay subtree setup") +{ + const struct sysctlnode *wsdisplay_node; + + if (sysctl_createv(clog, 0, NULL, _node, + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "wsdisplay", NULL, + NULL, 0, NULL, 0, + CTL_HW, CTL_CREATE, CTL_EOL) != 0) + return; + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_READWRITE, + CTLTYPE_BOOL, "multicons", + SYSCTL_DESCR("Enable wsdisplay multicons"), + NULL, 0, _multicons_enable, 0, + CTL_HW, wsdisplay_node->sysctl_num, CTL_CREATE, CTL_EOL); +} +#endif
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Thu Nov 15 13:50:51 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: WSDISPLAYIO_SFONT: Do not attempt to print to the console in the middle of resizing when DEBUG is defined. To generate a diff of this commit: cvs rdiff -u -r1.147 -r1.148 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.147 src/sys/dev/wscons/wsdisplay.c:1.148 --- src/sys/dev/wscons/wsdisplay.c:1.147 Wed Sep 26 09:04:12 2018 +++ src/sys/dev/wscons/wsdisplay.c Thu Nov 15 13:50:51 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.148 2018/11/15 13:50:51 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -1389,11 +1389,6 @@ wsdisplay_internal_ioctl(struct wsdispla if (!error && WSSCREEN_HAS_EMULATOR(scr)) { (*scr->scr_dconf->wsemul->reset) (scr->scr_dconf->wsemulcookie, WSEMUL_SYNCFONT); -#ifdef DEBUG - printf("resize: %d %d\n", - scr->scr_dconf->scrdata->nrows, - scr->scr_dconf->scrdata->ncols); -#endif if (scr->scr_dconf->wsemul->resize) { (*scr->scr_dconf->wsemul->resize) (scr->scr_dconf->wsemulcookie,
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: bouyer Date: Wed Sep 26 09:04:12 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay.c wsdisplayvar.h Log Message: Introduce wsdisplay_isconsole(struct wsdisplay_softc *), which returns sc->sc_isconsole To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/wsdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.146 src/sys/dev/wscons/wsdisplay.c:1.147 --- src/sys/dev/wscons/wsdisplay.c:1.146 Tue Sep 18 06:19:28 2018 +++ src/sys/dev/wscons/wsdisplay.c Wed Sep 26 09:04:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.146 2018/09/18 06:19:28 mrg Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.146 2018/09/18 06:19:28 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.147 2018/09/26 09:04:12 bouyer Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -2127,6 +2127,13 @@ wsdisplay_reset(device_t dv, enum wsdisp } } + +bool +wsdisplay_isconsole(struct wsdisplay_softc *sc) +{ + return sc->sc_isconsole; +} + /* * Interface for (external) VT switch / process synchronization code */ Index: src/sys/dev/wscons/wsdisplayvar.h diff -u src/sys/dev/wscons/wsdisplayvar.h:1.52 src/sys/dev/wscons/wsdisplayvar.h:1.53 --- src/sys/dev/wscons/wsdisplayvar.h:1.52 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsdisplayvar.h Wed Sep 26 09:04:12 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplayvar.h,v 1.52 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsdisplayvar.h,v 1.53 2018/09/26 09:04:12 bouyer Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -208,6 +208,8 @@ int wsdisplay_stat_ioctl(struct wsdispla int wsdisplay_cfg_ioctl(struct wsdisplay_softc *, u_long, void *, int, struct lwp *); +bool wsdisplay_isconsole(struct wsdisplay_softc *); + struct wsdisplayio_edid_info; int wsdisplayio_get_edid(device_t, struct wsdisplayio_edid_info *);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mrg Date: Tue Sep 18 06:19:28 UTC 2018 Modified Files: src/sys/dev/wscons: wsdisplay.c wskbd.c Log Message: fix wsdisplay/wskbd and cngetc() return value issues: - return -1 for error / no character - allow 0 as a character cngetc() itself considers any value >= 0 valid, and this matches the usage in other drivers that return -1 for "not data", vs polling until something arrives. removes ^G from spewing out the askname/etc prompts when no key has been pressed (these come from cngetsn(), ignoring unknown non printable characters.) from @skrll with help from @mlelstv. To generate a diff of this commit: cvs rdiff -u -r1.145 -r1.146 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.141 -r1.142 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.145 src/sys/dev/wscons/wsdisplay.c:1.146 --- src/sys/dev/wscons/wsdisplay.c:1.145 Mon Dec 18 22:44:30 2017 +++ src/sys/dev/wscons/wsdisplay.c Tue Sep 18 06:19:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.145 2017/12/18 22:44:30 christos Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.146 2018/09/18 06:19:28 mrg Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.145 2017/12/18 22:44:30 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.146 2018/09/18 06:19:28 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -2303,19 +2303,18 @@ wsdisplay_getc(dev_t dev) if (wsdisplay_cons_kbd_getc) { c = wsdisplay_cons_kbd_getc(wsdisplay_cons.cn_dev); - if (c > 0) + if (c >= 0) return c; } #ifdef WSDISPLAY_MULTICONS if (wsdisplay_ocn && wsdisplay_ocn->cn_getc) { c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev); - if (c > 0) + if (c >= 0) return c; } #endif - /* panic? */ - return (0); + return -1; } static void Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.141 src/sys/dev/wscons/wskbd.c:1.142 --- src/sys/dev/wscons/wskbd.c:1.141 Mon Dec 18 18:57:21 2017 +++ src/sys/dev/wscons/wskbd.c Tue Sep 18 06:19:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.141 2017/12/18 18:57:21 jmcneill Exp $ */ +/* $NetBSD: wskbd.c,v 1.142 2018/09/18 06:19:28 mrg Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.141 2017/12/18 18:57:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.142 2018/09/18 06:19:28 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1385,11 +1385,11 @@ wskbd_cngetc(dev_t dev) keysym_t ks; if (!wskbd_console_initted) - return 0; + return -1; if (wskbd_console_device != NULL && !wskbd_console_device->sc_translating) - return 0; + return -1; for(;;) { if (num-- > 0) { @@ -1402,7 +1402,7 @@ wskbd_cngetc(dev_t dev) , ); if (type == 0) { /* No data returned */ -return 0; +return -1; } if (type == WSCONS_EVENT_ASCII) { /*
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: uwe Date: Wed Jun 13 02:09:09 UTC 2018 Modified Files: src/sys/dev/wscons: wsevent.c Log Message: wsevent_copyout_events50 - don't leak garbage from the kernel stack. On 64-bit machines struct timespec50 has padding between 32-bit tv_sec and long tv_nsec that is not affected by normal assignment. Scrub it before we uiomove struct owscons_event. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/wscons/wsevent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsevent.c diff -u src/sys/dev/wscons/wsevent.c:1.37 src/sys/dev/wscons/wsevent.c:1.38 --- src/sys/dev/wscons/wsevent.c:1.37 Wed Oct 25 08:12:39 2017 +++ src/sys/dev/wscons/wsevent.c Wed Jun 13 02:09:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $ */ +/* $NetBSD: wsevent.c,v 1.38 2018/06/13 02:09:09 uwe Exp $ */ /*- * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.38 2018/06/13 02:09:09 uwe Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -202,6 +202,9 @@ wsevent_copyout_events50(const struct ws ev50.type = ev->type; ev50.value = ev->value; +#if INT32_MAX < LONG_MAX /* scrub padding */ + memset(, 0, offsetof(struct timespec50, tv_nsec)); +#endif timespec_to_timespec50(>time, ); error = uiomove(, sizeof(ev50), uio);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: uwe Date: Tue Jun 5 21:11:50 UTC 2018 Modified Files: src/sys/dev/wscons: wsemul_vt100_subr.c Log Message: PR kern/53245 - support SGR 39 (default foreground) and 49 (background). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/wscons/wsemul_vt100_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100_subr.c diff -u src/sys/dev/wscons/wsemul_vt100_subr.c:1.21 src/sys/dev/wscons/wsemul_vt100_subr.c:1.22 --- src/sys/dev/wscons/wsemul_vt100_subr.c:1.21 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsemul_vt100_subr.c Tue Jun 5 21:11:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100_subr.c,v 1.21 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsemul_vt100_subr.c,v 1.22 2018/06/05 21:11:50 uwe Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.21 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.22 2018/06/05 21:11:50 uwe Exp $"); #include #include @@ -516,12 +516,18 @@ wsemul_vt100_handle_csi(struct vt100base flags |= WSATTR_WSCOLORS; fgcol = ARG(edp, n) - 30; break; + case 39: +fgcol = edp->msgattrs.default_fg; +break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: /* bg color */ flags |= WSATTR_WSCOLORS; bgcol = ARG(edp, n) - 40; break; + case 49: +bgcol = edp->msgattrs.default_bg; +break; default: #ifdef VT100_PRINTUNKNOWN printf("CSI%dm unknown\n", ARG(edp, n));
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: khorben Date: Sat Mar 10 23:25:59 UTC 2018 Modified Files: src/sys/dev/wscons: mra.c Log Message: Fix spello in a comment To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wscons/mra.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/mra.c diff -u src/sys/dev/wscons/mra.c:1.6 src/sys/dev/wscons/mra.c:1.7 --- src/sys/dev/wscons/mra.c:1.6 Fri Mar 14 05:03:19 2014 +++ src/sys/dev/wscons/mra.c Sat Mar 10 23:25:59 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $ */ +/* $NetBSD: mra.c,v 1.7 2018/03/10 23:25:59 khorben Exp $ */ /* * Copyright (c) 1999 Shin Takemura All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.7 2018/03/10 23:25:59 khorben Exp $"); #include #include @@ -61,7 +61,7 @@ mra_Y_AX1_BX2_C(const int *y, int ys, #define Y(i) AA(y, ys, i) /* - * get avarage and sum + * get average and sum */ X1a = 0; X2a = 0; Ya = 0; X1X1s = 0; X2X2s = 0; X1X2s = 0;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: martin Date: Sun Jan 21 10:30:51 UTC 2018 Modified Files: src/sys/dev/wscons: wsemul_vt100.c Log Message: Try to fix previous to make it compile. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.43 src/sys/dev/wscons/wsemul_vt100.c:1.44 --- src/sys/dev/wscons/wsemul_vt100.c:1.43 Sun Jan 21 01:18:48 2018 +++ src/sys/dev/wscons/wsemul_vt100.c Sun Jan 21 10:30:51 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.44 2018/01/21 10:30:51 martin Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.44 2018/01/21 10:30:51 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -805,7 +805,6 @@ wsemul_vt100_output_dcs(struct wsemul_vt #endif vd->nargs = VT100_EMUL_NARGS; } - newstate = VT100_EMUL_STATE_STRING; switch (c) { case '$': return VT100_EMUL_STATE_DCS_DOLLAR; @@ -823,6 +822,7 @@ wsemul_vt100_output_dcs(struct wsemul_vt #endif break; } + return VT100_EMUL_STATE_STRING; } return VT100_EMUL_STATE_DCS;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sun Jan 21 01:18:48 UTC 2018 Modified Files: src/sys/dev/wscons: wsemul_vt100.c Log Message: make check cleaner, and simplify the code. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.42 src/sys/dev/wscons/wsemul_vt100.c:1.43 --- src/sys/dev/wscons/wsemul_vt100.c:1.42 Sat Jan 20 18:27:06 2018 +++ src/sys/dev/wscons/wsemul_vt100.c Sat Jan 20 20:18:48 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -230,7 +230,7 @@ wsemul_vt100_cnattach(const struct wsscr edp->isolatin1tab = edp->decgraphtab = edp->dectechtab = 0; edp->nrctab = 0; wsemul_vt100_reset(edp); - return (edp); + return edp; } void * @@ -263,7 +263,7 @@ wsemul_vt100_attach(int console, const s edp->nrctab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT); vt100_initchartables(edp); wsemul_vt100_reset(edp); - return (edp); + return edp; } void @@ -461,7 +461,7 @@ wsemul_vt100_output_c0c1(struct wsemul_v break; case ASCII_ESC: if (kernel) { - printf("wsemul_vt100_output_c0c1: ESC in kernel output ignored\n"); + printf("%s: ESC in kernel output ignored\n", __func__); break; /* ignore the ESC */ } @@ -490,7 +490,8 @@ wsemul_vt100_output_c0c1(struct wsemul_v case ST: /* string end 8-bit */ /* XXX only in VT100_EMUL_STATE_STRING */ wsemul_vt100_handle_dcs(edp); - return (VT100_EMUL_STATE_NORMAL); + edp->state = VT100_EMUL_STATE_NORMAL; + break; #endif case ASCII_LF: case ASCII_VT: @@ -504,7 +505,6 @@ static u_int wsemul_vt100_output_esc(struct wsemul_vt100_emuldata *edp, u_char c) { struct vt100base_data *vd = >bd; - u_int newstate = VT100_EMUL_STATE_NORMAL; int i; switch (c) { @@ -512,8 +512,7 @@ wsemul_vt100_output_esc(struct wsemul_vt vd->nargs = 0; memset(vd->args, 0, sizeof (vd->args)); vd->modif1 = vd->modif2 = '\0'; - newstate = VT100_EMUL_STATE_CSI; - break; + return VT100_EMUL_STATE_CSI; case '7': /* DECSC */ vd->flags |= VTFL_SAVEDCURS; edp->savedcursor_row = vd->crow; @@ -591,8 +590,7 @@ wsemul_vt100_output_esc(struct wsemul_vt case 'P': /* DCS */ vd->nargs = 0; memset(vd->args, 0, sizeof (vd->args)); - newstate = VT100_EMUL_STATE_DCS; - break; + return VT100_EMUL_STATE_DCS; case 'c': /* RIS */ wsemul_vt100_reset(edp); wsemul_vt100_ed(vd, 2); @@ -600,24 +598,19 @@ wsemul_vt100_output_esc(struct wsemul_vt break; case '(': case ')': case '*': case '+': /* SCS */ edp->designating = c - '('; - newstate = VT100_EMUL_STATE_SCS94; - break; + return VT100_EMUL_STATE_SCS94; case '-': case '.': case '/': /* SCS */ edp->designating = c - '-' + 1; - newstate = VT100_EMUL_STATE_SCS96; - break; + return VT100_EMUL_STATE_SCS96; case '#': - newstate = VT100_EMUL_STATE_ESC_HASH; - break; + return VT100_EMUL_STATE_ESC_HASH; case ' ': /* 7/8 bit */ - newstate = VT100_EMUL_STATE_ESC_SPC; - break; + return VT100_EMUL_STATE_ESC_SPC; case ']': /* OSC operating system command */ case '^': /* PM privacy message */ case '_': /* APC application program command */ /* ignored */ - newstate = VT100_EMUL_STATE_STRING; - break; + return VT100_EMUL_STATE_STRING; case '<': /* exit VT52 mode - ignored */ break; default: @@ -626,19 +619,15 @@ wsemul_vt100_output_esc(struct wsemul_vt #endif break; } - - return (newstate); + return VT100_EMUL_STATE_NORMAL; } static u_int wsemul_vt100_output_scs94(struct wsemul_vt100_emuldata *edp, u_char c) { - u_int newstate = VT100_EMUL_STATE_NORMAL; - switch (c) { case '%': /* probably DEC supplemental graphic */ - newstate = VT100_EMUL_STATE_SCS94_PERCENT; - break; + return VT100_EMUL_STATE_SCS94_PERCENT; case 'A': /* british / national */ edp->chartab_G[edp->designating] = edp->nrctab; break; @@ -661,7 +650,7 @@ wsemul_vt100_output_scs94(struct wsemul_ #endif break; } - return (newstate); + return VT100_EMUL_STATE_NORMAL; } static u_int @@ -678,19 +667,17 @@ wsemul_vt100_output_scs94_percent(struct #endif break; } - return (VT100_EMUL_STATE_NORMAL); + return VT100_EMUL_STATE_NORMAL; } static u_int wsemul_vt100_output_scs96(struct wsemul_vt100_emuldata *edp, u_char c) { - u_int newstate = VT100_EMUL_STATE_NORMAL; int nrc; switch (c) { case '%': /* probably portuguese */ - newstate =
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: rin Date: Sat Jan 20 23:27:06 UTC 2018 Modified Files: src/sys/dev/wscons: wsemul_vt100.c Log Message: Correct wrong assertion code introduced by rev 1.41: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/wscons/wsemul_vt100.c#rev1.41 Fix kernel panic reported in PR kern/52935. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.41 src/sys/dev/wscons/wsemul_vt100.c:1.42 --- src/sys/dev/wscons/wsemul_vt100.c:1.41 Fri Nov 3 19:20:27 2017 +++ src/sys/dev/wscons/wsemul_vt100.c Sat Jan 20 23:27:06 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -1006,7 +1006,7 @@ wsemul_vt100_output(void *cookie, const wsemul_vt100_output_normal(edp, *data, kernel); continue; } - KASSERT(edp->state < __arraycount(vt100_output) - 1); + KASSERT(edp->state <= __arraycount(vt100_output)); edp->state = vt100_output[edp->state - 1](edp, *data); } if (vd->flags & VTFL_CURSORON)
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Mon Dec 18 22:44:30 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: ifdef speeding ticket. To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.144 src/sys/dev/wscons/wsdisplay.c:1.145 --- src/sys/dev/wscons/wsdisplay.c:1.144 Mon Dec 18 13:59:32 2017 +++ src/sys/dev/wscons/wsdisplay.c Mon Dec 18 17:44:30 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.144 2017/12/18 18:59:32 jmcneill Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.145 2017/12/18 22:44:30 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.144 2017/12/18 18:59:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.145 2017/12/18 22:44:30 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -369,8 +369,10 @@ wsscreen_detach(struct wsscreen *scr) } if (scr->scr_dconf->scrdata->capabilities & WSSCREEN_FREE) free(__UNCONST(scr->scr_dconf->scrdata), M_DEVBUF); +#ifdef WSDISPLAY_MULTICONS callout_halt(>scr_getc_ch, NULL); callout_destroy(>scr_getc_ch); +#endif free(scr->scr_dconf, M_DEVBUF); free(scr, M_DEVBUF); }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Mon Dec 18 18:59:32 UTC 2017 Modified Files: src/sys/dev/wscons: files.wscons wsdisplay.c Log Message: Add WSDISPLAY_MULTICONS option which allows wsdisplay to cooperate with the console device being overridden. This allows for simultaneous console output on fb and debug uart. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/wscons/files.wscons cvs rdiff -u -r1.143 -r1.144 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.54 src/sys/dev/wscons/files.wscons:1.55 --- src/sys/dev/wscons/files.wscons:1.54 Wed Aug 30 00:39:27 2017 +++ src/sys/dev/wscons/files.wscons Mon Dec 18 18:59:32 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.54 2017/08/30 00:39:27 jmcneill Exp $ +# $NetBSD: files.wscons,v 1.55 2017/12/18 18:59:32 jmcneill Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -31,6 +31,7 @@ defflag opt_wsdisplay_compat.h WSDISPLAY WSCONS_SUPPORT_ISO7FONTS WSDISPLAY_SCROLLSUPPORT WSKBD_EVENT_AUTOREPEAT +WSDISPLAY_MULTICONS defparam opt_wsdisplay_compat.h WSCOMPAT_USL_SYNCTIMEOUT WSDISPLAY_DEFAULTSCREENS defparam opt_wsdisplay_compat.h WSDISPLAY_SCROLLBACK_LINES=100 Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.143 src/sys/dev/wscons/wsdisplay.c:1.144 --- src/sys/dev/wscons/wsdisplay.c:1.143 Fri Nov 3 18:49:37 2017 +++ src/sys/dev/wscons/wsdisplay.c Mon Dec 18 18:59:32 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.144 2017/12/18 18:59:32 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.144 2017/12/18 18:59:32 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -71,6 +71,9 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay.c, #include "locators.h" +/* Console device before replaced by wsdisplay */ +static struct consdev *wsdisplay_ocn; + struct wsscreen_internal { const struct wsdisplay_emulops *emulops; void *emulcookie; @@ -99,6 +102,10 @@ struct wsscreen { int scr_rawkbd; #endif +#ifdef WSDISPLAY_MULTICONS + callout_t scr_getc_ch; +#endif + struct wsdisplay_softc *sc; #ifdef DIAGNOSTIC @@ -234,14 +241,15 @@ static int wsdisplay_console_attached; static struct wsdisplay_softc *wsdisplay_console_device; static struct wsscreen_internal wsdisplay_console_conf; -static int wsdisplay_getc_dummy(dev_t); +static int wsdisplay_getc(dev_t); static void wsdisplay_pollc(dev_t, int); static int wsdisplay_cons_pollmode; +static int (*wsdisplay_cons_kbd_getc)(dev_t); static void (*wsdisplay_cons_kbd_pollc)(dev_t, int); static struct consdev wsdisplay_cons = { - NULL, NULL, wsdisplay_getc_dummy, wsdisplay_cnputc, + NULL, NULL, wsdisplay_getc, wsdisplay_cnputc, wsdisplay_pollc, NULL, NULL, NULL, NODEV, CN_NORMAL }; @@ -262,6 +270,27 @@ static int wsdisplay_dosync(struct wsdis int wsdisplay_clearonclose; +#ifdef WSDISPLAY_MULTICONS +static void +wsscreen_getc_poll(void *priv) +{ + struct wsscreen *scr = priv; + int c; + + if (wsdisplay_ocn && wsdisplay_ocn->cn_getc && + WSSCREEN_HAS_EMULATOR(scr) && WSSCREEN_HAS_TTY(scr)) { + struct tty *tp = scr->scr_tty; + do { + c = wsdisplay_ocn->cn_getc(wsdisplay_ocn->cn_dev); + if (c != -1) +(*tp->t_linesw->l_rint)((unsigned char)c, tp); + } while (c != -1); + } + + callout_schedule(>scr_getc_ch, mstohz(10)); +} +#endif + struct wsscreen * wsscreen_attach(struct wsdisplay_softc *sc, int console, const char *emul, const struct wsscreen_descr *type, void *cookie, int ccol, @@ -315,6 +344,12 @@ wsscreen_attach(struct wsdisplay_softc * #ifdef WSDISPLAY_COMPAT_RAWKBD scr->scr_rawkbd = 0; #endif +#ifdef WSDISPLAY_MULTICONS + callout_init(>scr_getc_ch, 0); + callout_setfunc(>scr_getc_ch, wsscreen_getc_poll, scr); + if (console) + callout_schedule(>scr_getc_ch, mstohz(10)); +#endif return (scr); } @@ -334,6 +369,8 @@ wsscreen_detach(struct wsscreen *scr) } if (scr->scr_dconf->scrdata->capabilities & WSSCREEN_FREE) free(__UNCONST(scr->scr_dconf->scrdata), M_DEVBUF); + callout_halt(>scr_getc_ch, NULL); + callout_destroy(>scr_getc_ch); free(scr->scr_dconf, M_DEVBUF); free(scr, M_DEVBUF); } @@ -884,6 +921,8 @@ wsdisplay_cnattach(const struct wsscreen ccol, crow, defattr); + if (cn_tab != _cons) + wsdisplay_ocn = cn_tab; cn_tab = _cons; wsdisplay_console_initted = 2; } @@ -910,6 +949,8 @@ wsdisplay_preattach(const struct wsscree ccol, crow, defattr); + if (cn_tab != _cons) +
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Mon Dec 18 18:57:21 UTC 2017 Modified Files: src/sys/dev/wscons: wskbd.c Log Message: If the wskbd driver returns type 0, return "no data" from wskbd_cngetc To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.140 src/sys/dev/wscons/wskbd.c:1.141 --- src/sys/dev/wscons/wskbd.c:1.140 Tue Jun 13 00:42:27 2017 +++ src/sys/dev/wscons/wskbd.c Mon Dec 18 18:57:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $ */ +/* $NetBSD: wskbd.c,v 1.141 2017/12/18 18:57:21 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.141 2017/12/18 18:57:21 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1400,6 +1400,10 @@ wskbd_cngetc(dev_t dev) (*wskbd_console_data.t_consops->getc) (wskbd_console_data.t_consaccesscookie, , ); + if (type == 0) { +/* No data returned */ +return 0; + } if (type == WSCONS_EVENT_ASCII) { /* * We assume that when the driver falls back
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sat Nov 4 01:52:09 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay_compat_usl.c wsdisplay_glyphcache.c Log Message: use sizeof(*var) instead of sizeof(type) To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/wscons/wsdisplay_compat_usl.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/wscons/wsdisplay_glyphcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_compat_usl.c diff -u src/sys/dev/wscons/wsdisplay_compat_usl.c:1.50 src/sys/dev/wscons/wsdisplay_compat_usl.c:1.51 --- src/sys/dev/wscons/wsdisplay_compat_usl.c:1.50 Fri Nov 3 09:34:56 2017 +++ src/sys/dev/wscons/wsdisplay_compat_usl.c Fri Nov 3 21:52:09 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.51 2017/11/04 01:52:09 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_freebsd.h" @@ -101,7 +101,7 @@ usl_sync_init(struct wsscreen *scr, stru struct usl_syncdata *sd; int res; - sd = kmem_alloc(sizeof(struct usl_syncdata), KM_SLEEP); + sd = kmem_alloc(sizeof(*sd), KM_SLEEP); sd->s_scr = scr; sd->s_proc = p; @@ -116,7 +116,7 @@ usl_sync_init(struct wsscreen *scr, stru callout_setfunc(>s_detach_ch, usl_detachtimeout, sd); res = wsscreen_attach_sync(scr, _syncops, sd); if (res) { - kmem_free(sd, sizeof(struct usl_syncdata)); + kmem_free(sd, sizeof(*sd)); return (res); } *sdp = sd; @@ -135,7 +135,7 @@ usl_sync_done(struct usl_syncdata *sd) (*sd->s_callback)(sd->s_cbarg, ENXIO, 0); } wsscreen_detach_sync(sd->s_scr); - kmem_free(sd, sizeof(struct usl_syncdata)); + kmem_free(sd, sizeof(*sd)); } static int Index: src/sys/dev/wscons/wsdisplay_glyphcache.c diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.9 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.10 --- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.9 Fri Jun 2 15:30:10 2017 +++ src/sys/dev/wscons/wsdisplay_glyphcache.c Fri Nov 3 21:52:09 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcache.c,v 1.9 2017/06/02 19:30:10 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcache.c,v 1.10 2017/11/04 01:52:09 christos Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -74,7 +74,9 @@ glyphcache_init(glyphcache *gc, int firs gc->gc_lines = lines; gc->gc_buckets = NULL; gc->gc_numbuckets = 0; - gc->gc_buckets = kmem_alloc(sizeof(gc_bucket) * NBUCKETS, KM_SLEEP); + // XXX: Never free? + gc->gc_buckets = kmem_alloc(sizeof(*gc->gc_buckets) * NBUCKETS, + KM_SLEEP); gc->gc_nbuckets = NBUCKETS; return glyphcache_reconfig(gc, cellwidth, cellheight, attr);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 19:49:23 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c wsmouse.c Log Message: Remove redundant includes of malloc.h To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/wscons/wsbell.c cvs rdiff -u -r1.67 -r1.68 src/sys/dev/wscons/wsmouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.8 src/sys/dev/wscons/wsbell.c:1.9 --- src/sys/dev/wscons/wsbell.c:1.8 Tue Jun 13 05:49:48 2017 +++ src/sys/dev/wscons/wsbell.c Fri Nov 3 19:49:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $ */ +/* $NetBSD: wsbell.c,v 1.9 2017/11/03 19:49:23 maya Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.9 2017/11/03 19:49:23 maya Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -131,7 +131,6 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1 #include #include #include -#include #include #include Index: src/sys/dev/wscons/wsmouse.c diff -u src/sys/dev/wscons/wsmouse.c:1.67 src/sys/dev/wscons/wsmouse.c:1.68 --- src/sys/dev/wscons/wsmouse.c:1.67 Fri Nov 3 19:20:27 2017 +++ src/sys/dev/wscons/wsmouse.c Fri Nov 3 19:49:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsmouse.c,v 1.67 2017/11/03 19:20:27 maya Exp $ */ +/* $NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.67 2017/11/03 19:20:27 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.68 2017/11/03 19:49:23 maya Exp $"); #include "wsmouse.h" #include "wsdisplay.h" @@ -124,7 +124,6 @@ __KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v #include #include #include -#include #include #include
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 19:20:27 UTC 2017 Modified Files: src/sys/dev/wscons: wsemul_vt100.c wsemul_vt100_chars.c wskbdutil.c wsmouse.c Log Message: Use __arraycount a bunch Also, DIAGNOSTIC panic -> KASSERT To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wscons/wsemul_vt100.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/wscons/wsemul_vt100_chars.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/wscons/wskbdutil.c cvs rdiff -u -r1.66 -r1.67 src/sys/dev/wscons/wsmouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.40 src/sys/dev/wscons/wsemul_vt100.c:1.41 --- src/sys/dev/wscons/wsemul_vt100.c:1.40 Fri Nov 3 18:42:35 2017 +++ src/sys/dev/wscons/wsemul_vt100.c Fri Nov 3 19:20:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.40 2017/11/03 18:42:35 maya Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.40 2017/11/03 18:42:35 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -1006,10 +1006,7 @@ wsemul_vt100_output(void *cookie, const wsemul_vt100_output_normal(edp, *data, kernel); continue; } -#ifdef DIAGNOSTIC - if (edp->state > sizeof(vt100_output) / sizeof(vt100_output[0])) - panic("wsemul_vt100: invalid state %d", edp->state); -#endif + KASSERT(edp->state < __arraycount(vt100_output) - 1); edp->state = vt100_output[edp->state - 1](edp, *data); } if (vd->flags & VTFL_CURSORON) Index: src/sys/dev/wscons/wsemul_vt100_chars.c diff -u src/sys/dev/wscons/wsemul_vt100_chars.c:1.14 src/sys/dev/wscons/wsemul_vt100_chars.c:1.15 --- src/sys/dev/wscons/wsemul_vt100_chars.c:1.14 Thu Feb 25 11:20:09 2010 +++ src/sys/dev/wscons/wsemul_vt100_chars.c Fri Nov 3 19:20:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100_chars.c,v 1.14 2010/02/25 11:20:09 drochner Exp $ */ +/* $NetBSD: wsemul_vt100_chars.c,v 1.15 2017/11/03 19:20:27 maya Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_chars.c,v 1.14 2010/02/25 11:20:09 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_chars.c,v 1.15 2017/11/03 19:20:27 maya Exp $"); #include #include @@ -145,7 +145,7 @@ vt100_setnrc(struct wsemul_vt100_emuldat int i; struct vt100base_data *vd = >bd; - KASSERT(nrc < sizeof(nrctable) / sizeof(nrctable[0])); + KASSERT(nrc < __arraycount(nrctable)); for (i = 0; i < 128; i++) (*vd->emulops->mapchar)(vd->emulcookie, i, >nrctab[i]); Index: src/sys/dev/wscons/wskbdutil.c diff -u src/sys/dev/wscons/wskbdutil.c:1.18 src/sys/dev/wscons/wskbdutil.c:1.19 --- src/sys/dev/wscons/wskbdutil.c:1.18 Fri Feb 5 18:26:38 2010 +++ src/sys/dev/wscons/wskbdutil.c Fri Nov 3 19:20:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbdutil.c,v 1.18 2010/02/05 18:26:38 drochner Exp $ */ +/* $NetBSD: wskbdutil.c,v 1.19 2017/11/03 19:20:27 maya Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbdutil.c,v 1.18 2010/02/05 18:26:38 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbdutil.c,v 1.19 2017/11/03 19:20:27 maya Exp $"); #include #include @@ -271,7 +271,7 @@ static struct compose_tab_s { { { KS_dead_slash, KS_l }, KS_lstroke } }; -#define COMPOSE_SIZE sizeof(compose_tab)/sizeof(compose_tab[0]) +#define COMPOSE_SIZE __arraycount(compose_tab) static int compose_tab_inorder = 0; @@ -504,7 +504,7 @@ wskbd_load_keymap(const struct wskbd_map mp++; } - if (stack_ptr == sizeof(stack)/sizeof(stack[0])) + if (stack_ptr == __arraycount(stack)) panic("wskbd_load_keymap: %d: recursion too deep", mapdata->layout); if (mp->map_size <= 0) Index: src/sys/dev/wscons/wsmouse.c diff -u src/sys/dev/wscons/wsmouse.c:1.66 src/sys/dev/wscons/wsmouse.c:1.67 --- src/sys/dev/wscons/wsmouse.c:1.66 Fri Jul 25 08:10:39 2014 +++ src/sys/dev/wscons/wsmouse.c Fri Nov 3 19:20:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsmouse.c,v 1.66 2014/07/25 08:10:39 dholland Exp $ */ +/* $NetBSD: wsmouse.c,v 1.67 2017/11/03 19:20:27 maya Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -104,7 +104,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.66 2014/07/25 08:10:39 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.67 2017/11/03 19:20:27 maya Exp $"); #include "wsmouse.h" #include "wsdisplay.h" @@ -475,7 +475,7 @@ wsmouse_input(device_t wsmousedev, u_int btnno = ffs(d) - 1; KASSERT(btnno >= 0); - if (nevents >= sizeof(events) / sizeof(events[0])) { + if (nevents >= __arraycount(events)) {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 18:49:37 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Use M_WAITOK if we aren't going to check for NULL before dereferencing Same function already uses M_WAITOK unconditionally, so this is a safe change While here, drop null check of M_WAITOK. it shouldn't fail. To generate a diff of this commit: cvs rdiff -u -r1.142 -r1.143 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.142 src/sys/dev/wscons/wsdisplay.c:1.143 --- src/sys/dev/wscons/wsdisplay.c:1.142 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsdisplay.c Fri Nov 3 18:49:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.143 2017/11/03 18:49:37 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -271,8 +271,6 @@ wsscreen_attach(struct wsdisplay_softc * struct wsscreen *scr; scr = malloc(sizeof(struct wsscreen), M_DEVBUF, M_WAITOK); - if (!scr) - return (NULL); if (console) { dconf = _console_conf; @@ -284,7 +282,7 @@ wsscreen_attach(struct wsdisplay_softc * (*dconf->wsemul->attach)(1, 0, 0, 0, 0, scr, 0); } else { /* not console */ dconf = malloc(sizeof(struct wsscreen_internal), - M_DEVBUF, M_NOWAIT); + M_DEVBUF, M_WAITOK); dconf->emulops = type->textops; dconf->emulcookie = cookie; if (dconf->emulops) {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 18:42:36 UTC 2017 Modified Files: src/sys/dev/wscons: wsemul_dumb.c wsemul_sun.c wsemul_vt100.c Log Message: Use c99 initializer for wsemul_ops To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wscons/wsemul_dumb.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/wscons/wsemul_sun.c cvs rdiff -u -r1.39 -r1.40 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_dumb.c diff -u src/sys/dev/wscons/wsemul_dumb.c:1.16 src/sys/dev/wscons/wsemul_dumb.c:1.17 --- src/sys/dev/wscons/wsemul_dumb.c:1.16 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsemul_dumb.c Fri Nov 3 18:42:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_dumb.c,v 1.16 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsemul_dumb.c,v 1.17 2017/11/03 18:42:35 maya Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.16 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.17 2017/11/03 18:42:35 maya Exp $"); #include #include @@ -55,16 +55,16 @@ void wsemul_dumb_detach(void *cookie, u_ void wsemul_dumb_resetop(void *, enum wsemul_resetops); const struct wsemul_ops wsemul_dumb_ops = { - "dumb", - wsemul_dumb_cnattach, - wsemul_dumb_attach, - wsemul_dumb_output, - wsemul_dumb_translate, - wsemul_dumb_detach, - wsemul_dumb_resetop, - NULL, /* getmsgattrs */ - NULL, /* setmsgattrs */ - NULL /* resize */ + .name = "dumb", + .cnattach = wsemul_dumb_cnattach, + .attach = wsemul_dumb_attach, + .output = wsemul_dumb_output, + .translate = wsemul_dumb_translate, + .detach = wsemul_dumb_detach, + .reset = wsemul_dumb_resetop, + .getmsgattrs = NULL, + .setmsgattrs = NULL, + .resize = NULL, }; struct wsemul_dumb_emuldata { Index: src/sys/dev/wscons/wsemul_sun.c diff -u src/sys/dev/wscons/wsemul_sun.c:1.31 src/sys/dev/wscons/wsemul_sun.c:1.32 --- src/sys/dev/wscons/wsemul_sun.c:1.31 Fri Nov 3 17:57:58 2017 +++ src/sys/dev/wscons/wsemul_sun.c Fri Nov 3 18:42:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_sun.c,v 1.31 2017/11/03 17:57:58 maya Exp $ */ +/* $NetBSD: wsemul_sun.c,v 1.32 2017/11/03 18:42:35 maya Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -33,7 +33,7 @@ /* XXX DESCRIPTION/SOURCE OF INFORMATION */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.31 2017/11/03 17:57:58 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.32 2017/11/03 18:42:35 maya Exp $"); #include #include @@ -58,16 +58,16 @@ void wsemul_sun_detach(void *cookie, u_i void wsemul_sun_resetop(void *, enum wsemul_resetops); const struct wsemul_ops wsemul_sun_ops = { - "sun", - wsemul_sun_cnattach, - wsemul_sun_attach, - wsemul_sun_output, - wsemul_sun_translate, - wsemul_sun_detach, - wsemul_sun_resetop, - NULL, /* getmsgattrs */ - NULL, /* setmsgattrs */ - NULL /* resize */ + .name = "sun", + .cnattach = wsemul_sun_cnattach, + .attach = wsemul_sun_attach, + .output = wsemul_sun_output, + .translate = wsemul_sun_translate, + .detach = wsemul_sun_detach, + .reset = wsemul_sun_resetop, + .getmsgattrs = NULL, + .setmsgattrs = NULL, + .resize = NULL, }; #define SUN_EMUL_STATE_NORMAL 0 /* normal processing */ Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.39 src/sys/dev/wscons/wsemul_vt100.c:1.40 --- src/sys/dev/wscons/wsemul_vt100.c:1.39 Fri Nov 3 17:57:58 2017 +++ src/sys/dev/wscons/wsemul_vt100.c Fri Nov 3 18:42:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.39 2017/11/03 17:57:58 maya Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.40 2017/11/03 18:42:35 maya Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.39 2017/11/03 17:57:58 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.40 2017/11/03 18:42:35 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -60,19 +60,19 @@ static void wsemul_vt100_setmsgattrs(voi static void wsemul_vt100_resize(void *, const struct wsscreen_descr *); const struct wsemul_ops wsemul_vt100_ops = { - "vt100", - wsemul_vt100_cnattach, - wsemul_vt100_attach, - wsemul_vt100_output, - wsemul_vt100_translate, - wsemul_vt100_detach, - wsemul_vt100_resetop, + .name = "vt100", + .cnattach = wsemul_vt100_cnattach, + .attach = wsemul_vt100_attach, + .output = wsemul_vt100_output, + .translate = wsemul_vt100_translate, + .detach = wsemul_vt100_detach, + .reset = wsemul_vt100_resetop, #ifdef WSDISPLAY_CUSTOM_OUTPUT - wsemul_vt100_getmsgattrs, - wsemul_vt100_setmsgattrs, + .getmsgattrs = wsemul_vt100_getmsgattrs, + .setmsgattrs = wsemul_vt100_setmsgattrs, #else - NULL, - NULL, + .getmsgattrs = NULL, + .setmsgattrs = NULL, #endif .resize =
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 17:57:58 UTC 2017 Modified Files: src/sys/dev/wscons: wsemul_sun.c wsemul_vt100.c Log Message: Don't #ifdef DIAGNOSTIC around KASSERTs. the definition of KASSERT does the same thing To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/wscons/wsemul_sun.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/wscons/wsemul_vt100.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_sun.c diff -u src/sys/dev/wscons/wsemul_sun.c:1.30 src/sys/dev/wscons/wsemul_sun.c:1.31 --- src/sys/dev/wscons/wsemul_sun.c:1.30 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsemul_sun.c Fri Nov 3 17:57:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_sun.c,v 1.30 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsemul_sun.c,v 1.31 2017/11/03 17:57:58 maya Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -33,7 +33,7 @@ /* XXX DESCRIPTION/SOURCE OF INFORMATION */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.30 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.31 2017/11/03 17:57:58 maya Exp $"); #include #include @@ -176,9 +176,7 @@ wsemul_sun_attach(int console, const str if (console) { edp = _sun_console_emuldata; -#ifdef DIAGNOSTIC KASSERT(edp->console == 1); -#endif } else { edp = malloc(sizeof *edp, M_DEVBUF, M_WAITOK); Index: src/sys/dev/wscons/wsemul_vt100.c diff -u src/sys/dev/wscons/wsemul_vt100.c:1.38 src/sys/dev/wscons/wsemul_vt100.c:1.39 --- src/sys/dev/wscons/wsemul_vt100.c:1.38 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsemul_vt100.c Fri Nov 3 17:57:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_vt100.c,v 1.38 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsemul_vt100.c,v 1.39 2017/11/03 17:57:58 maya Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.38 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.39 2017/11/03 17:57:58 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_wsmsgattrs.h" @@ -242,9 +242,7 @@ wsemul_vt100_attach(int console, const s if (console) { edp = _vt100_console_emuldata; -#ifdef DIAGNOSTIC KASSERT(edp->console == 1); -#endif } else { edp = malloc(sizeof *edp, M_DEVBUF, M_WAITOK); wsemul_vt100_init(edp, type, cookie, ccol, crow, defattr);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: maya Date: Fri Nov 3 13:34:56 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay_compat_usl.c Log Message: use kmem, don't check for allocation failure with KM_SLEEP To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/wscons/wsdisplay_compat_usl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_compat_usl.c diff -u src/sys/dev/wscons/wsdisplay_compat_usl.c:1.49 src/sys/dev/wscons/wsdisplay_compat_usl.c:1.50 --- src/sys/dev/wscons/wsdisplay_compat_usl.c:1.49 Mon Aug 24 22:50:33 2015 +++ src/sys/dev/wscons/wsdisplay_compat_usl.c Fri Nov 3 13:34:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_compat_usl.c,v 1.49 2015/08/24 22:50:33 pooka Exp $ */ +/* $NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $ */ /* * Copyright (c) 1998 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.49 2015/08/24 22:50:33 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.50 2017/11/03 13:34:56 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_freebsd.h" @@ -39,9 +39,9 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay_co #include #include #include +#include #include #include -#include #include #include @@ -101,9 +101,8 @@ usl_sync_init(struct wsscreen *scr, stru struct usl_syncdata *sd; int res; - sd = malloc(sizeof(struct usl_syncdata), M_DEVBUF, M_WAITOK); - if (!sd) - return (ENOMEM); + sd = kmem_alloc(sizeof(struct usl_syncdata), KM_SLEEP); + sd->s_scr = scr; sd->s_proc = p; sd->s_pid = p->p_pid; @@ -117,7 +116,7 @@ usl_sync_init(struct wsscreen *scr, stru callout_setfunc(>s_detach_ch, usl_detachtimeout, sd); res = wsscreen_attach_sync(scr, _syncops, sd); if (res) { - free(sd, M_DEVBUF); + kmem_free(sd, sizeof(struct usl_syncdata)); return (res); } *sdp = sd; @@ -136,7 +135,7 @@ usl_sync_done(struct usl_syncdata *sd) (*sd->s_callback)(sd->s_cbarg, ENXIO, 0); } wsscreen_detach_sync(sd->s_scr); - free(sd, M_DEVBUF); + kmem_free(sd, sizeof(struct usl_syncdata)); } static int
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Wed Aug 30 00:39:27 UTC 2017 Modified Files: src/sys/dev/wscons: files.wscons Added Files: src/sys/dev/wscons: linux_keymap.c linux_keymap.h Log Message: Add a keymap for converting Linux event codes to wscons keysyms. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/wscons/files.wscons cvs rdiff -u -r0 -r1.1 src/sys/dev/wscons/linux_keymap.c \ src/sys/dev/wscons/linux_keymap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.53 src/sys/dev/wscons/files.wscons:1.54 --- src/sys/dev/wscons/files.wscons:1.53 Sun Jun 18 05:57:58 2017 +++ src/sys/dev/wscons/files.wscons Wed Aug 30 00:39:27 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.53 2017/06/18 05:57:58 pgoyette Exp $ +# $NetBSD: files.wscons,v 1.54 2017/08/30 00:39:27 jmcneill Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -86,3 +86,6 @@ defflag opt_vcons.h VCONS_DRAW_INTR VCO define glyphcache file dev/wscons/wsdisplay_glyphcache.c glyphcache defflag opt_glyphcache.h GLYPHCACHE_DEBUG + +# linux event code keymap +file dev/wscons/linux_keymap.c linux_keymap Added files: Index: src/sys/dev/wscons/linux_keymap.c diff -u /dev/null src/sys/dev/wscons/linux_keymap.c:1.1 --- /dev/null Wed Aug 30 00:39:27 2017 +++ src/sys/dev/wscons/linux_keymap.c Wed Aug 30 00:39:27 2017 @@ -0,0 +1,174 @@ +/* $NetBSD: linux_keymap.c,v 1.1 2017/08/30 00:39:27 jmcneill Exp $ */ + +/*- + * Copyright (c) 1997-2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Juergen Hannken-Illjes and Jared McNeill. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: linux_keymap.c,v 1.1 2017/08/30 00:39:27 jmcneill Exp $"); + +#include +#include +#include +#include + +#define KC(n) KS_KEYCODE(n) + +static const keysym_t linux_keymap_keydesc_us[] = { +/* pos command normal shifted */ +KC(1), KS_Cmd_Debugger, KS_Escape, +KC(2), KS_1, KS_exclam, +KC(3), KS_2, KS_at, +KC(4), KS_3, KS_numbersign, +KC(5), KS_4, KS_dollar, +KC(6), KS_5, KS_percent, +KC(7), KS_6, KS_asciicircum, +KC(8), KS_7, KS_ampersand, +KC(9), KS_8, KS_asterisk, +KC(10), KS_9, KS_parenleft, +KC(11), KS_0, KS_parenright, +KC(12), KS_minus, KS_underscore, +KC(13), KS_equal, KS_plus, +KC(14), KS_Cmd_ResetEmul, KS_Delete, +KC(15), KS_Tab, +KC(16), KS_q, +KC(17), KS_w, +KC(18), KS_e, +KC(19), KS_r, +KC(20), KS_t, +KC(21), KS_y, +KC(22), KS_u, +KC(23), KS_i, +KC(24), KS_o, +KC(25), KS_p, +KC(26), KS_bracketleft, KS_braceleft, +KC(27), KS_bracketright, KS_braceright, +KC(28), KS_Return, +KC(29), KS_Cmd1, KS_Control_L, +KC(30), KS_a, +KC(31), KS_s, +KC(32), KS_d, +KC(33), KS_f, +KC(34), KS_g, +KC(35), KS_h, +KC(36), KS_j, +KC(37), KS_k, +KC(38), KS_l, +KC(39), KS_semicolon, KS_colon, +KC(40), KS_apostrophe, KS_quotedbl, +KC(41), KS_grave, KS_asciitilde, +KC(42), KS_Shift_L, +KC(43), KS_backslash, KS_bar, +KC(44), KS_z, +KC(45), KS_x, +KC(46), KS_c, +KC(47), KS_v, +KC(48), KS_b, +KC(49), KS_n, +KC(50), KS_m, +KC(51), KS_comma, KS_less, +KC(52),
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sat Aug 26 21:16:54 UTC 2017 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add WSKBD_TYPE_TCAKP for Texas Instruments TCA8418 To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.119 src/sys/dev/wscons/wsconsio.h:1.120 --- src/sys/dev/wscons/wsconsio.h:1.119 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/wsconsio.h Sat Aug 26 21:16:54 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.119 2017/06/11 03:55:56 nat Exp $ */ +/* $NetBSD: wsconsio.h,v 1.120 2017/08/26 21:16:54 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -109,6 +109,7 @@ struct wscons_event { #define WSKBD_TYPE_LUNA 23 /* OMRON SX-9100 LUNA */ #define WSKBD_TYPE_RFB 24 /* Usermode vnc remote keyboard */ #define WSKBD_TYPE_EPOC 25 /* Psion EPOC machine keyboard */ +#define WSKBD_TYPE_TCAKP 26 /* TI TCA8418 keypad */ /* Manipulate the keyboard bell. */ struct wskbd_bell_data {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Sun Jun 18 05:57:58 UTC 2017 Modified Files: src/sys/dev/wscons: files.wscons Log Message: wsbellmux.c doesn't need a needs-flag To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/files.wscons Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.52 src/sys/dev/wscons/files.wscons:1.53 --- src/sys/dev/wscons/files.wscons:1.52 Mon Jun 12 07:06:45 2017 +++ src/sys/dev/wscons/files.wscons Sun Jun 18 05:57:58 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.52 2017/06/12 07:06:45 pgoyette Exp $ +# $NetBSD: files.wscons,v 1.53 2017/06/18 05:57:58 pgoyette Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -70,7 +70,7 @@ file dev/wscons/wscons_rops.c wsrasterem defpseudo wsmux file dev/wscons/wsmux.c wsmux needs-flag -file dev/wscons/wsbellmux.c wsmux needs-flag +file dev/wscons/wsbellmux.c wsmux define tpcalib file dev/wscons/tpcalib.c tpcalib
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nat Date: Tue Jun 13 05:49:48 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c Log Message: Implement missing ioctls for the default bell. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/wscons/wsbell.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.7 src/sys/dev/wscons/wsbell.c:1.8 --- src/sys/dev/wscons/wsbell.c:1.7 Tue Jun 13 00:54:37 2017 +++ src/sys/dev/wscons/wsbell.c Tue Jun 13 05:49:48 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $ */ +/* $NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1 #include #include #include +#include #include #include #include @@ -345,6 +346,8 @@ wsbell_do_ioctl(struct wsbell_softc *sc, int flag, struct lwp *l) { struct wskbd_bell_data *ubdp, *kbdp; + int error; + if (sc->sc_dying == true) return (EIO); @@ -356,16 +359,31 @@ wsbell_do_ioctl(struct wsbell_softc *sc, if ((flag & FWRITE) == 0) return (EACCES); kbdp = >sc_bell_data; +setbell: ubdp = (struct wskbd_bell_data *)data; SETBELL(kbdp, ubdp, kbdp); return (0); case WSKBDIO_GETBELL: kbdp = >sc_bell_data; +getbell: ubdp = (struct wskbd_bell_data *)data; SETBELL(ubdp, kbdp, kbdp); return (0); + case WSKBDIO_SETDEFAULTBELL: + if ((error = kauth_authorize_device(l->l_cred, + KAUTH_DEVICE_WSCONS_KEYBOARD_BELL, NULL, NULL, + NULL, NULL)) != 0) + return (error); + kbdp = _default_bell_data; + goto setbell; + + + case WSKBDIO_GETDEFAULTBELL: + kbdp = _default_bell_data; + goto getbell; + case WSKBDIO_BELL: if ((flag & FWRITE) == 0) return (EACCES);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nat Date: Tue Jun 13 00:54:37 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c wsbellvar.h Log Message: Change sc_dying from u_char to bool. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wscons/wsbell.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/wscons/wsbellvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.6 src/sys/dev/wscons/wsbell.c:1.7 --- src/sys/dev/wscons/wsbell.c:1.6 Tue Jun 13 00:49:05 2017 +++ src/sys/dev/wscons/wsbell.c Tue Jun 13 00:54:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $ */ +/* $NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -220,6 +220,7 @@ wsbell_attach(device_t parent, device_t sc->sc_base.me_dv = self; sc->sc_accesscookie = ap->accesscookie; + sc->sc_dying = false; sc->sc_spkr = device_unit(parent); sc->sc_bell_data = wskbd_default_bell_data; #if NWSMUX > 0 @@ -256,7 +257,7 @@ wsbell_activate(device_t self, enum deva struct wsbell_softc *sc = device_private(self); if (act == DVACT_DEACTIVATE) - sc->sc_dying = 1; + sc->sc_dying = true; return (0); } @@ -305,7 +306,7 @@ wsbell_detach(device_t self, int flags) vdevgone(maj, mn, mn, VCHR); mutex_enter(>sc_bellock); - sc->sc_dying = 1; + sc->sc_dying = true; cv_broadcast(>sc_bellcv); mutex_exit(>sc_bellock); @@ -344,7 +345,7 @@ wsbell_do_ioctl(struct wsbell_softc *sc, int flag, struct lwp *l) { struct wskbd_bell_data *ubdp, *kbdp; - if (sc->sc_dying) + if (sc->sc_dying == true) return (EIO); /* @@ -400,7 +401,7 @@ bell_thread(void *arg) mutex_enter(>sc_bellock); cv_wait_sig(>sc_bellcv, >sc_bellock); - if (sc->sc_dying) { + if (sc->sc_dying == true) { mutex_exit(>sc_bellock); kthread_exit(0); } Index: src/sys/dev/wscons/wsbellvar.h diff -u src/sys/dev/wscons/wsbellvar.h:1.2 src/sys/dev/wscons/wsbellvar.h:1.3 --- src/sys/dev/wscons/wsbellvar.h:1.2 Tue Jun 13 00:49:05 2017 +++ src/sys/dev/wscons/wsbellvar.h Tue Jun 13 00:54:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbellvar.h,v 1.2 2017/06/13 00:49:05 nat Exp $ */ +/* $NetBSD: wsbellvar.h,v 1.3 2017/06/13 00:54:37 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss * All rights reserved. @@ -45,7 +45,7 @@ struct wsbell_softc { void *sc_accesscookie; int sc_refcnt; - u_char sc_dying; /* device is being detached */ + bool sc_dying; /* device is being detached */ lwp_t *sc_bellthread; kmutex_t sc_bellock;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nat Date: Tue Jun 13 00:49:05 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c wsbellvar.h Log Message: Remove dying ftom vb_args and use sc_dying instead. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/wsbell.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsbellvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.5 src/sys/dev/wscons/wsbell.c:1.6 --- src/sys/dev/wscons/wsbell.c:1.5 Tue Jun 13 00:42:27 2017 +++ src/sys/dev/wscons/wsbell.c Tue Jun 13 00:49:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $ */ +/* $NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -305,7 +305,7 @@ wsbell_detach(device_t self, int flags) vdevgone(maj, mn, mn, VCHR); mutex_enter(>sc_bellock); - sc->sc_bell_args.dying = true; + sc->sc_dying = 1; cv_broadcast(>sc_bellcv); mutex_exit(>sc_bellock); @@ -400,7 +400,7 @@ bell_thread(void *arg) mutex_enter(>sc_bellock); cv_wait_sig(>sc_bellcv, >sc_bellock); - if (vb->dying == true) { + if (sc->sc_dying) { mutex_exit(>sc_bellock); kthread_exit(0); } @@ -423,7 +423,6 @@ spkr_audio_play(struct wsbell_softc *sc, { mutex_enter(>sc_bellock); - sc->sc_bell_args.dying = false; sc->sc_bell_args.pitch = pitch; sc->sc_bell_args.period = period / 5; sc->sc_bell_args.volume = volume; Index: src/sys/dev/wscons/wsbellvar.h diff -u src/sys/dev/wscons/wsbellvar.h:1.1 src/sys/dev/wscons/wsbellvar.h:1.2 --- src/sys/dev/wscons/wsbellvar.h:1.1 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/wsbellvar.h Tue Jun 13 00:49:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbellvar.h,v 1.1 2017/06/11 03:55:56 nat Exp $ */ +/* $NetBSD: wsbellvar.h,v 1.2 2017/06/13 00:49:05 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss * All rights reserved. @@ -35,7 +35,6 @@ struct vbell_args { u_int pitch; u_int period; u_int volume; - bool dying; }; struct wsbell_softc {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nat Date: Tue Jun 13 00:42:27 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c wsbelldata.h wskbd.c Log Message: Move duplicate definition of SETBELL macro into wsbelldata.h. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/wscons/wsbell.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsbelldata.h cvs rdiff -u -r1.139 -r1.140 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.4 src/sys/dev/wscons/wsbell.c:1.5 --- src/sys/dev/wscons/wsbell.c:1.4 Mon Jun 12 07:12:49 2017 +++ src/sys/dev/wscons/wsbell.c Tue Jun 13 00:42:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $ */ +/* $NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,7 +107,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" @@ -351,17 +351,6 @@ wsbell_do_ioctl(struct wsbell_softc *sc, * Try the wsbell specific ioctls. */ switch (cmd) { -#define SETBELL(dstp, srcp, dfltp) \ -do {\ - (dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ? \ - (srcp)->pitch : (dfltp)->pitch;\ - (dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ? \ - (srcp)->period : (dfltp)->period;\ - (dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ? \ - (srcp)->volume : (dfltp)->volume;\ - (dstp)->which = WSKBD_BELL_DOALL;\ -} while (0) - case WSKBDIO_SETBELL: if ((flag & FWRITE) == 0) return (EACCES); Index: src/sys/dev/wscons/wsbelldata.h diff -u src/sys/dev/wscons/wsbelldata.h:1.1 src/sys/dev/wscons/wsbelldata.h:1.2 --- src/sys/dev/wscons/wsbelldata.h:1.1 Sun Jun 11 03:38:12 2017 +++ src/sys/dev/wscons/wsbelldata.h Tue Jun 13 00:42:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbelldata.h,v 1.1 2017/06/11 03:38:12 nat Exp $ */ +/* $NetBSD: wsbelldata.h,v 1.2 2017/06/13 00:42:27 nat Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss * All rights reserved. @@ -35,6 +35,17 @@ #define WSKBD_DEFAULT_BELL_VOLUME 50 /* 50% volume */ #endif +#define SETBELL(dstp, srcp, dfltp) \ +do {\ + (dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ? \ + (srcp)->pitch : (dfltp)->pitch;\ + (dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ? \ + (srcp)->period : (dfltp)->period;\ + (dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ? \ + (srcp)->volume : (dfltp)->volume;\ + (dstp)->which = WSKBD_BELL_DOALL;\ +} while (0) + static struct wskbd_bell_data wskbd_default_bell_data = { WSKBD_BELL_DOALL, WSKBD_DEFAULT_BELL_PITCH, Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.139 src/sys/dev/wscons/wskbd.c:1.140 --- src/sys/dev/wscons/wskbd.c:1.139 Sun Jun 11 03:38:12 2017 +++ src/sys/dev/wscons/wskbd.c Tue Jun 13 00:42:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $ */ +/* $NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1059,17 +1059,6 @@ wskbd_displayioctl(device_t dev, u_long int len, error; switch (cmd) { -#define SETBELL(dstp, srcp, dfltp) \ -do {\ - (dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ? \ - (srcp)->pitch : (dfltp)->pitch;\ - (dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ? \ - (srcp)->period : (dfltp)->period;\ - (dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ? \ - (srcp)->volume : (dfltp)->volume;\ - (dstp)->which = WSKBD_BELL_DOALL;\ -} while (0) - case WSKBDIO_BELL: if ((flag & FWRITE) == 0) return (EACCES);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Mon Jun 12 08:19:22 UTC 2017 Modified Files: src/sys/dev/wscons: wsmux.c Log Message: There is no longer a NWSBELL (since nothing depends on it), so there's no need to #include wsbell.h (which is where it used to be defined, as a result of a needs-flag in files.wscons). Remove the #include To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/wscons/wsmux.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsmux.c diff -u src/sys/dev/wscons/wsmux.c:1.62 src/sys/dev/wscons/wsmux.c:1.63 --- src/sys/dev/wscons/wsmux.c:1.62 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/wsmux.c Mon Jun 12 08:19:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsmux.c,v 1.62 2017/06/11 03:55:56 nat Exp $ */ +/* $NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $ */ /* * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.62 2017/06/11 03:55:56 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1. #include "wsmux.h" #include "wskbd.h" #include "wsmouse.h" -#include "wsbell.h" #include #include
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Mon Jun 12 07:12:49 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c Log Message: Revert previous - it's no longer needed since data structure sizes no longer depend on which wscons child devices exist To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/wscons/wsbell.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.3 src/sys/dev/wscons/wsbell.c:1.4 --- src/sys/dev/wscons/wsbell.c:1.3 Mon Jun 12 06:59:19 2017 +++ src/sys/dev/wscons/wsbell.c Mon Jun 12 07:12:49 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $ */ +/* $NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,11 +107,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" -#include "wsdisplay.h" #endif #include
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Mon Jun 12 07:10:07 UTC 2017 Modified Files: src/sys/dev/wscons: wsmuxvar.h Log Message: Always include declarations/definitions for NWSMUX and NWSDISPLAY even if they aren't needed. This enables us to have structures of a fixed size regardless of which child devices are configured, which enables better modularization. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wscons/wsmuxvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsmuxvar.h diff -u src/sys/dev/wscons/wsmuxvar.h:1.16 src/sys/dev/wscons/wsmuxvar.h:1.17 --- src/sys/dev/wscons/wsmuxvar.h:1.16 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/wsmuxvar.h Mon Jun 12 07:10:07 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsmuxvar.h,v 1.16 2017/06/11 03:55:56 nat Exp $ */ +/* $NetBSD: wsmuxvar.h,v 1.17 2017/06/12 07:10:07 pgoyette Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,13 +37,9 @@ struct wsevsrc { const struct wssrcops *me_ops; /* method pointers */ struct wseventvar me_evar; /* wseventvar opened directly */ struct wseventvar *me_evp; /* our wseventvar when open */ -#if NWSDISPLAY > 0 device_t me_dispdv; /* our display if part of one */ -#endif -#if NWSMUX > 0 struct wsmux_softc *me_parent; /* parent mux device */ TAILQ_ENTRY(wsevsrc) me_next; /* sibling pointers */ -#endif }; /* @@ -70,7 +66,6 @@ struct wssrcops { #define wsevsrc_set_display(me, arg) \ ((me)->me_ops->dsetdisplay((me)->me_dv, arg)) -#if NWSMUX > 0 struct wsmux_softc { struct wsevsrc sc_base; struct proc *sc_p; /* open proc */ @@ -90,5 +85,3 @@ int wsmux_set_display(struct wsmux_softc int wskbd_add_mux(int, struct wsmux_softc *); int wsmouse_add_mux(int, struct wsmux_softc *); int wsbell_add_mux(int, struct wsmux_softc *); - -#endif /* NWSMUX > 0 */
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Mon Jun 12 07:06:45 UTC 2017 Modified Files: src/sys/dev/wscons: files.wscons Log Message: Nothing needs the NWSBELL flag, so don't bother creating it To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/files.wscons Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.51 src/sys/dev/wscons/files.wscons:1.52 --- src/sys/dev/wscons/files.wscons:1.51 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/files.wscons Mon Jun 12 07:06:45 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.51 2017/06/11 03:55:56 nat Exp $ +# $NetBSD: files.wscons,v 1.52 2017/06/12 07:06:45 pgoyette Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -60,7 +60,7 @@ file dev/wscons/wsevent.c wsdisplay | w file dev/wscons/wskbd.c wskbd needs-flag file dev/wscons/wskbdutil.c wskbd needs-flag file dev/wscons/wsmouse.c wsmouse needs-flag -file dev/wscons/wsbell.c wsbell needs-flag +file dev/wscons/wsbell.c wsbell # rcons bit-depth options include "dev/rcons/files.rcons"
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Mon Jun 12 06:59:19 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c Log Message: For now, #include wsdisplay.h to get the definition of NWSDISPLAY The symbol is currently used to conditionally include members of a data structure, so without this include there could be different structure definitions, with different sizes, and data corruption is likely. XXX For cleaner modularization, all of the needs-flag entries in XXX wscons should be removed. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/wscons/wsbell.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.2 src/sys/dev/wscons/wsbell.c:1.3 --- src/sys/dev/wscons/wsbell.c:1.2 Sun Jun 11 22:14:55 2017 +++ src/sys/dev/wscons/wsbell.c Mon Jun 12 06:59:19 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $ */ +/* $NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,10 +107,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $"); #if defined(_KERNEL_OPT) #include "wsmux.h" +#include "wsdisplay.h" #endif #include
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: pgoyette Date: Sun Jun 11 22:14:55 UTC 2017 Modified Files: src/sys/dev/wscons: wsbell.c Log Message: Add module infrastructure for wsbell(4) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsbell.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsbell.c diff -u src/sys/dev/wscons/wsbell.c:1.1 src/sys/dev/wscons/wsbell.c:1.2 --- src/sys/dev/wscons/wsbell.c:1.1 Sun Jun 11 03:55:56 2017 +++ src/sys/dev/wscons/wsbell.c Sun Jun 11 22:14:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsbell.c,v 1.1 2017/06/11 03:55:56 nat Exp $ */ +/* $NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $ */ /*- * Copyright (c) 2017 Nathanial Sloss@@ -107,10 +107,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.1 2017/06/11 03:55:56 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $"); -#include "wsdisplay.h" +#if defined(_KERNEL_OPT) #include "wsmux.h" +#endif #include #include @@ -130,6 +131,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1 #include #include #include +#include #include #include @@ -138,6 +140,8 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1 #include +#include "ioconf.h" + #if defined(WSMUX_DEBUG) && NWSMUX > 0 #define DPRINTF(x) if (wsmuxdebug) printf x #define DPRINTFN(n,x) if (wsmuxdebug > (n)) printf x @@ -461,3 +465,50 @@ wsbell_mux_close(struct wsevsrc *me) return (0); } #endif /* NWSMUX > 0 */ + +MODULE(MODULE_CLASS_DRIVER, wsbell, "spkr"); + +#ifdef _MODULE +int wsbell_bmajor = -1, wsbell_cmajor = -1; + +#include "ioconf.c" +#endif + +static int +wsbell_modcmd(modcmd_t cmd, void *arg) +{ + int error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: +#ifdef _MODULE + error = devsw_attach("wsbell", NULL, _bmajor, + _cdevsw, _cmajor); + if (error) + break; + + error = config_init_component(cfdriver_ioconf_wsbell, + cfattach_ioconf_wsbell, cfdata_ioconf_wsbell); + if (error) + devsw_detach(NULL, _cdevsw); +#endif + break; + + case MODULE_CMD_FINI: +#ifdef _MODULE + devsw_detach(NULL, _cdevsw); + error = config_fini_component(cfdriver_ioconf_wsbell, + cfattach_ioconf_wsbell, cfdata_ioconf_wsbell); + if (error) + devsw_attach("wsbell", NULL, _bmajor, + _cdevsw, _cmajor); +#endif + break; + + default: + error = ENOTTY; + break; + } + + return error; +}
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: nat Date: Sun Jun 11 03:38:12 UTC 2017 Modified Files: src/sys/dev/wscons: wskbd.c Added Files: src/sys/dev/wscons: wsbelldata.h Log Message: Seperate the definitions for the console beep. This code will be shared with a new device. Ok pgoyette@. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/wscons/wsbelldata.h cvs rdiff -u -r1.138 -r1.139 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.138 src/sys/dev/wscons/wskbd.c:1.139 --- src/sys/dev/wscons/wskbd.c:1.138 Sat Dec 10 22:36:28 2016 +++ src/sys/dev/wscons/wskbd.c Sun Jun 11 03:38:12 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $ */ +/* $NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -142,6 +142,7 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1. #include #include #include +#include #ifdef KGDB #include @@ -313,23 +314,6 @@ const struct cdevsw wskbd_cdevsw = { .d_flag = D_OTHER }; -#ifndef WSKBD_DEFAULT_BELL_PITCH -#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */ -#endif -#ifndef WSKBD_DEFAULT_BELL_PERIOD -#define WSKBD_DEFAULT_BELL_PERIOD 100 /* 100ms */ -#endif -#ifndef WSKBD_DEFAULT_BELL_VOLUME -#define WSKBD_DEFAULT_BELL_VOLUME 50 /* 50% volume */ -#endif - -struct wskbd_bell_data wskbd_default_bell_data = { - WSKBD_BELL_DOALL, - WSKBD_DEFAULT_BELL_PITCH, - WSKBD_DEFAULT_BELL_PERIOD, - WSKBD_DEFAULT_BELL_VOLUME, -}; - #ifdef WSDISPLAY_SCROLLSUPPORT struct wskbd_scroll_data wskbd_default_scroll_data = { WSKBD_SCROLL_DOALL, Added files: Index: src/sys/dev/wscons/wsbelldata.h diff -u /dev/null src/sys/dev/wscons/wsbelldata.h:1.1 --- /dev/null Sun Jun 11 03:38:12 2017 +++ src/sys/dev/wscons/wsbelldata.h Sun Jun 11 03:38:12 2017 @@ -0,0 +1,43 @@ +/* $NetBSD: wsbelldata.h,v 1.1 2017/06/11 03:38:12 nat Exp $ */ +/*- + * Copyright (c) 2017 Nathanial Sloss+ * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WSKBD_DEFAULT_BELL_PITCH +#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */ +#endif +#ifndef WSKBD_DEFAULT_BELL_PERIOD +#define WSKBD_DEFAULT_BELL_PERIOD 100 /* 100ms */ +#endif +#ifndef WSKBD_DEFAULT_BELL_VOLUME +#define WSKBD_DEFAULT_BELL_VOLUME 50 /* 50% volume */ +#endif + +static struct wskbd_bell_data wskbd_default_bell_data = { + WSKBD_BELL_DOALL, + WSKBD_DEFAULT_BELL_PITCH, + WSKBD_DEFAULT_BELL_PERIOD, + WSKBD_DEFAULT_BELL_VOLUME, +};
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sat Jun 3 14:49:42 UTC 2017 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: Add type for ARM PrimeCell PL11x To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.117 src/sys/dev/wscons/wsconsio.h:1.118 --- src/sys/dev/wscons/wsconsio.h:1.117 Fri Mar 24 00:45:27 2017 +++ src/sys/dev/wscons/wsconsio.h Sat Jun 3 14:49:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.117 2017/03/24 00:45:27 macallan Exp $ */ +/* $NetBSD: wsconsio.h,v 1.118 2017/06/03 14:49:42 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -340,6 +340,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM SoC */ #define WSDISPLAY_TYPE_TEGRA 63 /* NVIDIA Tegra ARM SoC */ #define WSDISPLAY_TYPE_PLATINUM 64 /* onboard fb in PowerMac 7200 */ +#define WSDISPLAY_TYPE_PLFB 65 /* ARM PrimeCell PL11x */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Fri Jun 2 19:33:51 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h Log Message: - add a cookie to show_screen_cb() - call show_screen_cb() when loading a font into a visible screen, so this can be used to track parameters by drivers that use the glyph cache To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/wscons/wsdisplay_vcons.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.37 src/sys/dev/wscons/wsdisplay_vcons.c:1.38 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.37 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsdisplay_vcons.c Fri Jun 2 19:33:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.37 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.37 2017/05/19 19:22:33 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.38 2017/06/02 19:33:51 macallan Exp $"); #include #include @@ -438,6 +438,11 @@ vcons_load_font(void *v, void *cookie, s ri->ri_ops.copycols = vcons_copycols; ri->ri_ops.copyrows = vcons_copyrows; vcons_unlock(vd->active); + + /* notify things that we're about to redraw */ + if (vd->show_screen_cb != NULL) + vd->show_screen_cb(scr, vd->show_screen_cookie); + #ifdef VCONS_DRAW_INTR /* * XXX @@ -515,7 +520,7 @@ vcons_do_switch(void *arg) #endif if (vd->show_screen_cb != NULL) - vd->show_screen_cb(scr); + vd->show_screen_cb(scr, vd->show_screen_cookie); if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) vcons_redraw_screen(scr); @@ -1505,7 +1510,7 @@ vcons_hard_switch(struct vcons_screen *s vd->wanted = NULL; if (vd->show_screen_cb != NULL) - vd->show_screen_cb(scr); + vd->show_screen_cb(scr, vd->show_screen_cookie); } #ifdef VCONS_DRAW_INTR Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.25 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.26 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.25 Fri May 19 19:22:33 2017 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Fri Jun 2 19:33:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.25 2017/05/19 19:22:33 macallan Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.26 2017/06/02 19:33:51 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -116,7 +116,8 @@ struct vcons_data { void (*eraserows)(void *, int, int, long); void (*cursor)(void *, int, int, int); /* called before vcons_redraw_screen */ - void (*show_screen_cb)(struct vcons_screen *); + void *show_screen_cookie; + void (*show_screen_cb)(struct vcons_screen *, void *); /* virtual screen management stuff */ void (*switch_cb)(void *, int, int); void *switch_cb_arg;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Fri Jun 2 19:30:10 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay_glyphcache.c wsdisplay_glyphcachevar.h Log Message: make glyph caches reconfigurable To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/wscons/wsdisplay_glyphcache.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/wscons/wsdisplay_glyphcachevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_glyphcache.c diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.8 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.9 --- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.8 Thu Jun 1 02:45:12 2017 +++ src/sys/dev/wscons/wsdisplay_glyphcache.c Fri Jun 2 19:30:10 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcache.c,v 1.8 2017/06/01 02:45:12 chs Exp $ */ +/* $NetBSD: wsdisplay_glyphcache.c,v 1.9 2017/06/02 19:30:10 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -27,9 +27,6 @@ /* * a simple glyph cache in offscreen memory - * For now it only caches glyphs with the default attribute ( assuming they're - * the most commonly used glyphs ) but the API should at least not prevent - * more sophisticated caching algorithms */ #ifdef _KERNEL_OPT @@ -40,6 +37,9 @@ #include #include #include +#include +#include +#include #include #ifdef GLYPHCACHE_DEBUG @@ -48,6 +48,8 @@ #define DPRINTF while (0) printf #endif +#define NBUCKETS 32 + static inline int attr2idx(long attr) { @@ -62,18 +64,42 @@ int glyphcache_init(glyphcache *gc, int first, int lines, int width, int cellwidth, int cellheight, long attr) { - int cache_lines, buckets, i, usedcells = 0, idx; - gc_bucket *b; /* first the geometry stuff */ - gc->gc_cellwidth = cellwidth; - gc->gc_cellheight = cellheight; + if (lines < 0) lines = 0; + gc->gc_width = width; + gc->gc_cellwidth = -1; + gc->gc_cellheight = -1; gc->gc_firstline = first; - gc->gc_cellsperline = width / cellwidth; + gc->gc_lines = lines; gc->gc_buckets = NULL; gc->gc_numbuckets = 0; - if (lines < 0) lines = 0; - cache_lines = lines / cellheight; + gc->gc_buckets = kmem_alloc(sizeof(gc_bucket) * NBUCKETS, KM_SLEEP); + gc->gc_nbuckets = NBUCKETS; + return glyphcache_reconfig(gc, cellwidth, cellheight, attr); + +} + +int +glyphcache_reconfig(glyphcache *gc, int cellwidth, int cellheight, long attr) +{ + int cache_lines, buckets, i, usedcells = 0, idx; + gc_bucket *b; + + /* see if we actually need to reconfigure anything */ + if ((gc->gc_cellwidth == cellwidth) && + (gc->gc_cellheight == cellheight) && + ((gc->gc_buckets != NULL) && + (gc->gc_buckets[0].gb_index == attr2idx(attr { + return 0; + } + + gc->gc_cellwidth = cellwidth; + gc->gc_cellheight = cellheight; + + gc->gc_cellsperline = gc->gc_width / cellwidth; + + cache_lines = gc->gc_lines / cellheight; gc->gc_numcells = cache_lines * gc->gc_cellsperline; /* now allocate buckets */ @@ -88,7 +114,7 @@ glyphcache_init(glyphcache *gc, int firs if (buckets < 1) return ENOMEM; - gc->gc_buckets = kmem_alloc(sizeof(gc_bucket) * buckets, KM_SLEEP); + buckets = min(buckets, gc->gc_nbuckets); gc->gc_numbuckets = buckets; DPRINTF("%s: using %d buckets\n", __func__, buckets); @@ -120,6 +146,21 @@ glyphcache_init(glyphcache *gc, int firs } void +glyphcache_adapt(struct vcons_screen *scr, void *cookie) +{ + glyphcache *gc = cookie; + struct rasops_info *ri = >scr_ri; + + if (ri->ri_wsfcookie != gc->gc_fontcookie) { + glyphcache_wipe(gc); + gc->gc_fontcookie = ri->ri_wsfcookie; + } + + glyphcache_reconfig(gc, ri->ri_font->fontwidth, + ri->ri_font->fontheight, scr->scr_defattr); +} + +void glyphcache_wipe(glyphcache *gc) { gc_bucket *b; Index: src/sys/dev/wscons/wsdisplay_glyphcachevar.h diff -u src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.4 src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.5 --- src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.4 Thu Oct 4 10:26:32 2012 +++ src/sys/dev/wscons/wsdisplay_glyphcachevar.h Fri Jun 2 19:30:10 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcachevar.h,v 1.4 2012/10/04 10:26:32 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcachevar.h,v 1.5 2017/06/02 19:30:10 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -48,8 +48,12 @@ typedef struct _glyphcache { int gc_cellheight; int gc_cellsperline; int gc_firstline; /* first line in vram to use for glyphs */ + int gc_lines; + int gc_width; + int gc_fontcookie; /* buckets */ - int gc_numbuckets; + int gc_numbuckets; /* buckets we can use */ + int gc_nbuckets; /* buckets allocated */ gc_bucket *gc_buckets; /* we allocate as many as we can get into vram */ gc_bucket *gc_next; /* bucket the next glyph goes into */ long gc_underline; /* draw an underline in glyphcache_add() */ @@ -66,10 +70,19 @@ typedef struct _glyphcache { /* first line, lines, width, cellwidth,
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Fri May 19 19:22:33 UTC 2017 Modified Files: src/sys/dev/wscons: files.wscons wsdisplay.c wsdisplay_vcons.c wsdisplay_vconsvar.h wsdisplayvar.h wsemul_dumb.c wsemul_sun.c wsemul_vt100.c wsemul_vt100_subr.c wsemulvar.h Log Message: add support for loading fonts in vcons and subsequently resizing screens - drivers can use this by setting VCONS_LOADFONT and WSSCREEN_RESIZE - each vcons screen can now have its own font and geometry - while there, add support for xterm's ESC[18t to report the text buffer's size With this tou can: wsfontload -N foo /usr/share/wscons/fonts/flori.816 wsconsctl -dw font=foo currently this is limited to drivers that don't use the glyph cache, like genfb To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/wscons/files.wscons cvs rdiff -u -r1.141 -r1.142 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/wscons/wsdisplay_vcons.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/wscons/wsdisplay_vconsvar.h cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplayvar.h cvs rdiff -u -r1.15 -r1.16 src/sys/dev/wscons/wsemul_dumb.c \ src/sys/dev/wscons/wsemulvar.h cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wscons/wsemul_sun.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/wscons/wsemul_vt100.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/wscons/wsemul_vt100_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.49 src/sys/dev/wscons/files.wscons:1.50 --- src/sys/dev/wscons/files.wscons:1.49 Fri Oct 17 10:09:21 2014 +++ src/sys/dev/wscons/files.wscons Fri May 19 19:22:33 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.49 2014/10/17 10:09:21 uebayasi Exp $ +# $NetBSD: files.wscons,v 1.50 2017/05/19 19:22:33 macallan Exp $ # # "Workstation Console" glue; attaches frame buffer to emulator & keyboard, @@ -76,7 +76,7 @@ defflag opt_tpcalib.h TPCALIBDEBUG # generic virtual console support on bitmapped framebuffers file dev/wscons/wsdisplay_vcons.c vcons file dev/wscons/wsdisplay_vcons_util.c vcons -defflag opt_vcons.h VCONS_DRAW_INTR VCONS_INTR_DEBUG +defflag opt_vcons.h VCONS_DRAW_INTR VCONS_INTR_DEBUG VCONS_DEBUG # generic support code for caching rendered glyphs in video memory define glyphcache Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.141 src/sys/dev/wscons/wsdisplay.c:1.142 --- src/sys/dev/wscons/wsdisplay.c:1.141 Wed Jan 25 15:40:31 2017 +++ src/sys/dev/wscons/wsdisplay.c Fri May 19 19:22:33 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.141 2017/01/25 15:40:31 jakllsch Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.141 2017/01/25 15:40:31 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.142 2017/05/19 19:22:33 macallan Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -257,6 +257,9 @@ static void wsdisplay_switch2_cb(void *, static int wsdisplay_switch3(device_t, int, int); static void wsdisplay_switch3_cb(void *, int, int); +static void wsdisplay_swdone_cb(void *, int, int); +static int wsdisplay_dosync(struct wsdisplay_softc *, int); + int wsdisplay_clearonclose; struct wsscreen * @@ -331,6 +334,8 @@ wsscreen_detach(struct wsscreen *scr) , ); wsemul_drop(scr->scr_dconf->wsemul); } + if (scr->scr_dconf->scrdata->capabilities & WSSCREEN_FREE) + free(__UNCONST(scr->scr_dconf->scrdata), M_DEVBUF); free(scr->scr_dconf, M_DEVBUF); free(scr, M_DEVBUF); } @@ -342,7 +347,6 @@ wsdisplay_screentype_pick(const struct w const struct wsscreen_descr *scr; KASSERT(scrdata->nscreens > 0); - if (name == NULL) return (scrdata->screens[0]); @@ -377,6 +381,7 @@ wsdisplay_addscreen(struct wsdisplay_sof const char *screentype, const char *emul) { const struct wsscreen_descr *scrdesc; + struct wsscreen_descr *scrdescr2; int error; void *cookie; int ccol, crow; @@ -388,10 +393,24 @@ wsdisplay_addscreen(struct wsdisplay_sof return (EINVAL); if (sc->sc_scr[idx] != NULL) return (EBUSY); - scrdesc = wsdisplay_screentype_pick(sc->sc_scrdata, screentype); if (!scrdesc) return (ENXIO); + + /* + * if this screen can resize we need to copy the descr so each screen + * gets its own + */ + if (scrdesc->capabilities & WSSCREEN_RESIZE) { + /* we want per screen wsscreen_descr */ + scrdescr2 = malloc(sizeof(struct wsscreen_descr), M_DEVBUF, M_NOWAIT); + if (scrdescr2 == NULL) + return ENOMEM; + memcpy(scrdescr2, scrdesc, sizeof(struct wsscreen_descr)); + scrdescr2->capabilities |= WSSCREEN_FREE; + scrdesc = scrdescr2; + } + error = (*sc->sc_accessops->alloc_screen)(sc->sc_accesscookie,
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Wed Apr 26 21:03:52 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: properly optimize drawing stretches of blanks that are interrupted only by a change in background colour or flags To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.35 src/sys/dev/wscons/wsdisplay_vcons.c:1.36 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.35 Sun Nov 8 16:49:20 2015 +++ src/sys/dev/wscons/wsdisplay_vcons.c Wed Apr 26 21:03:52 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.36 2017/04/26 21:03:52 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.36 2017/04/26 21:03:52 macallan Exp $"); #include #include @@ -421,7 +421,7 @@ vcons_redraw_screen(struct vcons_screen int i, j, offset, boffset = 0, start = -1; mask = 0x00ff00ff; /* background and flags */ - cmp = -1; /* never match anything */ + cmp = 0x; /* never match anything */ vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { @@ -474,11 +474,12 @@ vcons_redraw_screen(struct vcons_screen } else if (acmp != last_a) { /* * different attr, need to - * flush + * flush & restart */ vd->erasecols(ri, i, start, j - start, last_a); - start = -1; + start = j; + last_a = acmp; } } else { if (start != -1) {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Thu Apr 6 20:44:39 UTC 2017 Modified Files: src/sys/dev/wscons: tpcalib.c Log Message: don't forget to store bounds rectangle in raw mode To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/wscons/tpcalib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/tpcalib.c diff -u src/sys/dev/wscons/tpcalib.c:1.11 src/sys/dev/wscons/tpcalib.c:1.12 --- src/sys/dev/wscons/tpcalib.c:1.11 Sun Mar 4 06:02:51 2007 +++ src/sys/dev/wscons/tpcalib.c Thu Apr 6 20:44:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tpcalib.c,v 1.11 2007/03/04 06:02:51 christos Exp $ */ +/* $NetBSD: tpcalib.c,v 1.12 2017/04/06 20:44:39 macallan Exp $ */ /* * Copyright (c) 1999-2003 TAKEMURA Shin All rights reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tpcalib.c,v 1.11 2007/03/04 06:02:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tpcalib.c,v 1.12 2017/04/06 20:44:39 macallan Exp $"); #ifdef _KERNEL_OPT #include "opt_tpcalib.h" @@ -101,7 +101,8 @@ tpcalib_ioctl(struct tpcalib_softc *sc, d = (const struct wsmouse_calibcoords *)data; if (d->samplelen == WSMOUSE_CALIBCOORDS_RESET) { tpcalib_reset(sc); - } else + } + if (d->samplelen > 0) { if (mra_Y_AX1_BX2_C(>samples[0].x, s, >samples[0].rawx, s, >samples[0].rawy, s, @@ -116,20 +117,21 @@ tpcalib_ioctl(struct tpcalib_softc *sc, tpcalib_reset(sc); return (EINVAL); - } else { -sc->sc_minx = d->minx; -sc->sc_maxx = d->maxx; -sc->sc_miny = d->miny; -sc->sc_maxy = d->maxy; -sc->sc_saved = *d; -DPRINTF(("tpcalib: x=%d~%d y=%d~%d\n", -sc->sc_minx, sc->sc_maxx, -sc->sc_miny, sc->sc_maxy)); -DPRINTF(("tpcalib: Ax=%d Bx=%d Cx=%d\n", -sc->sc_ax, sc->sc_bx, sc->sc_cx)); -DPRINTF(("tpcalib: Ay=%d By=%d Cy=%d\n", -sc->sc_ay, sc->sc_by, sc->sc_cy)); } + } + sc->sc_minx = d->minx; + sc->sc_maxx = d->maxx; + sc->sc_miny = d->miny; + sc->sc_maxy = d->maxy; + sc->sc_saved = *d; + DPRINTF(("tpcalib: x=%d~%d y=%d~%d\n", + sc->sc_minx, sc->sc_maxx, + sc->sc_miny, sc->sc_maxy)); + DPRINTF(("tpcalib: Ax=%d Bx=%d Cx=%d\n", + sc->sc_ax, sc->sc_bx, sc->sc_cx)); + DPRINTF(("tpcalib: Ay=%d By=%d Cy=%d\n", + sc->sc_ay, sc->sc_by, sc->sc_cy)); + break; case WSMOUSEIO_GCALIBCOORDS:
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Fri Mar 24 00:45:27 UTC 2017 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add fbinfo flag for wildcat split framebuffer workaround To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.116 src/sys/dev/wscons/wsconsio.h:1.117 --- src/sys/dev/wscons/wsconsio.h:1.116 Tue Jan 10 20:08:52 2017 +++ src/sys/dev/wscons/wsconsio.h Fri Mar 24 00:45:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.116 2017/01/10 20:08:52 christos Exp $ */ +/* $NetBSD: wsconsio.h,v 1.117 2017/03/24 00:45:27 macallan Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -339,7 +339,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_MGX 61 /* SSB 4096V-MGX */ #define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM SoC */ #define WSDISPLAY_TYPE_TEGRA 63 /* NVIDIA Tegra ARM SoC */ -#define WSDISPLAY_TYPE_PLATINUM 64 /* Apple onboard video 'platinum' */ +#define WSDISPLAY_TYPE_PLATINUM 64 /* onboard fb in PowerMac 7200 */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo { @@ -655,7 +655,8 @@ struct wsdisplayio_fbinfo { }; /* fbi_flags */ -#define WSFB_VRAM_IS_RAM 1 /* hint for wsfb - don't shadow */ +#define WSFB_VRAM_IS_RAM 0x0001 /* hint for wsfb - don't shadow */ +#define WSFB_VRAM_IS_SPLIT 0x0002 /* workaround for wildcat... */ #define WSDISPLAYIO_GET_FBINFO _IOWR('W', 104, struct wsdisplayio_fbinfo)
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jakllsch Date: Wed Jan 25 15:40:31 UTC 2017 Modified Files: src/sys/dev/wscons: wsdisplay.c Log Message: Double size of WSDISPLAYIO_SFONT name buffer to 32 characters. We've got a font known as "DejaVu Sans Mono", and that is 17 bytes by the time it's NUL terminated. To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/dev/wscons/wsdisplay.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.140 src/sys/dev/wscons/wsdisplay.c:1.141 --- src/sys/dev/wscons/wsdisplay.c:1.140 Thu Jul 7 06:55:42 2016 +++ src/sys/dev/wscons/wsdisplay.c Wed Jan 25 15:40:31 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.140 2016/07/07 06:55:42 msaitoh Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.141 2017/01/25 15:40:31 jakllsch Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.140 2016/07/07 06:55:42 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.141 2017/01/25 15:40:31 jakllsch Exp $"); #ifdef _KERNEL_OPT #include "opt_wsdisplay_compat.h" @@ -1223,7 +1223,7 @@ wsdisplay_internal_ioctl(struct wsdispla u_long cmd, void *data, int flag, struct lwp *l) { int error; - char namebuf[16]; + char namebuf[32]; struct wsdisplay_font fd; #ifdef WSDISPLAY_SCROLLSUPPORT struct wsdisplay_scroll_data *ksdp, *usdp;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Tue Jan 10 20:08:52 UTC 2017 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: Needed that it got in the past by side-effect loading of from . Go figure. To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.115 src/sys/dev/wscons/wsconsio.h:1.116 --- src/sys/dev/wscons/wsconsio.h:1.115 Fri Jun 10 17:26:43 2016 +++ src/sys/dev/wscons/wsconsio.h Tue Jan 10 15:08:52 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.115 2016/06/10 21:26:43 macallan Exp $ */ +/* $NetBSD: wsconsio.h,v 1.116 2017/01/10 20:08:52 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -46,6 +46,7 @@ #include #include +#include #include
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sat Dec 10 22:36:28 UTC 2016 Modified Files: src/sys/dev/wscons: wskbd.c Log Message: remove VAUDIOSPEAKER, needs to be done differently. To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/sys/dev/wscons/wskbd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wskbd.c diff -u src/sys/dev/wscons/wskbd.c:1.137 src/sys/dev/wscons/wskbd.c:1.138 --- src/sys/dev/wscons/wskbd.c:1.137 Thu Dec 8 06:31:08 2016 +++ src/sys/dev/wscons/wskbd.c Sat Dec 10 17:36:28 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: wskbd.c,v 1.137 2016/12/08 11:31:08 nat Exp $ */ +/* $NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -105,7 +105,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.137 2016/12/08 11:31:08 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -156,10 +156,6 @@ int wskbddebug = 0; #include -#ifdef VAUDIOSPEAKER -#include -#endif - struct wskbd_internal { const struct wskbd_mapdata *t_keymap; @@ -190,7 +186,7 @@ struct wskbd_softc { int sc_ledstate; int sc_isconsole; - + struct wskbd_bell_data sc_bell_data; struct wskbd_keyrepeat_data sc_keyrepeat_data; #ifdef WSDISPLAY_SCROLLSUPPORT @@ -1093,27 +1089,16 @@ wskbd_displayioctl(device_t dev, u_long case WSKBDIO_BELL: if ((flag & FWRITE) == 0) return (EACCES); -#ifndef VAUDIOSPEAKER return ((*sc->sc_accessops->ioctl)(sc->sc_accesscookie, WSKBDIO_COMPLEXBELL, (void *)>sc_bell_data, flag, l)); -#else - wskbd_cnbell(0, sc->sc_bell_data.pitch, sc->sc_bell_data.period, - sc->sc_bell_data.volume); - return 0; -#endif case WSKBDIO_COMPLEXBELL: if ((flag & FWRITE) == 0) return (EACCES); ubdp = (struct wskbd_bell_data *)data; SETBELL(ubdp, ubdp, >sc_bell_data); -#ifndef VAUDIOSPEAKER return ((*sc->sc_accessops->ioctl)(sc->sc_accesscookie, WSKBDIO_COMPLEXBELL, (void *)ubdp, flag, l)); -#else - wskbd_cnbell(0, ubdp->pitch, ubdp->period, ubdp->volume); - return 0; -#endif case WSKBDIO_SETBELL: if ((flag & FWRITE) == 0) @@ -1481,14 +1466,10 @@ wskbd_cnbell(dev_t dev, u_int pitch, u_i if (!wskbd_console_initted) return; -#ifndef VAUDIOSPEAKER if (wskbd_console_data.t_consops->bell != NULL) (*wskbd_console_data.t_consops->bell) (wskbd_console_data.t_consaccesscookie, pitch, period, volume); -#else - speaker_play(pitch, period, volume); -#endif } static inline void
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Fri Jun 10 21:26:43 UTC 2016 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add WSDISPLAY_TYPE_PLATINUM, for platinumfb To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.114 src/sys/dev/wscons/wsconsio.h:1.115 --- src/sys/dev/wscons/wsconsio.h:1.114 Sun Jul 19 13:22:42 2015 +++ src/sys/dev/wscons/wsconsio.h Fri Jun 10 21:26:43 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.114 2015/07/19 13:22:42 mlelstv Exp $ */ +/* $NetBSD: wsconsio.h,v 1.115 2016/06/10 21:26:43 macallan Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -338,6 +338,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_MGX 61 /* SSB 4096V-MGX */ #define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM SoC */ #define WSDISPLAY_TYPE_TEGRA 63 /* NVIDIA Tegra ARM SoC */ +#define WSDISPLAY_TYPE_PLATINUM 64 /* Apple onboard video 'platinum' */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Thu Jun 2 21:17:14 UTC 2016 Modified Files: src/sys/dev/wscons: wsdisplay_vconsvar.h Log Message: provide a default attribute To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/wscons/wsdisplay_vconsvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vconsvar.h diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.23 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.24 --- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.23 Tue Mar 18 18:20:42 2014 +++ src/sys/dev/wscons/wsdisplay_vconsvar.h Thu Jun 2 21:17:14 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vconsvar.h,v 1.23 2014/03/18 18:20:42 riastradh Exp $ */ +/* $NetBSD: wsdisplay_vconsvar.h,v 1.24 2016/06/02 21:17:14 macallan Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -90,6 +90,8 @@ struct vcons_screen { #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW) #define SCREEN_ENABLE_DRAWING(scr) ((scr)->scr_flags &= ~VCONS_DONT_DRAW) +#define DEFATTR ((WS_DEFAULT_FG << 24) || (WS_DEFAULT_BG << 16)) + struct vcons_data { /* usually the drivers softc */ void *cookie;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sun Nov 8 16:49:41 UTC 2015 Modified Files: src/sys/dev/wscons: wsemul_sun.c Log Message: Untangle. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/wscons/wsemul_sun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsemul_sun.c diff -u src/sys/dev/wscons/wsemul_sun.c:1.28 src/sys/dev/wscons/wsemul_sun.c:1.29 --- src/sys/dev/wscons/wsemul_sun.c:1.28 Fri Mar 12 03:40:50 2010 +++ src/sys/dev/wscons/wsemul_sun.c Sun Nov 8 11:49:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsemul_sun.c,v 1.28 2010/03/12 08:40:50 jdc Exp $ */ +/* $NetBSD: wsemul_sun.c,v 1.29 2015/11/08 16:49:41 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -33,7 +33,7 @@ /* XXX DESCRIPTION/SOURCE OF INFORMATION */ #include -__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.28 2010/03/12 08:40:50 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.29 2015/11/08 16:49:41 christos Exp $"); #include #include @@ -151,11 +151,11 @@ wsemul_sun_cnattach(const struct wsscree res = (*edp->emulops->allocattr)(cookie, 0, 0, WS_KERNEL_MONOATTR, >kernattr); - if (res) #else - res = 0; /* XXX gcc */ + res = EINVAL; #endif - edp->kernattr = defattr; + if (res) + edp->kernattr = defattr; edp->cbcookie = NULL;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Sun Nov 8 16:49:21 UTC 2015 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: PR/50413: Vicente Chaves: Check the allocattr return and return an error. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.34 src/sys/dev/wscons/wsdisplay_vcons.c:1.35 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.34 Sun Jul 19 09:22:42 2015 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Nov 8 11:49:20 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.34 2015/07/19 13:22:42 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.34 2015/07/19 13:22:42 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.35 2015/11/08 16:49:20 christos Exp $"); #include #include @@ -285,15 +285,21 @@ vcons_init_screen(struct vcons_data *vd, #else cnt = ri->ri_rows * ri->ri_cols; #endif - scr->scr_attrs = (long *)malloc(cnt * (sizeof(long) + + scr->scr_attrs = malloc(cnt * (sizeof(long) + sizeof(uint32_t)), M_DEVBUF, M_WAITOK); if (scr->scr_attrs == NULL) return ENOMEM; scr->scr_chars = (uint32_t *)>scr_attrs[cnt]; - ri->ri_ops.allocattr(ri, WS_DEFAULT_FG, WS_DEFAULT_BG, 0, defattr); - scr->scr_defattr = *defattr; + i = ri->ri_ops.allocattr(ri, WS_DEFAULT_FG, WS_DEFAULT_BG, 0, defattr); + if (i != 0) { +#ifdef DIAGNOSTIC + printf("vcons: error allocating attribute %d\n", i); +#endif + scr->scr_defattr = 0; + } else + scr->scr_defattr = *defattr; /* * fill the attribute buffer with *defattr, chars with 0x20 @@ -1140,6 +1146,7 @@ vcons_putwschar(struct vcons_screen *scr { long attr; struct rasops_info *ri; + int error; KASSERT(scr != NULL && wsc != NULL); @@ -1152,8 +1159,10 @@ vcons_putwschar(struct vcons_screen *scr if ((wsc->row >= 0) && (wsc->row < ri->ri_rows) && (wsc->col >= 0) && (wsc->col < ri->ri_cols)) { - ri->ri_ops.allocattr(ri, wsc->foreground, wsc->background, - wsc->flags, ); + error = ri->ri_ops.allocattr(ri, wsc->foreground, + wsc->background, wsc->flags, ); + if (error) + return error; vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr); #ifdef VCONS_DEBUG printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col,
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun Jul 19 13:22:42 UTC 2015 Modified Files: src/sys/dev/wscons: wsconsio.h wsdisplay_vcons.c Log Message: use optimized refresh with VCONS_DRAW_INTR even when in polling mode. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/wscons/wsconsio.h cvs rdiff -u -r1.33 -r1.34 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.113 src/sys/dev/wscons/wsconsio.h:1.114 --- src/sys/dev/wscons/wsconsio.h:1.113 Mon May 18 14:27:49 2015 +++ src/sys/dev/wscons/wsconsio.h Sun Jul 19 13:22:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.113 2015/05/18 14:27:49 jmcneill Exp $ */ +/* $NetBSD: wsconsio.h,v 1.114 2015/07/19 13:22:42 mlelstv Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -657,4 +657,24 @@ struct wsdisplayio_fbinfo { #define WSDISPLAYIO_GET_FBINFO _IOWR('W', 104, struct wsdisplayio_fbinfo) +struct wsdisplayio_blit { + uint32_t serial; + uint32_t op; + uint32_t srcx; + uint32_t srcy; + uint32_t dstx; + uint32_t dsty; + uint32_t width; + uint32_t height; + uint32_t pen; +}; + +/* blit ops */ +#define WSFB_BLIT_FILL 1 /* fill rectangle */ +#define WSFB_BLIT_COPY 2 /* copy rectangle */ +#define WSFB_BLIT_TRANS 3 /* copy rectangle with color key */ + +#define WSDISPLAYIO_DOBLIT _IOWR('W', 105, struct wsdisplayio_blit) +#define WSDISPLAYIO_WAITBLIT _IOWR('W', 106, struct wsdisplayio_blit) + #endif /* _DEV_WSCONS_WSCONSIO_H_ */ Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.33 src/sys/dev/wscons/wsdisplay_vcons.c:1.34 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.33 Mon Nov 10 20:52:47 2014 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun Jul 19 13:22:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.33 2014/11/10 20:52:47 jmcneill Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.34 2015/07/19 13:22:42 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.33 2014/11/10 20:52:47 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.34 2015/07/19 13:22:42 mlelstv Exp $); #include sys/param.h #include sys/systm.h @@ -736,9 +736,10 @@ vcons_copycols(void *cookie, int row, in vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { - scr-scr_vd-copycols(cookie, row, srccol, dstcol, ncols); #if defined(VCONS_DRAW_INTR) - vcons_invalidate_cache(scr-scr_vd); + vcons_update_screen(scr); +#else + scr-scr_vd-copycols(cookie, row, srccol, dstcol, ncols); #endif } vcons_unlock(scr); @@ -907,9 +908,10 @@ vcons_copyrows(void *cookie, int srcrow, vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { - scr-scr_vd-copyrows(cookie, srcrow, dstrow, nrows); #if defined(VCONS_DRAW_INTR) - vcons_invalidate_cache(scr-scr_vd); + vcons_update_screen(scr); +#else + scr-scr_vd-copyrows(cookie, srcrow, dstrow, nrows); #endif } vcons_unlock(scr);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Mon May 18 14:27:49 UTC 2015 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add WSDISPLAY_TYPE_TEGRA To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.112 src/sys/dev/wscons/wsconsio.h:1.113 --- src/sys/dev/wscons/wsconsio.h:1.112 Fri Mar 20 21:42:31 2015 +++ src/sys/dev/wscons/wsconsio.h Mon May 18 14:27:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.112 2015/03/20 21:42:31 jmcneill Exp $ */ +/* $NetBSD: wsconsio.h,v 1.113 2015/05/18 14:27:49 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -336,7 +336,8 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ #define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ #define WSDISPLAY_TYPE_MGX 61 /* SSB 4096V-MGX */ -#define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM Soc */ +#define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM SoC */ +#define WSDISPLAY_TYPE_TEGRA 63 /* NVIDIA Tegra ARM SoC */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Fri Mar 20 21:42:31 UTC 2015 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add WSDISPLAY_TYPE_MESON To generate a diff of this commit: cvs rdiff -u -r1.111 -r1.112 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.111 src/sys/dev/wscons/wsconsio.h:1.112 --- src/sys/dev/wscons/wsconsio.h:1.111 Tue Jan 6 19:19:10 2015 +++ src/sys/dev/wscons/wsconsio.h Fri Mar 20 21:42:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.111 2015/01/06 19:19:10 christos Exp $ */ +/* $NetBSD: wsconsio.h,v 1.112 2015/03/20 21:42:31 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -336,6 +336,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ #define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ #define WSDISPLAY_TYPE_MGX 61 /* SSB 4096V-MGX */ +#define WSDISPLAY_TYPE_MESON 62 /* Amlogic Meson ARM Soc */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Tue Jan 6 19:19:10 UTC 2015 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add MGX To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.110 src/sys/dev/wscons/wsconsio.h:1.111 --- src/sys/dev/wscons/wsconsio.h:1.110 Tue Jan 6 14:18:21 2015 +++ src/sys/dev/wscons/wsconsio.h Tue Jan 6 14:19:10 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.110 2015/01/06 19:18:21 christos Exp $ */ +/* $NetBSD: wsconsio.h,v 1.111 2015/01/06 19:19:10 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -334,7 +334,8 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_OMAP3 57 /* OMAP 3530 */ #define WSDISPLAY_TYPE_WINDERMERE 58 /* SoC for EPOC32 Series 5mx */ #define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ -#define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ +#define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ +#define WSDISPLAY_TYPE_MGX 61 /* SSB 4096V-MGX */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: christos Date: Tue Jan 6 19:18:21 UTC 2015 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: tab police To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.109 src/sys/dev/wscons/wsconsio.h:1.110 --- src/sys/dev/wscons/wsconsio.h:1.109 Sun Nov 9 09:33:21 2014 +++ src/sys/dev/wscons/wsconsio.h Tue Jan 6 14:18:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.109 2014/11/09 14:33:21 jmcneill Exp $ */ +/* $NetBSD: wsconsio.h,v 1.110 2015/01/06 19:18:21 christos Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -317,24 +317,24 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_STI 40 /* HP STI framebuffers */ #define WSDISPLAY_TYPE_HDLCD 41 /* Hitachi HD44780 based LCDs */ #define WSDISPLAY_TYPE_VESA 42 /* VESA BIOS framebuffer */ -#define WSDISPLAY_TYPE_XILFB 43 /* Xilinx TFT cores */ -#define WSDISPLAY_TYPE_LIGHT 44 /* SGI Light (a.k.a. Entry/Starter) */ -#define WSDISPLAY_TYPE_GENFB 45 /* generic nondescript framebuffer */ -#define WSDISPLAY_TYPE_CRIME 46 /* SGI O2 */ -#define WSDISPLAY_TYPE_PXALCD 47 /* PXA2x0 LCD controller */ -#define WSDISPLAY_TYPE_AG10 48 /* Fujitsu AG-10e */ -#define WSDISPLAY_TYPE_DL 49 /* DisplayLink DL-1x0/DL-1x5 */ -#define WSDISPLAY_TYPE_XVR1000 50 /* Sun XVR-1000 */ -#define WSDISPLAY_TYPE_LUNA 51 /* OMRON SX-9100 LUNA */ -#define WSDISPLAY_TYPE_GRF 52 /* wsdisplay on top of grf(4) */ -#define WSDISPLAY_TYPE_VNC 53 /* Usermode vnc framebuffer */ -#define WSDISPLAY_TYPE_VALKYRIE 54 /* Apple onboard video 'valkyrie' */ -#define WSDISPLAY_TYPE_IMXIPU 55 /* i.MX ipu */ -#define WSDISPLAY_TYPE_VC4 56 /* Broadcom VideoCore 4 */ -#define WSDISPLAY_TYPE_OMAP3 57 /* OMAP 3530 */ -#define WSDISPLAY_TYPE_WINDERMERE 58 /* SoC for EPOC32 Series 5mx */ -#define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ -#define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ +#define WSDISPLAY_TYPE_XILFB 43 /* Xilinx TFT cores */ +#define WSDISPLAY_TYPE_LIGHT 44 /* SGI Light (a.k.a. Entry/Starter) */ +#define WSDISPLAY_TYPE_GENFB 45 /* generic nondescript framebuffer */ +#define WSDISPLAY_TYPE_CRIME 46 /* SGI O2 */ +#define WSDISPLAY_TYPE_PXALCD 47 /* PXA2x0 LCD controller */ +#define WSDISPLAY_TYPE_AG10 48 /* Fujitsu AG-10e */ +#define WSDISPLAY_TYPE_DL 49 /* DisplayLink DL-1x0/DL-1x5 */ +#define WSDISPLAY_TYPE_XVR1000 50 /* Sun XVR-1000 */ +#define WSDISPLAY_TYPE_LUNA 51 /* OMRON SX-9100 LUNA */ +#define WSDISPLAY_TYPE_GRF 52 /* wsdisplay on top of grf(4) */ +#define WSDISPLAY_TYPE_VNC 53 /* Usermode vnc framebuffer */ +#define WSDISPLAY_TYPE_VALKYRIE 54 /* Apple onboard video 'valkyrie' */ +#define WSDISPLAY_TYPE_IMXIPU 55 /* i.MX ipu */ +#define WSDISPLAY_TYPE_VC4 56 /* Broadcom VideoCore 4 */ +#define WSDISPLAY_TYPE_OMAP3 57 /* OMAP 3530 */ +#define WSDISPLAY_TYPE_WINDERMERE 58 /* SoC for EPOC32 Series 5mx */ +#define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ +#define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Mon Nov 10 20:52:47 UTC 2014 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: allocate char and attr buffers with M_ZERO To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.32 src/sys/dev/wscons/wsdisplay_vcons.c:1.33 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.32 Tue Mar 18 18:20:42 2014 +++ src/sys/dev/wscons/wsdisplay_vcons.c Mon Nov 10 20:52:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.32 2014/03/18 18:20:42 riastradh Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.33 2014/11/10 20:52:47 jmcneill Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.32 2014/03/18 18:20:42 riastradh Exp $); +__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.33 2014/11/10 20:52:47 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -314,8 +314,10 @@ vcons_init_screen(struct vcons_data *vd, if (vd-chars != NULL) free(vd-chars, M_DEVBUF); if (vd-attrs != NULL) free(vd-attrs, M_DEVBUF); vd-cells = size; - vd-chars = malloc(size * sizeof(uint32_t), M_DEVBUF, M_WAITOK); - vd-attrs = malloc(size * sizeof(long), M_DEVBUF, M_WAITOK); + vd-chars = malloc(size * sizeof(uint32_t), M_DEVBUF, + M_WAITOK|M_ZERO); + vd-attrs = malloc(size * sizeof(long), M_DEVBUF, + M_WAITOK|M_ZERO); vcons_invalidate_cache(vd); } #endif
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: jmcneill Date: Sun Nov 9 14:33:21 UTC 2014 Modified Files: src/sys/dev/wscons: wsconsio.h Log Message: add WSDISPLAY_TYPE_ALLWINNER To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/dev/wscons/wsconsio.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsconsio.h diff -u src/sys/dev/wscons/wsconsio.h:1.108 src/sys/dev/wscons/wsconsio.h:1.109 --- src/sys/dev/wscons/wsconsio.h:1.108 Mon Apr 29 13:39:47 2013 +++ src/sys/dev/wscons/wsconsio.h Sun Nov 9 14:33:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsio.h,v 1.108 2013/04/29 13:39:47 kiyohara Exp $ */ +/* $NetBSD: wsconsio.h,v 1.109 2014/11/09 14:33:21 jmcneill Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -334,6 +334,7 @@ struct wsmouse_repeat { #define WSDISPLAY_TYPE_OMAP3 57 /* OMAP 3530 */ #define WSDISPLAY_TYPE_WINDERMERE 58 /* SoC for EPOC32 Series 5mx */ #define WSDISPLAY_TYPE_CLPS711X 59 /* CL PS-711x */ +#define WSDISPLAY_TYPE_ALLWINNER 60 /* Allwinner ARM SoC */ /* Basic display information. Not applicable to all display types. */ struct wsdisplay_fbinfo {
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: uebayasi Date: Fri Oct 17 10:09:21 UTC 2014 Modified Files: src/sys/dev/wscons: files.wscons Log Message: Give up making wscons modular for now. My intent is to make no handle dependency right so that you can simplely do: no wsdisplay* To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/wscons/files.wscons Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.48 src/sys/dev/wscons/files.wscons:1.49 --- src/sys/dev/wscons/files.wscons:1.48 Fri Oct 10 17:53:08 2014 +++ src/sys/dev/wscons/files.wscons Fri Oct 17 10:09:21 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.48 2014/10/10 17:53:08 uebayasi Exp $ +# $NetBSD: files.wscons,v 1.49 2014/10/17 10:09:21 uebayasi Exp $ # # Workstation Console glue; attaches frame buffer to emulator keyboard, @@ -36,29 +36,25 @@ defparam opt_wsdisplay_compat.h WSCOMPAT defparam opt_wsdisplay_compat.h WSDISPLAY_SCROLLBACK_LINES=100 # this loses, but there's no way to define attributes which have attributes -device wsdisplay: wsevent # tty? +device wsdisplay #tty? attach wsdisplay at wsemuldisplaydev with wsdisplay_emul attach wsdisplay at wsdisplaydev with wsdisplay_noemul -device wskbd: wsevent +device wskbd attach wskbd at wskbddev -device wsmouse: wsevent +device wsmouse attach wsmouse at wsmousedev file dev/wscons/wsdisplay.c wsdisplay needs-flag -define wsdisplay_compat_usl: wsdisplay -file dev/wscons/wsdisplay_compat_usl.c wsdisplay_compat_usl +file dev/wscons/wsdisplay_compat_usl.c wsdisplay wsdisplay_compat_usl file dev/wscons/wsdisplay_util.c wsdisplay file dev/wscons/wsemulconf.c wsdisplay file dev/wscons/wsemul_dumb.c wsdisplay !wsemul_no_dumb -define wsemul_sun: wsdisplay -file dev/wscons/wsemul_sun.c wsemul_sun -define wsemul_vt100: wsdisplay -file dev/wscons/wsemul_vt100.c wsemul_vt100 -file dev/wscons/wsemul_vt100_subr.c wsemul_vt100 -file dev/wscons/wsemul_vt100_chars.c wsemul_vt100 -file dev/wscons/wsemul_vt100_keys.c wsemul_vt100 -define wsevent -file dev/wscons/wsevent.c +file dev/wscons/wsemul_sun.c wsdisplay wsemul_sun +file dev/wscons/wsemul_vt100.c wsdisplay wsemul_vt100 +file dev/wscons/wsemul_vt100_subr.c wsdisplay wsemul_vt100 +file dev/wscons/wsemul_vt100_chars.c wsdisplay wsemul_vt100 +file dev/wscons/wsemul_vt100_keys.c wsdisplay wsemul_vt100 +file dev/wscons/wsevent.c wsdisplay | wskbd | wsmouse | wsmux file dev/wscons/wskbd.c wskbd needs-flag file dev/wscons/wskbdutil.c wskbd needs-flag file dev/wscons/wsmouse.c wsmouse needs-flag @@ -69,7 +65,7 @@ include dev/rcons/files.rcons file dev/wscons/wscons_rinit.c wsrasteremulops file dev/wscons/wscons_rops.c wsrasteremulops -defpseudo wsmux: wsevent +defpseudo wsmux file dev/wscons/wsmux.c wsmux needs-flag define tpcalib
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: uebayasi Date: Fri Oct 10 17:53:08 UTC 2014 Modified Files: src/sys/dev/wscons: files.wscons Log Message: Normalize wscons devices (except leaving one strange definition). To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/wscons/files.wscons Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/files.wscons diff -u src/sys/dev/wscons/files.wscons:1.47 src/sys/dev/wscons/files.wscons:1.48 --- src/sys/dev/wscons/files.wscons:1.47 Thu Oct 4 19:09:20 2012 +++ src/sys/dev/wscons/files.wscons Fri Oct 10 17:53:08 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.wscons,v 1.47 2012/10/04 19:09:20 macallan Exp $ +# $NetBSD: files.wscons,v 1.48 2014/10/10 17:53:08 uebayasi Exp $ # # Workstation Console glue; attaches frame buffer to emulator keyboard, @@ -36,25 +36,29 @@ defparam opt_wsdisplay_compat.h WSCOMPAT defparam opt_wsdisplay_compat.h WSDISPLAY_SCROLLBACK_LINES=100 # this loses, but there's no way to define attributes which have attributes -device wsdisplay #tty? +device wsdisplay: wsevent # tty? attach wsdisplay at wsemuldisplaydev with wsdisplay_emul attach wsdisplay at wsdisplaydev with wsdisplay_noemul -device wskbd +device wskbd: wsevent attach wskbd at wskbddev -device wsmouse +device wsmouse: wsevent attach wsmouse at wsmousedev file dev/wscons/wsdisplay.c wsdisplay needs-flag -file dev/wscons/wsdisplay_compat_usl.c wsdisplay wsdisplay_compat_usl +define wsdisplay_compat_usl: wsdisplay +file dev/wscons/wsdisplay_compat_usl.c wsdisplay_compat_usl file dev/wscons/wsdisplay_util.c wsdisplay file dev/wscons/wsemulconf.c wsdisplay file dev/wscons/wsemul_dumb.c wsdisplay !wsemul_no_dumb -file dev/wscons/wsemul_sun.c wsdisplay wsemul_sun -file dev/wscons/wsemul_vt100.c wsdisplay wsemul_vt100 -file dev/wscons/wsemul_vt100_subr.c wsdisplay wsemul_vt100 -file dev/wscons/wsemul_vt100_chars.c wsdisplay wsemul_vt100 -file dev/wscons/wsemul_vt100_keys.c wsdisplay wsemul_vt100 -file dev/wscons/wsevent.c wsdisplay | wskbd | wsmouse | wsmux +define wsemul_sun: wsdisplay +file dev/wscons/wsemul_sun.c wsemul_sun +define wsemul_vt100: wsdisplay +file dev/wscons/wsemul_vt100.c wsemul_vt100 +file dev/wscons/wsemul_vt100_subr.c wsemul_vt100 +file dev/wscons/wsemul_vt100_chars.c wsemul_vt100 +file dev/wscons/wsemul_vt100_keys.c wsemul_vt100 +define wsevent +file dev/wscons/wsevent.c file dev/wscons/wskbd.c wskbd needs-flag file dev/wscons/wskbdutil.c wskbd needs-flag file dev/wscons/wsmouse.c wsmouse needs-flag @@ -65,7 +69,7 @@ include dev/rcons/files.rcons file dev/wscons/wscons_rinit.c wsrasteremulops file dev/wscons/wscons_rops.c wsrasteremulops -defpseudo wsmux +defpseudo wsmux: wsevent file dev/wscons/wsmux.c wsmux needs-flag define tpcalib
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: khorben Date: Fri Mar 14 05:03:19 UTC 2014 Modified Files: src/sys/dev/wscons: mra.c Log Message: Fixed wrong cast and invalid array access in the calibration framework, as documented in PR kern/45872. The AA() macro accessed sample coordinates as long integers, whereas they are really stored as signed integers. Fixes calibration on my Wetab device. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/mra.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/mra.c diff -u src/sys/dev/wscons/mra.c:1.5 src/sys/dev/wscons/mra.c:1.6 --- src/sys/dev/wscons/mra.c:1.5 Sat Sep 14 21:06:50 2013 +++ src/sys/dev/wscons/mra.c Fri Mar 14 05:03:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $ */ +/* $NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $ */ /* * Copyright (c) 1999 Shin Takemura All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $); #include sys/param.h #include sys/systm.h @@ -55,7 +55,7 @@ mra_Y_AX1_BX2_C(const int *y, int ys, // int64_t SYY; int64_t S1Y, S2Y; int64_t A, B, C, M; -#define AA(p, s, i) (*((const long *)(((const char *)(p)) + (s) * (i +#define AA(p, s, i) (*((const int *)(((const char *)(p)) + (s) * (i #define X1(i) AA(x1, x1s, i) #define X2(i) AA(x2, x2s, i) #define Y(i) AA(y, ys, i)
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Tue Jan 21 00:08:28 UTC 2014 Modified Files: src/sys/dev/wscons: wsdisplay.c wsdisplayvar.h Log Message: add function to detach wscons from a console. This allows to switch the console to a different driver. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/sys/dev/wscons/wsdisplay.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/wscons/wsdisplayvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay.c diff -u src/sys/dev/wscons/wsdisplay.c:1.135 src/sys/dev/wscons/wsdisplay.c:1.136 --- src/sys/dev/wscons/wsdisplay.c:1.135 Thu Feb 2 13:11:25 2012 +++ src/sys/dev/wscons/wsdisplay.c Tue Jan 21 00:08:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay.c,v 1.135 2012/02/02 13:11:25 drochner Exp $ */ +/* $NetBSD: wsdisplay.c,v 1.136 2014/01/21 00:08:27 mlelstv Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wsdisplay.c,v 1.135 2012/02/02 13:11:25 drochner Exp $); +__KERNEL_RCSID(0, $NetBSD: wsdisplay.c,v 1.136 2014/01/21 00:08:27 mlelstv Exp $); #include opt_wsdisplay_compat.h #include opt_wsmsgattrs.h @@ -884,6 +884,15 @@ wsdisplay_preattach(const struct wsscree wsdisplay_console_initted = 1; } +void +wsdisplay_cndetach(void) +{ + KASSERT(wsdisplay_console_initted == 2); + + cn_tab = NULL; + wsdisplay_console_initted = 0; +} + /* * Tty and cdevsw functions. */ Index: src/sys/dev/wscons/wsdisplayvar.h diff -u src/sys/dev/wscons/wsdisplayvar.h:1.50 src/sys/dev/wscons/wsdisplayvar.h:1.51 --- src/sys/dev/wscons/wsdisplayvar.h:1.50 Thu Jan 31 10:57:30 2013 +++ src/sys/dev/wscons/wsdisplayvar.h Tue Jan 21 00:08:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplayvar.h,v 1.50 2013/01/31 10:57:30 macallan Exp $ */ +/* $NetBSD: wsdisplayvar.h,v 1.51 2014/01/21 00:08:27 mlelstv Exp $ */ /* * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. @@ -163,6 +163,7 @@ void wsdisplay_cnattach(const struct wss long); void wsdisplay_preattach(const struct wsscreen_descr *, void *, int, int, long); +void wsdisplay_cndetach(void); int wsdisplaydevprint(void *, const char *); int wsemuldisplaydevprint(void *, const char *);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Tue Jan 21 00:10:46 UTC 2014 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: keep track of VCONS_DRAW_INTR screen cache also in erasecols/rows and copycols/rows methods. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.29 src/sys/dev/wscons/wsdisplay_vcons.c:1.30 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.29 Sun Sep 15 16:12:00 2013 +++ src/sys/dev/wscons/wsdisplay_vcons.c Tue Jan 21 00:10:46 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.29 2013/09/15 16:12:00 martin Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.29 2013/09/15 16:12:00 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $); #include sys/param.h #include sys/systm.h @@ -89,6 +89,8 @@ static void vcons_copyrows(void *, int, static void vcons_eraserows(void *, int, int, long); static void vcons_putchar(void *, int, int, u_int, long); #ifdef VCONS_DRAW_INTR +static void vcons_erasecols_cached(void *, int, int, int, long); +static void vcons_eraserows_cached(void *, int, int, long); static void vcons_putchar_cached(void *, int, int, u_int, long); #endif static void vcons_cursor(void *, int, int, int); @@ -731,6 +733,9 @@ vcons_copycols(void *cookie, int row, in vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { scr-scr_vd-copycols(cookie, row, srccol, dstcol, ncols); +#if defined(VCONS_DRAW_INTR) + vcons_invalidate_cache(scr-scr_vd); +#endif } vcons_unlock(scr); } @@ -742,6 +747,7 @@ vcons_copycols_noread(void *cookie, int struct vcons_screen *scr = ri-ri_hw; struct vcons_data *vd = scr-scr_vd; + vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { int pos, c, offset, ppos; @@ -769,6 +775,7 @@ vcons_copycols_noread(void *cookie, int ppos++; } } + vcons_unlock(scr); } static void @@ -832,8 +839,8 @@ vcons_erasecols(void *cookie, int row, i vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { #ifdef VCONS_DRAW_INTR - vcons_erasecols_cached(cookie, row, startcol, ncols, - fillattr); + vcons_erasecols_cached(cookie, row, startcol, ncols, + fillattr); #else scr-scr_vd-erasecols(cookie, row, startcol, ncols, fillattr); #endif @@ -897,6 +904,9 @@ vcons_copyrows(void *cookie, int srcrow, vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { scr-scr_vd-copyrows(cookie, srcrow, dstrow, nrows); +#if defined(VCONS_DRAW_INTR) + vcons_invalidate_cache(scr-scr_vd); +#endif } vcons_unlock(scr); } @@ -908,6 +918,7 @@ vcons_copyrows_noread(void *cookie, int struct vcons_screen *scr = ri-ri_hw; struct vcons_data *vd = scr-scr_vd; + vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { int pos, l, c, offset, ppos; @@ -929,7 +940,7 @@ vcons_copyrows_noread(void *cookie, int vd-attrs[ppos] = scr-scr_attrs[pos]; } #else -vd-putchar(cookie, l, c, scr-scr_chars[pos], +scr-scr_vd-putchar(cookie, l, c, scr-scr_chars[pos], scr-scr_attrs[pos]); #endif pos++; @@ -937,6 +948,7 @@ vcons_copyrows_noread(void *cookie, int } } } + vcons_unlock(scr); } static void @@ -967,6 +979,23 @@ vcons_eraserows_buffer(void *cookie, int #endif } +#ifdef VCONS_DRAW_INTR +static void +vcons_eraserows_cached(void *cookie, int row, int nrows, long fillattr) +{ + struct rasops_info *ri = cookie; + struct vcons_screen *scr = ri-ri_hw; + struct vcons_data *vd = scr-scr_vd; + int i, pos = row * ri-ri_cols, end = (row+nrows) * ri-ri_cols; + + for (i = pos; i end; i++) { + vd-chars[i] = 0x20; + vd-attrs[i] = fillattr; + } + vd-eraserows(cookie, row, nrows, fillattr); +} +#endif + static void vcons_eraserows(void *cookie, int row, int nrows, long fillattr) { @@ -982,7 +1011,11 @@ vcons_eraserows(void *cookie, int row, i vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) SCREEN_CAN_DRAW(scr)) { +#ifdef VCONS_DRAW_INTR + vcons_eraserows_cached(cookie, row, nrows, fillattr); +#else scr-scr_vd-eraserows(cookie, row, nrows, fillattr); +#endif } vcons_unlock(scr); } @@ -1262,10 +1295,15 @@ vcons_softintr(void *cookie) struct vcons_screen *scr = vd-active; unsigned int dirty; - if (scr vd-use_intr == 1) { + if (scr vd-use_intr) { if (!SCREEN_IS_BUSY(scr)) { dirty = atomic_swap_uint(scr-scr_dirty, 0); - if (dirty 0) { + if (vd-use_intr == 2) { +if ((scr-scr_flags VCONS_NO_REDRAW) == 0) { + vd-use_intr = 1; + vcons_redraw_screen(scr);
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Tue Jan 21 00:36:11 UTC 2014 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: fix build To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.30 src/sys/dev/wscons/wsdisplay_vcons.c:1.31 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.30 Tue Jan 21 00:10:46 2014 +++ src/sys/dev/wscons/wsdisplay_vcons.c Tue Jan 21 00:36:11 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.31 2014/01/21 00:36:11 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $); +__KERNEL_RCSID(0, $NetBSD: wsdisplay_vcons.c,v 1.31 2014/01/21 00:36:11 mlelstv Exp $); #include sys/param.h #include sys/systm.h @@ -940,7 +940,7 @@ vcons_copyrows_noread(void *cookie, int vd-attrs[ppos] = scr-scr_attrs[pos]; } #else -scr-scr_vd-putchar(cookie, l, c, scr-scr_chars[pos], +vd-putchar(cookie, l, c, scr-scr_chars[pos], scr-scr_attrs[pos]); #endif pos++;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: macallan Date: Mon Jan 13 19:30:33 UTC 2014 Modified Files: src/sys/dev/wscons: wsdisplay_glyphcache.c Log Message: try not to crash when calling glyphcache_wipe() on an uninitialized cache first step to fix PR 48492 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/wsdisplay_glyphcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_glyphcache.c diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.5 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.6 --- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.5 Tue Nov 13 20:29:03 2012 +++ src/sys/dev/wscons/wsdisplay_glyphcache.c Mon Jan 13 19:30:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_glyphcache.c,v 1.5 2012/11/13 20:29:03 macallan Exp $ */ +/* $NetBSD: wsdisplay_glyphcache.c,v 1.6 2014/01/13 19:30:33 macallan Exp $ */ /* * Copyright (c) 2012 Michael Lorenz @@ -67,6 +67,8 @@ glyphcache_init(glyphcache *gc, int firs gc-gc_cellheight = cellheight; gc-gc_firstline = first; gc-gc_cellsperline = width / cellwidth; + gc-gc_buckets = NULL; + gc-gc_numbuckets = 0; if (lines 0) lines = 0; cache_lines = lines / cellheight; gc-gc_numcells = cache_lines * gc-gc_cellsperline; @@ -124,6 +126,9 @@ glyphcache_wipe(glyphcache *gc) gc_bucket *b; int i, j, idx; + if ((gc-gc_buckets == NULL) || (gc-gc_numbuckets 1)) + return; + idx = gc-gc_buckets[0].gb_index; /* empty all the buckets */