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-wsfb/dist/src Add support for 8bpp...



details:   https://anonhg.NetBSD.org/xsrc/rev/79e62877dcde
branches:  trunk
changeset: 6989:79e62877dcde
user:      jandberg <jandberg%NetBSD.org@localhost>
date:      Wed Jul 06 14:27:50 2022 +0000

description:
Add support for 8bpp with Amiga native graphics.

Conversion to bitplane format is done in shadowfb update proc.

diffstat:

 external/mit/xf86-video-wsfb/dist/src/wsfb.h        |   1 +
 external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c |  63 ++++++++++++++++++--
 2 files changed, 57 insertions(+), 7 deletions(-)

diffs (151 lines):

diff -r d40ab11ddc76 -r 79e62877dcde external/mit/xf86-video-wsfb/dist/src/wsfb.h
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Wed Jun 08 19:19:42 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Wed Jul 06 14:27:50 2022 +0000
@@ -63,6 +63,7 @@
        Bool                    shadowFB;
        Bool                    HWCursor;
        Bool                    useSwap32;
+       Bool                    planarAfb;
        CloseScreenProcPtr      CloseScreen;
        CreateScreenResourcesProcPtr CreateScreenResources;
        void                    (*PointerMoved)(SCRN_ARG_TYPE, int, int);
diff -r d40ab11ddc76 -r 79e62877dcde external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Wed Jun 08 19:19:42 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Wed Jul 06 14:27:50 2022 +0000
@@ -121,6 +121,8 @@
 static Bool WsfbCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static void *WsfbWindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
                              void *);
+static void *WsfbWindowAfb(ScreenPtr, CARD32, CARD32, int, CARD32 *,
+                             void *);
 static void WsfbPointerMoved(SCRN_ARG_TYPE, int, int);
 static Bool WsfbEnterVT(VT_FUNC_ARGS_DECL);
 static void WsfbLeaveVT(VT_FUNC_ARGS_DECL);
@@ -211,6 +213,7 @@
        "shadowUpdatePackedWeak",
        "shadowUpdateRotatePacked",
        "shadowUpdateRotatePackedWeak",
+       "shadowUpdateAfb8",
        NULL
 };
 
@@ -444,6 +447,13 @@
                return FALSE;
        }
 
+       if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) {
+               xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+                          "ioctl WSDISPLAY_GTYPE: %s\n",
+                          strerror(errno));
+               wstype = WSDISPLAY_TYPE_UNKNOWN;
+       }
+
        if (ioctl(fPtr->fd, WSDISPLAYIO_GET_FBINFO, &fPtr->fbi) != 0) {
                struct wsdisplay_fbinfo info;
                struct wsdisplayio_fbinfo *fbi = &fPtr->fbi;
@@ -457,12 +467,6 @@
                                   strerror(errno));
                        return FALSE;
                }
-               if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) {
-                       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                                  "ioctl WSDISPLAY_GTYPE: %s\n",
-                                  strerror(errno));
-                       return FALSE;
-               }
                if (ioctl(fPtr->fd, WSDISPLAYIO_LINEBYTES, &lb) == -1) {
                        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                                   "ioctl WSDISPLAYIO_LINEBYTES: %s\n",
@@ -573,6 +577,25 @@
                bitsperpixel = 1;
        }
 #endif
+#if defined(__NetBSD__) && defined(WSDISPLAY_TYPE_AMIGACC)
+       if (wstype == WSDISPLAY_TYPE_AMIGACC)
+       {
+               /*
+                * Video memory is organized in bitplanes.
+                * 8bpp or 1bpp supported in this driver.
+                * With 8bpp conversion to bitplane format
+                * is done in shadow update proc.
+                * With 1bpp no conversion needed.
+                */
+               if (bitsperpixel == 8) {
+                       fPtr->planarAfb = TRUE;
+               } else {
+                       default_depth = 1;
+                       bitsperpixel = 1;
+               }
+       }
+#endif
+
        if (!xf86SetDepthBpp(pScrn, default_depth, default_depth,
                bitsperpixel,
                bitsperpixel >= 24 ? Support24bppFb|Support32bppFb : 0))
@@ -826,6 +849,7 @@
        PixmapPtr pPixmap;
        Bool ret;
        void (*shadowproc)(ScreenPtr, shadowBufPtr);
+       ShadowWindowProc windowproc = WsfbWindowLinear;
 
        pScreen->CreateScreenResources = fPtr->CreateScreenResources;
        ret = pScreen->CreateScreenResources(pScreen);
@@ -841,11 +865,14 @@
                shadowproc = WsfbShadowUpdateSwap32;
        } else if (fPtr->rotate) {
                shadowproc = shadowUpdateRotatePacked;
+       } else if (fPtr->planarAfb) {
+               shadowproc = shadowUpdateAfb8;
+               windowproc = WsfbWindowAfb;
        } else
                shadowproc = shadowUpdatePacked;
        
        if (!shadowAdd(pScreen, pPixmap, shadowproc,
-               WsfbWindowLinear, fPtr->rotate, NULL)) {
+               windowproc, fPtr->rotate, NULL)) {
                return FALSE;
        }
        return TRUE;
@@ -987,6 +1014,9 @@
                         */
                        len = pScrn->virtualX * pScrn->virtualY *
                            (pScrn->bitsPerPixel >> 3);
+               } else if (fPtr->planarAfb) {
+                       /* always 8bpp */
+                       len = pScrn->virtualX * pScrn->virtualY;
                } else {
                        len = fPtr->fbi.fbi_stride * pScrn->virtualY;
                }
@@ -1006,6 +1036,8 @@
         */
        if (fPtr->rotate) {
                width = pScrn->displayWidth;
+       } else if (fPtr->planarAfb) {
+               width = pScrn->displayWidth;
        } else {
                if (pScrn->bitsPerPixel > 8) {
                        width =
@@ -1232,6 +1264,23 @@
        return ((CARD8 *)fPtr->fbstart + row * fPtr->fbi.fbi_stride + offset);
 }
 
+/**
+ * For use with shadowUpdateAfb8
+ *
+ * For video memory layout with non-interleaved bitplanes.
+ */
+static void *
+WsfbWindowAfb(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
+               CARD32 *size, void *closure)
+{
+       ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+       WsfbPtr fPtr = WSFBPTR(pScrn);
+
+       /* size is offset from start of bitplane to next bitplane */
+       *size = fPtr->fbi.fbi_stride * fPtr->fbi.fbi_height;
+       return ((CARD8 *)fPtr->fbstart + row * fPtr->fbi.fbi_stride + offset);
+}
+
 static void
 WsfbPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
 {



Home | Main Index | Thread Index | Old Index