Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga/dev Improved wscons support. Virtual screens ...



details:   https://anonhg.NetBSD.org/src/rev/98a295cc450f
branches:  trunk
changeset: 811604:98a295cc450f
user:      phx <phx%NetBSD.org@localhost>
date:      Sat Nov 07 14:29:10 2015 +0000

description:
Improved wscons support. Virtual screens are now working.

diffstat:

 sys/arch/amiga/dev/grf.c      |  324 ++++++++++-------------------------------
 sys/arch/amiga/dev/grf_cv.c   |   93 +++++++++--
 sys/arch/amiga/dev/grf_cv3d.c |   99 +++++++++---
 sys/arch/amiga/dev/grfvar.h   |   17 +-
 sys/arch/amiga/dev/grfws.h    |   73 ---------
 5 files changed, 233 insertions(+), 373 deletions(-)

diffs (truncated from 899 to 300 lines):

diff -r ea13f2ee2b12 -r 98a295cc450f sys/arch/amiga/dev/grf.c
--- a/sys/arch/amiga/dev/grf.c  Sat Nov 07 14:21:32 2015 +0000
+++ b/sys/arch/amiga/dev/grf.c  Sat Nov 07 14:29:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: grf.c,v 1.62 2014/07/25 08:10:31 dholland Exp $ */
+/*     $NetBSD: grf.c,v 1.63 2015/11/07 14:29:10 phx Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.62 2014/07/25 08:10:31 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.63 2015/11/07 14:29:10 phx Exp $");
 
 /*
  * Graphics display driver for the Amiga
@@ -76,7 +76,6 @@
 #include <amiga/amiga/color.h> /* DEBUG */
 #include <amiga/amiga/device.h>
 #include <amiga/dev/grfioctl.h>
-#include <amiga/dev/grfws.h>
 #include <amiga/dev/grfvar.h>
 #include <amiga/dev/itevar.h>
 #include <amiga/dev/kbdvar.h>
@@ -182,11 +181,11 @@
        grfsp[gp->g_unit] = gp;
 
        /*
-        * find our major device number
+        * find our major device number, make device
         */
        maj = cdevsw_lookup_major(&grf_cdevsw);
+       gp->g_grfdev = makedev(maj, gp->g_unit);
 
