Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev add vcons_{enable, disable}_polling and genfb_{enable...
details: https://anonhg.NetBSD.org/src/rev/65cf114e25d7
branches: trunk
changeset: 761851:65cf114e25d7
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Feb 09 13:19:18 2011 +0000
description:
add vcons_{enable,disable}_polling and genfb_{enable,disable}_polling
functions, to switch between intr and polling modes when VCONS_DRAW_INTR
is defined
diffstat:
sys/dev/wscons/wsdisplay_vcons.c | 37 ++++++++++++++++++++++++++++++++++---
sys/dev/wscons/wsdisplay_vconsvar.h | 6 +++++-
sys/dev/wsfb/genfb.c | 21 +++++++++++++++++++--
sys/dev/wsfb/genfbvar.h | 7 ++++---
4 files changed, 62 insertions(+), 9 deletions(-)
diffs (160 lines):
diff -r 4c23eddb693b -r 65cf114e25d7 sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c Wed Feb 09 11:38:57 2011 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c Wed Feb 09 13:19:18 2011 +0000
@@ -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
+}
diff -r 4c23eddb693b -r 65cf114e25d7 sys/dev/wscons/wsdisplay_vconsvar.h
--- a/sys/dev/wscons/wsdisplay_vconsvar.h Wed Feb 09 11:38:57 2011 +0000
+++ b/sys/dev/wscons/wsdisplay_vconsvar.h Wed Feb 09 13:19:18 2011 +0000
@@ -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_ */
diff -r 4c23eddb693b -r 65cf114e25d7 sys/dev/wsfb/genfb.c
--- a/sys/dev/wsfb/genfb.c Wed Feb 09 11:38:57 2011 +0000
+++ b/sys/dev/wsfb/genfb.c Wed Feb 09 13:19:18 2011 +0000
@@ -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);
+}
diff -r 4c23eddb693b -r 65cf114e25d7 sys/dev/wsfb/genfbvar.h
--- a/sys/dev/wsfb/genfbvar.h Wed Feb 09 11:38:57 2011 +0000
+++ b/sys/dev/wsfb/genfbvar.h Wed Feb 09 13:19:18 2011 +0000
@@ -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 */
Home |
Main Index |
Thread Index |
Old Index