Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode Replace the SDL based genfb driver with a ...



details:   https://anonhg.NetBSD.org/src/rev/f270c95e2283
branches:  trunk
changeset: 772318:f270c95e2283
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Dec 29 21:22:49 2011 +0000

description:
Replace the SDL based genfb driver with a wsdisplay and wskbd driver that
implements the VNC (RFB) protocol.

To enable the VNC server, add 'vnc=640x480,5900' to the kernel command line
(where 640x480 is the desired fb resolution and 5900 is the TCP port).

Screenshot of it here: http://www.netbsd.org/~jmcneill/usermode.tiff

diffstat:

 sys/arch/usermode/conf/GENERIC.common    |   16 +-
 sys/arch/usermode/conf/Makefile.usermode |   23 +-
 sys/arch/usermode/conf/files.usermode    |    9 +-
 sys/arch/usermode/dev/genfb_thunkbus.c   |  156 ---------
 sys/arch/usermode/dev/mainbus.c          |   24 +-
 sys/arch/usermode/dev/vncfb.c            |  500 +++++++++++++++++++++++++++++++
 sys/arch/usermode/dev/vnckbdmap.c        |  221 +++++++++++++
 sys/arch/usermode/include/mainbus.h      |    9 +-
 sys/arch/usermode/include/thunk.h        |   49 ++-
 sys/arch/usermode/usermode/machdep.c     |   39 +-
 sys/arch/usermode/usermode/thunk.c       |  294 ++++++++++++++++++-
 11 files changed, 1122 insertions(+), 218 deletions(-)

diffs (truncated from 1595 to 300 lines):

diff -r 82bf30aae670 -r f270c95e2283 sys/arch/usermode/conf/GENERIC.common
--- a/sys/arch/usermode/conf/GENERIC.common     Thu Dec 29 20:50:06 2011 +0000
+++ b/sys/arch/usermode/conf/GENERIC.common     Thu Dec 29 21:22:49 2011 +0000
@@ -1,14 +1,14 @@
-# $NetBSD: GENERIC.common,v 1.6 2011/12/27 18:24:41 jmcneill Exp $
+# $NetBSD: GENERIC.common,v 1.7 2011/12/29 21:22:49 jmcneill Exp $
 
 include "arch/usermode/conf/std.usermode"
 
 options        INCLUDE_CONFIG_FILE
-#ident                 "GENERIC-$Revision: 1.6 $"
+#ident                 "GENERIC-$Revision: 1.7 $"
 maxusers       32
 
 makeoptions    DEBUG="-O1 -g3"
 
-options        SYMTAB_SPACE=300000
+options        SYMTAB_SPACE=310000
 
 options        RTC_OFFSET=0
 options        KTRACE
@@ -56,9 +56,13 @@
 vaudio0                at mainbus?
 audio0         at vaudio0
 
-#options               SDL
-#genfb0                at thunkbus?
-#wsdisplay0    at genfb?
+vncfb0         at thunkbus?
+wsdisplay0     at vncfb?
+wskbd0         at vncfb?
+options        WSEMUL_VT100
+options        WS_KERNEL_FG=WSCOL_GREEN
+options                WSKBD_DEFAULT_KEYREPEAT_DEL1=1000
+options                WSKBD_DEFAULT_KEYREPEAT_DELN=200
 
 pseudo-device  loop
 pseudo-device  pty
diff -r 82bf30aae670 -r f270c95e2283 sys/arch/usermode/conf/Makefile.usermode
--- a/sys/arch/usermode/conf/Makefile.usermode  Thu Dec 29 20:50:06 2011 +0000
+++ b/sys/arch/usermode/conf/Makefile.usermode  Thu Dec 29 21:22:49 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.usermode,v 1.25 2011/12/20 21:01:39 jmcneill Exp $
+# $NetBSD: Makefile.usermode,v 1.26 2011/12/29 21:22:49 jmcneill Exp $
 
 OPT_CPU_HOST=                  %CPU_HOST%
 .if !empty(OPT_CPU_HOST)
@@ -37,16 +37,7 @@
 CPPFLAGS+=     -Dusermode
 CPPFLAGS.init_main.c+= -Dmain=kernmain
 
-OPT_SDL=       %SDL%
-
-.if !empty(OPT_SDL)
-SDL_CFLAGS!=   sdl-config --cflags
-SDL_LIBS!=     sdl-config --libs
-USERMODE_LIBS+=        -Wl,-Bdynamic ${SDL_LIBS}
-.endif
-
 CPPFLAGS.thunk.c+=     ${USERMODE_CPPFLAGS}
