Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Replace rcons console code with rasops console c...
details: https://anonhg.NetBSD.org/src/rev/f21dfa023739
branches: trunk
changeset: 485134:f21dfa023739
user: nathanw <nathanw%NetBSD.org@localhost>
date: Thu Apr 20 05:25:20 2000 +0000
description:
Replace rcons console code with rasops console code.
Console text should now be supported on all TGA cards;
8- and 32-bit TGA and 8-bit TGA2 have been tested.
Implement accelerated character drawing, scrolling, and clearing.
Stop clearing "odd" in VHCR; it's unnecessary and hurts performance.
Use bus_space_vaddr() instead of a local hack.
diffstat:
sys/dev/pci/files.pci | 4 +-
sys/dev/pci/tga.c | 448 ++++++++++++++++++++++++++++++++++---------------
sys/dev/pci/tgavar.h | 8 +-
3 files changed, 319 insertions(+), 141 deletions(-)
diffs (truncated from 669 to 300 lines):
diff -r 344ed6cca6e4 -r f21dfa023739 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Thu Apr 20 03:28:15 2000 +0000
+++ b/sys/dev/pci/files.pci Thu Apr 20 05:25:20 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pci,v 1.86 2000/04/19 08:44:32 haya Exp $
+# $NetBSD: files.pci,v 1.87 2000/04/20 05:25:20 nathanw Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@@ -146,7 +146,7 @@
file dev/pci/vga_pci.c vga_pci needs-flag
# DEC TGA
-device tga: wsemuldisplaydev, wsrasteremulops
+device tga: wsemuldisplaydev, rasops8, rasops32
attach tga at pci
file dev/pci/tga.c tga needs-flag
file dev/pci/tga_conf.c tga
diff -r 344ed6cca6e4 -r f21dfa023739 sys/dev/pci/tga.c
--- a/sys/dev/pci/tga.c Thu Apr 20 03:28:15 2000 +0000
+++ b/sys/dev/pci/tga.c Thu Apr 20 05:25:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tga.c,v 1.22 2000/04/02 19:01:11 nathanw Exp $ */
+/* $NetBSD: tga.c,v 1.23 2000/04/20 05:25:20 nathanw Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -51,10 +51,10 @@
#include <dev/ic/bt463reg.h>
#include <dev/ic/bt463var.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 <dev/wsfont/wsfont.h>
#ifdef __alpha__
#include <machine/pte.h>
@@ -84,13 +84,14 @@
static void tga_free_screen __P((void *, void *));
static int tga_show_screen __P((void *, void *, int,
void (*) (void *, int, int), void *));
-static int tga_rop __P((struct raster *, int, int, int, int, int,
- struct raster *, int, int));
-static int tga_rop_nosrc __P((struct raster *, int, int, int, int, int));
-static int tga_rop_htov __P((struct raster *, int, int, int, int,
- int, struct raster *, int, int ));
-static int tga_rop_vtov __P((struct raster *, int, int, int, int,
- int, struct raster *, int, int ));
+static int tga_rop __P((struct rasops_info *, int, int, int, int, int,
+ struct rasops_info *, int, int));
+static int tga_rop_vtov __P((struct rasops_info *, int, int, int, int,
+ int, struct rasops_info *, int, int ));
+static void tga_putchar __P((void *c, int row, int col,
+ u_int uc, long attr));
+static void tga_eraserows __P((void *, int, int, long));
+static void tga_erasecols __P((void *, int, int, int, long));
void tga2_init __P((struct tga_devconfig *, int));
static void tga_config_interrupts __P((struct device *));
@@ -107,15 +108,18 @@
/* Interrupt handler */
static int tga_intr __P((void *));
+/* The NULL entries will get filled in by rasops_init().
+ * XXX and the non-NULL ones will be overwritten; reset after calling it.
+ */
struct wsdisplay_emulops tga_emulops = {
- rcons_cursor, /* could use hardware cursor; punt */
- rcons_mapchar,
- rcons_putchar,
+ NULL,
+ NULL,
+ tga_putchar,
tga_copycols,
- rcons_erasecols,
+ tga_erasecols,
tga_copyrows,
- rcons_eraserows,
- rcons_alloc_attr
+ tga_eraserows,
+ NULL,
};
struct wsscreen_descr tga_stdscreen = {
@@ -176,8 +180,8 @@
struct tga_devconfig *dc;
{
const struct tga_conf *tgac;
- struct raster *rap;
- struct rcons *rcp;
+ struct rasops_info *rip;
+ int cookie;
bus_size_t pcisize;
int i, flags;
@@ -196,7 +200,7 @@
if (bus_space_map(memt, dc->dc_pcipaddr, pcisize,
BUS_SPACE_MAP_PREFETCHABLE | BUS_SPACE_MAP_LINEAR, &dc->dc_memh))
return;
- dc->dc_vaddr = dc->dc_memh; /* XXX Cheat-o-matic */
+ dc->dc_vaddr = (vaddr_t) bus_space_vaddr(memt, dc->dc_memh);
#ifdef __alpha__
dc->dc_paddr = ALPHA_K0SEG_TO_PHYS(dc->dc_vaddr); /* XXX */
#endif
@@ -254,19 +258,6 @@
}
dc->dc_rowbytes = dc->dc_wid * (dc->dc_tgaconf->tgac_phys_depth / 8);
-
- if ((TGARREG(dc, TGA_REG_VHCR) & 0x00000001) != 0 && /* XXX */
- (TGARREG(dc, TGA_REG_VHCR) & 0x80000000) != 0) { /* XXX */
- dc->dc_wid -= 4;
- /*
- * XXX XXX turning off 'odd' shouldn't be necesssary,
- * XXX XXX but i can't make X work with the weird size.
- */
- TGAWREG(dc, TGA_REG_VHCR, TGARREG(dc, TGA_REG_VHCR) & ~0x80000001);
- dc->dc_rowbytes =
- dc->dc_wid * (dc->dc_tgaconf->tgac_phys_depth / 8);
- }
-
dc->dc_ht = (TGARREG(dc, TGA_REG_VVCR) & 0x7ff); /* XXX */
/* XXX this seems to be what DEC does */
@@ -288,25 +279,59 @@
for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
*(u_int32_t *)(dc->dc_videobase + i) = 0;
- /* initialize the raster */
- rap = &dc->dc_raster;
- rap->width = dc->dc_wid;
- rap->height = dc->dc_ht;
- rap->depth = tgac->tgac_phys_depth;
- rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
- rap->pixels = (u_int32_t *)dc->dc_videobase;
- rap->data = (caddr_t)dc;
+ /* Initialize rasops descriptor */
+ rip = &dc->dc_rinfo;
+ rip->ri_flg = RI_CENTER;
+ rip->ri_depth = tgac->tgac_phys_depth;
+ rip->ri_bits = (void *)dc->dc_videobase;
+ rip->ri_width = dc->dc_wid;
+ rip->ri_height = dc->dc_ht;
+ rip->ri_stride = dc->dc_rowbytes;
+ rip->ri_hw = dc;
+
+ if (tgac->tgac_phys_depth == 32) {
+ rip->ri_rnum = 8;
+ rip->ri_gnum = 8;
+ rip->ri_bnum = 8;
+ rip->ri_rpos = 16;
+ rip->ri_gpos = 8;
+ rip->ri_bpos = 0;
+ }
- /* 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);
+ wsfont_init();
+ /* prefer 8 pixel wide font */
+ if ((cookie = wsfont_find(NULL, 8, 0, 0)) <= 0)
+ cookie = wsfont_find(NULL, 0, 0, 0);
+ if (cookie <= 0) {
+ printf("tga: no appropriate fonts.\n");
+ return;
+ }
+
+ /* the accelerated tga_putchar() needs LSbit left */
+ if (wsfont_lock(cookie, &dc->dc_rinfo.ri_font,
+ WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R) <= 0) {
+ printf("tga: couldn't lock font\n");
+ return;
+ }
+ dc->dc_rinfo.ri_wsfcookie = cookie;
- tga_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
- tga_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
+ rasops_init(rip, 34, 80);
+
+ /* add our accelerated functions */
+ /* XXX shouldn't have to do this; rasops should leave non-NULL
+ * XXX entries alone.
+ */
+ dc->dc_rinfo.ri_ops.copyrows = tga_copyrows;
+ dc->dc_rinfo.ri_ops.eraserows = tga_eraserows;
+ dc->dc_rinfo.ri_ops.erasecols = tga_erasecols;
+ dc->dc_rinfo.ri_ops.copycols = tga_copycols;
+ dc->dc_rinfo.ri_ops.putchar = tga_putchar;
+
+ tga_stdscreen.nrows = dc->dc_rinfo.ri_rows;
+ tga_stdscreen.ncols = dc->dc_rinfo.ri_cols;
+ tga_stdscreen.textops = &dc->dc_rinfo.ri_ops;
+ tga_stdscreen.capabilities = dc->dc_rinfo.ri_caps;
+
dc->dc_intrenabled = 0;
}
@@ -605,10 +630,11 @@
if (sc->nscreens > 0)
return (ENOMEM);
- *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
+ *cookiep = &sc->sc_dc->dc_rinfo; /* one and only for now */
*curxp = 0;
*curyp = 0;
- rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
+ sc->sc_dc->dc_rinfo.ri_ops.alloc_attr(&sc->sc_dc->dc_rinfo,
+ 0, 0, 0, &defattr);
*attrp = defattr;
sc->nscreens++;
return (0);
@@ -664,22 +690,21 @@
* Initialization includes disabling cursor, setting a sane
* colormap, etc. It will be reinitialized in tgaattach().
*/
-
- /* XXX -- this only works for bt485, but then we only support that,
- * currently.
- */
if (dcp->dc_tga2)
bt485_cninit(dcp, tga_sched_update, tga2_ramdac_wr,
tga2_ramdac_rd);
- else
- bt485_cninit(dcp, tga_sched_update, tga_ramdac_wr,
- tga_ramdac_rd);
-
- rcons_alloc_attr(&dcp->dc_rcons, 0, 0, 0, &defattr);
-
- wsdisplay_cnattach(&tga_stdscreen, &dcp->dc_rcons,
- 0, 0, defattr);
-
+ else {
+ if (dcp->dc_tgaconf->ramdac_funcs == bt485_funcs)
+ bt485_cninit(dcp, tga_sched_update, tga_ramdac_wr,
+ tga_ramdac_rd);
+ else {
+ bt463_cninit(dcp, tga_sched_update, tga_bt463_wr,
+ tga_bt463_rd);
+ }
+ }
+ dcp->dc_rinfo.ri_ops.alloc_attr(&dcp->dc_rinfo, 0, 0, 0, &defattr);
+ wsdisplay_cnattach(&tga_stdscreen, &dcp->dc_rinfo, 0, 0, defattr);
+
return(0);
}
@@ -838,17 +863,17 @@
void *id;
int row, srccol, dstcol, ncols;
{
- struct rcons *rc = id;
+ struct rasops_info *ri = id;
int y, srcx, dstx, nx;
- y = rc->rc_yorigin + rc->rc_font->height * row;
- srcx = rc->rc_xorigin + rc->rc_font->width * srccol;
- dstx = rc->rc_xorigin + rc->rc_font->width * dstcol;
- nx = rc->rc_font->width * ncols;
+ y = ri->ri_font->fontheight * row;
+ srcx = ri->ri_font->fontwidth * srccol;
+ dstx = ri->ri_font->fontwidth * dstcol;
+ nx = ri->ri_font->fontwidth * ncols;
- tga_rop(rc->rc_sp, dstx, y,
- nx, rc->rc_font->height, RAS_SRC,
- rc->rc_sp, srcx, y);
+ tga_rop(ri, dstx, y,
+ nx, ri->ri_font->fontheight, RAS_SRC,
+ ri, srcx, y);
}
/*
@@ -859,16 +884,16 @@
void *id;
int srcrow, dstrow, nrows;
{
- struct rcons *rc = id;
+ struct rasops_info *ri = id;
int srcy, dsty, ny;
- srcy = rc->rc_yorigin + rc->rc_font->height * srcrow;
- dsty = rc->rc_yorigin + rc->rc_font->height * dstrow;
- ny = rc->rc_font->height * nrows;
+ srcy = ri->ri_font->fontheight * srcrow;
+ dsty = ri->ri_font->fontheight * dstrow;
+ ny = ri->ri_font->fontheight * nrows;
- tga_rop(rc->rc_sp, rc->rc_xorigin, dsty,
- rc->rc_raswidth, ny, RAS_SRC,
- rc->rc_sp, rc->rc_xorigin, srcy);
+ tga_rop(ri, 0, dsty,
+ ri->ri_emuwidth, ny, RAS_SRC,
+ ri, 0, srcy);
Home |
Main Index |
Thread Index |
Old Index