Source-Changes-HG archive

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

[xsrc/trunk]: xsrc/external/mit/xorg-server.old/dist/hw/netbsd/x68k Cherry-pi...



details:   https://anonhg.NetBSD.org/xsrc/rev/312e268bbb45
branches:  trunk
changeset: 10620:312e268bbb45
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Nov 05 16:06:08 2020 +0000

description:
Cherry-pick Xorg version independent changes from xorg-server.

 Normalize #include paths.
 Call LogInit() for logging to /var/log/X68k.%s.log as Xorg and Xsun servers.
 Fix a suspicious chunk disabled on xfree 4.x migration as sunKbd.c does.
 Restore video mode properly on exit even on CRT Mode 19 (640x480 31kHz VGA).
 Add ModeDef for 640x480x4bit PseudoColor.
 Avoid a use of __UNVOLATILE(3).
 Remove unnecessary pointer casts from malloc(3).
 Use exact-width interger types properly for register accesses etc.

diffstat:

 external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68kConfig   |  11 ++-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68k.h       |  12 +-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c |  12 +-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c     |  27 ++++-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c  |  34 +++---
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c   |  31 +++++-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kKbd.c    |  16 +-
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kReg.h    |  54 +++++-----
 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kText.c   |   8 +-
 9 files changed, 127 insertions(+), 78 deletions(-)

diffs (truncated from 537 to 300 lines):

diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68kConfig
--- a/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68kConfig       Wed Nov 04 22:46:20 2020 +0000
+++ b/external/mit/xorg-server.old/dist/hw/netbsd/x68k/X68kConfig       Thu Nov 05 16:06:08 2020 +0000
@@ -1,4 +1,4 @@
-;; $NetBSD: X68kConfig,v 1.1.1.1 2016/06/09 09:07:59 mrg Exp $
+;; $NetBSD: X68kConfig,v 1.2 2020/11/05 16:06:08 tsutsui Exp $
 ;;----------------------------------------------------------------
 ;; X68kConfig: sample configuration for X68k
 ;; written by Yasushi Yamasaki
@@ -52,6 +52,14 @@
         91    9   17   81  567    5   40  552   27
        789    3    0)
 
+;
+; 640x480x4bit PseudoColor
+; CRTC-R20 = 0x0417(1047) VIDEOC-R0 = 0x0004
+;
+(ModeDef Pseudo16Color640x480 Graphic 4 PseudoColor  640 480
+        99   11   13   93  524    1   33  513   27
+      1047    4    0)
+
 ;;----------------------------------------------------------------
 ;; tricky modes
 ;;----------------------------------------------------------------
@@ -100,6 +108,7 @@
 ;(Mode Monochrome1024x768)
 ;(Mode Pseudo16Color1024x768)
 ;(Mode NeedsMultiScan)
+;(Mode Pseudo16Color640x480)
 
 ;;----------------------------------------------------------------
 ;; input devices
diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68k.h
--- a/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68k.h   Wed Nov 04 22:46:20 2020 +0000
+++ b/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68k.h   Thu Nov 05 16:06:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x68k.h,v 1.2 2020/04/10 16:49:36 tsutsui Exp $ */
+/* $NetBSD: x68k.h,v 1.3 2020/11/05 16:06:08 tsutsui Exp $ */
 /*-------------------------------------------------------------------------
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -43,12 +43,12 @@
 #include <machine/grfioctl.h>
 
 /* generic X */
-#include <X.h>
-#include <Xmd.h>
+#include <X11/X.h>
+#include <X11/Xmd.h>
 #define XK_KATAKANA
-#include <keysym.h>
+#include <X11/keysym.h>
 #define NEED_EVENTS
-#include <Xproto.h>
+#include <X11/Xproto.h>
 
 /* dix */
 #include <misc.h>
@@ -79,7 +79,7 @@
     int scr_height;             /* screen height       */
     int dpi;                    /* dots per inch       */
     uint8_t *fb;                /* frame buffer VA     */
-    volatile FbReg *reg;        /* control register VA */
+    FbReg *reg;                 /* control register VA */
     X68kFbReg x68kreg;          /* control register    */
     int mapsize;                /* size of mapped memory */
     ColormapPtr installedMap;   /* installed colormap    */
diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c
--- a/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c     Wed Nov 04 22:46:20 2020 +0000
+++ b/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kConfig.c     Thu Nov 05 16:06:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kConfig.c,v 1.3 2020/08/01 20:09:03 tsutsui Exp $ */
+/* $NetBSD: x68kConfig.c,v 1.4 2020/11/05 16:06:08 tsutsui Exp $ */
 /*-------------------------------------------------------------------------
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -176,7 +176,7 @@
     static int line = 1;
     Token *ret;
 
-    ret = (Token *)malloc(sizeof(Token));
+    ret = malloc(sizeof(Token));
     if (ret == NULL)
         FatalError("Out of memory");
     while (TRUE) {
@@ -202,7 +202,7 @@
     /* is a symbol? */
     if (isalpha(c)) {
         int i = 0;
-        ret->content.symbol = (char *)malloc(32 * sizeof(char));
+        ret->content.symbol = malloc(32 * sizeof(char));
         if (ret->content.symbol == NULL)
             FatalError("Out of memory");
         do {
@@ -295,7 +295,7 @@
             break;
         }
         argc++;
-        argv = (Token **)realloc(argv, sizeof(Token *) * argc);
+        argv = realloc(argv, sizeof(Token *) * argc);
         if (argv == NULL)
             FatalError("Out of memory");
         argv[argc-1] = token;
@@ -395,7 +395,7 @@
 
     checkArguments(18, argtype, argc-1, argv);
 
-    mode = (Mode *)malloc(sizeof(Mode));
+    mode = malloc(sizeof(Mode));
     if (mode == NULL)
         FatalError("Out of memory");
     mode->name = strdup(argv[1]->content.symbol);
@@ -545,7 +545,7 @@
             x68kFbProc[0].open = x68kGraphOpen;
             x68kFbProc[0].init = x68kGraphInit;
             x68kFbProc[0].close = x68kGraphClose;
-           x68kFormat = (PixmapFormatRec*) malloc (sizeof(PixmapFormatRec));
+           x68kFormat = malloc (sizeof(PixmapFormatRec));
            x68kFormat->scanlinePad = BITMAP_SCANLINE_PAD;
             x68kFormat->bitsPerPixel = 16;
             switch (mode->depth) {
diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c
--- a/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c Wed Nov 04 22:46:20 2020 +0000
+++ b/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kFb.c Thu Nov 05 16:06:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kFb.c,v 1.3 2020/08/01 20:09:03 tsutsui Exp $ */
+/* $NetBSD: x68kFb.c,v 1.4 2020/11/05 16:06:08 tsutsui Exp $ */
 /*-------------------------------------------------------------------------
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -30,6 +30,8 @@
 
 DevPrivateKeyRec x68kScreenPrivateKeyRec;
 
+static int cons_dwidth;
+
 /*-------------------------------------------------------------------------
  * function "x68kFbCommonOpen"
  *
@@ -68,6 +70,7 @@
     pPriv->fb = (uint8_t *)((uint32_t)pPriv->reg + gi.gd_regsize);
 
     x68kRegSetup( pPriv );
+    cons_dwidth = gi.gd_dwidth;
 
     return TRUE;
 }
@@ -83,7 +86,8 @@
 void
 x68kFbCommonClose(X68kScreenRec *pPriv)
 {
-    X68kFbReg graphNone = {
+    static const X68kFbReg graphNone_mode16 = {
+       /* CRT mode 16 (768x512 31.5kHz) */
         { 137,14, 28, 124,
           567, 5, 40, 552,
            27, 0,  0,   0,
@@ -93,12 +97,23 @@
         { 0x0004, 0x21e4, 0x0020 },
         0
     };
+    static const X68kFbReg graphNone_mode19 = {
+       /* CRT mode 19 (640x480 31.5kHz VGA mode) */
+        {  99,11, 13,  93,
+          524, 1, 33, 513,
+           27, 0,  0,   0,
+            0, 0,  0,   0,
+            0, 0,  0,   0,
+       0x0417, 0,  0,   0, 0 },
+        { 0x0004, 0x21e4, 0x0020 },
+        0
+    };
     /* change video mode */
-    pPriv->x68kreg = graphNone;
+    pPriv->x68kreg = (cons_dwidth == 640) ? graphNone_mode19 : graphNone_mode16;
     x68kRegSetup(pPriv);
 
     /* unmap and close frame buffer */
-    if ( munmap(__UNVOLATILE(pPriv->reg), pPriv->mapsize) == -1 )
+    if ( munmap(pPriv->reg, pPriv->mapsize) == -1 )
         Error("Can't unmap frame buffer");
     close(pPriv->fd);
 }
@@ -117,7 +132,7 @@
 static void
 x68kRegSetup(X68kScreenRec *pPriv)
 {
-    u_short pr20 = pPriv->reg->crtc.r20;
+    uint16_t pr20 = pPriv->reg->crtc.r20;
 
     /* timing registers */
     if ( (pr20 & 0x0003) < (pPriv->x68kreg.crtc.r20 & 0x0003) ||
@@ -160,7 +175,7 @@
 {
     X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen);
     static int status = FALSE;
-    static u_short r2;
+    static uint16_t r2;
 
     if (on == SCREEN_SAVER_ON || on == SCREEN_SAVER_CYCLE) {
         if (!status) {
diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c
--- a/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c      Wed Nov 04 22:46:20 2020 +0000
+++ b/external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kGraph.c      Thu Nov 05 16:06:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kGraph.c,v 1.3 2020/08/01 20:09:03 tsutsui Exp $ */
+/* $NetBSD: x68kGraph.c,v 1.4 2020/11/05 16:06:08 tsutsui Exp $ */
 /*-------------------------------------------------------------------------
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -125,7 +125,7 @@
 static void x68kStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs);
 
 static void x68kUpdateColormap(ScreenPtr pScreen, int dex, int count,
-                               u_char *rmap, u_char *gmap, u_char *bmap);
+                               uint8_t *rmap, uint8_t *gmap, uint8_t *bmap);
 
 /*-------------------------------------------------------------------------
  * function "x68kGraphOpen"                          [ X68kFBProc function ]
@@ -147,7 +147,7 @@
     if (pPriv->depth == 15 && pPriv->class == TrueColor) {
         /* for 32768 TrueColor mode */
        int i;
-       u_short x = 0x0001;
+       uint16_t x = 0x0001;
        for ( i = 0; i < 256; ) {
            pPriv->reg->gpal[i++] = x;
            pPriv->reg->gpal[i++] = x;
@@ -265,9 +265,9 @@
 
         ndepths = 1;
         nvisuals = 1;
-        depths = (DepthPtr)malloc( sizeof(DepthRec) );
-        visuals = (VisualPtr)malloc( sizeof(VisualRec) );
-        vid = (VisualID *)malloc( sizeof(VisualID) );
+        depths = malloc( sizeof(DepthRec) );
+        visuals = malloc( sizeof(VisualRec) );
+        vid = malloc( sizeof(VisualID) );
         if( !depths || !visuals || !vid ) {
             free( depths );
             free( visuals );
@@ -297,9 +297,9 @@
 
         ndepths = 1;
         nvisuals = 1;
-        depths = (DepthPtr)malloc( sizeof(DepthRec) );
-        visuals = (VisualPtr)malloc( sizeof(VisualRec) );
-        vid = (VisualID *)malloc( sizeof(VisualID) );
+        depths = malloc( sizeof(DepthRec) );
+        visuals = malloc( sizeof(VisualRec) );
+        vid = malloc( sizeof(VisualID) );
         if( !depths || !visuals || !vid ) {
             free( depths );
             free( visuals );
@@ -355,7 +355,7 @@
     register int i;
     register Entry *pent;
     register VisualPtr pVisual = cmap->pVisual;
-    u_char   rmap[256], gmap[256], bmap[256];
+    uint8_t   rmap[256], gmap[256], bmap[256];
     unsigned long rMask, gMask, bMask;
     int        oRed, oGreen, oBlue;
 
@@ -453,7 +453,7 @@
 x68kStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
 {
     X68kScreenRec *pPriv = x68kGetScreenPrivate(pmap->pScreen);
-    u_char     rmap[256], gmap[256], bmap[256];
+    uint8_t     rmap[256], gmap[256], bmap[256];
     xColorItem expanddefs[256];
     register int i;
 
@@ -480,20 +480,20 @@
  *  argument: (ScreenPtr)pScreen: screen
  *            (int)dex          : colormap index
  *            (int)count        : count for updating
- *            (u_char *)[rgb]map: each map
+ *            (uint8_t *)[rgb]map: each map
  *  returns:  nothing
  *-----------------------------------------------------------------------*/
 static void
 x68kUpdateColormap(ScreenPtr pScreen, int dex, int count,
-                               u_char *rmap, u_char *gmap, u_char *bmap)
+                               uint8_t *rmap, uint8_t *gmap, uint8_t *bmap)
 {
     X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen);
-    volatile u_short *pal = pPriv->reg->gpal;
+    volatile uint16_t *pal = pPriv->reg->gpal;
 
     for( ; count > 0; count--,dex++ ) {
-        pal[dex] = (u_short)gmap[dex] << 11 |
-                   (u_short)rmap[dex] << 6 |
-                   (u_short)bmap[dex] << 1;
+        pal[dex] = (uint16_t)gmap[dex] << 11 |
+                   (uint16_t)rmap[dex] << 6 |
+                   (uint16_t)bmap[dex] << 1;
     }
 }
 
diff -r bcb07c3efa1a -r 312e268bbb45 external/mit/xorg-server.old/dist/hw/netbsd/x68k/x68kInit.c



Home | Main Index | Thread Index | Old Index