Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wsfb some steps to make multiple instances work:



details:   https://anonhg.NetBSD.org/src/rev/e9df49c6d157
branches:  trunk
changeset: 765672:e9df49c6d157
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Jun 02 02:33:42 2011 +0000

description:
some steps to make multiple instances work:
- don't bail if we're not the console. If we get the right paramters there is no
  reason not to work
- move wsdisplay_accessops into the softc
- call wsdisplay_cnattach only if we're the console

diffstat:

 sys/dev/wsfb/genfb.c    |  38 +++++++++++++-------------------------
 sys/dev/wsfb/genfbvar.h |   5 +++--
 2 files changed, 16 insertions(+), 27 deletions(-)

diffs (120 lines):

diff -r 319fd0e6549b -r e9df49c6d157 sys/dev/wsfb/genfb.c
--- a/sys/dev/wsfb/genfb.c      Thu Jun 02 01:04:18 2011 +0000
+++ b/sys/dev/wsfb/genfb.c      Thu Jun 02 02:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $ */
+/*     $NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.40 2011/03/08 04:47:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.41 2011/06/02 02:33:42 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,17 +85,6 @@
 static int genfb_cnattach_called = 0;
 static int genfb_enabled = 1;
 
-struct wsdisplay_accessops genfb_accessops = {
-       genfb_ioctl,
-       genfb_mmap,
-       NULL,   /* alloc_screen */
-       NULL,   /* free_screen */
-       NULL,   /* show_screen */
-       NULL,   /* load_font */
-       NULL,   /* pollc */
-       NULL    /* scroll */
-};
-
 static struct genfb_softc *genfb_softc = NULL;
 
 void
@@ -217,14 +206,8 @@
            == false)
                sc->sc_want_clear = true;
 
-       /* do not attach when we're not console */
-       if (!console) {
-               aprint_normal_dev(sc->sc_dev, "no console, unable to continue\n");
-               return -1;
-       }
-
-       aprint_verbose_dev(sc->sc_dev, "framebuffer at %p, size %dx%d, depth %d, "
-           "stride %d\n",
+       aprint_verbose_dev(sc->sc_dev, "framebuffer at %p, size %dx%d,"
+           "depth %d, stride %d\n",
            sc->sc_fboffset ? (void *)(intptr_t)sc->sc_fboffset : sc->sc_fbaddr,
            sc->sc_width, sc->sc_height, sc->sc_depth, sc->sc_stride);
 
@@ -243,6 +226,9 @@
        if (sc->sc_modecb != NULL)
                sc->sc_modecb->gmc_setmode(sc, sc->sc_mode);
 
+       sc->sc_accessops.ioctl = genfb_ioctl;
+       sc->sc_accessops.mmap = genfb_mmap;
+
 #ifdef GENFB_SHADOWFB
        sc->sc_shadowfb = kmem_alloc(sc->sc_fbsize, KM_SLEEP);
        if (sc->sc_want_clear == false && sc->sc_shadowfb != NULL)
@@ -250,7 +236,7 @@
 #endif
 
        vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr,
-           &genfb_accessops);
+           &sc->sc_accessops);
        sc->vd.init_screen = genfb_init_screen;
 
        /* Do not print anything between this point and the screen
@@ -275,8 +261,10 @@
        sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
        sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
        sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
-       wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, crow,
-           defattr);
+
+       if (console)
+               wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, crow,
+                   defattr);
 
        /* Clear the whole screen to bring it to a known state. */
        if (sc->sc_want_clear)
@@ -331,7 +319,7 @@
 
        aa.console = console;
        aa.scrdata = &sc->sc_screenlist;
-       aa.accessops = &genfb_accessops;
+       aa.accessops = &sc->sc_accessops;
        aa.accesscookie = &sc->vd;
 
 #ifdef GENFB_DISABLE_TEXT
diff -r 319fd0e6549b -r e9df49c6d157 sys/dev/wsfb/genfbvar.h
--- a/sys/dev/wsfb/genfbvar.h   Thu Jun 02 01:04:18 2011 +0000
+++ b/sys/dev/wsfb/genfbvar.h   Thu Jun 02 02:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $ */
+/*     $NetBSD: genfbvar.h,v 1.20 2011/06/02 02:33:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.20 2011/06/02 02:33:42 macallan Exp $");
 
 #ifndef GENFBVAR_H
 #define GENFBVAR_H
@@ -109,6 +109,7 @@
 #ifdef SPLASHSCREEN
        struct splash_info sc_splash;
 #endif
+       struct wsdisplay_accessops sc_accessops;
 };
 
 void   genfb_cnattach(void);



Home | Main Index | Thread Index | Old Index