]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vt(4): Colors are indexed against a console palette, not a VGA palette
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>
Sun, 10 Aug 2014 17:04:10 +0000 (17:04 +0000)
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>
Sun, 10 Aug 2014 17:04:10 +0000 (17:04 +0000)
commit19e2ce2d836709d4fc28d11ff7c76dd43000fdee
tree3ff740873b9da0dd51559fa01322a9f583e821b5
parentbb0a8f248dae1ed158dbf6eccafeef6f15caa920
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
sys/dev/fb/creator_vt.c
sys/dev/vt/colors/vt_termcolors.c
sys/dev/vt/colors/vt_termcolors.h
sys/dev/vt/hw/efifb/efifb.c
sys/dev/vt/hw/fb/vt_early_fb.c
sys/dev/vt/hw/fb/vt_fb.c
sys/dev/vt/hw/ofwfb/ofwfb.c