diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2014-01-21 00:10:46 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2014-01-21 00:10:46 +0000 |
| commit | 00cc7e1f7b968ac5ed768c798fb7eabfe1f8f63f (patch) | |
| tree | 95da913a45ff45cd15c58d3960ae8916a038843b /sys/dev | |
| parent | 3886243d5f3e3769d1e59460337946dafcb4aae0 (diff) | |
keep track of VCONS_DRAW_INTR screen cache also in erasecols/rows and
copycols/rows methods.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/wscons/wsdisplay_vcons.c | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/sys/dev/wscons/wsdisplay_vcons.c b/sys/dev/wscons/wsdisplay_vcons.c index f76b4dcd94b..fd68ba1257e 100644 --- a/sys/dev/wscons/wsdisplay_vcons.c +++ b/sys/dev/wscons/wsdisplay_vcons.c @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.29 2013/09/15 16:12:00 martin Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.29 2013/09/15 16:12:00 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.30 2014/01/21 00:10:46 mlelstv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -89,6 +89,8 @@ static void vcons_copyrows(void *, int, int, int); static void vcons_eraserows(void *, int, int, long); static void vcons_putchar(void *, int, int, u_int, long); #ifdef VCONS_DRAW_INTR +static void vcons_erasecols_cached(void *, int, int, int, long); +static void vcons_eraserows_cached(void *, int, int, long); static void vcons_putchar_cached(void *, int, int, u_int, long); #endif static void vcons_cursor(void *, int, int, int); @@ -731,6 +733,9 @@ vcons_copycols(void *cookie, int row, int srccol, int dstcol, int ncols) vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->copycols(cookie, row, srccol, dstcol, ncols); +#if defined(VCONS_DRAW_INTR) + vcons_invalidate_cache(scr->scr_vd); +#endif } vcons_unlock(scr); } @@ -742,6 +747,7 @@ vcons_copycols_noread(void *cookie, int row, int srccol, int dstcol, int ncols) struct vcons_screen *scr = ri->ri_hw; struct vcons_data *vd = scr->scr_vd; + vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { int pos, c, offset, ppos; @@ -769,6 +775,7 @@ vcons_copycols_noread(void *cookie, int row, int srccol, int dstcol, int ncols) ppos++; } } + vcons_unlock(scr); } static void @@ -832,8 +839,8 @@ vcons_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr) vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { #ifdef VCONS_DRAW_INTR - vcons_erasecols_cached(cookie, row, startcol, ncols, - fillattr); + vcons_erasecols_cached(cookie, row, startcol, ncols, + fillattr); #else scr->scr_vd->erasecols(cookie, row, startcol, ncols, fillattr); #endif @@ -897,6 +904,9 @@ vcons_copyrows(void *cookie, int srcrow, int dstrow, int nrows) vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows); +#if defined(VCONS_DRAW_INTR) + vcons_invalidate_cache(scr->scr_vd); +#endif } vcons_unlock(scr); } @@ -908,6 +918,7 @@ vcons_copyrows_noread(void *cookie, int srcrow, int dstrow, int nrows) struct vcons_screen *scr = ri->ri_hw; struct vcons_data *vd = scr->scr_vd; + vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { int pos, l, c, offset, ppos; @@ -929,7 +940,7 @@ vcons_copyrows_noread(void *cookie, int srcrow, int dstrow, int nrows) vd->attrs[ppos] = scr->scr_attrs[pos]; } #else - vd->putchar(cookie, l, c, scr->scr_chars[pos], + scr->scr_vd->putchar(cookie, l, c, scr->scr_chars[pos], scr->scr_attrs[pos]); #endif pos++; @@ -937,6 +948,7 @@ vcons_copyrows_noread(void *cookie, int srcrow, int dstrow, int nrows) } } } + vcons_unlock(scr); } static void @@ -967,6 +979,23 @@ vcons_eraserows_buffer(void *cookie, int row, int nrows, long fillattr) #endif } +#ifdef VCONS_DRAW_INTR +static void +vcons_eraserows_cached(void *cookie, int row, int nrows, long fillattr) +{ + struct rasops_info *ri = cookie; + struct vcons_screen *scr = ri->ri_hw; + struct vcons_data *vd = scr->scr_vd; + int i, pos = row * ri->ri_cols, end = (row+nrows) * ri->ri_cols; + + for (i = pos; i < end; i++) { + vd->chars[i] = 0x20; + vd->attrs[i] = fillattr; + } + vd->eraserows(cookie, row, nrows, fillattr); +} +#endif + static void vcons_eraserows(void *cookie, int row, int nrows, long fillattr) { @@ -982,7 +1011,11 @@ vcons_eraserows(void *cookie, int row, int nrows, long fillattr) vcons_lock(scr); if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) { +#ifdef VCONS_DRAW_INTR + vcons_eraserows_cached(cookie, row, nrows, fillattr); +#else scr->scr_vd->eraserows(cookie, row, nrows, fillattr); +#endif } vcons_unlock(scr); } @@ -1262,10 +1295,15 @@ vcons_softintr(void *cookie) struct vcons_screen *scr = vd->active; unsigned int dirty; - if (scr && vd->use_intr == 1) { + if (scr && vd->use_intr) { if (!SCREEN_IS_BUSY(scr)) { dirty = atomic_swap_uint(&scr->scr_dirty, 0); - if (dirty > 0) { + if (vd->use_intr == 2) { + if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) { + vd->use_intr = 1; + vcons_redraw_screen(scr); + } + } else if (dirty > 0) { if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) vcons_update_screen(scr); } @@ -1280,7 +1318,7 @@ vcons_intr_enable(device_t dev) { /* the 'dev' arg we pass to config_interrupts isn't a device_t */ struct vcons_data *vd = (struct vcons_data *)dev; - vd->use_intr = 1; + vd->use_intr = 2; callout_schedule(&vd->intr, mstohz(33)); } #endif /* VCONS_DRAW_INTR */ @@ -1309,7 +1347,7 @@ vcons_disable_polling(struct vcons_data *vd) if (!vd->intr_valid) return; - vd->use_intr = 1; + vd->use_intr = 2; if (scr) atomic_inc_uint(&scr->scr_dirty); #endif |