-CPPFLAGS.thunk_sdl.c+= ${SDL_CFLAGS} ${USERMODE_CPPFLAGS}
 
 ##
 ## (3) libkern and compat
@@ -61,11 +52,6 @@
 MD_CFILES=     ${USERMODE}/usermode/thunk.c
 MD_SFILES=
 
-.if !empty(OPT_SDL)
-MD_OBJS+=      thunk_sdl.o
-MD_CFILES+=    ${USERMODE}/usermode/thunk_sdl.c
-.endif
-
 ##
 ## (5) link settings
 ##
@@ -98,13 +84,6 @@
 thunk.o: ${USERMODE}/usermode/thunk.c
        ${CC} ${CPPFLAGS.thunk.c} -c -o $@ ${USERMODE}/usermode/thunk.c
 
-thunk_sdl.d: ${USERMODE}/usermode/thunk.c
-       ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
-           ${CPPFLAGS.thunk_sdl.c} ${USERMODE}/usermode/thunk_sdl.c
-
-thunk_sdl.o: ${USERMODE}/usermode/thunk_sdl.c
-       ${CC} ${CPPFLAGS.thunk_sdl.c} -c -o $@ ${USERMODE}/usermode/thunk_sdl.c
-
 ##
 ## (7) misc settings
 ##
diff -r 82bf30aae670 -r f270c95e2283 sys/arch/usermode/conf/files.usermode
--- a/sys/arch/usermode/conf/files.usermode     Thu Dec 29 20:50:06 2011 +0000
+++ b/sys/arch/usermode/conf/files.usermode     Thu Dec 29 21:22:49 2011 +0000
@@ -1,10 +1,9 @@
-# $NetBSD: files.usermode,v 1.14 2011/12/26 21:06:42 jmcneill Exp $
+# $NetBSD: files.usermode,v 1.15 2011/12/29 21:22:49 jmcneill Exp $
 
 maxpartitions 8
 maxusers 8 16 64
 
 defparam opt_memsize.h                         MEMSIZE
-defflag opt_sdl.h                              SDL
 defflag opt_cpu.h                              CPU_DEBUG
 defparam opt_cpu.h                             CPU_HOST
 defparam opt_misc.h                            TEXTADDR
@@ -38,8 +37,10 @@
 attach ld at thunkbus with ld_thunkbus
 file   arch/usermode/dev/ld_thunkbus.c         ld_thunkbus
 
-attach genfb at thunkbus with genfb_thunkbus
-file   arch/usermode/dev/genfb_thunkbus.c      genfb_thunkbus
+device vncfb { } : wsemuldisplaydev, rasops32, vcons, wskbddev
+attach vncfb at thunkbus
+file   arch/usermode/dev/vncfb.c               vncfb
+file   arch/usermode/dev/vnckbdmap.c           vncfb
 
 file   arch/usermode/usermode/copy.c
 file   arch/usermode/usermode/intr.c