-       gp->g_grfdev = makedev(maj, gp->g_unit);
        if (self != NULL) {
                printf(": width %d height %d", gp->g_display.gd_dwidth,
                    gp->g_display.gd_dheight);
@@ -194,23 +193,25 @@
                        printf(" monochrome\n");
                else
                        printf(" colors %d\n", gp->g_display.gd_colors);
+
 #if NWSDISPLAY > 0
-               vcons_init(&gp->g_vd, gp, gp->g_screens[0], gp->g_accessops);
+               vcons_init(&gp->g_vd, gp, gp->g_defaultscr, gp->g_accessops);
                gp->g_vd.init_screen = grf_init_screen;
+
                if (gp->g_flags & GF_CONSOLE) {
                        console_vcons.scr_flags |= VCONS_SCREEN_IS_STATIC;
                        vcons_init_screen(&gp->g_vd,
                            &console_vcons, 1, &defattr);
-                       gp->g_screens[0]->textops =
+                       gp->g_defaultscr->textops =
                            &console_vcons.scr_ri.ri_ops;
-                       wsdisplay_cnattach(gp->g_screens[0],
+                       wsdisplay_cnattach(gp->g_defaultscr,
                            &console_vcons.scr_ri, 0, 0, defattr);
                        vcons_replay_msgbuf(&console_vcons);
                }
 
                /* attach wsdisplay */
                wa.console = (gp->g_flags & GF_CONSOLE) != 0;
-               wa.scrdata = &gp->g_screenlist;
+               wa.scrdata = gp->g_scrlist;
                wa.accessops = gp->g_accessops;
                wa.accesscookie = &gp->g_vd;
                config_found(self, &wa, wsemuldisplaydevprint);
@@ -477,16 +478,17 @@
                gp = grfsp[unit];
                if (gp != NULL && (gp->g_flags & GF_ALIVE)) {
                        gp->g_flags |= GF_CONSOLE;  /* we are console! */
-                       gp->g_screens[0]->ncols = gp->g_display.gd_fbwidth /
-                           gp->g_screens[0]->fontwidth;
-                       gp->g_screens[0]->nrows = gp->g_display.gd_fbheight /
-                           gp->g_screens[0]->fontheight;
+
+                       gp->g_defaultscr->ncols = gp->g_display.gd_fbwidth /
+                           gp->g_defaultscr->fontwidth;
+                       gp->g_defaultscr->nrows = gp->g_display.gd_fbheight /
+                           gp->g_defaultscr->fontheight;
 
                        ri = grf_setup_rasops(gp, &console_vcons);
                        console_vcons.scr_cookie = gp;
                        defattr = 0;  /* XXX */
 
-                       wsdisplay_preattach(gp->g_screens[0], ri, 0, 0,
+                       wsdisplay_preattach(gp->g_defaultscr, ri, 0, 0,
                            defattr);
 #if NKBD > 0
                        /* tell kbd device it is used as console keyboard */
@@ -519,8 +521,8 @@
        scr->scr_flags |= VCONS_DONT_READ;
        memset(ri, 0, sizeof(struct rasops_info));
 
-       ri->ri_rows = gp->g_screens[0]->nrows;
-       ri->ri_cols = gp->g_screens[0]->ncols;
+       ri->ri_rows = gp->g_defaultscr->nrows;
+       ri->ri_cols = gp->g_defaultscr->ncols;
        ri->ri_hw = scr;
        ri->ri_ops.cursor    = gp->g_emulops->cursor;
        ri->ri_ops.mapchar   = gp->g_emulops->mapchar;
@@ -538,6 +540,66 @@
        return ri;
 }
 
+/*
+ * Called as fallback for ioctls which are not handled by the specific
+ * grf driver.
+ */
+int
+grf_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
+{
+       struct wsdisplayio_fbinfo *iofbi;
+       struct wsdisplay_fbinfo *fbinfo;
+       struct vcons_data *vd;
+       struct grf_softc *gp;
+       struct vcons_screen *scr;
+       struct grfinfo *gi;
+
+       vd = v;
+       gp = vd->cookie;
+       scr = vd->active;
+
+       switch (cmd) {
+       case WSDISPLAYIO_GET_FBINFO:
+               if (scr != NULL) {
+                       iofbi = data;
+                       return wsdisplayio_get_fbinfo(&scr->scr_ri, iofbi);
+               }
+               return ENODEV;
+
+       case WSDISPLAYIO_GINFO:
+               if (scr != NULL) {
+                       fbinfo = (struct wsdisplay_fbinfo *)data;
+                       gi = &gp->g_display;
+
+                       /*
+                        * We should return truth about the current mode here,
+                        * because X11 wsfb driver depends on this!
+                        */
+                       fbinfo->height = gi->gd_fbheight;
+                       fbinfo->width = gi->gd_fbwidth;
+                       fbinfo->depth = gi->gd_planes;
+                       fbinfo->cmsize = gi->gd_colors;
+                       return 0;
+               }
+               return ENODEV;
+
+       case WSDISPLAYIO_GTYPE:
+               *(u_int *)data = WSDISPLAY_TYPE_GRF;
+               return 0;
+
+       case WSDISPLAYIO_SMODE:
+               if ((*(int *)data) != gp->g_wsmode) {
+                       gp->g_wsmode = *(int *)data;
+                       if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL &&
+                           scr != NULL)
+                               vcons_redraw_screen(scr);
+               } 
+               return 0;
+       }
+
+       return EPASSTHROUGH;
+}
+
 paddr_t
 grf_wsmmap(void *v, void *vs, off_t off, int prot)
 {
@@ -582,236 +644,6 @@
 #endif
 }
 
-int
-grf_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
-{
-       struct vcons_data *vd;
-       struct grf_softc *gp;
-
-       vd = v;
-       gp = vd->cookie;
-
-       switch (cmd) {
-       /* XXX: check if ptr to implementation is not null */
-       case WSDISPLAYIO_GINFO:
-               return gp->g_wsioctl->ginfo(gp, data);
-       case WSDISPLAYIO_SMODE:
-               return gp->g_wsioctl->smode(gp, data);
-       case WSDISPLAYIO_GMODE:
-               return gp->g_wsioctl->gmode(gp, data);
-       case WSDISPLAYIO_GTYPE:
-               return gp->g_wsioctl->gtype(gp, data);
-       case WSDISPLAYIO_SVIDEO:
-               return gp->g_wsioctl->svideo(gp, data);
-       case WSDISPLAYIO_GVIDEO:
-               return gp->g_wsioctl->gvideo(gp, data);
-       case WSDISPLAYIO_GETCMAP:
-               return gp->g_wsioctl->getcmap(gp, data);
-       case WSDISPLAYIO_PUTCMAP:
-               return gp->g_wsioctl->putcmap(gp, data);
-       }
-
-       return EPASSTHROUGH;
-}
-
-/* wsdisplay_accessops ioctls */
-
-int 
-grf_wsaogetcmap(void *c, void *data) 
-{
-       u_int index, count;
-       struct grf_softc *gp;
-       struct wsdisplay_cmap *cm __unused;
-
-       cm = (struct wsdisplay_cmap*) data;
-       gp = c;
-       index = 0;
-       count = 0;
-
-       if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL)
-               return EINVAL;
-
-       if (index >= 255 || count > 256 || index + count > 256)
-               return EINVAL;
-
-       /* 
-        * TODO: copyout values for r, g, b. This function should be 
-        * driver-specific... 
-        */
-
-       return 0;
-}
-
-int
-grf_wsaoputcmap(void *c, void *data)
-{
-       /*
-        * We probably couldn't care less about color map in MODE_EMUL,
-        * I don't know about X11 yet. Also, these ioctls could be used by
-        * fullscreen console programs (think wsdisplay picture viewer, or
-        * the wsimgshow tool written by Yasushi Oshima).
-        */
-       struct grf_softc *gp;
-
-       gp = c;
-
-       if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL)
-               return EINVAL;
-       /* ... */
-
-       return 0;
-}
-
-int
-grf_wsaosvideo(void *c, void *data)
-{
-#if 0
-       struct grf_softc *gp;
-       dev_t dev; 
-       int rv;
-
-       gp = c;
-       dev = (dev_t) &gp->g_grfdev;
-
-       if (*(u_int *)data == WSDISPLAYIO_VIDEO_OFF) {
-               if ((gp->g_flags & GF_GRFON) == 0)
-                       rv = 0;
-               else {
-                       gp->g_flags &= ~GF_GRFON;
-                       rv = gp->g_mode(gp, (dev & GRFOVDEV) ? 
-                           GM_GRFOVOFF : GM_GRFOFF, NULL, 0, 0);
-               }
-
-       } else {
-               if ((gp->g_flags & GF_GRFON))
-                       rv = 0;
-               else
-                       gp->g_flags |= GF_GRFON;
-                       rv = gp->g_mode(gp, (dev & GRFOVDEV) ? 
-                           GM_GRFOVON : GM_GRFON, NULL, 0, 0);
-       }
-
-       return rv;
-#endif
-       return 0;
-}
-
-int
-grf_wsaogvideo(void *c, void *data) 
-{
-       struct grf_softc *gp;
-
-       gp = c;
-
-       if(gp->g_flags & GF_GRFON) 
-               *(u_int *)data = WSDISPLAYIO_VIDEO_ON;
-       else
-               *(u_int *)data = WSDISPLAYIO_VIDEO_OFF;



Home | Main Index | Thread Index | Old Index