Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up following revision(s) (requested by abs in ticket...



details:   https://anonhg.NetBSD.org/src/rev/7bf3ea80bc84
branches:  netbsd-9
changeset: 989481:7bf3ea80bc84
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Oct 13 16:07:41 2021 +0000

description:
Pull up following revision(s) (requested by abs in ticket #1359):

        sys/arch/amiga/dev/amidisplaycc.c: revision 1.33
        share/man/man4/man4.amiga/amidisplaycc.4: revision 1.14
        sys/arch/amiga/dev/amidisplaycc.c: revision 1.35
        sys/arch/amiga/dev/amidisplaycc.c: revision 1.36

Implement the WSDISPLAYIO_GET_FBINFO ioctl, needed by X wsfb driver.

Add support for WSDISPLAYIO_MODE_DUMBFB to WSDISPLAYIO_SMODE.

Remove parentheses from return. No functional changes.

Update documentation to mention current status of X11

diffstat:

 share/man/man4/man4.amiga/amidisplaycc.4 |   10 +-
 sys/arch/amiga/dev/amidisplaycc.c        |  216 +++++++++++++++++-------------
 2 files changed, 129 insertions(+), 97 deletions(-)

diffs (truncated from 590 to 300 lines):

diff -r 05bb8f00e7ef -r 7bf3ea80bc84 share/man/man4/man4.amiga/amidisplaycc.4
--- a/share/man/man4/man4.amiga/amidisplaycc.4  Wed Oct 13 16:03:07 2021 +0000
+++ b/share/man/man4/man4.amiga/amidisplaycc.4  Wed Oct 13 16:07:41 2021 +0000
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.13 2016/02/07 14:06:04 wiz Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.13.18.1 2021/10/13 16:07:41 martin Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -43,11 +43,9 @@
 It uses the Amiga abstract graphic driver (grfabs) functions for
 the low-level display management.
 .Pp
-Currently it does not support running X.
-It can however coexist well enough with grf0 to make possible running
-X the old way, but be warned, you cannot switch screens while
-in X and when quitting it, it seems to hang.
-Switching a screen then will bring up the text console.
+The X11 server works in monochrome mode using the
+.Xr wsfb 4
+driver.
 .Pp
 It supports foreground and background color, and the hilite (bold),
 underline, and reverse text attributes.
diff -r 05bb8f00e7ef -r 7bf3ea80bc84 sys/arch/amiga/dev/amidisplaycc.c
--- a/sys/arch/amiga/dev/amidisplaycc.c Wed Oct 13 16:03:07 2021 +0000
+++ b/sys/arch/amiga/dev/amidisplaycc.c Wed Oct 13 16:07:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amidisplaycc.c,v 1.32 2018/09/03 16:29:22 riastradh Exp $ */
+/*     $NetBSD: amidisplaycc.c,v 1.32.4.1 2021/10/13 16:07:41 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.32 2018/09/03 16:29:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.32.4.1 2021/10/13 16:07:41 martin Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -116,7 +116,9 @@
 static int amidisplaycc_cmapioctl(view_t *, u_long, struct wsdisplay_cmap *);
 static int amidisplaycc_setcmap(view_t *, struct wsdisplay_cmap *);
 static int amidisplaycc_getcmap(view_t *, struct wsdisplay_cmap *);
-static int amidisplaycc_gfxscreen(struct amidisplaycc_softc *, int);
+static int amidisplaycc_setgfxview(struct amidisplaycc_softc *, int);
+static void amidisplaycc_initgfxview(struct amidisplaycc_softc *);
+static int amidisplaycc_getfbinfo(struct amidisplaycc_softc *, struct wsdisplayio_fbinfo *);
 
 static int amidisplaycc_setfont(struct amidisplaycc_screen *, const char *);
 static const struct wsdisplay_font * amidisplaycc_getbuiltinfont(void);
@@ -365,8 +367,6 @@
        int     x;
        int     y;
 
-       /* Yeah, we got the console! */
-
        /*
         * This will do the basic stuff we also need.
         */
@@ -403,11 +403,11 @@
        char *name = aux;
 
        if (matchname("amidisplaycc", name) == 0)
-               return (0);
+               return 0;
 
        /* Allow only one of us. */
        if (amidisplaycc_attached)
-               return (0);
+               return 0;
 
        return 1;
 }
@@ -542,10 +542,10 @@
 {
        if (ch > 0 && ch < 256) {
                *chp = ch;
-               return (5);
+               return 5;
        }
        *chp = ' ';
-       return (0);
+       return 0;
 }
 
 /*
@@ -1001,7 +1001,7 @@
 #endif
        *attrp = MAKEATTR(newfg, newbg, flags);
 
-       return (0);
+       return 0;
 }
 
 int
@@ -1014,7 +1014,7 @@
 
        if (adp == NULL) {
                printf("amidisplaycc_ioctl: adp==NULL\n");
-               return (EINVAL);
+               return EINVAL;
        }
 
 #define UINTDATA (*(u_int*)data)
@@ -1025,49 +1025,101 @@
        {
        case WSDISPLAYIO_GTYPE:
                UINTDATA = WSDISPLAY_TYPE_AMIGACC;
-               return (0);
+               return 0;
 
        case WSDISPLAYIO_SVIDEO:
                dprintf("amidisplaycc: WSDISPLAYIO_SVIDEO %s\n",
                        UINTDATA ? "On" : "Off");
 
-               return (amidisplaycc_setvideo(adp, UINTDATA));
+               return amidisplaycc_setvideo(adp, UINTDATA);
 
        case WSDISPLAYIO_GVIDEO:
                dprintf("amidisplaycc: WSDISPLAYIO_GVIDEO\n");
                UINTDATA = adp->ison ?
                    WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF;
 
-               return (0);
+               return 0;
 
        case WSDISPLAYIO_SMODE:
-               if (INTDATA == WSDISPLAYIO_MODE_EMUL)
-                       return amidisplaycc_gfxscreen(adp, 0);
-               if (INTDATA == WSDISPLAYIO_MODE_MAPPED)
-                       return amidisplaycc_gfxscreen(adp, 1);
-               return (EINVAL);
+               switch (INTDATA) {
+               case WSDISPLAYIO_MODE_EMUL:
+                       return amidisplaycc_setgfxview(adp, 0);
+               case WSDISPLAYIO_MODE_MAPPED:
+               case WSDISPLAYIO_MODE_DUMBFB:
+                       return amidisplaycc_setgfxview(adp, 1);
+               default:
+                       return EINVAL;
+               }
 
        case WSDISPLAYIO_GINFO:
                FBINFO.width  = adp->gfxwidth;
                FBINFO.height = adp->gfxheight;
                FBINFO.depth  = adp->gfxdepth;
                FBINFO.cmsize = 1 << FBINFO.depth;
-               return (0);
+               return 0;
 
        case WSDISPLAYIO_PUTCMAP:
        case WSDISPLAYIO_GETCMAP:
-               return (amidisplaycc_cmapioctl(adp->gfxview,
-                                              cmd,
-                                              (struct wsdisplay_cmap*)data));
+               return amidisplaycc_cmapioctl(adp->gfxview, cmd,
+                                              (struct wsdisplay_cmap*)data);
+       case WSDISPLAYIO_GET_FBINFO:
+               amidisplaycc_initgfxview(adp);
+               return amidisplaycc_getfbinfo(adp, data);
        }
 
-       return (EPASSTHROUGH);
+       return EPASSTHROUGH;
 
 #undef UINTDATA
 #undef INTDATA
 #undef FBINFO
 }
 
+static int
+amidisplaycc_getfbinfo(struct amidisplaycc_softc *adp, struct wsdisplayio_fbinfo *fbinfo)
+{
+       bmap_t *bm;
+
+       KASSERT(adp);
+
+       if (adp->gfxview == NULL) {
+               return ENOMEM;
+       }
+
+       bm = adp->gfxview->bitmap;
+       KASSERT(bm);
+
+       /* Depth 1 since current X wsfb driver doesn't support multiple bitplanes */
+       memset(fbinfo, 0, sizeof(*fbinfo));
+       fbinfo->fbi_fbsize = bm->bytes_per_row * bm->rows;
+       fbinfo->fbi_fboffset = 0;
+       fbinfo->fbi_width = bm->bytes_per_row * 8;
+       fbinfo->fbi_height = bm->rows;
+       fbinfo->fbi_stride = bm->bytes_per_row;
+       fbinfo->fbi_bitsperpixel = 1;
+       fbinfo->fbi_pixeltype = WSFB_CI;
+       fbinfo->fbi_flags = 0;
+       fbinfo->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << adp->gfxdepth;
+
+       return 0;
+}
+
+/*
+ * Initialize (but not display) the view used for graphics.
+ */
+static void
+amidisplaycc_initgfxview(struct amidisplaycc_softc *adp)
+{
+       dimen_t dimension;
+
+       if (adp->gfxview == NULL) {
+               /* First time here, create the screen */
+               dimension.width = adp->gfxwidth;
+               dimension.height = adp->gfxheight;
+               adp->gfxview = grf_alloc_view(NULL,
+                       &dimension,
+                       adp->gfxdepth);
+       }
+}
 
 /*
  * Switch to either emulation (text) or mapped (graphics) mode
@@ -1076,18 +1128,15 @@
  *
  * Once the extra screen is created, it never goes away.
  */
