Xfbdev, Xephyr and Xfake all use only one framebuffer, so simplify
implementation by removing overlay support.

Signed-off-by: Mikhail Gusarov <[email protected]>
---
 hw/kdrive/ephyr/ephyr.c      |  100 +++++++++++++++++-----------------
 hw/kdrive/ephyr/ephyr.h      |    4 +-
 hw/kdrive/ephyr/ephyrvideo.c |    2 +-
 hw/kdrive/fake/fake.c        |   81 ++++++++++++++--------------
 hw/kdrive/fake/fake.h        |    4 +-
 hw/kdrive/fbdev/fbdev.c      |   84 +++++++++++++++---------------
 hw/kdrive/fbdev/fbdev.h      |    4 +-
 hw/kdrive/src/Makefile.am    |    1 -
 hw/kdrive/src/kcmap.c        |  121 ++++++++++++-----------------------------
 hw/kdrive/src/kcurscol.c     |   94 --------------------------------
 hw/kdrive/src/kdrive.c       |  107 +++++++++++--------------------------
 hw/kdrive/src/kdrive.h       |   28 +++-------
 hw/kdrive/src/kmode.c        |   10 ++--
 hw/kdrive/src/kshadow.c      |   34 ++++++------
 14 files changed, 235 insertions(+), 439 deletions(-)
 delete mode 100644 hw/kdrive/src/kcurscol.c

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 93118a8..b21559b 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -101,77 +101,77 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv 
*scrpriv)
     }
 
   if (EphyrWantGrayScale)
-    screen->fb[0].depth = 8;
+    screen->fb.depth = 8;
 
-  if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
+  if (screen->fb.depth && screen->fb.depth != hostx_get_depth())
     {
-      if (screen->fb[0].depth < hostx_get_depth()
-         && (screen->fb[0].depth == 24 || screen->fb[0].depth == 16
-             || screen->fb[0].depth == 8))
+      if (screen->fb.depth < hostx_get_depth()
+         && (screen->fb.depth == 24 || screen->fb.depth == 16
+             || screen->fb.depth == 8))
        {
-         hostx_set_server_depth(screen, screen->fb[0].depth);
+         hostx_set_server_depth(screen, screen->fb.depth);
        }
       else
        ErrorF("\nXephyr: requested screen depth not supported, setting to 
match hosts.\n");
     }
   
-  screen->fb[0].depth = hostx_get_server_depth(screen);
+  screen->fb.depth = hostx_get_server_depth(screen);
   screen->rate = 72;
   
-  if (screen->fb[0].depth <= 8)
+  if (screen->fb.depth <= 8)
     {
       if (EphyrWantGrayScale)
-       screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale));
+       screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale));
       else
-       screen->fb[0].visuals = ((1 << StaticGray) |
-                                (1 << GrayScale) |
-                                (1 << StaticColor) |
-                                (1 << PseudoColor) |
-                                (1 << TrueColor) |
-                                (1 << DirectColor));
+       screen->fb.visuals = ((1 << StaticGray) |
+                             (1 << GrayScale) |
+                             (1 << StaticColor) |
+                             (1 << PseudoColor) |
+                             (1 << TrueColor) |
+                             (1 << DirectColor));
       
-      screen->fb[0].redMask   = 0x00;
-      screen->fb[0].greenMask = 0x00;
-      screen->fb[0].blueMask  = 0x00;
-      screen->fb[0].depth        = 8;
-      screen->fb[0].bitsPerPixel = 8;
+      screen->fb.redMask   = 0x00;
+      screen->fb.greenMask = 0x00;
+      screen->fb.blueMask  = 0x00;
+      screen->fb.depth        = 8;
+      screen->fb.bitsPerPixel = 8;
     }
   else 
     {
-      screen->fb[0].visuals = (1 << TrueColor);
+      screen->fb.visuals = (1 << TrueColor);
       
-      if (screen->fb[0].depth <= 15)
+      if (screen->fb.depth <= 15)
        {
-         screen->fb[0].depth = 15;
-         screen->fb[0].bitsPerPixel = 16;
+         screen->fb.depth = 15;
+         screen->fb.bitsPerPixel = 16;
        }
-      else if (screen->fb[0].depth <= 16)
+      else if (screen->fb.depth <= 16)
        {
-         screen->fb[0].depth = 16;
-         screen->fb[0].bitsPerPixel = 16;
+         screen->fb.depth = 16;
+         screen->fb.bitsPerPixel = 16;
        }
-      else if (screen->fb[0].depth <= 24)
+      else if (screen->fb.depth <= 24)
        {
-         screen->fb[0].depth = 24;
-         screen->fb[0].bitsPerPixel = 32;
+         screen->fb.depth = 24;
+         screen->fb.bitsPerPixel = 32;
        }
-      else if (screen->fb[0].depth <= 30)
+      else if (screen->fb.depth <= 30)
        {
-         screen->fb[0].depth = 30;
-         screen->fb[0].bitsPerPixel = 32;
+         screen->fb.depth = 30;
+         screen->fb.bitsPerPixel = 32;
        }
       else
        {
          ErrorF("\nXephyr: Unsupported screen depth %d\n",
-                screen->fb[0].depth);
+                screen->fb.depth);
          return FALSE;
        }
 
       hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
 
-      screen->fb[0].redMask = (Pixel) redMask;
-      screen->fb[0].greenMask = (Pixel) greenMask;
-      screen->fb[0].blueMask = (Pixel) blueMask;
+      screen->fb.redMask = (Pixel) redMask;
+      screen->fb.greenMask = (Pixel) greenMask;
+      screen->fb.blueMask = (Pixel) blueMask;
 
     }
   
@@ -250,7 +250,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
   KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
   KdSetPointerMatrix (&m);
   
-  priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 
5) << 2;
+  priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) 
<< 2;
 
   buffer_height = ephyrBufferHeight(screen);
 
@@ -260,9 +260,9 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
     {
       scrpriv->shadow = FALSE;
       
-      screen->fb[0].byteStride = priv->bytes_per_line;
-      screen->fb[0].pixelStride = screen->width;
-      screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
+      screen->fb.byteStride = priv->bytes_per_line;
+      screen->fb.pixelStride = screen->width;
+      screen->fb.frameBuffer = (CARD8 *) (priv->base);
     }
   else
     {
@@ -271,7 +271,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
       
       EPHYR_LOG("allocing shadow");
       
-      KdShadowFbAlloc (screen, 0, 
+      KdShadowFbAlloc (screen,
                       scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
     }
   
@@ -307,7 +307,7 @@ ephyrUnmapFramebuffer (KdScreenInfo *screen)
   EphyrScrPriv  *scrpriv = screen->driver;
   
   if (scrpriv->shadow)
-    KdShadowFbFree (screen, 0);
+    KdShadowFbFree (screen);
   
   /* Note, priv->base will get freed when XImage recreated */
   
@@ -571,10 +571,10 @@ ephyrRandRSetConfig (ScreenPtr            pScreen,
   (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
                                  pScreen->width,
                                  pScreen->height,
-                                 screen->fb[0].depth,
-                                 screen->fb[0].bitsPerPixel,
-                                 screen->fb[0].byteStride,
-                                 screen->fb[0].frameBuffer);
+                                 screen->fb.depth,
+                                 screen->fb.bitsPerPixel,
+                                 screen->fb.byteStride,
+                                 screen->fb.frameBuffer);
   
   /* set the subpixel order */
   
@@ -735,7 +735,7 @@ ephyrScreenFini (KdScreenInfo *screen)
 {
     EphyrScrPriv  *scrpriv = screen->driver;
     if (scrpriv->shadow) {
-        KdShadowFbFree (screen, 0);
+        KdShadowFbFree (screen);
     }
     xfree(screen->driver);
     screen->driver = NULL;
@@ -1027,7 +1027,7 @@ ephyrCardFini (KdCardInfo *card)
 }
 
 void
-ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
   /* XXX Not sure if this is right */
   
@@ -1044,7 +1044,7 @@ ephyrGetColors (ScreenPtr pScreen, int fb, int n, 
xColorItem *pdefs)
 }
 
 void
-ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
   int min, max, p;
 
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index cb5e4b5..41a82bf 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -116,10 +116,10 @@ void
 ephyrCardFini (KdCardInfo *card);
 
 void
-ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 void
-ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 Bool
 ephyrMapFramebuffer (KdScreenInfo *screen);
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index bb2ee10..6624ab9 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -302,7 +302,7 @@ ephyrInitVideo (ScreenPtr pScreen)
 
     EPHYR_LOG ("enter\n") ;
 
-    if (screen->fb[0].bitsPerPixel == 8) {
+    if (screen->fb.bitsPerPixel == 8) {
         EPHYR_LOG_ERROR ("8 bits depth not supported\n") ;
         return FALSE ;
     }
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index a4044b6..809e309 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -69,45 +69,45 @@ fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv 
*scrpriv)
     if (screen->height <= 0)
        screen->height = 1;
     
-    if (!screen->fb[0].depth)
-       screen->fb[0].depth = 16;
+    if (!screen->fb.depth)
+       screen->fb.depth = 16;
 
-    if (screen->fb[0].depth <= 8)
+    if (screen->fb.depth <= 8)
     {
-       screen->fb[0].visuals = ((1 << StaticGray) |
-                                (1 << GrayScale) |
-                                (1 << StaticColor) |
-                                (1 << PseudoColor) |
-                                (1 << TrueColor) |
-                                (1 << DirectColor));
+       screen->fb.visuals = ((1 << StaticGray) |
+                             (1 << GrayScale) |
+                             (1 << StaticColor) |
+                             (1 << PseudoColor) |
+                             (1 << TrueColor) |
+                             (1 << DirectColor));
     }
     else 
     {
-       screen->fb[0].visuals = (1 << TrueColor);
+       screen->fb.visuals = (1 << TrueColor);
 #define Mask(o,l)   (((1 << l) - 1) << o)
-       if (screen->fb[0].depth <= 15)
+       if (screen->fb.depth <= 15)
        {
-           screen->fb[0].depth = 15;
-           screen->fb[0].bitsPerPixel = 16;
-           screen->fb[0].redMask = Mask (10, 5);
-           screen->fb[0].greenMask = Mask (5, 5);
-           screen->fb[0].blueMask = Mask (0, 5);
+           screen->fb.depth = 15;
+           screen->fb.bitsPerPixel = 16;
+           screen->fb.redMask = Mask (10, 5);
+           screen->fb.greenMask = Mask (5, 5);
+           screen->fb.blueMask = Mask (0, 5);
        }
-       else if (screen->fb[0].depth <= 16)
+       else if (screen->fb.depth <= 16)
        {
-           screen->fb[0].depth = 16;
-           screen->fb[0].bitsPerPixel = 16;
-           screen->fb[0].redMask = Mask (11, 5);
-           screen->fb[0].greenMask = Mask (5, 6);
-           screen->fb[0].blueMask = Mask (0, 5);
+           screen->fb.depth = 16;
+           screen->fb.bitsPerPixel = 16;
+           screen->fb.redMask = Mask (11, 5);
+           screen->fb.greenMask = Mask (5, 6);
+           screen->fb.blueMask = Mask (0, 5);
        }
        else
        {
-           screen->fb[0].depth = 24;
-           screen->fb[0].bitsPerPixel = 32;
-           screen->fb[0].redMask = Mask (16, 8);
-           screen->fb[0].greenMask = Mask (8, 8);
-           screen->fb[0].blueMask = Mask (0, 8);
+           screen->fb.depth = 24;
+           screen->fb.bitsPerPixel = 32;
+           screen->fb.redMask = Mask (16, 8);
+           screen->fb.greenMask = Mask (8, 8);
+           screen->fb.blueMask = Mask (0, 8);
        }
     }
 
@@ -167,23 +167,22 @@ fakeMapFramebuffer (KdScreenInfo *screen)
     
     KdSetPointerMatrix (&m);
     
-    priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) 
>> 5) << 2;
+    priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 
5) << 2;
     if (priv->base)
        free (priv->base);
     priv->base = malloc (priv->bytes_per_line * screen->height);
     
     if (scrpriv->shadow)
     {
-       if (!KdShadowFbAlloc (screen, 0, 
-                             scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
+       if (!KdShadowFbAlloc (screen, scrpriv->randr & 
(RR_Rotate_90|RR_Rotate_270)))
            return FALSE;
     }
     else
     {
-        screen->fb[0].byteStride = priv->bytes_per_line;
-        screen->fb[0].pixelStride = (priv->bytes_per_line * 8/
-                                    screen->fb[0].bitsPerPixel);
-        screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
+        screen->fb.byteStride = priv->bytes_per_line;
+        screen->fb.pixelStride = (priv->bytes_per_line * 8/
+                                    screen->fb.bitsPerPixel);
+        screen->fb.frameBuffer = (CARD8 *) (priv->base);
     }
     
     return TRUE;
@@ -216,7 +215,7 @@ Bool
 fakeUnmapFramebuffer (KdScreenInfo *screen)
 {
     FakePriv           *priv = screen->card->driver;
-    KdShadowFbFree (screen, 0);
+    KdShadowFbFree (screen);
     if (priv->base)
     {
        free (priv->base);
@@ -338,10 +337,10 @@ fakeRandRSetConfig (ScreenPtr             pScreen,
     (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
                                    pScreen->width,
                                    pScreen->height,
-                                   screen->fb[0].depth,
-                                   screen->fb[0].bitsPerPixel,
-                                   screen->fb[0].byteStride,
-                                   screen->fb[0].frameBuffer);
+                                   screen->fb.depth,
+                                   screen->fb.bitsPerPixel,
+                                   screen->fb.byteStride,
+                                   screen->fb.frameBuffer);
     
     /* set the subpixel order */
     
@@ -460,7 +459,7 @@ fakeCardFini (KdCardInfo *card)
 }
 
 void
-fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
     while (n--)
     {
@@ -472,6 +471,6 @@ fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem 
*pdefs)
 }
 
 void
-fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
 }
diff --git a/hw/kdrive/fake/fake.h b/hw/kdrive/fake/fake.h
index 3c4a51b..d505860 100644
--- a/hw/kdrive/fake/fake.h
+++ b/hw/kdrive/fake/fake.h
@@ -85,10 +85,10 @@ void
 fakeCardFini (KdCardInfo *card);
 
 void
-fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 void
-fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 Bool
 fakeMapFramebuffer (KdScreenInfo *screen);
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index d4fc5db..37bda17 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -175,12 +175,12 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv 
*scrpriv)
        }
        screen->rate = 103; /* FIXME: should get proper value from fb driver */
     }
