fbcon: add palette

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-17 03:35:47 -04:00
commit 45c88c16e4
3 changed files with 32 additions and 8 deletions

View file

@ -33,6 +33,16 @@ static struct tty_serial_ops fbcon_serial_ops = {
struct tty *fbcon_init(void)
{
static u32 ansi_colors[] = {0x000000, 0x0000AA, 0x00AA00, 0x00AAAA, 0xAA0000, 0xAA00AA, 0xAAAA00, 0xAAAAAA};
static u32 ansi_bright_colors[] = {0x000000, 0x0000DD, 0x00DD00, 0x00DDDD, 0xDD0000, 0xDD00DD, 0xDDDD00, 0xDDDDDD};
static u32 default_fg = 0xDDDDDDDD;
static u32 default_bg = 0x00000000;
static u32 default_fg_bright = 0xFFFFFFFF;
static u32 default_bg_bright = 0x00000000;
if (!fb_res || !fb_res->framebuffer_count)
return NULL;
@ -44,9 +54,21 @@ struct tty *fbcon_init(void)
return NULL;
ft_ctx = flanterm_fb_init(
NULL, NULL, fb_virt, fb->width, fb->height, fb->pitch, fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size,
fb->green_mask_shift, fb->blue_mask_size, fb->blue_mask_shift, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0,
0, 0, 0, 0, FLANTERM_FB_ROTATE_0);
NULL, NULL, /* malloc/free override */
fb_virt, /* framebuffer virt pointer */
fb->width, fb->height, fb->pitch, /* screen geometry */
fb->red_mask_size, fb->red_mask_shift, /* red */
fb->green_mask_size, fb->green_mask_shift, /* green */
fb->blue_mask_size, fb->blue_mask_shift, /* blue */
NULL, /* canvas */
ansi_colors, ansi_bright_colors, /* colors */
&default_bg, &default_fg, /* bg colors */
&default_bg_bright, &default_fg_bright, /* bright bg colors */
NULL, 0, 0, 0, /* font ptr, width, height, spacing */
0, 0, /* font scale x, y */
0, /* margin */
FLANTERM_FB_ROTATE_0 /* rotation */
);
if (!ft_ctx)
return NULL;
@ -57,5 +79,5 @@ struct tty *fbcon_init(void)
kinfo("fbcon: framebuffer console initialized (%lux%lu)\n", fb->width, fb->height);
return fbtty;
return fbtty;
}