-
 static int
-amidisplaycc_gfxscreen(struct amidisplaycc_softc *adp, int on)
+amidisplaycc_setgfxview(struct amidisplaycc_softc *adp, int on)
 {
-       dimen_t  dimension;
-
        dprintf("amidisplaycc: switching to %s mode.\n",
                on ? "mapped" : "emul");
 
        /* Current mode same as requested mode? */
        if ( (on > 0) == (adp->gfxon > 0) )
-               return (0);
+               return 0;
 
        if (!on) {
                /*
@@ -1101,26 +1150,11 @@
                else if (adp->gfxview)
                        grf_remove_view(adp->gfxview);
 
-               return (0);
+               return 0;
        }
 
        /* switch to mapped mode then */
-
-       if (adp->gfxview == NULL) {
-               /* First time here, create the screen */
-
-               dimension.width = adp->gfxwidth;
-               dimension.height = adp->gfxheight;
-
-               dprintf("amidisplaycc: preparing mapped screen %dx%dx%d\n",
-                       dimension.width,
-                       dimension.height,
-                       adp->gfxdepth);
-
-               adp->gfxview = grf_alloc_view(NULL,
-                                             &dimension,
-                                             adp->gfxdepth);
-       }
+       amidisplaycc_initgfxview(adp);
 
        if (adp->gfxview) {
                adp->gfxon = 1;
@@ -1128,9 +1162,9 @@
                grf_display_view(adp->gfxview);
        } else {
                printf("amidisplaycc: failed to make mapped screen\n");
-               return (ENOMEM);
+               return ENOMEM;
        }
-       return (0);
+       return 0;
 }
 
 /*
@@ -1212,9 +1246,9 @@
 
        /* Sanity checks because of fixed buffers */
        if (depth > MAXDEPTH || maxcolor >= MAXCOLORS)
-               return (ENOMEM);
+               return ENOMEM;
        if (screenp->nrows > MAXROWS)
-               return (ENOMEM);
+               return ENOMEM;
 
        fontwidth = screenp->fontwidth;
        fontheight = screenp->fontheight;
@@ -1229,7 +1263,7 @@



Home | Main Index | Thread Index | Old Index