From owner-svn-src-head@freebsd.org Sat Jun 2 14:07:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7B54EF8F23; Sat, 2 Jun 2018 14:07:28 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 471C4830B6; Sat, 2 Jun 2018 14:07:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2315D10C45; Sat, 2 Jun 2018 14:07:28 +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 w52E7RDq075887; Sat, 2 Jun 2018 14:07:27 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w52E7RGL075883; Sat, 2 Jun 2018 14:07:27 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201806021407.w52E7RGL075883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 2 Jun 2018 14:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334530 - in head: share/man/man4 sys/conf sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/dev/syscons X-SVN-Commit-Revision: 334530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 14:07:29 -0000 Author: bde Date: Sat Jun 2 14:07:27 2018 New Revision: 334530 URL: https://svnweb.freebsd.org/changeset/base/334530 Log: Improve defaults for per-CPU kernel console colors, especially with 2 or 4 CPUs. Add a compile-time option SC_KERNEL_CONS_ATTRS to control the defaults. Default to color numbers in reverse order to CPU numbers (instead of in the same order with white first and wrapping to dark grey), so that the brightest bright colors are used first. Don't use dark grey at all; replace it by dark green. Syscons has too many compile-time options, but this one is needed in in case the defaults give something like white on white, or the user really hates this feature and can't wait to turn it off in rc. MFC after: next release? Modified: head/share/man/man4/syscons.4 head/sys/conf/NOTES head/sys/conf/options head/sys/dev/syscons/syscons.c Modified: head/share/man/man4/syscons.4 ============================================================================== --- head/share/man/man4/syscons.4 Sat Jun 2 10:36:30 2018 (r334529) +++ head/share/man/man4/syscons.4 Sat Jun 2 14:07:27 2018 (r334530) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2016 +.Dd June 2, 2018 .Dt SYSCONS 4 .Os .Sh NAME @@ -53,6 +53,7 @@ .Cd "options SC_NORM_ATTR=_attribute_" .Cd "options SC_NORM_REV_ATTR=_attribute_" .Cd "options SC_KERNEL_CONS_ATTR=_attribute_" +.Cd "options SC_KERNEL_CONS_ATTRS=_attributes_" .Cd "options SC_KERNEL_CONS_REV_ATTR=_attribute_" .Cd "options SC_DFLT_FONT" .Cd "makeoptions SC_DFLT_FONT=_font_name_" @@ -341,6 +342,7 @@ above. .It Dv SC_NORM_ATTR=_attribute_ .It Dv SC_NORM_REV_ATTR=_attribute_ .It Dv SC_KERNEL_CONS_ATTR=_attribute_ +.It Dv SC_KERNEL_CONS_ATTRS=_attributes_ .It Dv SC_KERNEL_CONS_REV_ATTR=_attribute_ These options will set the default colors. Available colors are defined in @@ -348,6 +350,11 @@ Available colors are defined in See .Sx EXAMPLES below. +.Dv SC_KERNEL_CONS_ATTRS +is a character string giving a sequence of attributes in binary format. +The sequence will be repeated up to the number of CPUs. +Beware that the string must not be null, +since the kernel divides by its length. .It Dv SC_DFLT_FONT This option will specify the default font. Available fonts are: iso, iso2, koi8-r, koi8-u, cp437, cp850, cp865, @@ -538,6 +545,23 @@ The reversed message will be black on red background. .Pp .Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)" .Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)" +.Pp +Provided +.Dv SC_KERNEL_CONS_ATTR +is not set, or is set to its default of bright white on black, +the following line will set 4 red-ish colors +for printing kernel messages in colors depending on the CPU. +.Pp +.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0c\ex04\ex40\ex0e\e" +.Pp +The default scheme is probably better for up to 8 CPUs. +Use a long string to get unique colors for more than 8 CPUs. +.Pp +To turn off all per-CPU coloring of kernel messages, +set SC_KERNEL_CONS_ATTR to a non-default value, +or use the default in a pattern of length 1. +.Pp +.Dl options SC_KERNEL_CONS_ATTRS=\e"\ex0f\e" .Pp The following example adds the font files .Pa cp850-8x16.fnt , Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/conf/NOTES Sat Jun 2 14:07:27 2018 (r334530) @@ -1474,6 +1474,7 @@ options SC_PIXEL_MODE # add support for the raster t options SC_NORM_ATTR=(FG_GREEN|BG_BLACK) options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN) options SC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK) +options SC_KERNEL_CONS_ATTRS=\"\x0c\x0d\x0e\x0f\x02\x09\x0a\x0b\" options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED) # The following options will let you change the default behavior of Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/conf/options Sat Jun 2 14:07:27 2018 (r334530) @@ -774,6 +774,7 @@ SC_DISABLE_KDBKEY opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_KERNEL_CONS_ATTR opt_syscons.h +SC_KERNEL_CONS_ATTRS opt_syscons.h SC_KERNEL_CONS_REV_ATTR opt_syscons.h SC_MOUSE_CHAR opt_syscons.h SC_NO_CUTPASTE opt_syscons.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Jun 2 10:36:30 2018 (r334529) +++ head/sys/dev/syscons/syscons.c Sat Jun 2 14:07:27 2018 (r334530) @@ -3153,6 +3153,17 @@ scinit(int unit, int flags) static u_char font_16[256*16]; #endif +#ifdef SC_KERNEL_CONS_ATTRS + static const u_char dflt_kattrtab[] = SC_KERNEL_CONS_ATTRS; +#elif SC_KERNEL_CONS_ATTR == FG_WHITE + static const u_char dflt_kattrtab[] = { + FG_WHITE, FG_YELLOW, FG_LIGHTMAGENTA, FG_LIGHTRED, + FG_LIGHTCYAN, FG_LIGHTGREEN, FG_LIGHTBLUE, FG_GREEN, + 0, + }; +#else + static const u_char dflt_kattrtab[] = { FG_WHITE, 0, }; +#endif sc_softc_t *sc; scr_stat *scp; video_adapter_t *adp; @@ -3163,13 +3174,8 @@ scinit(int unit, int flags) /* one time initialization */ if (init_done == COLD) { sc_get_bios_values(&bios_value); - for (i = 0; i < nitems(sc_kattrtab); i++) { -#if SC_KERNEL_CONS_ATTR == FG_WHITE - sc_kattrtab[i] = 8 + (i + FG_WHITE) % 8U; -#else - sc_kattrtab[i] = SC_KERNEL_CONS_ATTR; -#endif - } + for (i = 0; i < nitems(sc_kattrtab); i++) + sc_kattrtab[i] = dflt_kattrtab[i % (nitems(dflt_kattrtab) - 1)]; } init_done = WARM;