Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/luna68k Switch luna68k wscons framebuffer driver to...



details:   https://anonhg.NetBSD.org/src/rev/24e9b4da6d38
branches:  trunk
changeset: 780348:24e9b4da6d38
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Jul 20 19:31:53 2012 +0000

description:
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4).  This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.

diffstat:

 sys/arch/luna68k/conf/GENERIC      |     5 +-
 sys/arch/luna68k/conf/INSTALL      |     3 +-
 sys/arch/luna68k/dev/lunafb.c      |    71 +-
 sys/arch/luna68k/dev/omrasops.c    |   302 +++++----
 sys/arch/luna68k/dev/omrasopsvar.h |    29 +
 sys/arch/luna68k/dev/omron_rfont.h |  1039 ------------------------------------
 6 files changed, 239 insertions(+), 1210 deletions(-)

diffs (truncated from 1769 to 300 lines):

diff -r 9088cf9b1342 -r 24e9b4da6d38 sys/arch/luna68k/conf/GENERIC
--- a/sys/arch/luna68k/conf/GENERIC     Fri Jul 20 19:18:08 2012 +0000
+++ b/sys/arch/luna68k/conf/GENERIC     Fri Jul 20 19:31:53 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.98 2012/03/10 21:51:53 joerg Exp $
+# $NetBSD: GENERIC,v 1.99 2012/07/20 19:31:53 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.98 $"
+#ident                 "GENERIC-$Revision: 1.99 $"
 
 maxusers       8
 
@@ -137,6 +137,7 @@
 
 # WS console uses SUN or VT100 terminal emulation
 options        WSEMUL_VT100
+options        FONT_OMRON12x20
 
 config         netbsd root on ? type ?
 
diff -r 9088cf9b1342 -r 24e9b4da6d38 sys/arch/luna68k/conf/INSTALL
--- a/sys/arch/luna68k/conf/INSTALL     Fri Jul 20 19:18:08 2012 +0000
+++ b/sys/arch/luna68k/conf/INSTALL     Fri Jul 20 19:31:53 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.5 2012/03/10 21:51:53 joerg Exp $
+# $NetBSD: INSTALL,v 1.6 2012/07/20 19:31:53 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -123,6 +123,7 @@
 
 # WS console uses SUN or VT100 terminal emulation
 options        WSEMUL_VT100
+options        FONT_OMRON12x20
 
 config         netbsd root on ? type ?
 
diff -r 9088cf9b1342 -r 24e9b4da6d38 sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c     Fri Jul 20 19:18:08 2012 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c     Fri Jul 20 19:31:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.26 2012/07/20 19:31:53 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.25 2011/07/27 14:17:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.26 2012/07/20 19:31:53 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,14 +47,15 @@
 
 #include <uvm/uvm_extern.h>
 
-#include <dev/rcons/raster.h>
 #include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wscons_raster.h>
 #include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
 
 #include <machine/cpu.h>
 #include <machine/autoconf.h>
 
+#include <arch/luna68k/dev/omrasopsvar.h>
+
 #include "ioconf.h"
 
 struct bt454 {
@@ -88,8 +89,7 @@
        int     dc_rowbytes;            /* bytes in a FB scan line */
        int     dc_cmsize;              /* colormap size */
        vaddr_t dc_videobase;           /* base of flat frame buffer */
-       struct raster   dc_raster;      /* raster description */
-       struct rcons    dc_rcons;       /* raster blitter control info */
+       struct rasops_info dc_ri;       /* raster blitter variables */
 };
 
 struct hwcmap {
@@ -112,13 +112,8 @@
 static struct om_hwdevconfig omfb_console_dc;
 static void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *);
 
-extern struct wsdisplay_emulops omfb_emulops;
-
 static struct wsscreen_descr omfb_stdscreen = {
-       "std", 0, 0,
-       &omfb_emulops,
-       0, 0,
-       0
+       .name = "std"
 };
 
 static const struct wsscreen_descr *_omfb_scrlist[] = {
@@ -187,7 +182,7 @@
                sc->nscreens = 1;
        } else {
                sc->sc_dc = malloc(sizeof(struct om_hwdevconfig),
-                   M_DEVBUF, M_WAITOK);
+                   M_DEVBUF, M_WAITOK | M_ZERO);
                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,
