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 wsfb: reduce diffs f...



details:   https://anonhg.NetBSD.org/xsrc/rev/0477d4b72514
branches:  trunk
changeset: 7156:0477d4b72514
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 10 19:23:03 2022 +0000

description:
wsfb: reduce diffs from upstream.

Mostly pulled/merged from the following upstream changes:

- Fix for dlopen() -based module loader.
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/b77092858a178aa169ed4c1c7fe733d5cd355702

- Remove useless loader symbol lists.
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/bce9fd21483fbeddc84672a1ef01fdd9b58c88ed

- Add compat-api.h for compatibility with xserver 1.13
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/586b722fb17b3eb0ab776c170ee21e6a66fc7f22

- Use own thunk functions instead of shadow*Weak
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/fa9aabe95a65c4dd12008e16ad66d5c773a7993a

- Remove obsolete #ifdef HAVE_XF1BPP and #ifdef HAVE_XF4BPP blocks,
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/16ac29883cb80053fb0b973166a3f664cae1fa44

- Remove unused variables
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1c1bf30b612933a3303d414c75671c9a05ec450a

- Suppress a bunch of compiler warnings for using constant strings
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1ff2e87ea1c19d1417b11886d940e205be376d78

- Replace LoaderGetOS with ifdef
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/8069c6970c731c38e105f5dddd5ce83ba88b0773

- Fix spelling/wording issues
  https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/27c2d76404c7b440a6662446b189fa257c4cebfc

With minor adjustments:
- sync order of members in private struct WsfbRec
- add more const to avoid warning
- add newlines properly to xf86Msg() messages

No particular objection on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/06/thread1.html#002311

diffstat:

 external/mit/xf86-video-wsfb/dist/src/wsfb.h        |    4 +-
 external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c |  147 +++++--------------
 2 files changed, 46 insertions(+), 105 deletions(-)

diffs (truncated from 411 to 300 lines):

