VCONS_DRAW_INTR changes:
- use softint instead of workqueue for drawing - track scr_dirty with atomic_ops
This commit is contained in:
parent
e95e36baec
commit
3f11f2aa84
|
@ -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 @@ static void vcons_kthread(void *);
|
|||
#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 @@ vcons_init(struct vcons_data *vd, void *cookie, struct wsscreen_descr *def,
|
|||
&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 @@ vcons_copycols_buffer(void *cookie, int row, int srccol, int dstcol, int ncols)
|
|||
#endif
|
||||
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
scr->scr_dirty++;
|
||||
atomic_inc_uint(&scr->scr_dirty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ vcons_erasecols_buffer(void *cookie, int row, int startcol, int ncols, long fill
|
|||
#endif
|
||||
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
scr->scr_dirty++;
|
||||
atomic_inc_uint(&scr->scr_dirty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ vcons_copyrows_buffer(void *cookie, int srcrow, int dstrow, int nrows)
|
|||
len * sizeof(uint16_t));
|
||||
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
scr->scr_dirty++;
|
||||
atomic_inc_uint(&scr->scr_dirty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -806,7 +806,7 @@ vcons_eraserows_buffer(void *cookie, int row, int nrows, long fillattr)
|
|||
}
|
||||
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
scr->scr_dirty++;
|
||||
atomic_inc_uint(&scr->scr_dirty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ vcons_putchar_buffer(void *cookie, int row, int col, u_int c, long attr)
|
|||
#endif
|
||||
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
scr->scr_dirty++;
|
||||
atomic_inc_uint(&scr->scr_dirty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@ vcons_cursor(void *cookie, int on, int row, int col)
|
|||
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 @@ vcons_intr(void *cookie)
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ struct vcons_screen {
|
|||
int scr_current_offset;
|
||||
#endif
|
||||
#ifdef VCONS_DRAW_INTR
|
||||
int scr_dirty;
|
||||
unsigned int scr_dirty;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -139,8 +137,7 @@ struct vcons_data {
|
|||
#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
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue