Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons VCONS_DRAW_INTR changes:



details:   https://anonhg.NetBSD.org/src/rev/65a27287f544
branches:  trunk
changeset: 761837:65a27287f544
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Feb 08 23:06:25 2011 +0000

description:
VCONS_DRAW_INTR changes:
- use softint instead of workqueue for drawing
- track scr_dirty with atomic_ops

diffstat:

 sys/dev/wscons/wsdisplay_vcons.c    |  37 ++++++++++++++++++++-----------------
 sys/dev/wscons/wsdisplay_vconsvar.h |   9 +++------
 2 files changed, 23 insertions(+), 23 deletions(-)

diffs (159 lines):

diff -r 4424b936fd6d -r 65a27287f544 sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Tue Feb 08 22:16:58 2011 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Tue Feb 08 23:06:25 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vcons.c,v 1.21 2011/02/08 13:40:35 jmcneill Exp $ */
+/*     $NetBSD: wsdisplay_vcons.c,v 1.22 2011/02/08 23:06:25 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.21 2011/02/08 13:40:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.22 2011/02/08 23:06:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,7 +123,7 @@
 #endif
 #ifdef VCONS_DRAW_INTR
 static void vcons_intr(void *);
-static void vcons_intr_work(struct work *, void *);
+static void vcons_softintr(void *);
 static void vcons_intr_enable(device_t);
 #endif
 
@@ -173,8 +173,8 @@
            &vd->drawing_thread, "vcons_draw");
 #endif
 #ifdef VCONS_DRAW_INTR
-       workqueue_create(&vd->intr_wq, "vcons_draw",
-           vcons_intr_work, vd, PRI_KTHREAD, IPL_TTY, WQ_MPSAFE);
+       vd->intr_softint = softint_establish(SOFTINT_SERIAL,
+           vcons_softintr, vd);
        callout_init(&vd->intr, 0);
        callout_setfunc(&vd->intr, vcons_intr, vd);
 
@@ -582,7 +582,7 @@
 #endif
 
 #ifdef VCONS_DRAW_INTR
-       scr->scr_dirty++;
+       atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
 
@@ -659,7 +659,7 @@
 #endif
 
 #ifdef VCONS_DRAW_INTR
-       scr->scr_dirty++;
+       atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
 
@@ -727,7 +727,7 @@
            len * sizeof(uint16_t));
 
 #ifdef VCONS_DRAW_INTR
-       scr->scr_dirty++;
+       atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
 
@@ -806,7 +806,7 @@
        }
 
 #ifdef VCONS_DRAW_INTR
-       scr->scr_dirty++;
+       atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
 
@@ -863,7 +863,7 @@
 #endif
 
 #ifdef VCONS_DRAW_INTR
-       scr->scr_dirty++;
+       atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
 
@@ -906,7 +906,7 @@
                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++;
+                       atomic_inc_uint(&scr->scr_dirty);
                }
                vcons_unlock(scr);
                return;
@@ -1416,20 +1416,23 @@
 {
        struct vcons_data *vd = cookie;
 
-       workqueue_enqueue(vd->intr_wq, &vd->wk, NULL);
+       softint_schedule(vd->intr_softint);
 }
 
 static void
-vcons_intr_work(struct work *wk, void *cookie)
+vcons_softintr(void *cookie)
 {
        struct vcons_data *vd = cookie;
        struct vcons_screen *scr = vd->active;
+       unsigned int dirty;
 
        if (scr) {
-               if (!SCREEN_IS_BUSY(scr) && scr->scr_dirty > 0) {
-                       if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
-                               vcons_redraw_screen(scr);
-                       scr->scr_dirty = 0;
+               if (!SCREEN_IS_BUSY(scr)) {
+                       dirty = atomic_swap_uint(&scr->scr_dirty, 0);
+                       if (dirty > 0) {
+                               if ((scr->scr_flags & VCONS_NO_REDRAW) == 0)
+                                       vcons_redraw_screen(scr);
+                       }
                }
        }
 
diff -r 4424b936fd6d -r 65a27287f544 sys/dev/wscons/wsdisplay_vconsvar.h
--- a/sys/dev/wscons/wsdisplay_vconsvar.h       Tue Feb 08 22:16:58 2011 +0000
+++ b/sys/dev/wscons/wsdisplay_vconsvar.h       Tue Feb 08 23:06:25 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vconsvar.h,v 1.15 2011/02/08 13:40:35 jmcneill Exp $ */
+/*     $NetBSD: wsdisplay_vconsvar.h,v 1.16 2011/02/08 23:06:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -32,8 +32,6 @@
 #include "opt_wsdisplay_compat.h"
 #include "opt_vcons.h"
 
-#include <sys/workqueue.h>
-
 struct vcons_data;
 
 struct vcons_screen {
@@ -76,7 +74,7 @@
        int scr_current_offset;
 #endif
 #ifdef VCONS_DRAW_INTR
-       int scr_dirty;
+       unsigned int scr_dirty;
 #endif
 };
 
@@ -139,8 +137,7 @@
 #endif
 #ifdef VCONS_DRAW_INTR
        callout_t intr;
-       struct workqueue *intr_wq;
-       struct work wk;
+       void *intr_softint;
        int use_intr;           /* use intr drawing when non-zero */
 #endif
 };



Home | Main Index | Thread Index | Old Index