Module Name: src
Committed By: jmcneill
Date: Tue Feb 8 13:40:35 UTC 2011
Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h
Log Message:
abuse config_interrupts to make sure we don't switch to 'intr' mode until
interrupts are enabled
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/wscons/wsdisplay_vconsvar.h
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.20 src/sys/dev/wscons/wsdisplay_vcons.c:1.21
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.20 Tue Feb 8 12:45:04 2011
+++ src/sys/dev/wscons/wsdisplay_vcons.c Tue Feb 8 13:40:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vcons.c,v 1.20 2011/02/08 12:45:04 jmcneill Exp $ */
+/* $NetBSD: wsdisplay_vcons.c,v 1.21 2011/02/08 13:40:35 jmcneill Exp $ */
/*-
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.20 2011/02/08 12:45:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.21 2011/02/08 13:40:35 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -124,6 +124,7 @@
#ifdef VCONS_DRAW_INTR
static void vcons_intr(void *);
static void vcons_intr_work(struct work *, void *);
+static void vcons_intr_enable(device_t);
#endif
int
@@ -176,7 +177,9 @@
vcons_intr_work, vd, PRI_KTHREAD, IPL_TTY, WQ_MPSAFE);
callout_init(&vd->intr, 0);
callout_setfunc(&vd->intr, vcons_intr, vd);
- callout_schedule(&vd->intr, mstohz(33));
+
+ /* XXX assume that the 'dev' arg is never dereferenced */
+ config_interrupts((device_t)vd, vcons_intr_enable);
#endif
return 0;
}
@@ -586,14 +589,16 @@
static void
vcons_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
{
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-#endif
vcons_copycols_buffer(cookie, row, srccol, dstcol, ncols);
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
+#if defined(VCONS_DRAW_INTR)
+ if (scr->scr_vd->use_intr)
+ return;
+#endif
+
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
@@ -605,7 +610,6 @@
scr->scr_vd->copycols(cookie, row, srccol, dstcol, ncols);
}
vcons_unlock(scr);
-#endif
}
static void
@@ -662,14 +666,16 @@
static void
vcons_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
{
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-#endif
vcons_erasecols_buffer(cookie, row, startcol, ncols, fillattr);
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
+#if defined(VCONS_DRAW_INTR)
+ if (scr->scr_vd->use_intr)
+ return;
+#endif
+
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
@@ -683,7 +689,6 @@
fillattr);
}
vcons_unlock(scr);
-#endif
}
static void
@@ -729,14 +734,16 @@
static void
vcons_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
{
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-#endif
vcons_copyrows_buffer(cookie, srcrow, dstrow, nrows);
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
+#if defined(VCONS_DRAW_INTR)
+ if (scr->scr_vd->use_intr)
+ return;
+#endif
+
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
@@ -748,7 +755,6 @@
scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows);
}
vcons_unlock(scr);
-#endif
}
static void
@@ -807,14 +813,16 @@
static void
vcons_eraserows(void *cookie, int row, int nrows, long fillattr)
{
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-#endif
vcons_eraserows_buffer(cookie, row, nrows, fillattr);
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
+#if defined(VCONS_DRAW_INTR)
+ if (scr->scr_vd->use_intr)
+ return;
+#endif
+
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
@@ -826,7 +834,6 @@
scr->scr_vd->eraserows(cookie, row, nrows, fillattr);
}
vcons_unlock(scr);
-#endif
}
static void
@@ -863,14 +870,16 @@
static void
vcons_putchar(void *cookie, int row, int col, u_int c, long attr)
{
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-#endif
vcons_putchar_buffer(cookie, row, col, c, attr);
-
-#if !defined(VCONS_DRAW_INTR) || defined(VCONS_INTR_DEBUG)
+
+#if defined(VCONS_DRAW_INTR)
+ if (scr->scr_vd->use_intr)
+ return;
+#endif
+
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
@@ -882,7 +891,6 @@
scr->scr_vd->putchar(cookie, row, col, c, attr);
}
vcons_unlock(scr);
-#endif
}
static void
@@ -892,14 +900,21 @@
struct vcons_screen *scr = ri->ri_hw;
- vcons_lock(scr);
#if defined(VCONS_DRAW_INTR)
- if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
- scr->scr_ri.ri_crow = row;
- scr->scr_ri.ri_ccol = col;
- scr->scr_dirty++;
+ if (scr->scr_vd->use_intr) {
+ vcons_lock(scr);
+ if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
+ scr->scr_ri.ri_crow = row;
+ scr->scr_ri.ri_ccol = col;
+ scr->scr_dirty++;
+ }
+ vcons_unlock(scr);
+ return;
}
-#else
+#endif
+
+ vcons_lock(scr);
+
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_ASYNC
struct vcons_data *vd = scr->scr_vd;
@@ -912,7 +927,6 @@
scr->scr_ri.ri_crow = row;
scr->scr_ri.ri_ccol = col;
}
-#endif
vcons_unlock(scr);
}
@@ -1421,4 +1435,13 @@
callout_schedule(&vd->intr, mstohz(33));
}
+
+static void
+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;
+ callout_schedule(&vd->intr, mstohz(33));
+}
#endif /* VCONS_DRAW_INTR */
Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.14 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.15
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.14 Tue Feb 8 12:45:04 2011
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h Tue Feb 8 13:40:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vconsvar.h,v 1.14 2011/02/08 12:45:04 jmcneill Exp $ */
+/* $NetBSD: wsdisplay_vconsvar.h,v 1.15 2011/02/08 13:40:35 jmcneill Exp $ */
/*-
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -141,6 +141,7 @@
callout_t intr;
struct workqueue *intr_wq;
struct work wk;
+ int use_intr; /* use intr drawing when non-zero */
#endif
};