diff options
author | yokota <yokota@FreeBSD.org> | 1997-10-04 04:24:18 +0000 |
---|---|---|
committer | yokota <yokota@FreeBSD.org> | 1997-10-04 04:24:18 +0000 |
commit | d26bc9bf8e3c7261deac2260a4d95f056b786eb2 (patch) | |
tree | 6ea10efd986e3f36789dcd399bab62c3212f415b /lkm | |
parent | 1d704478e47ba414979ce4f1e15b18075567e99a (diff) | |
download | FreeBSD-src-d26bc9bf8e3c7261deac2260a4d95f056b786eb2.zip FreeBSD-src-d26bc9bf8e3c7261deac2260a4d95f056b786eb2.tar.gz |
Make the blank screen saver work with MDA and CGA. The fade and green
savers are also modified so that they behave in the same way as the
blank saver on MDA and CGA, although it's not the way these screen
savers are supposed to work, but fading monitor and tickling green
monitor cannot be done on MDA and CGA, AFAIK. So, this is the second
best solution.
As of this change, the current state of support of screen savers is
summarized in the following table.
MDA CGA EGA VGA
blank OK OK NA OK
daemon OK OK OK OK
fade * * NA OK
green * * NA OK
snake OK OK OK OK
star OK OK OK OK
OK: works
NA: doesn't work, the module cannot be loaded for this adapter.
*: behave the same way as the blank saver.
As you can see, EGA is left out for now. But, we can do no better, as
EGA registers cannot be read...
Reviewed by: sos
Diffstat (limited to 'lkm')
-rw-r--r-- | lkm/syscons/blank/blank_saver.c | 55 | ||||
-rw-r--r-- | lkm/syscons/fade/fade_saver.c | 84 | ||||
-rw-r--r-- | lkm/syscons/green/green_saver.c | 67 | ||||
-rw-r--r-- | lkm/syscons/saver.h | 4 |
4 files changed, 171 insertions, 39 deletions
diff --git a/lkm/syscons/blank/blank_saver.c b/lkm/syscons/blank/blank_saver.c index a534ab3..451dc9a 100644 --- a/lkm/syscons/blank/blank_saver.c +++ b/lkm/syscons/blank/blank_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ + * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $ */ #include <sys/param.h> @@ -46,12 +46,44 @@ blank_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -59,8 +91,17 @@ blank_saver(int blank) static int blank_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(blank_saver); } diff --git a/lkm/syscons/fade/fade_saver.c b/lkm/syscons/fade/fade_saver.c index d68bba9..341f7e8 100644 --- a/lkm/syscons/fade/fade_saver.c +++ b/lkm/syscons/fade/fade_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ + * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $ */ #include <sys/param.h> @@ -48,34 +48,80 @@ fade_saver(int blank) if (blank) { scrn_blanked = 1; - if (count < 64) { - outb(PIXMASK, 0xFF); /* no pixelmask */ - outb(PALWADR, 0x00); - outb(PALDATA, 0); - outb(PALDATA, 0); - outb(PALDATA, 0); - for (i = 3; i < 768; i++) { - if (palette[i] - count > 15) - outb(PALDATA, palette[i]-count); - else - outb(PALDATA, 15); + switch (crtc_type) { + case KD_VGA: + if (count < 64) { + outb(PIXMASK, 0xFF); /* no pixelmask */ + outb(PALWADR, 0x00); + outb(PALDATA, 0); + outb(PALDATA, 0); + outb(PALDATA, 0); + for (i = 3; i < 768; i++) { + if (palette[i] - count > 15) + outb(PALDATA, palette[i]-count); + else + outb(PALDATA, 15); + } + inb(crtc_addr+6); /* reset flip/flop */ + outb(ATC, 0x20); /* enable palette */ + count++; } - inb(crtc_addr+6); /* reset flip/flop */ - outb(ATC, 0x20); /* enable palette */ - count++; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; } } else { - load_palette(palette); - count = scrn_blanked = 0; + switch (crtc_type) { + case KD_VGA: + load_palette(palette); + count = 0; + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } + scrn_blanked = 0; } } static int fade_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `fade' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(fade_saver); } diff --git a/lkm/syscons/green/green_saver.c b/lkm/syscons/green/green_saver.c index 0454753..b8c8295 100644 --- a/lkm/syscons/green/green_saver.c +++ b/lkm/syscons/green/green_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ + * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $ */ #include <sys/param.h> @@ -46,16 +46,48 @@ green_saver(int blank) u_char val; if (blank) { scrn_blanked = 1; - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val | 0x20); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val & ~0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val | 0x20); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val & ~0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x25); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x21); + break; + default: + break; + } } else { - outb(TSIDX, 0x01); val = inb(TSREG); - outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); - outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); - outb(crtc_addr + 1, val | 0x80); + switch (crtc_type) { + case KD_VGA: + outb(TSIDX, 0x01); val = inb(TSREG); + outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); + outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); + outb(crtc_addr + 1, val | 0x80); + break; + case KD_EGA: + /* not yet done XXX */ + break; + case KD_CGA: + outb(crtc_addr + 4, 0x2d); + break; + case KD_MONO: + case KD_HERCULES: + outb(crtc_addr + 4, 0x29); + break; + default: + break; + } scrn_blanked = 0; } } @@ -63,8 +95,21 @@ green_saver(int blank) static int green_saver_load(struct lkm_table *lkmtp, int cmd) { - if (!crtc_vga) - return EINVAL; + switch (crtc_type) { + case KD_MONO: + case KD_HERCULES: + case KD_CGA: + /* + * `green' saver is not fully implemented for MDA and CGA. + * It simply blanks the display instead. + */ + case KD_VGA: + break; + case KD_EGA: + /* EGA is yet to be supported */ + default: + return ENODEV; + } return add_scrn_saver(green_saver); } diff --git a/lkm/syscons/saver.h b/lkm/syscons/saver.h index 7ba6c11..7118e45 100644 --- a/lkm/syscons/saver.h +++ b/lkm/syscons/saver.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: saver.h,v 1.8 1997/05/21 14:18:00 yokota Exp $ + * $Id: saver.h,v 1.9 1997/07/15 14:48:11 yokota Exp $ */ #include <machine/apm_bios.h> @@ -36,7 +36,7 @@ extern scr_stat *cur_console; extern u_short *Crtat; extern u_int crtc_addr; -extern char crtc_vga; +extern char crtc_type; extern char scr_map[]; extern int scrn_blanked; extern int fonts_loaded; |