diff -r afa12749767e -r 0477d4b72514 external/mit/xf86-video-wsfb/dist/src/wsfb.h
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Fri Sep 09 23:18:56 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Sat Sep 10 19:23:03 2022 +0000
@@ -65,12 +65,12 @@
 typedef struct {
        int                     fd; /* file descriptor of open device */
        struct wsdisplayio_fbinfo fbi;
-       int                     rotate;
        unsigned char*          fbstart;
        unsigned char*          fbmem;
        size_t                  fbmem_len;
+       int                     rotate;
+       Bool                    shadowFB;
        void *                  shadow;
-       Bool                    shadowFB;
        Bool                    HWCursor;
        Bool                    useSwap32;
 #ifdef HAVE_SHADOW_AFB
diff -r afa12749767e -r 0477d4b72514 external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Fri Sep 09 23:18:56 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Sat Sep 10 19:23:03 2022 +0000
@@ -52,7 +52,6 @@
 /* All drivers need this. */
 #include "xf86.h"
 #include "xf86_OSproc.h"
-#include "xf86_OSlib.h"
 
 #include "mipointer.h"
 #include "micmap.h"
@@ -75,10 +74,6 @@
 
 #include "wsfb.h"
 
-/* #include "wsconsio.h" */
-
-#include <sys/mman.h>
-
 #ifdef X_PRIVSEP
 extern int priv_open_device(const char *);
 #else
@@ -91,12 +86,6 @@
 #define WSFB_DEFAULT_DEV "/dev/ttyC0"
 #endif
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 6
-#define xf86LoaderReqSymLists(...) do {} while (0)
-#define LoaderRefSymLists(...) do {} while (0)
-#define xf86LoaderReqSymbols(...) do {} while (0)
-#endif
-
 #define DEBUG 0
 
 #if DEBUG
@@ -165,13 +154,13 @@
  */
 static int pix24bpp = 0;
 
-#define WSFB_VERSION           4000
+#define WSFB_VERSION           4000
 #define WSFB_NAME              "wsfb"
 #define WSFB_DRIVER_NAME       "wsfb"
 
 _X_EXPORT DriverRec WSFB = {
        WSFB_VERSION,
-       WSFB_DRIVER_NAME,
+       (char *)WSFB_DRIVER_NAME,
        WsfbIdentify,
        WsfbProbe,
        WsfbAvailableOptions,
@@ -201,34 +190,6 @@
        { -1, NULL, OPTV_NONE, {0}, FALSE}
 };
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) <= 6
-/* Symbols needed from other modules */
-static const char *fbSymbols[] = {
-       "fbPictureInit",
-       "fbScreenInit",
-       NULL
-};
-static const char *shadowSymbols[] = {
-       "shadowAdd",
-       "shadowSetup",
-       "shadowUpdatePacked",
-       "shadowUpdatePackedWeak",
-       "shadowUpdateRotatePacked",
-       "shadowUpdateRotatePackedWeak",
-#ifdef HAVE_SHADOW_AFB
-       "shadowUpdateAfb8",
-#endif
-       NULL
-};
-
-static const char *ramdacSymbols[] = {
-       "xf86CreateCursorInfoRec",
-       "xf86DestroyCursorInfoRec",
-       "xf86InitCursor",
-       NULL
-};
-#endif
-
 static XF86ModuleVersionInfo WsfbVersRec = {
        "wsfb",
        MODULEVENDORSTRING,
@@ -251,19 +212,13 @@
 {
        static Bool setupDone = FALSE;
 
-#if !(defined __NetBSD__ || defined __OpenBSD__)
-       /* Check that we're being loaded on a OpenBSD or NetBSD system. */
-       if (errmaj)
-               *errmaj = LDR_BADOS;
-       if (errmin)
-               *errmin = 0;
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
        return NULL;
 #endif
+
        if (!setupDone) {
                setupDone = TRUE;
                xf86AddDriver(&WSFB, module, HaveDriverFuncs);
-               LoaderRefSymLists(fbSymbols, shadowSymbols, ramdacSymbols,
-                   NULL);
                return (pointer)1;
        } else {
                if (errmaj != NULL)
@@ -360,7 +315,7 @@
 WsfbProbe(DriverPtr drv, int flags)
 {
        int i, fd, entity;
-               GDevPtr *devSections;
+       GDevPtr *devSections;
        int numDevSections;
        const char *dev;
        Bool foundScreen = FALSE;
@@ -375,13 +330,6 @@
                                              &devSections)) <= 0)
                return FALSE;
 
-       /* Do not attach if the modesetting driver is active */
-       if (fbSlotClaimed == TRUE) {
-               DriverPtr fbSlotDrv = xf86GetEntityInfo(0)->driver;
-               if (strcmp(fbSlotDrv->driverName, "modesetting") == 0)
-                       return FALSE;
-       }
-
        for (i = 0; i < numDevSections; i++) {
                ScrnInfoPtr pScrn = NULL;
 
@@ -393,8 +341,8 @@
                        if (pScrn != NULL) {
                                foundScreen = TRUE;
                                pScrn->driverVersion = WSFB_VERSION;
-                               pScrn->driverName = WSFB_DRIVER_NAME;
-                               pScrn->name = WSFB_NAME;
+                               pScrn->driverName = (char *)WSFB_DRIVER_NAME;
+                               pScrn->name = (char *)WSFB_NAME;
                                pScrn->Probe = WsfbProbe;
                                pScrn->PreInit = WsfbPreInit;
                                pScrn->ScreenInit = WsfbScreenInit;
@@ -420,9 +368,8 @@
 {
        WsfbPtr fPtr;
        int default_depth, bitsperpixel, wstype;
-       const char *dev, *s;
-       char *mod = NULL;
-       const char *reqSym = NULL;
+       const char *dev;
+       const char *s;
        Gamma zeros = {0.0, 0.0, 0.0};
        DisplayModePtr mode;
        MessageType from;
@@ -772,7 +719,7 @@
 
        pScrn->progClock = TRUE;
        pScrn->rgbBits   = (pScrn->depth >= 8) ? 8 : pScrn->depth;
-       pScrn->chipset   = "wsfb";
+       pScrn->chipset   = (char *)"wsfb";
        pScrn->videoRam  = fPtr->fbi.fbi_fbsize;
 
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Vidmem: %dk\n",
@@ -782,7 +729,7 @@
        mode = (DisplayModePtr)malloc(sizeof(DisplayModeRec));
        mode->prev = mode;
        mode->next = mode;
-       mode->name = "wsfb current mode";
+       mode->name = (char *)"wsfb current mode";
        mode->status = MODE_OK;
        mode->type = M_T_BUILTIN;
        mode->Clock = 0;
@@ -820,15 +767,6 @@
        xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
                fPtr->HWCursor ? "HW" : "SW");
 
-       /* Load bpp-specific modules. */
-       switch(pScrn->bitsPerPixel) {
-       case 1:
-       case 4:
-       default:
-               mod = "fb";
-               break;
-       }
-
 
        /* Load shadow if needed. */
        if (fPtr->shadowFB) {
@@ -839,8 +777,7 @@
                        return FALSE;
                }
        }
-
-       if (mod && xf86LoadSubModule(pScrn, mod) == NULL) {
+       if (xf86LoadSubModule(pScrn, "fb") == NULL) {
                WsfbFreeRec(pScrn);
                return FALSE;
        }
@@ -850,21 +787,26 @@
                return FALSE;
         }
 
-       if (mod) {
-               if (reqSym) {
-                       xf86LoaderReqSymbols(reqSym, NULL);
-               } else {
-                       xf86LoaderReqSymLists(fbSymbols, NULL);
-               }
-       }
        TRACE_EXIT("PreInit");
        return TRUE;
 }
 
+static void
+wsfbUpdateRotatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    shadowUpdateRotatePacked(pScreen, pBuf);
+}
+
+static void
+wsfbUpdatePacked(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+    shadowUpdatePacked(pScreen, pBuf);
+}
+
 static Bool
 WsfbCreateScreenResources(ScreenPtr pScreen)
 {
-       ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
        WsfbPtr fPtr = WSFBPTR(pScrn);
        PixmapPtr pPixmap;
        Bool ret;
@@ -884,7 +826,7 @@
        } else if (fPtr->useSwap32) {
                shadowproc = WsfbShadowUpdateSwap32;
        } else if (fPtr->rotate) {
-               shadowproc = shadowUpdateRotatePacked;
+               shadowproc = wsfbUpdateRotatePacked;
        } else
 #ifdef HAVE_SHADOW_AFB
        if (fPtr->planarAfb) {
@@ -893,7 +835,7 @@
        } else
 #endif
        {
-               shadowproc = shadowUpdatePacked;
+               shadowproc = wsfbUpdatePacked;
        }
        
        if (!shadowAdd(pScreen, pPixmap, shadowproc,
@@ -907,7 +849,7 @@
 static Bool
 WsfbShadowInit(ScreenPtr pScreen)
 {
-       ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
        WsfbPtr fPtr = WSFBPTR(pScrn);
 
        if (!shadowSetup(pScreen))
@@ -921,7 +863,7 @@
 static Bool
 WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 {
-       ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+       ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
        WsfbPtr fPtr = WSFBPTR(pScrn);
        VisualPtr visual;
        int ret, flags, ncolors;
@@ -959,7 +901,6 @@
        case 15:
        case 16:
                if (fPtr->fbi.fbi_stride == fPtr->fbi.fbi_width) {
-                       xf86Msg(X_ERROR, "Bogus stride == width in 16bit colour\n");
                        len = fPtr->fbi.fbi_width * fPtr->fbi.fbi_height * sizeof(short);
                } else {
                        len = fPtr->fbi.fbi_stride * fPtr->fbi.fbi_height;
@@ -967,7 +908,6 @@
                break;
        case 24:
                if (fPtr->fbi.fbi_stride == fPtr->fbi.fbi_width) {
-                       xf86Msg(X_ERROR, "Bogus stride == width in 24bit colour\n");



Home | Main Index | Thread Index | Old Index