diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-09-28 20:36:06 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-09-28 20:36:06 +0000 |
commit | 3271ef2c0bbab76d03e21c88d8b1a5febf93767b (patch) | |
tree | a2042ab32317a15e2b927c86c184a335ce611839 /sys | |
parent | cb066ff313c704a731da91a7f47176e14aa7b769 (diff) |
- Reallocate scrollbuffer when changing linemodes, not loading fonts.
- Now reallocate it when switching VTs, too, since different VTs may be in
different linemodes.
- Also, cut memory usage in half (thinko on my part in malloc calculation).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_ext.c | 13 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_hdr.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_out.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/pcvt_sup.c | 65 |
4 files changed, 42 insertions, 43 deletions
diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c index 44591d70bee..85425fca42c 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_ext.c +++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_ext.c,v 1.20 1999/09/18 22:54:48 aaron Exp $ */ +/* $OpenBSD: pcvt_ext.c,v 1.21 1999/09/28 20:36:04 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -2552,16 +2552,7 @@ vgapage(int new_screen) { /* we are committed */ vt_switch_pending = 0; - if (vsp->Scrollback) - { - vsp->scrolling = 0; - fillw(user_attr | ' ', (caddr_t)vsp->Scrollback, - vsp->screen_rowsize * vsp->maxcol * - SCROLLBACK_PAGES); - bcopy(vsp->Crtat, vsp->Scrollback, - vsp->screen_rows * vsp->maxcol * CHR); - vsp->scr_offset = vsp->row; - } + reallocate_scrollbuffer(vsp, SCROLLBACK_PAGES); } } return 0; diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h index a064281dd69..633299299e9 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_hdr.h,v 1.23 1999/09/08 12:56:42 aaron Exp $ */ +/* $OpenBSD: pcvt_hdr.h,v 1.24 1999/09/28 20:36:04 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1084,6 +1084,7 @@ void set_2ndcharset ( void ); void set_charset ( struct video_state *svsp, int curvgacs ); void set_emulation_mode ( struct video_state *svsp, int mode ); void set_screen_size ( struct video_state *svsp, int size ); +void reallocate_scrollbuffer ( struct video_state *svsp, int pages ); u_char *sgetc ( int noblock ); void sixel_vga ( struct sixels *charsixel, u_char *charvga ); void sput ( u_char *s, U_char attrib, int len, int page ); diff --git a/sys/arch/i386/isa/pcvt/pcvt_out.c b/sys/arch/i386/isa/pcvt/pcvt_out.c index a4a4af53654..38df337389b 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_out.c +++ b/sys/arch/i386/isa/pcvt/pcvt_out.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_out.c,v 1.9 1999/09/08 12:56:42 aaron Exp $ */ +/* $OpenBSD: pcvt_out.c,v 1.10 1999/09/28 20:36:05 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -1393,7 +1393,7 @@ vt_coldmalloc(void) } if ((Scrollbuffer = (u_short *)malloc(vs[0].maxcol * - vs[0].screen_rowsize * SCROLLBACK_PAGES * CHR * 2, M_DEVBUF, + vs[0].screen_rows * SCROLLBACK_PAGES * CHR, M_DEVBUF, M_WAITOK)) == NULL) { printf("pcvt: scrollback memory malloc failed\n"); diff --git a/sys/arch/i386/isa/pcvt/pcvt_sup.c b/sys/arch/i386/isa/pcvt/pcvt_sup.c index 3687707176e..b2e4a4f1bda 100644 --- a/sys/arch/i386/isa/pcvt/pcvt_sup.c +++ b/sys/arch/i386/isa/pcvt/pcvt_sup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcvt_sup.c,v 1.8 1999/09/18 22:54:48 aaron Exp $ */ +/* $OpenBSD: pcvt_sup.c,v 1.9 1999/09/28 20:36:05 aaron Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. @@ -422,7 +422,6 @@ vgasetfontattr(struct vgafontattr *data) int lines_per_character; int totscanlines; int size; - int charset_flag = 0; vga_character_set = data->character_set; vga_character_set = (vga_character_set < 0) ? 0 : @@ -521,34 +520,7 @@ vgasetfontattr(struct vgafontattr *data) for (i = 0;i < PCVT_NSCREENS;i++) { if(vga_character_set == vs[i].vga_charset) - { set_charset(&(vs[i]),vga_character_set); - charset_flag = i; - } - } - if (charset_flag && Scrollbuffer) - { - free(Scrollbuffer, M_DEVBUF); - if ((Scrollbuffer = (u_short *)malloc(vs[i].maxcol * - vs[i].screen_rowsize * SCROLLBACK_PAGES * CHR * 2, - M_DEVBUF, M_NOWAIT)) == NULL) - { - printf("pcvt: scrollback memory malloc failed\n"); - } - else - { - for (i = 0; i < PCVT_NSCREENS; i++) - { - vs[i].Scrollback = Scrollbuffer; - vs[i].scr_offset = 0; - vs[i].scrolling = 0; - vs[i].max_off = vs[i].screen_rowsize * - SCROLLBACK_PAGES - 1; - } - bcopy(vsp->Crtat, vsp->Scrollback, vsp->screen_rows * - vsp->maxcol * CHR); - vsp->scr_offset = vsp->row; - } } switch_screen(current_video_screen, 0, 0); } @@ -767,12 +739,47 @@ set_screen_size(struct video_state *svsp, int size) pgsignal(svsp->vs_tty->t_pgrp, SIGWINCH, 1); #endif /* PCVT_SIGWINCH */ + reallocate_scrollbuffer(svsp, SCROLLBACK_PAGES); break; } } } /*---------------------------------------------------------------------------* + * resize the scrollback buffer to the specified number of "pages" + *---------------------------------------------------------------------------*/ +void +reallocate_scrollbuffer(struct video_state *svsp, int pages) +{ + int i, s; + + s = splhigh(); + if (Scrollbuffer) + free(Scrollbuffer, M_DEVBUF); + + if ((Scrollbuffer = (u_short *)malloc(svsp->maxcol * + svsp->screen_rows * pages * CHR, M_DEVBUF, M_NOWAIT)) == NULL) + { + printf("pcvt: scrollback memory malloc + failed\n"); + } + else + { + for (i = 0; i < PCVT_NSCREENS; i++) + { + vs[i].Scrollback = Scrollbuffer; + vs[i].scr_offset = 0; + vs[i].scrolling = 0; + vs[i].max_off = svsp->screen_rows * pages - 1; + } + bcopy(svsp->Crtat, svsp->Scrollback, svsp->screen_rows * + svsp->maxcol * CHR); + svsp->scr_offset = svsp->row; + } + splx(s); +} + +/*---------------------------------------------------------------------------* * VGA ioctl - read DAC palette entry *---------------------------------------------------------------------------*/ static void |