Module Name: xsrc Committed By: jandberg Date: Wed Jul 6 14:27:50 UTC 2022
Modified Files: xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c Log Message: Add support for 8bpp with Amiga native graphics. Conversion to bitplane format is done in shadowfb update proc. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h cvs rdiff -u -r1.37 -r1.38 \ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.7 --- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6 Tue Aug 16 06:28:25 2016 +++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h Wed Jul 6 14:27:50 2022 @@ -63,6 +63,7 @@ typedef struct { Bool shadowFB; Bool HWCursor; Bool useSwap32; + Bool planarAfb; CloseScreenProcPtr CloseScreen; CreateScreenResourcesProcPtr CreateScreenResources; void (*PointerMoved)(SCRN_ARG_TYPE, int, int); Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.38 --- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37 Mon Dec 30 18:27:50 2019 +++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c Wed Jul 6 14:27:50 2022 @@ -121,6 +121,8 @@ static Bool WsfbScreenInit(SCREEN_INIT_A 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 @@ static const char *shadowSymbols[] = { "shadowUpdatePackedWeak", "shadowUpdateRotatePacked", "shadowUpdateRotatePackedWeak", + "shadowUpdateAfb8", NULL }; @@ -444,6 +447,13 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags 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 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags 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 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags 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 @@ WsfbCreateScreenResources(ScreenPtr pScr PixmapPtr pPixmap; Bool ret; void (*shadowproc)(ScreenPtr, shadowBufPtr); + ShadowWindowProc windowproc = WsfbWindowLinear; pScreen->CreateScreenResources = fPtr->CreateScreenResources; ret = pScreen->CreateScreenResources(pScreen); @@ -841,11 +865,14 @@ WsfbCreateScreenResources(ScreenPtr pScr 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 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL) */ 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 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL) */ if (fPtr->rotate) { width = pScrn->displayWidth; + } else if (fPtr->planarAfb) { + width = pScrn->displayWidth; } else { if (pScrn->bitsPerPixel > 8) { width = @@ -1232,6 +1264,23 @@ WsfbWindowLinear(ScreenPtr pScreen, CARD 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) {