diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-09-05 14:30:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-09-05 14:30:25 +0000 |
commit | c818bfbdec899fc627d95f7d7149b9425f7f9188 (patch) | |
tree | 8e9a5275622e611ecee1c99c8528066224d70128 | |
parent | fe97057f16fd1cffc35ca63c0ad5df12f2a7b2df (diff) |
Make the output() wsemul_op return the number of characters processed and
check it in wsdisplaystart() to suspend output if not all characters have
been output; they will get reissued at the next tty rstrt_to timeout.
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 29 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_dumb.c | 18 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_sun.c | 12 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_vt100.c | 12 | ||||
-rw-r--r-- | sys/dev/wscons/wsemulvar.h | 9 |
5 files changed, 47 insertions, 33 deletions
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index 11c5586d731..4e3cbc84fde 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.92 2009/05/31 17:02:20 miod Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.93 2009/09/05 14:30:24 miod Exp $ */ /* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1401,7 +1401,7 @@ wsdisplaystart(struct tty *tp) { struct wsdisplay_softc *sc; struct wsscreen *scr; - int s, n, unit; + int s, n, done, unit; u_char *buf; unit = WSDISPLAYUNIT(tp->t_dev); @@ -1454,22 +1454,21 @@ wsdisplaystart(struct tty *tp) mouse_hide(scr); } #endif - (*scr->scr_dconf->wsemul->output)(scr->scr_dconf->wsemulcookie, - buf, n, 0); + done = (*scr->scr_dconf->wsemul->output) + (scr->scr_dconf->wsemulcookie, buf, n, 0); } - ndflush(&tp->t_outq, n); + ndflush(&tp->t_outq, done); - if ((n = ndqb(&tp->t_outq, 0)) > 0) { - buf = tp->t_outq.c_cf; + if (done == n) { + if ((n = ndqb(&tp->t_outq, 0)) > 0) { + buf = tp->t_outq.c_cf; - if (!(scr->scr_flags & SCR_GRAPHICS)) { -#ifdef BURNER_SUPPORT - wsdisplay_burn(sc, WSDISPLAY_BURN_OUTPUT); -#endif - (*scr->scr_dconf->wsemul->output) - (scr->scr_dconf->wsemulcookie, buf, n, 0); + if (!(scr->scr_flags & SCR_GRAPHICS)) { + done = (*scr->scr_dconf->wsemul->output) + (scr->scr_dconf->wsemulcookie, buf, n, 0); + } + ndflush(&tp->t_outq, done); } - ndflush(&tp->t_outq, n); } s = spltty(); @@ -2089,7 +2088,7 @@ wsdisplay_cnputc(dev_t dev, int i) #ifdef BURNER_SUPPORT /*wsdisplay_burn(wsdisplay_console_device, WSDISPLAY_BURN_OUTPUT);*/ #endif - (*dc->wsemul->output)(dc->wsemulcookie, &c, 1, 1); + (void)(*dc->wsemul->output)(dc->wsemulcookie, &c, 1, 1); } int diff --git a/sys/dev/wscons/wsemul_dumb.c b/sys/dev/wscons/wsemul_dumb.c index 5a53b095323..5dedc3e24ea 100644 --- a/sys/dev/wscons/wsemul_dumb.c +++ b/sys/dev/wscons/wsemul_dumb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_dumb.c,v 1.7 2007/11/27 16:37:27 miod Exp $ */ +/* $OpenBSD: wsemul_dumb.c,v 1.8 2009/09/05 14:30:24 miod Exp $ */ /* $NetBSD: wsemul_dumb.c,v 1.7 2000/01/05 11:19:36 drochner Exp $ */ /* @@ -46,10 +46,9 @@ void *wsemul_dumb_cnattach(const struct wsscreen_descr *, void *, int, int, long); void *wsemul_dumb_attach(int console, const struct wsscreen_descr *, void *, int, int, void *, long); -void wsemul_dumb_output(void *cookie, const u_char *data, u_int count, - int); -int wsemul_dumb_translate(void *cookie, keysym_t, const char **); -void wsemul_dumb_detach(void *cookie, u_int *crowp, u_int *ccolp); +u_int wsemul_dumb_output(void *, const u_char *, u_int, int); +int wsemul_dumb_translate(void *, keysym_t, const char **); +void wsemul_dumb_detach(void *, u_int *, u_int *); void wsemul_dumb_resetop(void *, enum wsemul_resetops); const struct wsemul_ops wsemul_dumb_ops = { @@ -130,7 +129,7 @@ wsemul_dumb_attach(console, type, cookie, ccol, crow, cbcookie, defattr) return (edp); } -void +u_int wsemul_dumb_output(cookie, data, count, kernel) void *cookie; const u_char *data; @@ -138,6 +137,7 @@ wsemul_dumb_output(cookie, data, count, kernel) int kernel; /* ignored */ { struct wsemul_dumb_emuldata *edp = cookie; + u_int processed = 0; u_char c; int n; @@ -150,8 +150,9 @@ wsemul_dumb_output(cookie, data, count, kernel) else (*edp->emulops->putchar)(edp->emulcookie, 0, 0, c, 0); + processed++; } - return; + return processed; } /* XXX */ @@ -221,9 +222,12 @@ wsemul_dumb_output(cookie, data, count, kernel) edp->crow -= n - 1; break; } + processed++; } /* XXX */ (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol); + + return processed; } int diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c index 66f25a5bf9b..8ca6c9cd322 100644 --- a/sys/dev/wscons/wsemul_sun.c +++ b/sys/dev/wscons/wsemul_sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_sun.c,v 1.25 2009/09/05 13:43:58 miod Exp $ */ +/* $OpenBSD: wsemul_sun.c,v 1.26 2009/09/05 14:30:24 miod Exp $ */ /* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */ /* @@ -58,7 +58,7 @@ void *wsemul_sun_cnattach(const struct wsscreen_descr *, void *, int, int, long); void *wsemul_sun_attach(int, const struct wsscreen_descr *, void *, int, int, void *, long); -void wsemul_sun_output(void *, const u_char *, u_int, int); +u_int wsemul_sun_output(void *, const u_char *, u_int, int); int wsemul_sun_translate(void *, keysym_t, const char **); void wsemul_sun_detach(void *, u_int *, u_int *); void wsemul_sun_resetop(void *, enum wsemul_resetops); @@ -532,10 +532,11 @@ wsemul_sun_output_control(struct wsemul_sun_emuldata *edp, u_char c) } } -void +u_int wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel) { struct wsemul_sun_emuldata *edp = cookie; + u_int processed = 0; u_char c; #ifdef JUMP_SCROLL int lines; @@ -572,11 +573,13 @@ wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel) c = *data; if (c < ' ') { wsemul_sun_output_lowchars(edp, c, kernel); + processed++; continue; } if (kernel) { wsemul_sun_output_normal(edp, c, 1); + processed++; continue; } @@ -600,9 +603,12 @@ wsemul_sun_output(void *cookie, const u_char *data, u_int count, int kernel) #endif break; } + processed++; } /* XXX */ (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol); + + return processed; } #ifdef JUMP_SCROLL diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c index e80b84b2a17..3dd48cc8bbd 100644 --- a/sys/dev/wscons/wsemul_vt100.c +++ b/sys/dev/wscons/wsemul_vt100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_vt100.c,v 1.24 2009/09/05 13:43:58 miod Exp $ */ +/* $OpenBSD: wsemul_vt100.c,v 1.25 2009/09/05 14:30:24 miod Exp $ */ /* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */ /* @@ -47,7 +47,7 @@ void *wsemul_vt100_cnattach(const struct wsscreen_descr *, void *, int, int, long); void *wsemul_vt100_attach(int, const struct wsscreen_descr *, void *, int, int, void *, long); -void wsemul_vt100_output(void *, const u_char *, u_int, int); +u_int wsemul_vt100_output(void *, const u_char *, u_int, int); void wsemul_vt100_detach(void *, u_int *, u_int *); void wsemul_vt100_resetop(void *, enum wsemul_resetops); @@ -915,10 +915,11 @@ wsemul_vt100_output_csi(struct wsemul_vt100_emuldata *edp, u_char c) edp->state = newstate; } -void +u_int wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) { struct wsemul_vt100_emuldata *edp = cookie; + u_int processed = 0; u_char c; #ifdef JUMP_SCROLL int lines; @@ -955,11 +956,13 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) c = *data; if ((c & 0x7f) < 0x20) { wsemul_vt100_output_c0c1(edp, c, kernel); + processed++; continue; } if (edp->state == VT100_EMUL_STATE_NORMAL || kernel) { wsemul_vt100_output_normal(edp, c, kernel); + processed++; continue; } #ifdef DIAGNOSTIC @@ -967,11 +970,14 @@ wsemul_vt100_output(void *cookie, const u_char *data, u_int count, int kernel) panic("wsemul_vt100: invalid state %d", edp->state); #endif vt100_output[edp->state - 1](edp, c); + processed++; } if (edp->flags & VTFL_CURSORON) (*edp->emulops->cursor)(edp->emulcookie, 1, edp->crow, edp->ccol << edp->dw); + + return processed; } #ifdef JUMP_SCROLL diff --git a/sys/dev/wscons/wsemulvar.h b/sys/dev/wscons/wsemulvar.h index 3884f75830d..a4370ce7c69 100644 --- a/sys/dev/wscons/wsemulvar.h +++ b/sys/dev/wscons/wsemulvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemulvar.h,v 1.10 2007/11/27 16:37:27 miod Exp $ */ +/* $OpenBSD: wsemulvar.h,v 1.11 2009/09/05 14:30:24 miod Exp $ */ /* $NetBSD: wsemulvar.h,v 1.6 1999/01/17 15:46:15 drochner Exp $ */ /* @@ -46,12 +46,11 @@ struct wsemul_ops { void *(*cnattach)(const struct wsscreen_descr *, void *, int, int, long); - void *(*attach)(int console, const struct wsscreen_descr *, void *, + void *(*attach)(int, const struct wsscreen_descr *, void *, int, int, void *, long); - void (*output)(void *cookie, const u_char *data, u_int count, - int); + u_int (*output)(void *, const u_char *, u_int, int); int (*translate)(void *, keysym_t, const char **); - void (*detach)(void *cookie, u_int *crow, u_int *ccol); + void (*detach)(void *, u_int *, u_int *); void (*reset)(void *, enum wsemul_resetops); }; |