Page MenuHomeFreeBSD

vg_vga: fix color in pixel blocks with more than 4 colors
ClosedPublic

Authored by emaste on Mar 2 2022, 4:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 7:54 PM
Unknown Object (File)
Thu, Apr 11, 5:59 AM
Unknown Object (File)
Wed, Apr 10, 6:23 AM
Unknown Object (File)
Tue, Apr 9, 10:32 PM
Unknown Object (File)
Sun, Mar 31, 3:53 PM
Unknown Object (File)
Thu, Mar 21, 5:51 PM
Unknown Object (File)
Jan 14 2024, 5:40 AM
Unknown Object (File)
Jan 3 2024, 10:06 PM
Subscribers

Details

Summary

VGA hardware provides many different graphics and data access modes, each with different capabilities and limitations.

VGA vt(4) graphics mode operates on blocks of pixels at a time. When a given pixel block contains only two colors vg_vga uses write mode 3. When the block contains more than two colors it uses write mode 0. This is done because two-color write mode 3 is much more efficient. In practice write mode 3 is used most of the time, as there is often a single foreground color and single background color across the entire console. One common exception is when the mouse cursor is drawn over a background other than black, as we use black and white for the cursor in addition to the background color.

VGA's default 16-color palette provides the same colors as the system console, but in a different order. Previously we configured a non-default VGA palette to provide the same colors at the same indexes. However, this caused anything drawn prior to the kernel starting (e.g., drawn by the loader) to change color when the kernel configured the new palette.

In 5e251aec8636 we switched to leaving the default VGA palette in place, translating console color indexes to VGA color indexes as necessary. This translation was missed for the write mode 0 case for pixel blocks with more than two colors.

PR: 261751
Fixes: 5e251aec8636 ("vt(4): Use default VGA palette")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable