From owner-svn-src-all@freebsd.org Mon Mar 27 10:48:30 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D0DCCA1738; Mon, 27 Mar 2017 10:48:30 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBCD89AD; Mon, 27 Mar 2017 10:48:29 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2RAmTkP025598; Mon, 27 Mar 2017 10:48:29 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2RAmS2u025596; Mon, 27 Mar 2017 10:48:28 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201703271048.v2RAmS2u025596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Mon, 27 Mar 2017 10:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316019 - in head/sys: kern teken X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 10:48:30 -0000 Author: bde Date: Mon Mar 27 10:48:28 2017 New Revision: 316019 URL: https://svnweb.freebsd.org/changeset/base/316019 Log: Oops, my fix for bright colors broke bright black some more (in cases that used to work via the bold hack). Fix the table entry for bright black. Fix spelling of plain black in nearby table entries (use the macro for black everywhere everywhere). Fix the currently-unused non-bright color table to not have bright colors in entries 9-15. Improve nearby comments. Start converting to the xterm terminology and default rendering of "bright" instead of "light" for bright colors. Syscons wasn't affected by the bug since I optimized it a little by converting colors 0-15 directly. This also fixes the layering of the conversion for these colors. Apply the same optimization to vt (actually the layer above it). This also moves the conversion 1 closer to the correct layer for colors 0-15. The optimization of just avoiding 2 calls to a trivial function is worth about 10% for simple output to the virtual buffer with occasional rendering. The optimization is so large because the 2 calls are done on every character, so although there are too many other calls and other instructions per character, there are only about 10 times as many. Old versions of syscons were about 10 times faster for simple output, by using a fast path with about 12 instructions per character. Rendering to even slow hardware takes relatively little time provided it is rarely actually done. Modified: head/sys/kern/subr_terminal.c head/sys/teken/teken.c Modified: head/sys/kern/subr_terminal.c ============================================================================== --- head/sys/kern/subr_terminal.c Mon Mar 27 10:38:53 2017 (r316018) +++ head/sys/kern/subr_terminal.c Mon Mar 27 10:48:28 2017 (r316019) @@ -146,9 +146,18 @@ static const teken_attr_t default_messag TCOLOR_BG(_c & 7) | ((_c & 8) << 20); \ }) +#define TCOLOR_256TO16(color) __extension__ ({ \ + teken_color_t _c; \ + \ + _c = (color); \ + if (_c >= 16) \ + _c = teken_256to16(_c); \ + _c; \ +}) + #define TCHAR_CREATE(c, a) ((c) | TFORMAT((a)->ta_format) | \ - TCOLOR_FG_FUDGED(teken_256to16((a)->ta_fgcolor)) | \ - TCOLOR_BG_FUDGED(teken_256to16((a)->ta_bgcolor))) + TCOLOR_FG_FUDGED(TCOLOR_256TO16((a)->ta_fgcolor)) | \ + TCOLOR_BG_FUDGED(TCOLOR_256TO16((a)->ta_bgcolor))) static void terminal_init(struct terminal *tm) Modified: head/sys/teken/teken.c ============================================================================== --- head/sys/teken/teken.c Mon Mar 27 10:38:53 2017 (r316018) +++ head/sys/teken/teken.c Mon Mar 27 10:48:28 2017 (r316019) @@ -491,11 +491,11 @@ teken_state_numbers(teken_t *t, teken_ch * be twice as large as green in (0, 1, 2). */ static const teken_color_t teken_256to8tab[] = { - /* xterm-16+ 8 dark colors: */ - 0, r, g, y, b, m, c, w, + /* xterm normal colors: */ + k, r, g, y, b, m, c, w, - /* xterm-16+ 8 light colors: */ - 0, R, G, Y, B, M, C, W, + /* xterm bright colors: */ + k, r, g, y, b, m, c, w, /* Red0 submap. */ k, b, b, b, b, b, @@ -559,11 +559,11 @@ static const teken_color_t teken_256to8t * used for different fine tuning of the tables. */ static const teken_color_t teken_256to16tab[] = { - /* xterm-16+ 8 dark colors: */ - 0, r, g, y, b, m, c, w, + /* xterm normal colors: */ + k, r, g, y, b, m, c, w, - /* xterm-16+ 8 light colors: */ - 0, R, G, Y, B, M, C, W, + /* xterm bright colors: */ + K, R, G, Y, B, M, C, W, /* Red0 submap. */ k, b, b, b, b, b,