From 899fe378a6d3d12067650b9b2e1ffa45c797f1c1 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sun, 25 Sep 1994 02:06:51 +0000 Subject: [PATCH] 1)Back out my previous change: only 8x16 font grabbing available, more work required to grab all fonts 2)Make standard VGA font as default, make HARDFONTS an option (load iso8859 fonts instead) 3)Check fonts_loaded for all restore (copy_font...palette) sequences. --- sys/dev/syscons/syscons.c | 38 +++++++++++++++++++++++--------------- sys/i386/isa/syscons.c | 38 +++++++++++++++++++++++--------------- sys/isa/syscons.c | 38 +++++++++++++++++++++++--------------- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index fff842a1cb11..68e50f76af33 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: syscons.c,v 1.54 1994/09/15 07:26:40 sos Exp $ + * $Id: syscons.c,v 1.55 1994/09/24 21:29:38 ache Exp $ */ #include "sc.h" @@ -68,7 +68,7 @@ #define NCONS 12 #endif -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) #include #endif @@ -357,10 +357,11 @@ pcattach(struct isa_device *dev) else printf("\n"); if (crtc_vga) { -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) font_8 = font_8x8; font_14 = font_8x14; font_16 = font_8x16; + fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; copy_font(LOAD, 1, 8, font_8); copy_font(LOAD, 2, 14, font_14); copy_font(LOAD, 0, 16, font_16); @@ -368,11 +369,9 @@ pcattach(struct isa_device *dev) font_8 = (char *)malloc(8*256, M_DEVBUF, M_NOWAIT); font_14 = (char *)malloc(14*256, M_DEVBUF, M_NOWAIT); font_16 = (char *)malloc(16*256, M_DEVBUF, M_NOWAIT); - copy_font(SAVE, 1, 8, font_8); - copy_font(SAVE, 2, 14, font_14); copy_font(SAVE, 0, 16, font_16); + fonts_loaded = FONT_16_LOADED; #endif - fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; save_palette(); } for (i = 0; i < NCONS; i++) { @@ -762,9 +761,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case KD_TEXT: /* switch to TEXT (known) mode */ /* restore fonts & palette ! */ if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } /* FALL THROUGH */ @@ -994,9 +996,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) fp = (struct trapframe *)p->p_md.md_regs; fp->tf_eflags &= ~PSL_IOPL; if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } scp->status &= ~UNKNOWN_MODE; @@ -1443,9 +1448,12 @@ exchange_scr(void) bcopy(new_scp->scr_buf, Crtat, new_scp->xsize * new_scp->ysize * 2); update_leds(new_scp->status); if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE) diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index fff842a1cb11..68e50f76af33 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: syscons.c,v 1.54 1994/09/15 07:26:40 sos Exp $ + * $Id: syscons.c,v 1.55 1994/09/24 21:29:38 ache Exp $ */ #include "sc.h" @@ -68,7 +68,7 @@ #define NCONS 12 #endif -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) #include #endif @@ -357,10 +357,11 @@ pcattach(struct isa_device *dev) else printf("\n"); if (crtc_vga) { -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) font_8 = font_8x8; font_14 = font_8x14; font_16 = font_8x16; + fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; copy_font(LOAD, 1, 8, font_8); copy_font(LOAD, 2, 14, font_14); copy_font(LOAD, 0, 16, font_16); @@ -368,11 +369,9 @@ pcattach(struct isa_device *dev) font_8 = (char *)malloc(8*256, M_DEVBUF, M_NOWAIT); font_14 = (char *)malloc(14*256, M_DEVBUF, M_NOWAIT); font_16 = (char *)malloc(16*256, M_DEVBUF, M_NOWAIT); - copy_font(SAVE, 1, 8, font_8); - copy_font(SAVE, 2, 14, font_14); copy_font(SAVE, 0, 16, font_16); + fonts_loaded = FONT_16_LOADED; #endif - fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; save_palette(); } for (i = 0; i < NCONS; i++) { @@ -762,9 +761,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case KD_TEXT: /* switch to TEXT (known) mode */ /* restore fonts & palette ! */ if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } /* FALL THROUGH */ @@ -994,9 +996,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) fp = (struct trapframe *)p->p_md.md_regs; fp->tf_eflags &= ~PSL_IOPL; if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } scp->status &= ~UNKNOWN_MODE; @@ -1443,9 +1448,12 @@ exchange_scr(void) bcopy(new_scp->scr_buf, Crtat, new_scp->xsize * new_scp->ysize * 2); update_leds(new_scp->status); if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE) diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index fff842a1cb11..68e50f76af33 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -34,7 +34,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: syscons.c,v 1.54 1994/09/15 07:26:40 sos Exp $ + * $Id: syscons.c,v 1.55 1994/09/24 21:29:38 ache Exp $ */ #include "sc.h" @@ -68,7 +68,7 @@ #define NCONS 12 #endif -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) #include #endif @@ -357,10 +357,11 @@ pcattach(struct isa_device *dev) else printf("\n"); if (crtc_vga) { -#if !defined(NO_HARDFONTS) +#if defined(HARDFONTS) font_8 = font_8x8; font_14 = font_8x14; font_16 = font_8x16; + fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; copy_font(LOAD, 1, 8, font_8); copy_font(LOAD, 2, 14, font_14); copy_font(LOAD, 0, 16, font_16); @@ -368,11 +369,9 @@ pcattach(struct isa_device *dev) font_8 = (char *)malloc(8*256, M_DEVBUF, M_NOWAIT); font_14 = (char *)malloc(14*256, M_DEVBUF, M_NOWAIT); font_16 = (char *)malloc(16*256, M_DEVBUF, M_NOWAIT); - copy_font(SAVE, 1, 8, font_8); - copy_font(SAVE, 2, 14, font_14); copy_font(SAVE, 0, 16, font_16); + fonts_loaded = FONT_16_LOADED; #endif - fonts_loaded = FONT_8_LOADED|FONT_14_LOADED|FONT_16_LOADED; save_palette(); } for (i = 0; i < NCONS; i++) { @@ -762,9 +761,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) case KD_TEXT: /* switch to TEXT (known) mode */ /* restore fonts & palette ! */ if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } /* FALL THROUGH */ @@ -994,9 +996,12 @@ pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) fp = (struct trapframe *)p->p_md.md_regs; fp->tf_eflags &= ~PSL_IOPL; if (crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } scp->status &= ~UNKNOWN_MODE; @@ -1443,9 +1448,12 @@ exchange_scr(void) bcopy(new_scp->scr_buf, Crtat, new_scp->xsize * new_scp->ysize * 2); update_leds(new_scp->status); if ((old_scp->status & UNKNOWN_MODE) && crtc_vga) { - copy_font(LOAD, 0, 16, font_16); - copy_font(LOAD, 1, 8, font_8); - copy_font(LOAD, 2, 14, font_14); + if (fonts_loaded & FONT_16_LOADED) + copy_font(LOAD, 0, 16, font_16); + if (fonts_loaded & FONT_8_LOADED) + copy_font(LOAD, 1, 8, font_8); + if (fonts_loaded & FONT_14_LOADED) + copy_font(LOAD, 2, 14, font_14); load_palette(); } if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE)