From 5ab260317ad3b2aafff31a97df21620db52eacd1 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 10 Mar 2013 21:04:19 +0100 Subject: [PATCH] Xfbdev: Wire up Amiga afb4 and afb8 support Add support for Amiga-style bitplanes, with 4 or 8 bits per pixel. Signed-off-by: Geert Uytterhoeven Acked-by: Keith Packard --- hw/kdrive/fbdev/fbdev.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index 40747fe8b..95f64cbef 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -319,6 +319,21 @@ fbdevWindowLinear(ScreenPtr pScreen, return (CARD8 *) priv->fb + row * priv->fix.line_length + offset; } +static void * +fbdevWindowAfb(ScreenPtr pScreen, + CARD32 row, + CARD32 offset, int mode, CARD32 *size, void *closure) +{ + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + + if (!pScreenPriv->enabled) + return 0; + /* offset to next plane */ + *size = priv->var.yres_virtual * priv->fix.line_length; + return (CARD8 *) priv->fb + row * priv->fix.line_length + offset; +} + Bool fbdevMapFramebuffer(KdScreenInfo * screen) { @@ -435,7 +450,20 @@ fbdevSetShadow(ScreenPtr pScreen) break; case FB_TYPE_PLANES: - FatalError("Bitplanes are not yet supported\n"); + window = fbdevWindowAfb; + switch (priv->var.bits_per_pixel) { + case 4: + update = shadowUpdateAfb4; + break; + + case 8: + update = shadowUpdateAfb8; + break; + + default: + FatalError("Bitplanes with bpp %u are not yet supported\n", + priv->var.bits_per_pixel); + } break; case FB_TYPE_INTERLEAVED_PLANES: