[PATCH 3/5] fbdev: Add support for further video bit depths on atafb:external
From: Michael Schmitz <schmitzmic@gmail.com>
Date: 2026-08-14 03:17:57
Also in:
linux-m68k
Subsystem:
framebuffer layer, the rest · Maintainers:
Helge Deller, Linus Torvalds
From: Miro Kropacek <redacted> Supervidel offers additional video bit depths (8-bit chunky, 16-bit RGB565 (also on the originaln Videl) and ARGB888. Add code to support these bit depths. Signed-off-by: Miro Kropacek <redacted> Reviewed-by: Michael Schmitz <schmitzmic@gmail.com> Cc: <redacted> Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html --- drivers/video/fbdev/atafb.c | 89 ++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 7 deletions(-)
diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index 3d540803dc2b..50853d7a08e3 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c@@ -2081,8 +2081,12 @@ static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par) external_pmode == FB_TYPE_PACKED_PIXELS) ? FB_VISUAL_MONO10 : FB_VISUAL_MONO01; } else { - /* Use STATIC if we don't know how to access color registers */ - int visual = external_vgaiobase ? + /* Use STATIC if we don't know how to access color registers; + * SuperVidel 8bpp chunky (fb in SV RAM) uses the Falcon palette + */ + int visual = (external_vgaiobase || + (external_depth == 8 && + external_addr >= 0xa0000000)) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; switch (external_pmode) {
@@ -2159,6 +2163,35 @@ static int ext_encode_var(struct fb_var_screeninfo *var, struct atafb_par *par) var->transp.offset = 0; var->transp.length = 0; var->transp.msb_right = 0; + if (external_pmode == -1 && external_depth == 16) { + /* RGB565 truecolor (e.g. SuperVidel native mode) */ + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + } else if (external_pmode == -1 && external_depth == 32) { + /* ARGB8888 truecolor (e.g. SuperVidel native mode) */ + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.offset = 24; + var->transp.length = 8; + } else if (external_pmode == FB_TYPE_PACKED_PIXELS && + external_depth == 8 && external_addr >= 0xa0000000) { + /* SuperVidel 8bpp chunky: palette has 8 bits per channel. + * Without this, fb_get_color_depth() sees length 0 and + * fbcon falls back to its 2-color palette — the console + * text (color 7) stays black on black. + */ + var->red.length = 8; + var->green.length = 8; + var->blue.length = 8; + } var->yres_virtual = var->yres; var->xoffset = 0; var->yoffset = 0;
@@ -2193,6 +2226,38 @@ static int ext_setcolreg(unsigned int regno, unsigned int red, { unsigned char colmask = (1 << external_bitspercol) - 1; + if (external_pmode == -1 && external_depth == 16) { + /* truecolor: only the pseudo palette for fbcon is needed */ + if (regno > 15) + return 1; + ((u32 *)info->pseudo_palette)[regno] = (red & 0xf800) | + ((green & 0xfc00) >> 5) | + ((blue & 0xf800) >> 11); + return 0; + } + if (external_pmode == -1 && external_depth == 32) { + /* ARGB8888, alpha forced opaque */ + if (regno > 15) + return 1; + ((u32 *)info->pseudo_palette)[regno] = 0xff000000 | + ((red & 0xff00) << 8) | + (green & 0xff00) | + ((blue & 0xff00) >> 8); + return 0; + } + if (external_pmode == FB_TYPE_PACKED_PIXELS && external_depth == 8 && + external_addr >= 0xa0000000) { + /* SuperVidel native 8bpp chunky scans out via the Falcon + * palette registers, honoring all 8 bits per channel + */ + if (regno > 255) + return 1; + f030_col[regno] = ((red & 0xff00) << 16) | + ((green & 0xff00) << 8) | + ((blue & 0xff00) >> 8); + return 0; + } + if (!external_vgaiobase) return 1;
@@ -2422,7 +2487,9 @@ static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) return; #ifdef ATAFB_FALCON - if (info->var.bits_per_pixel == 16) { + /* chunky modes (Falcon hicolor, external packed/truecolor) */ + if (info->fix.type == FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel > 1) { cfb_fillrect(info, rect); return; }
@@ -2463,7 +2530,9 @@ static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area) int rev_copy = 0; #ifdef ATAFB_FALCON - if (info->var.bits_per_pixel == 16) { + /* chunky modes (Falcon hicolor, external packed/truecolor) */ + if (info->fix.type == FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel > 1) { cfb_copyarea(info, area); return; }
@@ -2517,7 +2586,9 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image) u32 dx, dy, width, height, pitch; #ifdef ATAFB_FALCON - if (info->var.bits_per_pixel == 16) { + /* chunky modes (Falcon hicolor, external packed/truecolor) */ + if (info->fix.type == FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel > 1) { cfb_imageblit(info, image); return; }
@@ -2753,7 +2824,7 @@ static void __init atafb_setup_ext(char *spec) return; depth = simple_strtoul(p, NULL, 10); if (depth != 1 && depth != 2 && depth != 4 && depth != 8 && - depth != 16 && depth != 24) + depth != 16 && depth != 24 && depth != 32) return; p = strsep(&spec, ";");
@@ -3131,7 +3202,11 @@ static int __init atafb_probe(struct platform_device *pdev) atafb_set_disp(&fb_info); - fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0); + /* truecolor visuals only need the 16-entry console palette; this + * also avoids 1 << 32 overflowing at 32bpp + */ + fb_alloc_cmap(&(fb_info.cmap), fb_info.var.bits_per_pixel > 8 ? + 16 : 1 << fb_info.var.bits_per_pixel, 0); dev_info(&pdev->dev, "Determined %dx%d, depth %d\n", fb_info.var.xres,
--
2.17.1