diff options
author | Keith Packard <keithp@keithp.com> | 2001-06-05 17:17:39 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2001-06-05 17:17:39 +0000 |
commit | 4f8254b31f30bd12224c2fdcecfbd67b41ecd7e1 (patch) | |
tree | 9553b4e6014c081e4f3e65fc2c0cd6e560f4fcc6 /hw/kdrive/fbdev/fbdev.c | |
parent | bf4dbfbf45e4e6b1b86c624b1995a1050b7a0eef (diff) |
Attempt to make kdrive/fbdev run on static gray hardware (iPaq 3150)
Diffstat (limited to 'hw/kdrive/fbdev/fbdev.c')
-rw-r--r-- | hw/kdrive/fbdev/fbdev.c | 70 |
1 files changed, 64 insertions, 6 deletions
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index f9abeff18..efccfdf39 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -93,20 +93,43 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) Pixel allbits; int depth; Bool shadow; + Bool gray; #ifdef FAKE24_ON_16 Bool fake24; #endif depth = priv->var.bits_per_pixel; + gray = priv->var.grayscale; switch (priv->fix.visual) { case FB_VISUAL_PSEUDOCOLOR: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); + if (gray) + { + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale)); + } + else + { + screen->fb[0].visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + } + screen->fb[0].blueMask = 0x00; + screen->fb[0].greenMask = 0x00; + screen->fb[0].redMask = 0x00; + break; + case FB_VISUAL_STATIC_PSEUDOCOLOR: + if (gray) + { + screen->fb[0].visuals = (1 << StaticGray); + } + else + { + screen->fb[0].visuals = (1 << StaticColor); + } screen->fb[0].blueMask = 0x00; screen->fb[0].greenMask = 0x00; screen->fb[0].redMask = 0x00; @@ -557,6 +580,39 @@ fbdevRandRInit (ScreenPtr pScreen) } #endif +Bool +fbdevCreateColormap (ColormapPtr pmap) +{ + ScreenPtr pScreen = pmap->pScreen; + KdScreenPriv(pScreen); + FbdevPriv *priv = pScreenPriv->card->driver; + VisualPtr pVisual; + int i; + int nent; + xColorItem *pdefs; + + switch (priv->fix.visual) { + case FB_VISUAL_STATIC_PSEUDOCOLOR: + pVisual = pmap->pVisual; + nent = pVisual->ColormapEntries; + pdefs = ALLOCATE_LOCAL (nent * sizeof (xColorItem)); + if (!pdefs) + return FALSE; + fbdevGetColors (pScreen, 0, nent, pdefs); + for (i = 0; i < nent; i++) + { + pmap->red[i].co.local.red = pdefs[i].red; + pmap->red[i].co.local.green = pdefs[i].green; + pmap->red[i].co.local.blue = pdefs[i].blue; + break; + } + DEALLOCATE_LOCAL (pdefs); + return TRUE; + default: + return fbInitializeColormap (pmap); + } +} + #ifdef TOUCHSCREEN int TsFbdev = -1; #endif @@ -574,6 +630,8 @@ fbdevInitScreen (ScreenPtr pScreen) TsFbdev = pScreen->myNum; #endif + pScreen->CreateColormap = fbdevCreateColormap; + if (!LayerStartInit (pScreen)) return FALSE; if (!LayerFinishInit (pScreen)) |