diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-07-04 00:34:29 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-07-04 00:34:29 +0000 |
commit | 92809e364832a1206235fddb4b3432bda0b1d3c6 (patch) | |
tree | 874d6ad7ec4ffcee95c1b44c2b066f6eb9d528cc | |
parent | 0a7f78ce521b8f2d0e02c39b1c663995d877822b (diff) |
Various tga hacks:
- some KNF touches
- use simpler constructs
- do not forget to make use of the tga interrupt when it is enabled (speeds
up X11 startup and shutdown, hi matthieu!)
- implement the wscons screen burner facility
-rw-r--r-- | sys/dev/pci/tga.c | 111 | ||||
-rw-r--r-- | sys/dev/pci/tgavar.h | 10 |
2 files changed, 69 insertions, 52 deletions
diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c index c1be6d36bdb..c3a59ccb312 100644 --- a/sys/dev/pci/tga.c +++ b/sys/dev/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.16 2002/05/02 19:21:48 matthieu Exp $ */ +/* $OpenBSD: tga.c,v 1.17 2002/07/04 00:34:28 miod Exp $ */ /* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */ /* @@ -85,35 +85,35 @@ unsigned tga_getdotclock(struct tga_devconfig *dc); struct tga_devconfig tga_console_dc; -int tga_ioctl(void *, u_long, caddr_t, int, struct proc *); -paddr_t tga_mmap(void *, off_t, int); -static void tga_copyrows(void *, int, int, int); -static void tga_copycols(void *, int, int, int, int); -static int tga_alloc_screen(void *, const struct wsscreen_descr *, - void **, int *, int *, long *); -static void tga_free_screen(void *, void *); -static int tga_show_screen(void *, void *, int, +int tga_ioctl(void *, u_long, caddr_t, int, struct proc *); +paddr_t tga_mmap(void *, off_t, int); +void tga_copyrows(void *, int, int, int); +void tga_copycols(void *, int, int, int, int); +int tga_alloc_screen(void *, const struct wsscreen_descr *, + void **, int *, int *, long *); +void tga_free_screen(void *, void *); +int tga_show_screen(void *, void *, int, void (*) (void *, int, int), void *); -static int tga_rop(struct rasops_info *, int, int, int, int, int, +void tga_burner(void *, u_int, u_int); +int tga_rop(struct rasops_info *, int, int, int, int, int, struct rasops_info *, int, int); -static int tga_rop_vtov(struct rasops_info *, int, int, int, int, +int tga_rop_vtov(struct rasops_info *, int, int, int, int, int, struct rasops_info *, int, int ); -static void tga_putchar(void *c, int row, int col, - u_int uc, long attr); -static void tga_eraserows(void *, int, int, long); -static void tga_erasecols(void *, int, int, int, long); -void tga2_init(struct tga_devconfig *); +void tga_putchar(void *c, int row, int col, u_int uc, long attr); +void tga_eraserows(void *, int, int, long); +void tga_erasecols(void *, int, int, int, long); +void tga2_init(struct tga_devconfig *); -void tga_config_interrupts(struct device *); +void tga_config_interrupts(struct device *); /* RAMDAC interface functions */ -int tga_sched_update(void *, void (*)(void *)); -void tga_ramdac_wr(void *, u_int, u_int8_t); -u_int8_t tga_ramdac_rd(void *, u_int); -void tga_bt463_wr(void *, u_int, u_int8_t); -u_int8_t tga_bt463_rd(void *, u_int); -void tga2_ramdac_wr(void *, u_int, u_int8_t); -u_int8_t tga2_ramdac_rd(void *, u_int); +int tga_sched_update(void *, void (*)(void *)); +void tga_ramdac_wr(void *, u_int, u_int8_t); +u_int8_t tga_ramdac_rd(void *, u_int); +void tga_bt463_wr(void *, u_int, u_int8_t); +u_int8_t tga_bt463_rd(void *, u_int); +void tga2_ramdac_wr(void *, u_int, u_int8_t); +u_int8_t tga2_ramdac_rd(void *, u_int); /* Interrupt handler */ int tga_intr(void *); @@ -156,7 +156,9 @@ struct wsdisplay_accessops tga_accessops = { tga_free_screen, tga_show_screen, NULL, /* load_font */ - NULL /* scrollback */ + NULL, /* scrollback */ + NULL, /* getchar */ + tga_burner, }; void tga_blank(struct tga_devconfig *); @@ -378,31 +380,30 @@ tga_getdevconfig(memt, pc, tag, dc) } /* the accelerated tga_putchar() needs LSbit left */ - if (wsfont_lock(cookie, &dc->dc_rinfo.ri_font, + if (wsfont_lock(cookie, &rip->ri_font, WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R) <= 0) { printf("tga: couldn't lock font\n"); return; } - dc->dc_rinfo.ri_wsfcookie = cookie; + rip->ri_wsfcookie = cookie; /* fill screen size */ - rasops_init(rip, dc->dc_ht / rip->ri_font->fontheight, - dc->dc_wid / rip->ri_font->fontwidth); + rasops_init(rip, rip->ri_height / rip->ri_font->fontheight, + rip->ri_width / rip->ri_font->fontwidth); /* 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; + rip->ri_ops.copyrows = tga_copyrows; + rip->ri_ops.eraserows = tga_eraserows; + rip->ri_ops.erasecols = tga_erasecols; + rip->ri_ops.copycols = tga_copycols; + rip->ri_ops.putchar = tga_putchar; + tga_stdscreen.nrows = rip->ri_rows; + tga_stdscreen.ncols = rip->ri_cols; + tga_stdscreen.textops = &rip->ri_ops; + tga_stdscreen.capabilities = rip->ri_caps; dc->dc_intrenabled = 0; } @@ -546,6 +547,8 @@ tgaattach(parent, self, aux) #ifdef __NetBSD__ config_interrupts(self, tga_config_interrupts); +#else + tga_config_interrupts(self); #endif } @@ -721,7 +724,7 @@ tga_mmap(v, offset, prot) /* * The framebuffer starts at the upper half of tga mem */ - offset += dc->dc_tgaconf->tgac_cspace_size/2; + offset += dc->dc_tgaconf->tgac_cspace_size / 2; } #if defined(__alpha__) return alpha_btop(sc->sc_dc->dc_paddr + offset); @@ -832,6 +835,20 @@ tga_cnattach(iot, memt, pc, bus, device, function) * Functions to blank and unblank the display. */ void +tga_burner(v, on, flags) + void *v; + u_int on, flags; +{ + struct tga_softc *sc = v; + + if (on) { + tga_unblank(sc->sc_dc); + } else { + tga_blank(sc->sc_dc); + } +} + +void tga_blank(dc) struct tga_devconfig *dc; { @@ -897,7 +914,7 @@ tga_builtin_set_cursor(dc, cursorp) } if (v & WSDISPLAY_CURSOR_DOPOS) { TGAWREG(dc, TGA_REG_CXYR, - ((cursorp->pos.y & 0xfff) << 12) | (cursorp->pos.x & 0xfff)); + ((cursorp->pos.y & 0xfff) << 12) | (cursorp->pos.x & 0xfff)); } if (v & WSDISPLAY_CURSOR_DOCMAP) { /* can't fail. */ @@ -1307,7 +1324,7 @@ void tga_putchar (c, row, col, uc, attr) /* XXX Abuses the fact that there is only one write barrier on Alphas */ TGAREGWB(dc, TGA_REG_GMOR, 1); - while(height--) { + while (height--) { /* The actual stipple write */ *rp = fr[0] | (fr[1] << 8) | (fr[2] << 16) | (fr[3] << 24); @@ -1383,9 +1400,9 @@ tga_eraserows(c, row, num, attr) void tga_erasecols (c, row, col, num, attr) -void *c; -int row, col, num; -long attr; + void *c; + int row, col, num; + long attr; { struct rasops_info *ri = c; struct tga_devconfig *dc = ri->ri_hw; @@ -1671,8 +1688,8 @@ tga2_ics9110_wr(dc, dotclock) bus_space_subregion(dc->dc_memt, dc->dc_memh, TGA2_MEM_EXTDEV + TGA2_MEM_CLOCK + (0xe << 12), 4, &clock); /* XXX */ - for (i=24; i>0; i--) { - u_int32_t writeval; + for (i = 24; i > 0; i--) { + u_int32_t writeval; writeval = valU & 0x1; if (i == 1) diff --git a/sys/dev/pci/tgavar.h b/sys/dev/pci/tgavar.h index 93f071ed724..ebe52785abf 100644 --- a/sys/dev/pci/tgavar.h +++ b/sys/dev/pci/tgavar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tgavar.h,v 1.7 2002/04/26 20:04:50 matthieu Exp $ */ +/* $OpenBSD: tgavar.h,v 1.8 2002/07/04 00:34:28 miod Exp $ */ /* $NetBSD: tgavar.h,v 1.8 2000/04/02 19:01:11 nathanw Exp $ */ /* @@ -50,11 +50,11 @@ struct tga_conf { vsize_t tgac_vvbr_units; /* what '1' in the VVBR means */ int tgac_ndbuf; /* number of display buffers */ - vaddr_t tgac_dbuf[2]; /* display buffer offsets/addresses */ + vaddr_t tgac_dbuf[2]; /* display buffer offsets/addresses */ vsize_t tgac_dbufsz[2]; /* display buffer sizes */ int tgac_nbbuf; /* number of display buffers */ - vaddr_t tgac_bbuf[2]; /* back buffer offsets/addresses */ + vaddr_t tgac_bbuf[2]; /* back buffer offsets/addresses */ vsize_t tgac_bbufsz[2]; /* back buffer sizes */ }; @@ -83,7 +83,7 @@ struct tga_devconfig { int dc_ht; /* height of frame buffer */ int dc_rowbytes; /* bytes in a FB scan line */ - vaddr_t dc_videobase; /* base of flat frame buffer */ + vaddr_t dc_videobase; /* base of flat frame buffer */ struct rasops_info dc_rinfo; /* raster display data */ @@ -91,7 +91,7 @@ struct tga_devconfig { void *dc_ramdac_private; /* RAMDAC private storage */ void (*dc_ramdac_intr)(void *); - int dc_intrenabled; /* can we depend on interrupts yet? */ + int dc_intrenabled; /* can we depend on interrupts yet? */ }; struct tga_softc { |