-    if (!screen->fb[0].depth)
+    if (!screen->fb.depth)
     {
        if (k >= 0)
-           screen->fb[0].depth = var.bits_per_pixel;
+           screen->fb.depth = var.bits_per_pixel;
        else
-           screen->fb[0].depth = 16;
+           screen->fb.depth = 16;
     }
 
     if ((screen->width != var.xres) || (screen->height != var.yres))
@@ -196,7 +196,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv 
*scrpriv)
     }
 
     var.activate = FB_ACTIVATE_NOW;
-    var.bits_per_pixel = screen->fb[0].depth;
+    var.bits_per_pixel = screen->fb.depth;
     var.nonstd = 0;
     var.grayscale = 0;
 
@@ -222,60 +222,60 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv 
*scrpriv)
     case FB_VISUAL_PSEUDOCOLOR:
        if (gray)
        {
-           screen->fb[0].visuals = (1 << StaticGray);
+           screen->fb.visuals = (1 << StaticGray);
            /* could also support GrayScale, but what's the point? */
        }
        else
        {
-           screen->fb[0].visuals = ((1 << StaticGray) |
+           screen->fb.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;
+       screen->fb.blueMask  = 0x00;
+       screen->fb.greenMask = 0x00;
+       screen->fb.redMask   = 0x00;
        break;
     case FB_VISUAL_STATIC_PSEUDOCOLOR:
        if (gray)
        {
-           screen->fb[0].visuals = (1 << StaticGray);
+           screen->fb.visuals = (1 << StaticGray);
        }
        else
        {
-           screen->fb[0].visuals = (1 << StaticColor);
+           screen->fb.visuals = (1 << StaticColor);
        }
-       screen->fb[0].blueMask  = 0x00;
-       screen->fb[0].greenMask = 0x00;
-       screen->fb[0].redMask   = 0x00;
+       screen->fb.blueMask  = 0x00;
+       screen->fb.greenMask = 0x00;
+       screen->fb.redMask   = 0x00;
        break;
     case FB_VISUAL_TRUECOLOR:
     case FB_VISUAL_DIRECTCOLOR:
-       screen->fb[0].visuals = (1 << TrueColor);
+       screen->fb.visuals = (1 << TrueColor);
 #define Mask(o,l)   (((1 << l) - 1) << o)
-       screen->fb[0].redMask = Mask (priv->var.red.offset, 
priv->var.red.length);
-       screen->fb[0].greenMask = Mask (priv->var.green.offset, 
priv->var.green.length);
-       screen->fb[0].blueMask = Mask (priv->var.blue.offset, 
priv->var.blue.length);
+       screen->fb.redMask = Mask (priv->var.red.offset, priv->var.red.length);
+       screen->fb.greenMask = Mask (priv->var.green.offset, 
priv->var.green.length);
+       screen->fb.blueMask = Mask (priv->var.blue.offset, 
priv->var.blue.length);
 
        /*
         * This is a kludge so that Render will work -- fill in the gaps
         * in the pixel
         */
-       screen->fb[0].redMask = fbdevMakeContig (screen->fb[0].redMask,
-                                                screen->fb[0].greenMask|
-                                                screen->fb[0].blueMask);
+       screen->fb.redMask = fbdevMakeContig (screen->fb.redMask,
+                                                screen->fb.greenMask|
+                                                screen->fb.blueMask);
 
-       screen->fb[0].greenMask = fbdevMakeContig (screen->fb[0].greenMask,
-                                                  screen->fb[0].redMask|
-                                                  screen->fb[0].blueMask);
+       screen->fb.greenMask = fbdevMakeContig (screen->fb.greenMask,
+                                                  screen->fb.redMask|
+                                                  screen->fb.blueMask);
 
-       screen->fb[0].blueMask = fbdevMakeContig (screen->fb[0].blueMask,
-                                                 screen->fb[0].redMask|
-                                                 screen->fb[0].greenMask);
+       screen->fb.blueMask = fbdevMakeContig (screen->fb.blueMask,
+                                                 screen->fb.redMask|
+                                                 screen->fb.greenMask);
 
-       allbits = screen->fb[0].redMask | screen->fb[0].greenMask | 
screen->fb[0].blueMask;
+       allbits = screen->fb.redMask | screen->fb.greenMask | 
screen->fb.blueMask;
        depth = 32;
        while (depth && !(allbits & (1 << (depth - 1))))
            depth--;
@@ -284,8 +284,8 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv 
*scrpriv)
        return FALSE;
        break;
     }
