summaryrefslogtreecommitdiff
path: root/sys/arch/luna88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-08-06 13:04:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-08-06 13:04:34 +0000
commitff1ab5ff2068034439bc0c422b5eef88f61d9a39 (patch)
treec66a959bdb4c9e5ce048a14d052204e7625cf0f2 /sys/arch/luna88k
parent06657fb3267c92e8abdb21f118cbd6b4ac3273f6 (diff)
Switch luna88k from rcons to rasops. Tested by aoyama@
Diffstat (limited to 'sys/arch/luna88k')
-rw-r--r--sys/arch/luna88k/conf/files.luna88k6
-rw-r--r--sys/arch/luna88k/dev/lunafb.c80
-rw-r--r--sys/arch/luna88k/dev/omrasops.c185
3 files changed, 113 insertions, 158 deletions
diff --git a/sys/arch/luna88k/conf/files.luna88k b/sys/arch/luna88k/conf/files.luna88k
index 18de478dadf..5f13247499d 100644
--- a/sys/arch/luna88k/conf/files.luna88k
+++ b/sys/arch/luna88k/conf/files.luna88k
@@ -1,5 +1,5 @@
-# $OpenBSD: files.luna88k,v 1.12 2006/06/19 15:13:35 deraadt Exp $
-#
+# $OpenBSD: files.luna88k,v 1.13 2006/08/06 13:04:31 miod Exp $
+#
maxpartitions 16
device mainbus {}
@@ -30,7 +30,7 @@ device ws: wskbddev,wsmousedev
attach ws at sio
file arch/luna88k/dev/lunaws.c ws
-device fb: wsemuldisplaydev,wsrasteremulops
+device fb: wsemuldisplaydev, rasops1
attach fb at mainbus
file arch/luna88k/dev/lunafb.c fb
file arch/luna88k/dev/omrasops.c fb
diff --git a/sys/arch/luna88k/dev/lunafb.c b/sys/arch/luna88k/dev/lunafb.c
index 887b9509ada..a2b28962a0d 100644
--- a/sys/arch/luna88k/dev/lunafb.c
+++ b/sys/arch/luna88k/dev/lunafb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lunafb.c,v 1.6 2006/01/10 18:56:11 miod Exp $ */
+/* $OpenBSD: lunafb.c,v 1.7 2006/08/06 13:04:33 miod Exp $ */
/* $NetBSD: lunafb.c,v 1.7.6.1 2002/08/07 01:48:34 lukem Exp $ */
/*-
@@ -51,10 +51,9 @@
#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>
@@ -90,8 +89,7 @@ struct om_hwdevconfig {
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 {
@@ -114,13 +112,16 @@ int omsetcmap(struct omfb_softc *, struct wsdisplay_cmap *);
struct om_hwdevconfig omfb_console_dc;
void omfb_getdevconfig(paddr_t, struct om_hwdevconfig *);
-extern struct wsdisplay_emulops omfb_emulops;
+/* in omrasops.c */
+void om_cursor(void *, int, int, int);
+void om_putchar(void *, int, int, u_int, long);
+void om_copycols(void *, int, int, int, int);
+void om_copyrows(void *, int, int, int num);
+void om_erasecols(void *, int, int, int, long);
+void om_eraserows(void *, int, int, long);
struct wsscreen_descr omfb_stdscreen = {
- "std", 0, 0,
- &omfb_emulops,
- 0, 0,
- 0
+ "std"
};
const struct wsscreen_descr *_omfb_scrlist[] = {
@@ -223,11 +224,12 @@ omfbattach(parent, self, args)
omfb_cnattach()
{
struct om_hwdevconfig *dc = &omfb_console_dc;
+ struct rasops_info *ri = &dc->dc_ri;
long defattr;
omfb_getdevconfig(OMFB_FB_WADDR, dc);
- (*omfb_emulops.alloc_attr)(&dc->dc_rcons, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&omfb_stdscreen, &dc->dc_rcons, 0, 0, defattr);
+ ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&omfb_stdscreen, ri, 0, 0, defattr);
omfb_console = 1;
return (0);
}
@@ -376,8 +378,7 @@ omfb_getdevconfig(paddr, dc)
struct om_hwdevconfig *dc;
{
int bpp, i;
- struct raster *rap;
- struct rcons *rcp;
+ struct rasops_info *ri;
union {
struct { short h, v; } p;
u_int32_t u;
@@ -436,7 +437,7 @@ omfb_getdevconfig(paddr, dc)
}
#endif
- /* adjust h/v orgin on screen */
+ /* adjust h/v origin on screen */
rfcnt.p.h = 7;
rfcnt.p.v = -27;
*(u_int32_t *)OMFB_RFCNT = rfcnt.u; /* single write of 0x007ffe6 */
@@ -444,28 +445,34 @@ omfb_getdevconfig(paddr, dc)
/* clear the screen */
*(u_int32_t *)OMFB_PLANEMASK = 0xff;
((u_int32_t *)OMFB_ROPFUNC)[5] = ~0; /* ROP copy */
- for (i = 0; i < dc->dc_ht * dc->dc_rowbytes/sizeof(u_int32_t); i++)
+ for (i = 0; i < dc->dc_ht * dc->dc_rowbytes / sizeof(u_int32_t); i++)
*((u_int32_t *)dc->dc_videobase + i) = 0;
*(u_int32_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(u_int32_t);
- rap->pixels = (u_int32_t *)dc->dc_videobase;
-
- /* 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);
-
- omfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
- omfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
+ 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;
+ ri->ri_hw = dc;
+
+ rasops_init(ri, 35, 80);
+
+ omfb_stdscreen.ncols = ri->ri_cols;
+ omfb_stdscreen.nrows = ri->ri_rows;
+ ri->ri_ops.cursor = om_cursor;
+ ri->ri_ops.putchar = om_putchar;
+ ri->ri_ops.copycols = om_copycols;
+ ri->ri_ops.erasecols = om_erasecols;
+ ri->ri_ops.copyrows = om_copyrows;
+ ri->ri_ops.eraserows = om_eraserows;
+ omfb_stdscreen.textops = &ri->ri_ops;
+ omfb_stdscreen.fontwidth = ri->ri_font->fontwidth;
+ omfb_stdscreen.fontheight = ri->ri_font->fontheight;
+ omfb_stdscreen.capabilities = ri->ri_caps & ~WSSCREEN_UNDERLINE;
}
int
@@ -477,16 +484,15 @@ omfb_alloc_screen(v, type, cookiep, curxp, curyp, attrp)
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.alloc_attr)(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
- *attrp = defattr;
+ ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
sc->nscreens++;
return (0);
}
diff --git a/sys/arch/luna88k/dev/omrasops.c b/sys/arch/luna88k/dev/omrasops.c
index d8adf5890de..9a71a3c3013 100644
--- a/sys/arch/luna88k/dev/omrasops.c
+++ b/sys/arch/luna88k/dev/omrasops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: omrasops.c,v 1.2 2006/03/04 19:33:21 miod Exp $ */
+/* $OpenBSD: omrasops.c,v 1.3 2006/08/06 13:04:33 miod Exp $ */
/* $NetBSD: omrasops.c,v 1.1 2000/01/05 08:48:56 nisimura Exp $ */
/*-
@@ -50,31 +50,17 @@
#include <sys/systm.h>
#include <sys/device.h>
-#include <dev/rcons/raster.h>
-#include <dev/wscons/wscons_raster.h>
-#include <dev/wscons/wscons_rfont.h>
+#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
+#include <dev/rasops/rasops.h>
/* wscons emulator operations */
void om_cursor(void *, int, int, int);
-int om_mapchar(void *, int, unsigned int *);
void om_putchar(void *, int, int, u_int, long);
void om_copycols(void *, int, int, int, int);
void om_copyrows(void *, int, int, int num);
void om_erasecols(void *, int, int, int, long);
void om_eraserows(void *, int, int, long);
-int om_alloc_attr(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_alloc_attr
-};
#define ALL1BITS (~0U)
#define ALL0BITS (0U)
@@ -95,33 +81,37 @@ om_putchar(cookie, row, startcol, uc, attr)
u_int uc;
long attr;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t p;
int scanspan, startx, height, width, align, y;
u_int32_t lmask, rmask, glyph, inverse;
- u_int32_t *g;
-
- 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;
- inverse = (attr != 0) ? ALL1BITS : ALL0BITS;
-
- p = (caddr_t)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ int i, fg, bg;
+ u_int8_t *fb;
+
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * startcol;
+ height = ri->ri_font->fontheight;
+ fb = ri->ri_font->data +
+ (uc - ri->ri_font->firstchar) * ri->ri_fontscale;
+ rasops_unpack_attr(attr, &fg, &bg, NULL);
+ inverse = (bg != 0) ? ALL1BITS : ALL0BITS;
+
+ p = (caddr_t)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
- width = rc->rc_font->width + align;
+ width = ri->ri_font->fontwidth + align;
lmask = ALL1BITS >> align;
rmask = ALL1BITS << (-width & ALIGNMASK);
if (width <= BLITWIDTH) {
lmask &= rmask;
while (height > 0) {
- glyph = *g;
+ glyph = 0;
+ for (i = ri->ri_font->stride; i != 0; i--)
+ glyph = (glyph << 8) | *fb++;
+ glyph <<= (4 - ri->ri_font->stride) * NBBY;
glyph = (glyph >> align) ^ inverse;
W(p) = (R(p) & ~lmask) | (glyph & lmask);
p += scanspan;
- g += 1;
height--;
}
}
@@ -130,7 +120,10 @@ om_putchar(cookie, row, startcol, uc, attr)
u_int32_t lhalf, rhalf;
while (height > 0) {
- glyph = *g;
+ glyph = 0;
+ for (i = ri->ri_font->stride; i != 0; i--)
+ glyph = (glyph << 8) | *fb++;
+ glyph <<= (4 - ri->ri_font->stride) * NBBY;
lhalf = (glyph >> align) ^ inverse;
W(p) = (R(p) & ~lmask) | (lhalf & lmask);
p += BYTESDONE;
@@ -138,7 +131,6 @@ om_putchar(cookie, row, startcol, uc, attr)
W(p) = (rhalf & rmask) | (R(p) & ~rmask);
p = (q += scanspan);
- g += 1;
height--;
}
}
@@ -150,20 +142,19 @@ om_erasecols(cookie, row, startcol, ncols, attr)
int row, startcol, ncols;
long attr;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t p;
int scanspan, startx, height, width, align, w, y;
u_int32_t lmask, rmask, fill;
- 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;
- w = rc->rc_font->width * ncols;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * startcol;
+ height = ri->ri_font->fontheight;
+ w = ri->ri_font->fontwidth * ncols;
fill = (attr != 0) ? ALL1BITS : ALL0BITS;
- p = (caddr_t)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ p = (caddr_t)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
width = w + align;
lmask = ALL1BITS >> align;
@@ -203,20 +194,18 @@ om_eraserows(cookie, startrow, nrows, attr)
int startrow, nrows;
long attr;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t p, q;
int scanspan, starty, height, width, w;
u_int32_t rmask, fill;
- scanspan = rap->linelongs * 4;
- starty = rc->rc_yorigin + rc->rc_font->height * startrow;
- height = rc->rc_font->height * nrows;
- w = rc->rc_font->width * rc->rc_maxcol;
+ scanspan = ri->ri_stride;
+ starty = ri->ri_font->fontheight * startrow;
+ height = ri->ri_font->fontheight * nrows;
+ w = ri->ri_emuwidth;
fill = (attr == 1) ? ALL1BITS : ALL0BITS;
- p = (caddr_t)rap->pixels + starty * scanspan;
- p += (rc->rc_xorigin / 32) * 4;
+ p = (caddr_t)ri->ri_bits + starty * scanspan;
width = w;
rmask = ALL1BITS << (-width & ALIGNMASK);
q = p;
@@ -241,24 +230,22 @@ om_copyrows(cookie, srcrow, dstrow, nrows)
void *cookie;
int srcrow, dstrow, nrows;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t p, q;
int scanspan, offset, srcy, height, width, w;
u_int32_t rmask;
- scanspan = rap->linelongs * 4;
- height = rc->rc_font->height * nrows;
- offset = (dstrow - srcrow) * scanspan * rc->rc_font->height;
- srcy = rc->rc_yorigin + rc->rc_font->height * srcrow;
+ scanspan = ri->ri_stride;
+ height = ri->ri_font->fontheight * nrows;
+ offset = (dstrow - srcrow) * scanspan * ri->ri_font->fontheight;
+ srcy = ri->ri_font->fontheight * srcrow;
if (srcrow < dstrow && srcrow + nrows > dstrow) {
scanspan = -scanspan;
srcy += height;
}
- p = (caddr_t)rap->pixels + srcy * (rap->linelongs * 4);
- p += (rc->rc_xorigin / 32) * 4;
- w = rc->rc_font->width * rc->rc_maxcol;
+ p = (caddr_t)ri->ri_bits + srcy * ri->ri_stride;
+ w = ri->ri_emuwidth;
width = w;
rmask = ALL1BITS << (-width & ALIGNMASK);
q = p;
@@ -284,19 +271,18 @@ om_copycols(cookie, startrow, srccol, dstcol, ncols)
void *cookie;
int startrow, srccol, dstcol, ncols;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t sp, dp, basep;
int scanspan, height, width, align, shift, w, y, srcx, dstx;
u_int32_t lmask, rmask;
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * startrow;
- srcx = rc->rc_xorigin + rc->rc_font->width * srccol;
- dstx = rc->rc_xorigin + rc->rc_font->width * dstcol;
- height = rc->rc_font->height;
- w = rc->rc_font->width * ncols;
- basep = (caddr_t)rap->pixels + y * scanspan;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * startrow;
+ srcx = ri->ri_font->fontwidth * srccol;
+ dstx = ri->ri_font->fontwidth * dstcol;
+ height = ri->ri_font->fontheight;
+ w = ri->ri_font->fontwidth * ncols;
+ basep = (caddr_t)ri->ri_bits + y * scanspan;
align = shift = srcx & ALIGNMASK;
width = w + align;
@@ -376,23 +362,6 @@ om_copycols(cookie, startrow, srccol, dstcol, ncols)
}
/*
- * Map a character.
- */
-int
-om_mapchar(cookie, c, cp)
- void *cookie;
- int c;
- u_int *cp;
-{
- if (c < 128) {
- *cp = c;
- return (5);
- }
- *cp = ' ';
- return (0);
-}
-
-/*
* Position|{enable|disable} the cursor at the specified location.
*/
void
@@ -400,33 +369,32 @@ om_cursor(cookie, on, row, col)
void *cookie;
int on, row, col;
{
- struct rcons *rc = cookie;
- struct raster *rap = rc->rc_sp;
+ struct rasops_info *ri = cookie;
caddr_t p;
int scanspan, startx, height, width, align, y;
u_int32_t lmask, rmask, image;
if (!on) {
/* make sure it's on */
- if ((rc->rc_bits & RC_CURSOR) == 0)
+ if ((ri->ri_flg & RI_CURSOR) == 0)
return;
- row = *rc->rc_crowp;
- col = *rc->rc_ccolp;
+ row = ri->ri_crow;
+ col = ri->ri_ccol;
} else {
/* unpaint the old copy. */
- *rc->rc_crowp = row;
- *rc->rc_ccolp = col;
+ ri->ri_crow = row;
+ ri->ri_ccol = col;
}
- scanspan = rap->linelongs * 4;
- y = rc->rc_yorigin + rc->rc_font->height * row;
- startx = rc->rc_xorigin + rc->rc_font->width * col;
- height = rc->rc_font->height;
+ scanspan = ri->ri_stride;
+ y = ri->ri_font->fontheight * row;
+ startx = ri->ri_font->fontwidth * col;
+ height = ri->ri_font->fontheight;
- p = (caddr_t)rap->pixels + y * scanspan + ((startx / 32) * 4);
+ p = (caddr_t)ri->ri_bits + y * scanspan + ((startx / 32) * 4);
align = startx & ALIGNMASK;
- width = rc->rc_font->width + align;
+ width = ri->ri_font->fontwidth + align;
lmask = ALL1BITS >> align;
rmask = ALL1BITS << (-width & ALIGNMASK);
if (width <= BLITWIDTH) {
@@ -452,24 +420,5 @@ om_cursor(cookie, on, row, col)
height--;
}
}
- rc->rc_bits ^= RC_CURSOR;
-}
-
-/*
- * Allocate attribute. We just pack these into an integer.
- */
-int
-om_alloc_attr(id, fg, bg, flags, attrp)
- void *id;
- int fg, bg, flags;
- long *attrp;
-{
- if (flags & (WSATTR_HILIT | WSATTR_BLINK |
- WSATTR_UNDERLINE | WSATTR_WSCOLORS))
- return (EINVAL);
- if (flags & WSATTR_REVERSE)
- *attrp = 1;
- else
- *attrp = 0;
- return (0);
+ ri->ri_flg ^= RI_CURSOR;
}