Module Name: src
Committed By: jmcneill
Date: Wed Feb 9 13:19:19 UTC 2011
Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h
src/sys/dev/wsfb: genfb.c genfbvar.h
Log Message:
add vcons_{enable,disable}_polling and genfb_{enable,disable}_polling
functions, to switch between intr and polling modes when VCONS_DRAW_INTR
is defined
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wscons/wsdisplay_vconsvar.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/wsfb/genfbvar.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.22 src/sys/dev/wscons/wsdisplay_vcons.c:1.23
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.22 Tue Feb 8 23:06:25 2011
+++ src/sys/dev/wscons/wsdisplay_vcons.c Wed Feb 9 13:19:18 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vcons.c,v 1.22 2011/02/08 23:06:25 jmcneill Exp $ */
+/* $NetBSD: wsdisplay_vcons.c,v 1.23 2011/02/09 13:19:18 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.22 2011/02/08 23:06:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.23 2011/02/09 13:19:18 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -177,6 +177,7 @@
vcons_softintr, vd);
callout_init(&vd->intr, 0);
callout_setfunc(&vd->intr, vcons_intr, vd);
+ vd->intr_valid = 1;
/* XXX assume that the 'dev' arg is never dereferenced */
config_interrupts((device_t)vd, vcons_intr_enable);
@@ -1426,7 +1427,7 @@
struct vcons_screen *scr = vd->active;
unsigned int dirty;
- if (scr) {
+ if (scr && vd->use_intr == 1) {
if (!SCREEN_IS_BUSY(scr)) {
dirty = atomic_swap_uint(&scr->scr_dirty, 0);
if (dirty > 0) {
@@ -1448,3 +1449,33 @@
callout_schedule(&vd->intr, mstohz(33));
}
#endif /* VCONS_DRAW_INTR */
+
+void
+vcons_enable_polling(struct vcons_data *vd)
+{
+ struct vcons_screen *scr = vd->active;
+
+#ifdef VCONS_DRAW_INTR
+ vd->use_intr = 0;
+#endif
+
+ if (scr && !SCREEN_IS_BUSY(scr)) {
+ if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
+ vcons_redraw_screen(scr);
+ }
+}
+
+void
+vcons_disable_polling(struct vcons_data *vd)
+{
+#ifdef VCONS_DRAW_INTR
+ struct vcons_screen *scr = vd->active;
+
+ if (!vd->intr_valid)
+ return;
+
+ vd->use_intr = 1;
+ if (scr)
+ atomic_inc_uint(&scr->scr_dirty);
+#endif
+}
Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.16 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.17
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.16 Tue Feb 8 23:06:25 2011
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h Wed Feb 9 13:19:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vconsvar.h,v 1.16 2011/02/08 23:06:25 jmcneill Exp $ */
+/* $NetBSD: wsdisplay_vconsvar.h,v 1.17 2011/02/09 13:19:19 jmcneill Exp $ */
/*-
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -137,6 +137,7 @@
#endif
#ifdef VCONS_DRAW_INTR
callout_t intr;
+ int intr_valid;
void *intr_softint;
int use_intr; /* use intr drawing when non-zero */
#endif
@@ -174,4 +175,7 @@
void vcons_replay_msgbuf(struct vcons_screen *);
+void vcons_enable_polling(struct vcons_data *);
+void vcons_disable_polling(struct vcons_data *);
+
#endif /* _WSDISPLAY_VCONS_H_ */
Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.34 src/sys/dev/wsfb/genfb.c:1.35
--- src/sys/dev/wsfb/genfb.c:1.34 Tue Feb 8 10:52:56 2011
+++ src/sys/dev/wsfb/genfb.c Wed Feb 9 13:19:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.34 2011/02/08 10:52:56 jmcneill Exp $ */
+/* $NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.34 2011/02/08 10:52:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.35 2011/02/09 13:19:19 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -685,3 +685,20 @@
genfb_set_backlight(sc, sc->sc_backlight_level - 8);
}
+
+void
+genfb_enable_polling(device_t dev)
+{
+ struct genfb_softc *sc = device_private(dev);
+
+ SCREEN_ENABLE_DRAWING(&sc->sc_console_screen);
+ vcons_enable_polling(&sc->vd);
+}
+
+void
+genfb_disable_polling(device_t dev)
+{
+ struct genfb_softc *sc = device_private(dev);
+
+ vcons_disable_polling(&sc->vd);
+}
Index: src/sys/dev/wsfb/genfbvar.h
diff -u src/sys/dev/wsfb/genfbvar.h:1.18 src/sys/dev/wsfb/genfbvar.h:1.19
--- src/sys/dev/wsfb/genfbvar.h:1.18 Tue Feb 8 10:52:56 2011
+++ src/sys/dev/wsfb/genfbvar.h Wed Feb 9 13:19:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: genfbvar.h,v 1.18 2011/02/08 10:52:56 jmcneill Exp $ */
+/* $NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.18 2011/02/08 10:52:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfbvar.h,v 1.19 2011/02/09 13:19:19 jmcneill Exp $");
#ifndef GENFBVAR_H
#define GENFBVAR_H
@@ -119,6 +119,7 @@
int genfb_attach(struct genfb_softc *, struct genfb_ops *);
int genfb_borrow(bus_addr_t, bus_space_handle_t *);
void genfb_restore_palette(struct genfb_softc *);
-
+void genfb_enable_polling(device_t);
+void genfb_disable_polling(device_t);
#endif /* GENFBVAR_H */