@@ -209,11 +204,12 @@
 omfb_cnattach(void)
 {
        struct om_hwdevconfig *dc = &omfb_console_dc;
+       struct rasops_info *ri = &dc->dc_ri;
        long defattr;
 
        omfb_getdevconfig(OMFB_FB_WADDR, dc);
-       (*omfb_emulops.allocattr)(&dc->dc_rcons, 0, 0, 0, &defattr);
-       wsdisplay_cnattach(&omfb_stdscreen, &dc->dc_rcons, 0, 0, defattr);
+       (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+       wsdisplay_cnattach(&omfb_stdscreen, ri, 0, 0, defattr);
        omfb_console = 1;
        return 0;
 }
@@ -350,8 +346,7 @@
 omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
 {
        int bpp, i;
-       struct raster *rap;
-       struct rcons *rcp;
+       struct rasops_info *ri;
        union {
                struct { short h, v; } p;
                uint32_t u;
@@ -415,7 +410,7 @@
                }
        }
 
-       /* adjust h/v orgin on screen */
+       /* adjust h/v origin on screen */
        rfcnt.p.h = 7;
        rfcnt.p.v = -27;
        /* single write of 0x007ffe6 */
@@ -424,28 +419,29 @@
        /* clear the screen */
        *(volatile uint32_t *)OMFB_PLANEMASK = 0xff;
        ((volatile uint32_t *)OMFB_ROPFUNC)[5] = ~0;    /* ROP copy */
-       for (i = 0; i < dc->dc_ht * dc->dc_rowbytes/sizeof(uint32_t); i++)
+       for (i = 0; i < dc->dc_ht * dc->dc_rowbytes / sizeof(uint32_t); i++)
                *((volatile uint32_t *)dc->dc_videobase + i) = 0;
        *(volatile uint32_t *)OMFB_PLANEMASK = 0x01;
 
        /* initialize the raster */
-       rap = &dc->dc_raster;
-       rap->width = dc->dc_wid;
-       rap->height = dc->dc_ht;
-       rap->depth = dc->dc_depth;
-       rap->linelongs = dc->dc_rowbytes / sizeof(uint32_t);
-       rap->pixels = (uint32_t *)dc->dc_videobase;
+       ri = &dc->dc_ri;
+       ri->ri_width = dc->dc_wid;
+       ri->ri_height = dc->dc_ht;
+       ri->ri_depth = 1;       /* since planes are independently addressed */
+       ri->ri_stride = dc->dc_rowbytes;
+       ri->ri_bits = (void *)dc->dc_videobase;
+       ri->ri_flg = RI_CENTER;
+       if (dc == &omfb_console_dc)
+               ri->ri_flg |= RI_NO_AUTO;
+       ri->ri_hw = dc;
 
-       /* initialize the raster console blitter */
-       rcp = &dc->dc_rcons;
-       rcp->rc_sp = rap;
-       rcp->rc_crow = rcp->rc_ccol = -1;
-       rcp->rc_crowp = &rcp->rc_crow;
-       rcp->rc_ccolp = &rcp->rc_ccol;
-       rcons_init(rcp, 34, 80);
+       omrasops_init(ri, 34, 80);
 
-       omfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
-       omfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
+       omfb_stdscreen.nrows = ri->ri_rows;
+       omfb_stdscreen.ncols = ri->ri_cols;
+       omfb_stdscreen.textops = &ri->ri_ops;
+       omfb_stdscreen.fontwidth = ri->ri_font->fontwidth;
+       omfb_stdscreen.fontheight = ri->ri_font->fontheight;
 }
 
 static int
@@ -453,16 +449,15 @@
     int *curxp, int *curyp, long *attrp)
 {
        struct omfb_softc *sc = v;
-       long defattr;
+       struct rasops_info *ri = &sc->sc_dc->dc_ri;
 
        if (sc->nscreens > 0)
                return ENOMEM;
 
-       *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
+       *cookiep = ri;
        *curxp = 0;
        *curyp = 0;
-       (*omfb_emulops.allocattr)(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
-       *attrp = defattr;
+       (*ri->ri_ops.allocattr)(ri, 0, 0, 0, attrp);
        sc->nscreens++;
        return 0;
 }
diff -r 9088cf9b1342 -r 24e9b4da6d38 sys/arch/luna68k/dev/omrasops.c
--- a/sys/arch/luna68k/dev/omrasops.c   Fri Jul 20 19:18:08 2012 +0000
+++ b/sys/arch/luna68k/dev/omrasops.c   Fri Jul 20 19:31:53 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.12 2012/07/16 11:41:05 tsutsui Exp $ */
+/* $NetBSD: omrasops.c,v 1.13 2012/07/20 19:31:53 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.12 2012/07/16 11:41:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.13 2012/07/20 19:31:53 tsutsui Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -42,22 +42,15 @@
  *     - font glyphs are stored in 32bit padded.
  */
 
-#define USE_OMRONFONT
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
 
-#include <dev/rcons/raster.h>
-#include <dev/wscons/wscons_raster.h>
-#ifndef USE_OMRONFONT
-#include <dev/wscons/wscons_rfont.h>
-#else
-#include <arch/luna68k/dev/omron_rfont.h>
-#endif
+#include <dev/wscons/wsconsio.h>
 #include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
 
-void rcons_init(struct rcons *, int, int);
+#include <arch/luna68k/dev/omrasopsvar.h>
 
 /* wscons emulator operations */
 static void    om_cursor(void *, int, int, int);
@@ -69,17 +62,6 @@
 static void    om_eraserows(void *, int, int, long);
 static int     om_allocattr(void *, int, int, int, long *);
 
-struct wsdisplay_emulops omfb_emulops = {
-       om_cursor,
-       om_mapchar,
-       om_putchar,
-       om_copycols,
-       om_erasecols,
-       om_copyrows,
-       om_eraserows,
-       om_allocattr
-};
-
 #define        ALL1BITS        (~0U)
 #define        ALL0BITS        (0U)
 #define        BLITWIDTH       (32)
@@ -95,33 +77,36 @@
 static void
 om_putchar(void *cookie, int row, int startcol, u_int uc, long attr)
 {
-       struct rcons *rc = cookie;
-       struct raster *rap = rc->rc_sp;
+       struct rasops_info *ri = cookie;
        uint8_t *p;
        int scanspan, startx, height, width, align, y;
        uint32_t lmask, rmask, glyph, inverse;
-       uint32_t *g;
+       int i;
+       uint8_t *fb;
 
-       scanspan = rap->linelongs * 4;
-       y = rc->rc_yorigin + rc->rc_font->height * row;
-       startx = rc->rc_xorigin + rc->rc_font->width * startcol;
-       height = rc->rc_font->height;
-       g = rc->rc_font->chars[uc].r->pixels;
+       scanspan = ri->ri_stride;
+       y = ri->ri_font->fontheight * row;
+       startx = ri->ri_font->fontwidth * startcol;
+       height = ri->ri_font->fontheight;
+       fb = (uint8_t *)ri->ri_font->data +
+           (uc - ri->ri_font->firstchar) * ri->ri_fontscale;



Home | Main Index | Thread Index | Old Index