Module Name: src Committed By: mlelstv Date: Tue Jan 21 00:10:46 UTC 2014
Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: keep track of VCONS_DRAW_INTR screen cache also in erasecols/rows and copycols/rows methods. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.29 src/sys/dev/wscons/wsdisplay_vcons.c:1.30 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.29 Sun Sep 15 16:12:00 2013 +++ src/sys/dev/wscons/wsdisplay_vcons.c Tue Jan 21 00:10:46 2014 @@ -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, 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, in 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 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 ppos++; } } + vcons_unlock(scr); } static void @@ -832,8 +839,8 @@ vcons_erasecols(void *cookie, int row, i 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, 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 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 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 } } } + vcons_unlock(scr); } static void @@ -967,6 +979,23 @@ vcons_eraserows_buffer(void *cookie, int #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, i 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 if (!vd->intr_valid) return; - vd->use_intr = 1; + vd->use_intr = 2; if (scr) atomic_inc_uint(&scr->scr_dirty); #endif