diff -r 82bf30aae670 -r f270c95e2283 sys/arch/usermode/dev/genfb_thunkbus.c
--- a/sys/arch/usermode/dev/genfb_thunkbus.c    Thu Dec 29 20:50:06 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/* $NetBSD: genfb_thunkbus.c,v 1.1 2011/08/25 11:45:25 jmcneill Exp $ */
-
-/*-
- * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_thunkbus.c,v 1.1 2011/08/25 11:45:25 jmcneill Exp $");
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <dev/wsfb/genfbvar.h>
-
-#include <machine/mainbus.h>
-#include <machine/thunk.h>
-
-#ifdef _KERNEL_OPT
-#include "opt_sdl.h"
-#endif
-
-#if !defined(SDL)
-#error genfb_thunkbus requires options SDL
-#endif
-
-#define GENFB_THUNKBUS_WIDTH   640
-#define        GENFB_THUNKBUS_HEIGHT   480
-#define        GENFB_THUNKBUS_DEPTH    32
-#define        GENFB_THUNKBUS_FBSIZE   \
-       (GENFB_THUNKBUS_WIDTH * GENFB_THUNKBUS_HEIGHT * (GENFB_THUNKBUS_DEPTH / 8))
-
-static int     genfb_thunkbus_match(device_t, cfdata_t, void *);
-static void    genfb_thunkbus_attach(device_t, device_t, void *);
-static int     genfb_thunkbus_ioctl(void *, void *, u_long, void *, int, lwp_t *);
-static paddr_t genfb_thunkbus_mmap(void *, void *, off_t, int);
-
-int            genfb_thunkbus_cnattach(void);
-
-struct genfb_thunkbus_softc {
-       struct genfb_softc      sc_gen;
-};
-
-static void *  genfb_thunkbus_fbaddr;
-
-CFATTACH_DECL_NEW(genfb_thunkbus, sizeof(struct genfb_thunkbus_softc),
-    genfb_thunkbus_match, genfb_thunkbus_attach, NULL, NULL);
-
-static int
-genfb_thunkbus_match(device_t parent, cfdata_t match, void *opaque)
-{
-       struct thunkbus_attach_args *taa = opaque;
-
-       if (taa->taa_type != THUNKBUS_TYPE_GENFB)
-               return 0;
-
-       if (thunk_getenv("DISPLAY") == NULL)
-               return 0;
-
-       return 1;
-}
-
-static void
-genfb_thunkbus_attach(device_t parent, device_t self, void *opaque)
-{
-       struct genfb_thunkbus_softc *sc = device_private(self);
-       struct genfb_ops ops;
-       prop_dictionary_t dict = device_properties(self);
-
-       aprint_naive("\n");
-       aprint_normal("\n");
-
-       sc->sc_gen.sc_dev = self;
-       sc->sc_gen.sc_fbaddr = genfb_thunkbus_fbaddr;
-
-       prop_dictionary_set_bool(dict, "is_console", true);
-       prop_dictionary_set_uint32(dict, "width", GENFB_THUNKBUS_WIDTH);
-       prop_dictionary_set_uint32(dict, "height", GENFB_THUNKBUS_HEIGHT);
-       prop_dictionary_set_uint8(dict, "depth", GENFB_THUNKBUS_DEPTH);
-       prop_dictionary_set_uint16(dict, "linebytes",
-           GENFB_THUNKBUS_WIDTH * (GENFB_THUNKBUS_DEPTH / 8));
-       prop_dictionary_set_uint64(dict, "address", 0);
-       prop_dictionary_set_uint64(dict, "virtual_address",
-           (vaddr_t)sc->sc_gen.sc_fbaddr);
-
-       genfb_init(&sc->sc_gen);
-
-       memset(&ops, 0, sizeof(ops));
-       ops.genfb_ioctl = genfb_thunkbus_ioctl;
-       ops.genfb_mmap = genfb_thunkbus_mmap;
-
-       if (genfb_attach(&sc->sc_gen, &ops) != 0)
-               panic("%s: couldn't attach genfb", __func__);
-
-}
-
-static int
-genfb_thunkbus_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l)
-{
-       switch (cmd) {
-       case WSDISPLAYIO_GTYPE:
-               *(unsigned int *)data = WSDISPLAY_TYPE_UNKNOWN;
-               return 0;
-       }
-
-       return EPASSTHROUGH;
-}
-
-static paddr_t
-genfb_thunkbus_mmap(void *v, void *vs, off_t off, int prot)
-{
-       return -1;
-}
-
-int
-genfb_thunkbus_cnattach(void)
-{
-       int error;
-
-       if (thunk_getenv("DISPLAY") == NULL)
-               return 0;
-
-       genfb_thunkbus_fbaddr = thunk_sdl_getfb(GENFB_THUNKBUS_FBSIZE);
-       if (genfb_thunkbus_fbaddr == NULL)
-               return 0;
-
-       error = thunk_sdl_init(GENFB_THUNKBUS_WIDTH,
-           GENFB_THUNKBUS_HEIGHT, GENFB_THUNKBUS_DEPTH);
-       if (error)
-               return 0;
-
-       return 1;
-}
diff -r 82bf30aae670 -r f270c95e2283 sys/arch/usermode/dev/mainbus.c
--- a/sys/arch/usermode/dev/mainbus.c   Thu Dec 29 20:50:06 2011 +0000
+++ b/sys/arch/usermode/dev/mainbus.c   Thu Dec 29 21:22:49 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.7 2011/12/26 21:06:42 jmcneill Exp $ */
+/* $NetBSD: mainbus.c,v 1.8 2011/12/29 21:22:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -26,12 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifdef _KERNEL_OPT
-#include "opt_sdl.h"
-#endif
-
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2011/12/26 21:06:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2011/12/29 21:22:49 jmcneill Exp $");
 
 #include <sys/param.h>



Home | Main Index | Thread Index | Old Index