Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/arch/luna68k Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/781043842362
branches: netbsd-6
changeset: 776780:781043842362
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Sun Nov 09 07:34:12 2014 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
diffstat:
sys/arch/luna68k/conf/GENERIC | 5 +-
sys/arch/luna68k/conf/files.luna68k | 4 +-
sys/arch/luna68k/dev/lunafb.c | 163 ++++++++------
sys/arch/luna68k/dev/lunaws.c | 173 ++++------------
sys/arch/luna68k/dev/omkbdmap.c | 303 ++++++++++++++++++++++++++++
sys/arch/luna68k/dev/omkbdmap.h | 23 ++
sys/arch/luna68k/dev/omrasops.c | 377 +++++++++++++++++++++--------------
sys/arch/luna68k/dev/omrasopsvar.h | 87 ++++++--
8 files changed, 756 insertions(+), 379 deletions(-)
diffs (truncated from 1729 to 300 lines):
diff -r e525b1841a63 -r 781043842362 sys/arch/luna68k/conf/GENERIC
--- a/sys/arch/luna68k/conf/GENERIC Sun Nov 09 07:09:17 2014 +0000
+++ b/sys/arch/luna68k/conf/GENERIC Sun Nov 09 07:34:12 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97.2.2 2014/01/12 12:08:36 bouyer Exp $
+# $NetBSD: GENERIC,v 1.97.2.3 2014/11/09 07:34:12 msaitoh Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.97.2.2 $"
+#ident "GENERIC-$Revision: 1.97.2.3 $"
maxusers 8
@@ -138,6 +138,7 @@
# WS console uses SUN or VT100 terminal emulation
options WSEMUL_VT100
+options WSDISPLAY_COMPAT_RAWKBD
options FONT_OMRON12x20
config netbsd root on ? type ?
diff -r e525b1841a63 -r 781043842362 sys/arch/luna68k/conf/files.luna68k
--- a/sys/arch/luna68k/conf/files.luna68k Sun Nov 09 07:09:17 2014 +0000
+++ b/sys/arch/luna68k/conf/files.luna68k Sun Nov 09 07:34:12 2014 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: files.luna68k,v 1.23 2011/11/15 13:25:44 tsutsui Exp $
+# $NetBSD: files.luna68k,v 1.23.6.1 2014/11/09 07:34:12 msaitoh Exp $
#
maxpartitions 8
maxusers 2 8 64
@@ -42,9 +42,11 @@
device siotty: tty
attach siotty at sio
file arch/luna68k/dev/siotty.c siotty needs-flag
+
device ws: wskbddev,wsmousedev
attach ws at sio
file arch/luna68k/dev/lunaws.c ws
+file arch/luna68k/dev/omkbdmap.c ws
device fb: wsemuldisplaydev
attach fb at mainbus
diff -r e525b1841a63 -r 781043842362 sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c Sun Nov 09 07:09:17 2014 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c Sun Nov 09 07:34:12 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.25.8.2 2014/01/12 12:25:03 bouyer Exp $ */
+/* $NetBSD: lunafb.c,v 1.25.8.3 2014/11/09 07:34:12 msaitoh Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,14 +31,14 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.25.8.2 2014/01/12 12:25:03 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.25.8.3 2014/11/09 07:34:12 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/mman.h>
#include <sys/proc.h>
#include <sys/tty.h>
@@ -75,11 +75,8 @@
};
#define OMFB_RFCNT 0xB1000000 /* video h-origin/v-origin */
-#define OMFB_PLANEMASK 0xB1040000 /* planemask register */
-#define OMFB_FB_WADDR 0xB1080008 /* common plane */
-#define OMFB_FB_RADDR 0xB10C0008 /* plane #0 */
-#define OMFB_ROPFUNC 0xB12C0000 /* ROP function code */
#define OMFB_RAMDAC 0xC1100000 /* Bt454/Bt458 RAMDAC */
+
#define OMFB_SIZE (0xB1300000 - 0xB1080000 + PAGE_SIZE)
struct hwcmap {
@@ -126,13 +123,15 @@
struct omfb_softc {
device_t sc_dev; /* base device */
struct om_hwdevconfig *sc_dc; /* device configuration */
- int nscreens;
+ int sc_nscreens;
+ int sc_mode;
};
static int omgetcmap(struct omfb_softc *, struct wsdisplay_cmap *);
static int omsetcmap(struct omfb_softc *, struct wsdisplay_cmap *);
static struct om_hwdevconfig omfb_console_dc;
+static void omfb_resetcmap(struct om_hwdevconfig *);
static void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *);
static struct wsscreen_descr omfb_stdscreen = {
@@ -156,12 +155,14 @@
void (*) (void *, int, int), void *);
static const struct wsdisplay_accessops omfb_accessops = {
- omfbioctl,
- omfbmmap,
- omfb_alloc_screen,
- omfb_free_screen,
- omfb_show_screen,
- 0 /* load_font */
+ .ioctl = omfbioctl,
+ .mmap = omfbmmap,
+ .alloc_screen = omfb_alloc_screen,
+ .free_screen = omfb_free_screen,
+ .show_screen = omfb_show_screen,
+ .load_font = NULL,
+ .pollc = NULL,
+ .scroll = NULL
};
static int omfbmatch(device_t, cfdata_t, void *);
@@ -202,15 +203,16 @@
if (omfb_console) {
sc->sc_dc = &omfb_console_dc;
- sc->nscreens = 1;
+ sc->sc_nscreens = 1;
} else {
- sc->sc_dc = malloc(sizeof(struct om_hwdevconfig),
- M_DEVBUF, M_WAITOK | M_ZERO);
+ sc->sc_dc = kmem_zalloc(sizeof(struct om_hwdevconfig),
+ KM_SLEEP);
omfb_getdevconfig(OMFB_FB_WADDR, sc->sc_dc);
}
aprint_normal(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
sc->sc_dc->dc_depth);
+ sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
waa.console = omfb_console;
waa.scrdata = &omfb_screenlist;
waa.accessops = &omfb_accessops;
@@ -238,6 +240,7 @@
{
struct omfb_softc *sc = v;
struct om_hwdevconfig *dc = sc->sc_dc;
+ int new_mode;
switch (cmd) {
case WSDISPLAYIO_GTYPE:
@@ -263,6 +266,15 @@
case WSDISPLAYIO_PUTCMAP:
return omsetcmap(sc, (struct wsdisplay_cmap *)data);
+ case WSDISPLAYIO_SMODE:
+ new_mode = *(int *)data;
+ if (new_mode != sc->sc_mode) {
+ sc->sc_mode = new_mode;
+ if (new_mode == WSDISPLAYIO_MODE_EMUL)
+ omfb_resetcmap(dc);
+ }
+ return 0;
+
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_GVIDEO:
case WSDISPLAYIO_GCURPOS:
@@ -286,13 +298,21 @@
struct om_hwdevconfig *dc = sc->sc_dc;
paddr_t cookie = -1;
-#if 0 /* XXX: quick workaround to make X.Org mono server work */
- if (offset >= 0 && offset < OMFB_SIZE)
- cookie = m68k_btop(m68k_trunc_page(dc->dc_videobase) + offset);
-#else
- if (offset >= 0 && offset < dc->dc_rowbytes * dc->dc_ht * dc->dc_depth)
- cookie = m68k_btop(m68k_trunc_page(OMFB_FB_RADDR) + offset);
+ switch (sc->sc_mode) {
+#if 0
+ case WSDISPLAYIO_MODE_MAPPED:
+ if (offset >= 0 && offset < OMFB_SIZE)
+ cookie = m68k_btop(m68k_trunc_page(dc->dc_videobase) +
+ offset);
+ break;
#endif
+ case WSDISPLAYIO_MODE_DUMBFB:
+ if (offset >= 0 &&
+ offset < dc->dc_rowbytes * dc->dc_ht * dc->dc_depth)
+ cookie = m68k_btop(m68k_trunc_page(OMFB_FB_RADDR) +
+ offset);
+ break;
+ }
return cookie;
}
@@ -362,42 +382,10 @@
}
static void
-omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
+omfb_resetcmap(struct om_hwdevconfig *dc)
{
- int bpp, i;
- struct rasops_info *ri;
- union {
- struct { short h, v; } p;
- uint32_t u;
- } rfcnt;
+ int i;
- switch (hwplanemask) {
- case 0xff:
- bpp = 8; /* XXX check monochrome bit in DIPSW */
- break;
- default:
- case 0x0f:
-#if 1
- /*
- * XXX
- * experiment resulted in WHITE on SKYBLUE after Xorg server
- * touches pallete. Disable 4bpp for now.
- */
- bpp = 4; /* XXX check monochrome bit in DIPSW */
- break;
-#endif
- case 1:
- bpp = 1;
- break;
- }
- dc->dc_wid = 1280;
- dc->dc_ht = 1024;
- dc->dc_depth = bpp;
- dc->dc_rowbytes = 2048 / 8;
- dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
- dc->dc_videobase = paddr;
-
- /* WHITE on BLACK */
if (hwplanemask == 0x01) {
struct bt454 *odac = (struct bt454 *)OMFB_RAMDAC;
@@ -431,7 +419,11 @@
} else if (hwplanemask == 0xff) {
struct bt458 *ndac = (struct bt458 *)OMFB_RAMDAC;
- /* Initialize the Bt458 */
+ /*
+ * Initialize the Bt458. When we write to control registers,
+ * the address is not incremented automatically. So we specify
+ * it ourselves for each control register.
+ */
ndac->bt_addr = 0x04;
ndac->bt_ctrl = 0xff; /* all planes will be read */
ndac->bt_addr = 0x05;
@@ -441,16 +433,49 @@
ndac->bt_addr = 0x07;
ndac->bt_ctrl = 0x00; /* no test mode */
+ /*
+ * Set ANSI 16 colors. We only supports 4bpp console right
+ * now, repeat 16 colors in 256 colormap.
+ */
ndac->bt_addr = 0;
- ndac->bt_cmap = dc->dc_cmap.r[0] = 0;
- ndac->bt_cmap = dc->dc_cmap.g[0] = 0;
- ndac->bt_cmap = dc->dc_cmap.b[0] = 0;
- for (i = 1; i < 256; i++) {
- ndac->bt_cmap = dc->dc_cmap.r[i] = 255;
- ndac->bt_cmap = dc->dc_cmap.g[i] = 255;
- ndac->bt_cmap = dc->dc_cmap.b[i] = 255;
+ for (i = 0; i < 256; i++) {
+ ndac->bt_cmap = dc->dc_cmap.r[i] = ansicmap[i % 16].r;
+ ndac->bt_cmap = dc->dc_cmap.g[i] = ansicmap[i % 16].g;
+ ndac->bt_cmap = dc->dc_cmap.b[i] = ansicmap[i % 16].b;
}
}
+}
+
+static void
+omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
+{
+ int bpp, i;
+ struct rasops_info *ri;
+ union {
+ struct { short h, v; } p;
+ uint32_t u;
+ } rfcnt;
+
+ switch (hwplanemask) {
+ case 0xff:
+ bpp = 8; /* XXX check monochrome bit in DIPSW */
+ break;
+ default:
+ case 0x0f:
+ bpp = 4; /* XXX check monochrome bit in DIPSW */
+ break;
+ case 1:
+ bpp = 1;
+ break;
Home |
Main Index |
Thread Index |
Old Index