-    screen->fb[0].depth = depth;
-    screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
+    screen->fb.depth = depth;
+    screen->fb.bitsPerPixel = priv->var.bits_per_pixel;
 
     scrpriv->randr = screen->randr;
 
@@ -348,16 +348,16 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
 
     if (scrpriv->shadow)
     {
-       if (!KdShadowFbAlloc (screen, 0,
+       if (!KdShadowFbAlloc (screen,
                              scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
            return FALSE;
     }
     else
     {
-        screen->fb[0].byteStride = priv->fix.line_length;
-        screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
+        screen->fb.byteStride = priv->fix.line_length;
+        screen->fb.pixelStride = (priv->fix.line_length * 8 /
                                 priv->var.bits_per_pixel);
-        screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
+        screen->fb.frameBuffer = (CARD8 *) (priv->fb);
     }
 
     return TRUE;
@@ -390,7 +390,7 @@ fbdevSetScreenSizes (ScreenPtr pScreen)
 Bool
 fbdevUnmapFramebuffer (KdScreenInfo *screen)
 {
-    KdShadowFbFree (screen, 0);
+    KdShadowFbFree (screen);
     return TRUE;
 }
 
@@ -538,10 +538,10 @@ fbdevRandRSetConfig (ScreenPtr            pScreen,
     (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
                                    pScreen->width,
                                    pScreen->height,
-                                   screen->fb[0].depth,
-                                   screen->fb[0].bitsPerPixel,
-                                   screen->fb[0].byteStride,
-                                   screen->fb[0].frameBuffer);
+                                   screen->fb.depth,
+                                   screen->fb.bitsPerPixel,
+                                   screen->fb.byteStride,
+                                   screen->fb.frameBuffer);
 
     /* set the subpixel order */
 
@@ -600,7 +600,7 @@ fbdevCreateColormap (ColormapPtr pmap)
            return FALSE;
        for (i = 0; i < nent; i++)
            pdefs[i].pixel = i;
-       fbdevGetColors (pScreen, 0, nent, pdefs);
+       fbdevGetColors (pScreen, nent, pdefs);
        for (i = 0; i < nent; i++)
        {
            pmap->red[i].co.local.red = pdefs[i].red;
@@ -745,7 +745,7 @@ fbdevCardFini (KdCardInfo *card)
 }
 
 void
-fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
     KdScreenPriv(pScreen);
     FbdevPriv      *priv = pScreenPriv->card->driver;
@@ -786,7 +786,7 @@ fbdevGetColors (ScreenPtr pScreen, int fb, int n, 
xColorItem *pdefs)
 }
 
 void
-fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
+fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
 {
     KdScreenPriv(pScreen);
     FbdevPriv  *priv = pScreenPriv->card->driver;
diff --git a/hw/kdrive/fbdev/fbdev.h b/hw/kdrive/fbdev/fbdev.h
index 3da8e47..4d4f7a9 100644
--- a/hw/kdrive/fbdev/fbdev.h
+++ b/hw/kdrive/fbdev/fbdev.h
@@ -94,10 +94,10 @@ void
 fbdevCardFini (KdCardInfo *card);
 
 void
-fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 void
-fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
 
 Bool
 fbdevMapFramebuffer (KdScreenInfo *screen);
diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index 7ac23c2..9aa8e5e 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -15,7 +15,6 @@ endif
 libkdrive_la_SOURCES = \
        fourcc.h        \
        kcmap.c         \
-       kcurscol.c      \
        kdrive.c        \
        kdrive.h        \
        kinfo.c         \
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index 053e719..40697e0 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -30,10 +30,10 @@
  */
 
 void
-KdSetColormap (ScreenPtr pScreen, int fb)
+KdSetColormap (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
-    ColormapPtr        pCmap = pScreenPriv->pInstalledmap[fb];
+    ColormapPtr        pCmap = pScreenPriv->pInstalledmap;
     Pixel      pixels[KD_MAX_PSEUDO_SIZE];
     xrgb       colors[KD_MAX_PSEUDO_SIZE];
     xColorItem defs[KD_MAX_PSEUDO_SIZE];
@@ -41,7 +41,7 @@ KdSetColormap (ScreenPtr pScreen, int fb)
 
     if (!pScreenPriv->card->cfuncs->putColors)
        return;
-    if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+    if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
        return;
 
     if (!pScreenPriv->enabled)
@@ -55,12 +55,12 @@ KdSetColormap (ScreenPtr pScreen, int fb)
      * true/direct as well as pseudo/static visuals
      */
 
-    for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+    for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
        pixels[i] = i;
 
-    QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, 
colors);
+    QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors);
 
-    for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
+    for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
     {
        defs[i].pixel = i;
        defs[i].red = colors[i].red;
@@ -69,8 +69,8 @@ KdSetColormap (ScreenPtr pScreen, int fb)
        defs[i].flags = DoRed|DoGreen|DoBlue;
     }
 
-    (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
-                                            (1 << 
pScreenPriv->screen->fb[fb].depth),
+    (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
+                                            (1 << 
pScreenPriv->screen->fb.depth),
                                             defs);
 
     /* recolor hardware cursor */
@@ -87,77 +87,35 @@ KdEnableColormap (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
     int            i;
-    int            fb;
-    Bool    done = FALSE;
 
     if (!pScreenPriv->card->cfuncs->putColors)
        return;
-    for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+
+    if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
     {
-       if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
-       {
-           for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
-               pScreenPriv->systemPalette[i].pixel = i;
-           (*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
-                                                  (1 << 
pScreenPriv->screen->fb[fb].depth),
-                                                  pScreenPriv->systemPalette);
-           done = TRUE;
-       }
-       KdSetColormap (pScreen, fb);
+       for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
+           pScreenPriv->systemPalette[i].pixel = i;
+       (*pScreenPriv->card->cfuncs->getColors) (pScreen,
+                                                (1 << 
pScreenPriv->screen->fb.depth),
+                                                pScreenPriv->systemPalette);
     }
+    KdSetColormap (pScreen);
 }
 
 void
 KdDisableColormap (ScreenPtr pScreen)
 {
     KdScreenPriv(pScreen);
-    int            fb;
 
     if (!pScreenPriv->card->cfuncs->putColors)
        return;
-    for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
-    {
-       if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
-       {
-           (*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
-                                                    (1 << 
pScreenPriv->screen->fb[fb].depth),
-                                                    
pScreenPriv->systemPalette);
-           break;
-       }
-    }
-}
 
-static int
-KdColormapFb (ColormapPtr   pCmap)
-{
-    ScreenPtr  pScreen = pCmap->pScreen;
-    KdScreenPriv (pScreen);
-    KdScreenInfo    *screen = pScreenPriv->screen;
-    int                d;
-    DepthPtr   depth;
-    int                v;
-    VisualID   vid = pCmap->pVisual->vid;
-    int                fb;
-
-    if (screen->fb[1].depth)
+    if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
     {
-       for (d = 0; d < pScreen->numDepths; d++)
-       {
-           depth = &pScreen->allowedDepths[d];
-           for (v = 0; v < depth->numVids; v++)
-           {
-               if (depth->vids[v] == vid)
-               {
-                   for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
-                   {
-                       if (depth->depth == screen->fb[fb].depth)
-                           return fb;
-                   }
-               }
-           }
-       }
+       (*pScreenPriv->card->cfuncs->putColors) (pScreen,
+                                                (1 << 
pScreenPriv->screen->fb.depth),
+                                                pScreenPriv->systemPalette);
     }
-    return 0;
 }
 
 /*
@@ -173,20 +131,19 @@ void
 KdInstallColormap (ColormapPtr pCmap)
 {
     KdScreenPriv(pCmap->pScreen);
-    int                fb = KdColormapFb (pCmap);
 
-    if (pCmap == pScreenPriv->pInstalledmap[fb])
+    if (pCmap == pScreenPriv->pInstalledmap)
        return;
 
     /* Tell X clients that the installed colormap is going away. */
-    if (pScreenPriv->pInstalledmap[fb])
-       WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
-                (pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
+    if (pScreenPriv->pInstalledmap)
+       WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
+                (pointer) &(pScreenPriv->pInstalledmap->mid));
 
     /* Take note of the new installed colorscreen-> */
-    pScreenPriv->pInstalledmap[fb] = pCmap;
+    pScreenPriv->pInstalledmap = pCmap;
 
-    KdSetColormap (pCmap->pScreen, fb);
+    KdSetColormap (pCmap->pScreen);
 
     /* Tell X clients of the new colormap */
     WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
@@ -203,12 +160,11 @@ void
 KdUninstallColormap (ColormapPtr pCmap)
 {
     KdScreenPriv(pCmap->pScreen);
-    int                fb = KdColormapFb (pCmap);
     Colormap   defMapID;
     ColormapPtr defMap;
 
     /* ignore if not installed */
-    if (pCmap != pScreenPriv->pInstalledmap[fb])
+    if (pCmap != pScreenPriv->pInstalledmap)
        return;
 
     /* ignore attempts to uninstall default colormap */
@@ -216,17 +172,17 @@ KdUninstallColormap (ColormapPtr pCmap)
     if ((Colormap) pCmap->mid == defMapID)
        return;
 
-    /* install default if on same fb */
+    /* install default */
     dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
                            serverClient, DixInstallAccess);
-    if (defMap && KdColormapFb (defMap) == fb)
+    if (defMap)
        (*pCmap->pScreen->InstallColormap)(defMap);
     else
     {
        /* uninstall and clear colormap pointer */
        WalkTree(pCmap->pScreen, TellLostMap,
                 (pointer) &(pCmap->mid));
-       pScreenPriv->pInstalledmap[fb] = 0;
+       pScreenPriv->pInstalledmap = 0;
     }
 }
 
@@ -234,16 +190,12 @@ int
 KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
 {
     KdScreenPriv(pScreen);
-    int                fb;
     int                n = 0;
 
-    for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
+    if (pScreenPriv->pInstalledmap)
     {
-       if (pScreenPriv->pInstalledmap[fb])
-       {
-           *pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
-           n++;
-       }
+       *pCmaps++ = pScreenPriv->pInstalledmap->mid;
+       n++;
     }
     return n;
 }
@@ -261,15 +213,14 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem 
*pdefs)
     KdScreenPriv(pCmap->pScreen);
     VisualPtr           pVisual;
     xColorItem          expanddefs[KD_MAX_PSEUDO_SIZE];
-    int                        fb = KdColormapFb (pCmap);
 
-    if (pCmap != pScreenPriv->pInstalledmap[fb])
+    if (pCmap != pScreenPriv->pInstalledmap)
        return;
 
     if (!pScreenPriv->card->cfuncs->putColors)
        return;
 
-    if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
+    if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
        return;
 
     if (!pScreenPriv->enabled)
@@ -287,7 +238,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem 
*pdefs)
        pdefs = expanddefs;
     }
 
-    (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
+    (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
 
     /* recolor hardware cursor */
     if (pScreenPriv->card->cfuncs->recolorCursor)
diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c
deleted file mode 100644
index 2eef6d9..0000000
--- a/hw/kdrive/src/kcurscol.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright © 1999 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <kdrive-config.h>
-#endif
-#include "kdrive.h"
-#include "cursorstr.h"
-
-static int
-KdComputeCmapShift (unsigned long mask)
-{
-    int        shift;
-    unsigned long   bit;
-
-    shift = 16;
-    bit = 0x80000000;
-    while (!(mask & bit))
-    {
-       shift--;
-       bit >>= 1;
-    }
-    return shift;
-}
-
-#define Shift(v,d)  ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
-
-void
-KdAllocateCursorPixels (ScreenPtr      pScreen,
-                       int             fb,
-                       CursorPtr       pCursor,
-                       Pixel           *source,
-                       Pixel           *mask)
-{
-    xColorItem     sourceColor, maskColor;
-    int                    r, g, b;
-    KdScreenPriv(pScreen);
-
-    if (pScreenPriv->screen->fb[fb].redMask)
-    {
-
-       r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
-       g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
-       b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
-       *source = ((Shift(pCursor->foreRed,r) & 
pScreenPriv->screen->fb[fb].redMask) |
-                           (Shift(pCursor->foreGreen,g) & 
pScreenPriv->screen->fb[fb].greenMask) |
-                           (Shift(pCursor->foreBlue,b) & 
pScreenPriv->screen->fb[fb].blueMask));
-       *mask = ((Shift(pCursor->backRed,r) & 
pScreenPriv->screen->fb[fb].redMask) |
-                         (Shift(pCursor->backGreen,g) & 
pScreenPriv->screen->fb[fb].greenMask) |
-                         (Shift(pCursor->backBlue,b) & 
pScreenPriv->screen->fb[fb].blueMask));
-    }
-    else
-    {
-       /*
-        * Set these to an invalid pixel value so that
-        * when the store colors comes through, the cursor
-        * won't get recolored
-        */
-       *source = ~0;
-       *mask = ~0;
-
-       sourceColor.red = pCursor->foreRed;
-       sourceColor.green = pCursor->foreGreen;
-       sourceColor.blue = pCursor->foreBlue;
-       FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
-       maskColor.red = pCursor->backRed;
-       maskColor.green = pCursor->backGreen;
-       maskColor.blue = pCursor->backBlue;
-       FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
-       FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
-       FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
-       *source = sourceColor.pixel;
-       *mask = maskColor.pixel;
-    }
-}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 76c03fd..d481d50 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -389,7 +389,6 @@ KdParseScreen (KdScreenInfo *screen,
 {
     char    delim;
     char    save[1024];
-    int            fb;
     int            i;
     int            pixels, mm;
 
@@ -403,8 +402,7 @@ KdParseScreen (KdScreenInfo *screen,
     screen->height_mm = 0;
     screen->subpixel_order = kdSubpixelOrder;
     screen->rate = 0;
-    for (fb = 0; fb < KD_MAX_FB; fb++)
-       screen->fb[fb].depth = 0;
+    screen->fb.depth = 0;
     if (!arg)
        return;
     if (strlen (arg) >= sizeof (save))
@@ -477,25 +475,18 @@ KdParseScreen (KdScreenInfo *screen,
        screen->randr |= RR_Reflect_Y;
     }
 
-    fb = 0;
-    while (fb < KD_MAX_FB)
+    arg = KdParseFindNext (arg, "x/,", save, &delim);
+    if (save[0])
     {
-       arg = KdParseFindNext (arg, "x/,", save, &delim);
-       if (!save[0])
-           break;
-       screen->fb[fb].depth = atoi(save);
+       screen->fb.depth = atoi(save);
        if (delim == '/')
        {
            arg = KdParseFindNext (arg, "x,", save, &delim);
-           if (!save[0])
-               break;
-           screen->fb[fb].bitsPerPixel = atoi (save);
+           if (save[0])
+               screen->fb.bitsPerPixel = atoi (save);
        }
        else
-           screen->fb[fb].bitsPerPixel = 0;
-       if (delim != ',')
-           break;
-       fb++;
+           screen->fb.bitsPerPixel = 0;
     }
 
     if (delim == 'x')
@@ -919,7 +910,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char 
**argv)
     KdScreenInfo       *screen = kdCurrentScreen;
     KdCardInfo         *card = screen->card;
     KdPrivScreenPtr    pScreenPriv;
-    int                        fb;
     /*
      * note that screen->fb is set up for the nominal orientation
      * of the screen; that means if randr is rotated, the values
@@ -949,8 +939,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char 
**argv)
     screen->pScreen = pScreen;
     pScreenPriv->screen = screen;
     pScreenPriv->card = card;
-    for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
-       pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
+    pScreenPriv->bytesPerPixel = screen->fb.bitsPerPixel >> 3;
     pScreenPriv->dpmsState = KD_DPMS_NORMAL;
 #ifdef PANORAMIX
     dixScreenOrigins[pScreen->myNum] = screen->origin;
@@ -964,11 +953,11 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char 
**argv)
      * backing store
      */
     if (!fbSetupScreen (pScreen,
-                       screen->fb[0].frameBuffer,
+                       screen->fb.frameBuffer,
                        width, height,
                        monitorResolution, monitorResolution,
-                       screen->fb[0].pixelStride,
-                       screen->fb[0].bitsPerPixel))
+                       screen->fb.pixelStride,
+                       screen->fb.bitsPerPixel))
     {
        return FALSE;
     }
@@ -984,36 +973,14 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char 
**argv)
     pScreen->SaveScreen                = KdSaveScreen;
     pScreen->CreateWindow      = KdCreateWindow;
 
-#if KD_MAX_FB > 1
-    if (screen->fb[1].depth)
-    {
-       if (!fbOverlayFinishScreenInit (pScreen,
-                                       screen->fb[0].frameBuffer,
-                                       screen->fb[1].frameBuffer,
-                                       width, height,
-                                       monitorResolution, monitorResolution,
-                                       screen->fb[0].pixelStride,
-                                       screen->fb[1].pixelStride,
-                                       screen->fb[0].bitsPerPixel,
-                                       screen->fb[1].bitsPerPixel,
-                                       screen->fb[0].depth,
-                                       screen->fb[1].depth))
-       {
-           return FALSE;
-       }
-    }
-    else
-#endif
+    if (!fbFinishScreenInit (pScreen,
+                            screen->fb.frameBuffer,
+                            width, height,
+                            monitorResolution, monitorResolution,
+                            screen->fb.pixelStride,
+                            screen->fb.bitsPerPixel))
     {
-       if (!fbFinishScreenInit (pScreen,
-                                screen->fb[0].frameBuffer,
-                                width, height,
-                                monitorResolution, monitorResolution,
-                                screen->fb[0].pixelStride,
-                                screen->fb[0].bitsPerPixel))
-       {
-           return FALSE;
-       }
+       return FALSE;
     }
 
     /*
@@ -1143,7 +1110,6 @@ KdSetPixmapFormats (ScreenInfo    *pScreenInfo)
     KdScreenInfo    *screen;
     int                    i;
     int                    bpp;
-    int                    fb;
     PixmapFormatRec *format;
 
     for (i = 1; i <= 32; i++)
@@ -1159,16 +1125,13 @@ KdSetPixmapFormats (ScreenInfo  *pScreenInfo)
     {
        for (screen = card->screenList; screen; screen = screen->next)
        {
-           for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
-           {
-               bpp = screen->fb[fb].bitsPerPixel;
-               if (bpp == 24)
-                   bpp = 32;
-               if (!depthToBpp[screen->fb[fb].depth])
-                   depthToBpp[screen->fb[fb].depth] = bpp;
-               else if (depthToBpp[screen->fb[fb].depth] != bpp)
-                   return FALSE;
-           }
+           bpp = screen->fb.bitsPerPixel;
+           if (bpp == 24)
+               bpp = 32;
+           if (!depthToBpp[screen->fb.depth])
+               depthToBpp[screen->fb.depth] = bpp;
+           else if (depthToBpp[screen->fb.depth] != bpp)
+               return FALSE;
        }
     }
 
@@ -1214,20 +1177,15 @@ KdAddScreen (ScreenInfo     *pScreenInfo,
     {
        unsigned long   visuals;
        Pixel           rm, gm, bm;
-       int             fb;
 
        visuals = 0;
        rm = gm = bm = 0;
-       for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+       if (pScreenInfo->formats[i].depth == screen->fb.depth)
        {
-           if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
-           {
-               visuals = screen->fb[fb].visuals;
-               rm = screen->fb[fb].redMask;
-               gm = screen->fb[fb].greenMask;
-               bm = screen->fb[fb].blueMask;
-               break;
-           }
+           visuals = screen->fb.visuals;
+           rm = screen->fb.redMask;
+           gm = screen->fb.greenMask;
+           bm = screen->fb.blueMask;
        }
        fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
                                  visuals,
@@ -1246,10 +1204,9 @@ int
 KdDepthToFb (ScreenPtr pScreen, int depth)
 {
     KdScreenPriv(pScreen);
-    int            fb;
 
-    for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; 
fb++)
-       if (pScreenPriv->screen->fb[fb].depth == depth)
+    for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb.frameBuffer; fb++)
+       if (pScreenPriv->screen->fb.depth == depth)
            return fb;
 }
 
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index e097bce..9f8465f 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -53,10 +53,6 @@
 #define KD_DPMS_POWERDOWN   3
 #define KD_DPMS_MAX        KD_DPMS_POWERDOWN
 
-#ifndef KD_MAX_FB
-#define KD_MAX_FB   FB_OVERLAY_MAX
-#endif
-
 #define Status int
 
 typedef struct _KdCardInfo {
@@ -106,7 +102,7 @@ typedef struct _KdScreenInfo {
     Bool        softCursor;
     int                mynum;
     DDXPointRec        origin;
-    KdFrameBuffer   fb[KD_MAX_FB];
+    KdFrameBuffer   fb;
 } KdScreenInfo;
 
 typedef struct _KdCardFuncs {
@@ -134,8 +130,8 @@ typedef struct _KdCardFuncs {
     void        (*disableAccel) (ScreenPtr);
     void        (*finiAccel) (ScreenPtr);
 
-    void        (*getColors) (ScreenPtr, int, int, xColorItem *);
-    void        (*putColors) (ScreenPtr, int, int, xColorItem *);
+    void        (*getColors) (ScreenPtr, int, xColorItem *);
+    void        (*putColors) (ScreenPtr, int, xColorItem *);
 
 } KdCardFuncs;
 
@@ -148,11 +144,11 @@ typedef struct {
 
     Bool           enabled;
     Bool           closed;
-    int                    bytesPerPixel[KD_MAX_FB];
+    int                    bytesPerPixel;
 
     int                    dpmsState;
 
-    ColormapPtr     pInstalledmap[KD_MAX_FB];         /* current colormap */
+    ColormapPtr     pInstalledmap;                    /* current colormap */
     xColorItem      systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors 
*/
 
     CreateScreenResourcesProcPtr    CreateScreenResources;
@@ -370,7 +366,7 @@ extern GCOps                kdNoopOps;
 
 /* kcmap.c */
 void
-KdSetColormap (ScreenPtr pScreen, int fb);
+KdSetColormap (ScreenPtr pScreen);
 
 void
 KdEnableColormap (ScreenPtr pScreen);
@@ -390,14 +386,6 @@ KdListInstalledColormaps (ScreenPtr pScreen, Colormap 
*pCmaps);
 void
 KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
 
-/* kcurscol.c */
-void
-KdAllocateCursorPixels (ScreenPtr      pScreen,
-                       int             fb,
-                       CursorPtr       pCursor,
-                       Pixel           *source,
-                       Pixel           *mask);
-
 /* kdrive.c */
 extern miPointerScreenFuncRec kdPointerScreenFuncs;
 
@@ -656,10 +644,10 @@ KdRandRGetTiming (ScreenPtr           pScreen,
 
 /* kshadow.c */
 Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
+KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate);
 
 void
-KdShadowFbFree (KdScreenInfo *screen, int fb);
+KdShadowFbFree (KdScreenInfo *screen);
 
 Bool
 KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, 
ShadowWindowProc window);
diff --git a/hw/kdrive/src/kmode.c b/hw/kdrive/src/kmode.c
index 1c3c240..38b7bc8 100644
--- a/hw/kdrive/src/kmode.c
+++ b/hw/kdrive/src/kmode.c
@@ -321,12 +321,10 @@ KdTuneMode (KdScreenInfo    *screen,
        /*
         * Fix requested depth and geometry until it works
         */
-       if (screen->fb[1].depth)
-           screen->fb[1].depth = 0;
-       else if (screen->fb[0].depth > 16)
-           screen->fb[0].depth = 16;
-       else if (screen->fb[0].depth > 8)
-           screen->fb[0].depth = 8;
+       if (screen->fb.depth > 16)
+           screen->fb.depth = 16;
+       else if (screen->fb.depth > 8)
+           screen->fb.depth = 8;
        else
        {
            t = kdFindPrevSize (KdFindMode (screen, supported));
diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c
index ea44812..cf3391d 100644
--- a/hw/kdrive/src/kshadow.c
+++ b/hw/kdrive/src/kshadow.c
@@ -26,36 +26,36 @@
 #include "kdrive.h"
 
 Bool
-KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate)
+KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate)
 {
     int            paddedWidth;
     void    *buf;
     int            width = rotate ? screen->height : screen->width;
     int            height = rotate ? screen->width : screen->height;
-    int            bpp = screen->fb[fb].bitsPerPixel;
+    int            bpp = screen->fb.bitsPerPixel;
 
     /* use fb computation for width */
     paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
     buf = xalloc (paddedWidth * height);
     if (!buf)
        return FALSE;
-    if (screen->fb[fb].shadow)
-       xfree (screen->fb[fb].frameBuffer);
-    screen->fb[fb].shadow = TRUE;
-    screen->fb[fb].frameBuffer = buf;
-    screen->fb[fb].byteStride = paddedWidth;
-    screen->fb[fb].pixelStride = paddedWidth * 8 / bpp;
+    if (screen->fb.shadow)
+       xfree (screen->fb.frameBuffer);
+    screen->fb.shadow = TRUE;
+    screen->fb.frameBuffer = buf;
+    screen->fb.byteStride = paddedWidth;
+    screen->fb.pixelStride = paddedWidth * 8 / bpp;
     return TRUE;
 }
 
 void
-KdShadowFbFree (KdScreenInfo *screen, int fb)
+KdShadowFbFree (KdScreenInfo *screen)
 {
-    if (screen->fb[fb].shadow)
+    if (screen->fb.shadow)
     {
-       xfree (screen->fb[fb].frameBuffer);
-       screen->fb[fb].frameBuffer = 0;
-       screen->fb[fb].shadow = FALSE;
+       xfree (screen->fb.frameBuffer);
+       screen->fb.frameBuffer = 0;
+       screen->fb.shadow = FALSE;
     }
 }
 
@@ -64,14 +64,12 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc 
update, ShadowWindow
 {
     KdScreenPriv(pScreen);
     KdScreenInfo *screen = pScreenPriv->screen;
-    int         fb;
 
     shadowRemove (pScreen, pScreen->GetScreenPixmap(pScreen));
-    for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
+    if(screen->fb.shadow)
     {
-       if (screen->fb[fb].shadow)
-            return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
-                              update, window, randr, 0);
+       return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
+                         update, window, randr, 0);
     }
     return TRUE;
 }
-- 
1.6.3.3

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to