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: reorganize imp...



details:   https://anonhg.NetBSD.org/xsrc/rev/6a99a7d6e807
branches:  trunk
changeset: 7140:6a99a7d6e807
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Aug 30 15:05:21 2022 +0000

description:
wsfb: reorganize implementation of Afb support.

- use XORG_VERSION_NUMERIC() to check if Afb is avaiable and
  define and use explicit HAVE_SHADOW_AFB macro
- disable all Afb references if it is not available

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

"Looks like good improvement" from jandberg@ and also confirmed by rin@.

diffstat:

 external/mit/xf86-video-wsfb/dist/src/wsfb.h        |   8 ++++
 external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c |  39 +++++++++++++-------
 2 files changed, 33 insertions(+), 14 deletions(-)

diffs (150 lines):

diff -r 86148d6a41d6 -r 6a99a7d6e807 external/mit/xf86-video-wsfb/dist/src/wsfb.h
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Mon Aug 29 14:54:04 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb.h      Tue Aug 30 15:05:21 2022 +0000
@@ -41,6 +41,8 @@
 #include <sys/time.h>
 #include <dev/wscons/wsconsio.h>
 
+#include "xorgVersion.h"
+
 #include "compat-api.h"
 
 #include "xf86.h"
@@ -55,6 +57,10 @@
 #ifndef WSFB_H
 #define WSFB_H
 
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
+#define HAVE_SHADOW_AFB
+#endif
+
 /* private data */
 typedef struct {
        int                     fd; /* file descriptor of open device */
@@ -67,7 +73,9 @@
        Bool                    shadowFB;
        Bool                    HWCursor;
        Bool                    useSwap32;
+#ifdef HAVE_SHADOW_AFB
        Bool                    planarAfb;
+#endif
        CloseScreenProcPtr      CloseScreen;
        CreateScreenResourcesProcPtr CreateScreenResources;
        void                    (*PointerMoved)(SCRN_ARG_TYPE, int, int);
diff -r 86148d6a41d6 -r 6a99a7d6e807 external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
--- a/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Mon Aug 29 14:54:04 2022 +0000
+++ b/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c       Tue Aug 30 15:05:21 2022 +0000
@@ -121,8 +121,10 @@
 static Bool WsfbCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static void *WsfbWindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
                              void *);
+#ifdef HAVE_SHADOW_AFB
 static void *WsfbWindowAfb(ScreenPtr, CARD32, CARD32, int, CARD32 *,
                              void *);
+#endif
 static void WsfbPointerMoved(SCRN_ARG_TYPE, int, int);
 static Bool WsfbEnterVT(VT_FUNC_ARGS_DECL);
 static void WsfbLeaveVT(VT_FUNC_ARGS_DECL);
@@ -213,7 +215,7 @@
        "shadowUpdatePackedWeak",
        "shadowUpdateRotatePacked",
        "shadowUpdateRotatePackedWeak",
-#if XORG_VERSION_CURRENT >= (1) * 10000000 + (20) * 100000
+#ifdef HAVE_SHADOW_AFB
        "shadowUpdateAfb8",
 #endif
        NULL
@@ -581,7 +583,6 @@
 #endif
 #ifdef WSDISPLAY_TYPE_AMIGACC
        if (wstype == WSDISPLAY_TYPE_AMIGACC) {
-#  if XORG_VERSION_CURRENT >= (1) * 10000000 + (20) * 100000
                /*
                 * Video memory is organized in bitplanes.
                 * 8bpp or 1bpp supported in this driver.
@@ -589,10 +590,11 @@
                 * is done in shadow update proc.
                 * With 1bpp no conversion needed.
                 */
+#ifdef HAVE_SHADOW_AFB
                if (bitsperpixel == 8) {
                        fPtr->planarAfb = TRUE;
                } else
-#  endif
+#endif
                {
                        default_depth = 1;
                        bitsperpixel = 1;
@@ -869,17 +871,16 @@
                shadowproc = WsfbShadowUpdateSwap32;
        } else if (fPtr->rotate) {
                shadowproc = shadowUpdateRotatePacked;
-       } else if (fPtr->planarAfb) {
-#if XORG_VERSION_CURRENT >= (1) * 10000000 + (20) * 100000
+       } else
+#ifdef HAVE_SHADOW_AFB
+       if (fPtr->planarAfb) {
                shadowproc = shadowUpdateAfb8;
-#else
-               xf86Msg(X_ERROR,
-                   "Planar fb requires xorg-server 1.20 or higher.");
-               return FALSE;
-#endif
                windowproc = WsfbWindowAfb;
        } else
+#endif
+       {
                shadowproc = shadowUpdatePacked;
+       }
        
        if (!shadowAdd(pScreen, pPixmap, shadowproc,
                windowproc, fPtr->rotate, NULL)) {
@@ -1024,10 +1025,14 @@
                         */
                        len = pScrn->virtualX * pScrn->virtualY *
                            (pScrn->bitsPerPixel >> 3);
-               } else if (fPtr->planarAfb) {
+               } else
+#ifdef HAVE_SHADOW_AFB
+               if (fPtr->planarAfb) {
                        /* always 8bpp */
                        len = pScrn->virtualX * pScrn->virtualY;
-               } else {
+               } else
+#endif
+               {
                        len = fPtr->fbi.fbi_stride * pScrn->virtualY;
                }
                fPtr->shadow = calloc(1, len);
@@ -1046,9 +1051,13 @@
         */
        if (fPtr->rotate) {
                width = pScrn->displayWidth;
-       } else if (fPtr->planarAfb) {
+       } else
+#ifdef HAVE_SHADOW_AFB
+       if (fPtr->planarAfb) {
                width = pScrn->displayWidth;
-       } else {
+       } else
+#endif
+       {
                if (pScrn->bitsPerPixel > 8) {
                        width =
                            fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3);
@@ -1274,6 +1283,7 @@
        return ((CARD8 *)fPtr->fbstart + row * fPtr->fbi.fbi_stride + offset);
 }
 
+#ifdef HAVE_SHADOW_AFB
 /*
  * For use with shadowUpdateAfb8
  *
@@ -1290,6 +1300,7 @@
        *size = fPtr->fbi.fbi_stride * fPtr->fbi.fbi_height;
        return ((CARD8 *)fPtr->fbstart + row * fPtr->fbi.fbi_stride + offset);
 }
+#endif
 
 static void
 WsfbPointerMoved(SCRN_ARG_TYPE arg, int x, int y)



Home | Main Index | Thread Index | Old Index