Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-video-suncg14/dist/src support 8 bit colour



details:   https://anonhg.NetBSD.org/xsrc/rev/7d8339fb6680
branches:  trunk
changeset: 10818:7d8339fb6680
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Dec 02 22:32:35 2021 +0000

description:
support 8 bit colour
no acceleration yet, the code is riddled with 32bit per pixel assumptions

diffstat:

 external/mit/xf86-video-suncg14/dist/src/cg14_driver.c |  21 ++++++++++++-----
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r 57e38df1ac97 -r 7d8339fb6680 external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
--- a/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c    Wed Dec 01 17:47:11 2021 +0000
+++ b/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c    Thu Dec 02 22:32:35 2021 +0000
@@ -370,6 +370,7 @@
     switch (pScrn->depth) {
        case 32:
        case 24:
+       case 8:
            /* OK */
            break;
        default:
@@ -593,9 +594,11 @@
      */
     miClearVisualTypes();
 
-    /* Setup the visuals we support. */
+    /* Set the bits per RGB for 8bpp mode */
+    pScrn->rgbBits = 8;
 
-    if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
+    /* Setup the visuals we support. */
+    if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
                          pScrn->rgbBits, pScrn->defaultVisual))
        return FALSE;
 
@@ -617,6 +620,7 @@
      */
 
     CG14InitCplane24(pScrn);
+
     ret = fbScreenInit(pScreen, pCg14->use_shadow ? pCg14->shadow : pCg14->fb,
                       pScrn->virtualX,
                       pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
@@ -683,6 +687,9 @@
     if (!miCreateDefColormap(pScreen))
        return FALSE;
 
+    if(!xf86SbusHandleColormaps(pScreen, pCg14->psdp))
+       return FALSE;
+
     pCg14->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = CG14CloseScreen;
     pScreen->SaveScreen = CG14SaveScreen;
@@ -774,8 +781,7 @@
 
     pScrn->vtSema = FALSE;
     CG14ExitCplane24 (pScrn);
-    xf86UnmapSbusMem(pCg14->psdp, pCg14->fb,
-                    (pCg14->psdp->width * pCg14->psdp->height * 4));
+    xf86UnmapSbusMem(pCg14->psdp, pCg14->fb, pCg14->memsize);
     xf86UnmapSbusMem(pCg14->psdp, pCg14->x32,
                     (pCg14->psdp->width * pCg14->psdp->height));
     xf86UnmapSbusMem(pCg14->psdp, pCg14->xlut, 4096);
@@ -864,9 +870,12 @@
   int size, bpp;
               
   size = pScrn->virtualX * pScrn->virtualY;
-  bpp = 32;
+  if (pScrn->bitsPerPixel > 8) {
+       bpp = 32;
+  } else
+       bpp = 8;
   ioctl (pCg14->psdp->fd, CG14_SET_PIXELMODE, &bpp);
-  memset (pCg14->fb, 0, size * 4);
+  memset (pCg14->fb, 0, size * (bpp >> 3));
   memset (pCg14->x32, 0, size);
   memset (pCg14->xlut, 0, 0x200);
 }                                                  



Home | Main Index | Thread Index | Old Index