Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons remove VCONS_DRAW_ASYNC
details: https://anonhg.NetBSD.org/src/rev/5f9b6cd7266e
branches: trunk
changeset: 765398:5f9b6cd7266e
user: macallan <macallan%NetBSD.org@localhost>
date: Wed May 25 06:13:29 2011 +0000
description:
remove VCONS_DRAW_ASYNC
it was always experimental, VCONS_DRAW_INTR is much simpler and Just Works.
diffstat:
sys/dev/wscons/files.wscons | 5 +-
sys/dev/wscons/wsdisplay_vcons.c | 402 +-----------------------------------
sys/dev/wscons/wsdisplay_vconsvar.h | 38 +---
3 files changed, 8 insertions(+), 437 deletions(-)
diffs (truncated from 568 to 300 lines):
diff -r 3ee202c2e2ef -r 5f9b6cd7266e sys/dev/wscons/files.wscons
--- a/sys/dev/wscons/files.wscons Wed May 25 06:01:38 2011 +0000
+++ b/sys/dev/wscons/files.wscons Wed May 25 06:13:29 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.43 2011/02/08 12:45:04 jmcneill Exp $
+# $NetBSD: files.wscons,v 1.44 2011/05/25 06:13:30 macallan Exp $
#
# "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -75,5 +75,4 @@
# generic virtual console support on bitmapped framebuffers
file dev/wscons/wsdisplay_vcons.c vcons
file dev/wscons/wsdisplay_vcons_util.c vcons
-defflag opt_vcons.h VCONS_DRAW_ASYNC VCONS_ASYNC_DEBUG
- VCONS_DRAW_INTR VCONS_INTR_DEBUG
+defflag opt_vcons.h VCONS_DRAW_INTR VCONS_INTR_DEBUG
diff -r 3ee202c2e2ef -r 5f9b6cd7266e sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c Wed May 25 06:01:38 2011 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c Wed May 25 06:13:29 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vcons.c,v 1.25 2011/05/25 06:01:38 macallan Exp $ */
+/* $NetBSD: wsdisplay_vcons.c,v 1.26 2011/05/25 06:13:29 macallan Exp $ */
/*-
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.25 2011/05/25 06:01:38 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.26 2011/05/25 06:13:29 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,10 +55,6 @@
#include "opt_wsdisplay_compat.h"
#include "opt_vcons.h"
-#if defined(VCONS_DRAW_ASYNC) && defined(VCONS_DRAW_INTR)
-#error VCONS_DRAW_ASYNC and VCONS_DRAW_INTR cannot be defined together
-#endif
-
static void vcons_dummy_init_screen(void *, struct vcons_screen *, int,
long *);
@@ -83,16 +79,6 @@
static void vcons_eraserows_buffer(void *, int, int, long);
static void vcons_putchar_buffer(void *, int, int, u_int, long);
-#ifdef VCONS_DRAW_ASYNC
-/* methods that work asynchronously */
-static void vcons_copycols_async(void *, int, int, int, int);
-static void vcons_erasecols_async(void *, int, int, int, long);
-static void vcons_copyrows_async(void *, int, int, int);
-static void vcons_eraserows_async(void *, int, int, long);
-static void vcons_putchar_async(void *, int, int, u_int, long);
-static void vcons_cursor_async(void *, int, int, int);
-#endif
-
/*
* actual wrapper methods which call both the _buffer ones above and the
* driver supplied ones to do the drawing
@@ -121,9 +107,6 @@
static void vcons_lock(struct vcons_screen *);
static void vcons_unlock(struct vcons_screen *);
-#ifdef VCONS_DRAW_ASYNC
-static void vcons_kthread(void *);
-#endif
#ifdef VCONS_DRAW_INTR
static void vcons_intr(void *);
static void vcons_softintr(void *);
@@ -177,10 +160,6 @@
#ifdef DIAGNOSTIC
vd->switch_poll_count = 0;
#endif
-#ifdef VCONS_DRAW_ASYNC
- kthread_create(PRI_NONE, 0, NULL, vcons_kthread, vd,
- &vd->drawing_thread, "vcons_draw");
-#endif
#ifdef VCONS_DRAW_INTR
vd->intr_softint = softint_establish(SOFTINT_SERIAL,
vcons_softintr, vd);
@@ -690,13 +669,7 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_copycols_async(cookie, row, srccol, dstcol, ncols);
- } else
-#endif
- scr->scr_vd->copycols(cookie, row, srccol, dstcol, ncols);
+ scr->scr_vd->copycols(cookie, row, srccol, dstcol, ncols);
}
vcons_unlock(scr);
}
@@ -797,13 +770,6 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_erasecols_async(cookie, row, startcol, ncols,
- fillattr);
- } else
-#endif
#ifdef VCONS_DRAW_INTR
vcons_erasecols_cached(cookie, row, startcol, ncols,
fillattr);
@@ -869,13 +835,7 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_copyrows_async(cookie, srcrow, dstrow, nrows);
- } else
-#endif
- scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows);
+ scr->scr_vd->copyrows(cookie, srcrow, dstrow, nrows);
}
vcons_unlock(scr);
}
@@ -963,12 +923,6 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_eraserows_async(cookie, row, nrows, fillattr);
- } else
-#endif
scr->scr_vd->eraserows(cookie, row, nrows, fillattr);
}
vcons_unlock(scr);
@@ -1041,12 +995,6 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_putchar_async(cookie, row, col, c, attr);
- } else
-#endif
#ifdef VCONS_DRAW_INTR
vcons_putchar_cached(cookie, row, col, c, attr);
#else
@@ -1079,13 +1027,7 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
-#ifdef VCONS_DRAW_ASYNC
- struct vcons_data *vd = scr->scr_vd;
- if (vd->use_async) {
- vcons_cursor_async(cookie, on, row, col);
- } else
-#endif
- scr->scr_vd->cursor(cookie, on, row, col);
+ scr->scr_vd->cursor(cookie, on, row, col);
} else {
scr->scr_ri.ri_crow = row;
scr->scr_ri.ri_ccol = col;
@@ -1245,340 +1187,6 @@
#endif /* WSDISPLAY_SCROLLSUPPORT */
-/* async drawing using a kernel thread */
-
-#ifdef VCONS_DRAW_ASYNC
-
-static inline uint32_t
-vcons_words_in_buffer(struct vcons_data *vd)
-{
- int len = vd->rb_write - vd->rb_read;
-
- if (len < 0) len += VCONS_RING_BUFFER_LENGTH;
- if (len < 0) vd->use_async = 0;
- if (len >= VCONS_RING_BUFFER_LENGTH) vd->use_async = 0;
- return (uint32_t)len;
-}
-
-static inline int
-vcons_wait_buffer(struct vcons_data *vd, uint32_t words)
-{
- int bail = 0;
-
- mutex_enter(&vd->go_buffer_il);
- while (((VCONS_RING_BUFFER_LENGTH - vcons_words_in_buffer(vd)) < words)
- && (bail < 3)) {
- if (cv_timedwait(&vd->go_buffer, &vd->go_buffer_il, hz)
- == EWOULDBLOCK)
- bail++;
- }
- if (bail >= 3) {
- /*
- * waited too long, something is wrong so fall back to sync
- * we should probably kill the kthread here and try to empty
- * the command buffer as well
- */
- vd->use_async = 0;
- }
- return 0;
-}
-
-#define VRB_NEXT(idx) ((idx + 1) >= VCONS_RING_BUFFER_LENGTH) ? 0 : idx + 1
-
-static void
-vcons_copycols_async(void *cookie, int row, int srccol, int dstcol, int ncols)
-{
- struct rasops_info *ri = cookie;
- struct vcons_screen *scr = ri->ri_hw;
- struct vcons_data *vd = scr->scr_vd;
- int idx;
-
- vcons_wait_buffer(vd, 5);
- mutex_enter(&vd->drawing_mutex);
- mutex_exit(&vd->go_buffer_il);
- idx = vd->rb_write;
- vd->rb_buffer[idx] = VCMD_COPYCOLS;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = row;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = srccol;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = dstcol;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = ncols;
- idx = VRB_NEXT(idx);
- membar_producer();
- vd->rb_write = idx;
- membar_enter();
- mutex_exit(&vd->drawing_mutex);
- cv_signal(&vd->go_draw);
-}
-
-static void
-vcons_erasecols_async(void *cookie, int row, int startcol, int ncols,
- long fillattr)
-{
- struct rasops_info *ri = cookie;
- struct vcons_screen *scr = ri->ri_hw;
- struct vcons_data *vd = scr->scr_vd;
- int idx;
-
- vcons_wait_buffer(vd, 5);
- mutex_enter(&vd->drawing_mutex);
- mutex_exit(&vd->go_buffer_il);
- idx = vd->rb_write;
- vd->rb_buffer[idx] = VCMD_ERASECOLS;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = row;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = startcol;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = ncols;
- idx = VRB_NEXT(idx);
- /*
- * XXX all drivers I've seen use 32bit attributes although fillattr is
- * a 64bit value on LP64
- */
- vd->rb_buffer[idx] = (uint32_t)fillattr;
- idx = VRB_NEXT(idx);
- membar_producer();
- vd->rb_write = idx;
- membar_enter();
- mutex_exit(&vd->drawing_mutex);
- cv_signal(&vd->go_draw);
-}
-
-static void
-vcons_copyrows_async(void *cookie, int srcrow, int dstrow, int nrows)
-{
- struct rasops_info *ri = cookie;
- struct vcons_screen *scr = ri->ri_hw;
- struct vcons_data *vd = scr->scr_vd;
- int idx;
-
- vcons_wait_buffer(vd, 4);
- mutex_enter(&vd->drawing_mutex);
- mutex_exit(&vd->go_buffer_il);
- idx = vd->rb_write;
- vd->rb_buffer[idx] = VCMD_COPYROWS;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = srcrow;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = dstrow;
- idx = VRB_NEXT(idx);
- vd->rb_buffer[idx] = nrows;
- idx = VRB_NEXT(idx);
- membar_producer();
- vd->rb_write = idx;
- membar_enter();
- mutex_exit(&vd->drawing_mutex);
- cv_signal(&vd->go_draw);
Home |
Main Index |
Thread Index |
Old Index