Xfbdev: Treat 1 bpp pseudocolor as monochrome
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 12 Mar 2013 17:10:40 +0000 (18:10 +0100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 18 Apr 2013 11:10:25 +0000 (13:10 +0200)
miCreateDefColormap() only preallocates black and white pixels if
depth > 1.
Hence override the visual, so fbdevCreateColormap() takes care of it.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
hw/kdrive/fbdev/fbdev.c

index 0082575..ebbfeb9 100644 (file)
@@ -216,11 +216,13 @@ fbdevScreenInitialize(KdScreenInfo * screen, FbdevScrPriv * scrpriv)
         screen->fb.visuals = (1 << StaticGray);
         break;
     case FB_VISUAL_PSEUDOCOLOR:
-        if (gray) {
-            screen->fb.visuals = (1 << StaticGray);
+        screen->fb.visuals = (1 << StaticGray);
+        if (priv->var.bits_per_pixel == 1) {
+            /* Override to monochrome, to have preallocated black/white */
+            priv->fix.visual = FB_VISUAL_MONO01;
+        } else if (gray) {
             /* could also support GrayScale, but what's the point? */
-        }
-        else {
+        } else {
             screen->fb.visuals = ((1 << StaticGray) |
                                   (1 << GrayScale) |
                                   (1 << StaticColor) |