Module Name: src
Committed By: macallan
Date: Thu Jun 2 02:33:42 UTC 2011
Modified Files:
src/sys/dev/wsfb: genfb.c genfbvar.h
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/wsfb/genfbvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.40 src/sys/dev/wsfb/genfb.c:1.41
--- src/sys/dev/wsfb/genfb.c:1.40 Tue Mar 8 04:47:10 2011
+++ src/sys/dev/wsfb/genfb.c Thu Jun 2 02:33:42 2011
@@ -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
Index: src/sys/dev/wsfb/genfbvar.h
diff -u src/sys/dev/wsfb/genfbvar.h:1.19 src/sys/dev/wsfb/genfbvar.h:1.20
--- src/sys/dev/wsfb/genfbvar.h:1.19 Wed Feb 9 13:19:19 2011
+++ src/sys/dev/wsfb/genfbvar.h Thu Jun 2 02:33:42 2011
@@ -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);