Commit Graph

9 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
5e251aec86 vt(4): Use default VGA palette
Before this change, the VGA palette was configured to match the shell
palette (e.g. color #1 was red). There was one glitch early in boot when
the vt(4)'s VGA palette was loaded: the loader's logo would switch from
red to blue. Likewise for the "Booting..." message switching from blue
to red. That's because the loader's logo was drawed with the default VGA
palette where a few colors are swapped compared to the shell palette
(e.g. blue <-> red).

This change configures the default VGA palette during initialization and
converts input's colors from shell to VGA palette index.

There should be no visible changes, except the loader's logo which will
keep its original color.

Reviewed by:	eadler
2018-05-10 17:00:33 +00:00
Jean-Sébastien Pédron
e525438697 vt(4): Put for() loop outside switch() in vt_generate_cons_palette()
This makes it more logical:
 1. It checks the requested color format
 2. It fills the palette accordingly

Also vt_palette_init() is only called when needed (i.e. when the format
is `COLOR_FORMAT_RGB`).
2018-05-10 16:41:47 +00:00
Oleksandr Tymoshenko
de87887b78 Fix GCC build broken by r32744
Indicate in function declaration that vt_palette_init does not take any arguments
2017-12-31 23:40:06 +00:00
Oleksandr Tymoshenko
c127b9f9d1 Unbreak build broken by r327444
During review iterations function signature has changed in definition
but not in actual call. Fix call to match the definition.

Reported by:	Herbert J. Skuhra
Pointyhat to: gonzo
MFC after:	2 weeks
2017-12-31 21:29:20 +00:00
Oleksandr Tymoshenko
29f61a2f42 vt(4): add support for configurable console palette
Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
number from 0 to 15. The value is either comma-separated list decimal
numbers ranging from 0 to 255 that represent values of red, green, and
blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
commonly used to represent colors in HTML or xterm settings (i.e. #808080)

Each tunable overrides one of the 16 hardcoded palette codes and can be set
in loader.conf(5)

Reviewed by:	bcr(docs), jilles, manu, ray
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13645
2017-12-31 20:21:05 +00:00
Pedro F. Giffuni
718cf2ccb9 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 14:52:40 +00:00
Marius Strobl
d75accb539 - Use __FBSDID().
- Const'ify cons_to_vga_colors.
- Fix line wrapping.

MFC after:	3 days
2015-07-27 14:34:32 +00:00
Jean-Sébastien Pédron
19e2ce2d83 vt(4): Colors are indexed against a console palette, not a VGA palette
Rename vt_generate_vga_palette() to vt_generate_cons_palette() and
change it to build a palette where the color index is the same than in
terminal escape codes, not the VGA index. That's what TCHAR_CREATE()
uses and passes to vt(4).

The main differences between both orders are:
    o  Blue and red are swapped (1 <-> 4)
    o  Yellow and cyan are swapped (3 <-> 6)

The problem remained unnoticed, because the RGB bit indexes passed to
vt_generate_vga_palette() were reversed. This inversion was cancelled
by the colors inversions in the generated palette. For instance, red
(0xff0000) and blue (0x0000ff) have bytes in opposite order, but were
swapped in the palette. But after changing the value of blue (see last
paragraph), the modified color was in fact the red one.

This commit includes a fix to creator_vt.c, submitted by Nathan
Whitehorn: fb_cmsize is set to 16. Before this, the generated palette
would be overwritte. This fixes colors on sparc64 with a Creator3D
adapter.

While here, tune the palette to better match console colors and improve
the readability (especially the dark blue).

Submitted by:	nwhitehorn (fix to creator_vt.c)
MFC after:	1 week
2014-08-10 17:04:10 +00:00
Aleksandr Rybalko
27cf7d04ef Merge VT(9) project (a.k.a. newcons).
Reviewed by:	nwhitehorn
MFC_to_10_after:	re approval

Sponsored by:	The FreeBSD Foundation
2013-12-05 22:38:53 +00:00