1) font loading (two fixes)

When an ioctl command SW_XXXX is issued, scioctl() checks if the font
appropriate for the specified mode is already loaded.  The check was
correctly done for 8 line and 16 line fonts, but not for 14 line font.

The symbols FONT_8, FONT_14 and FONT_16 were defined as numbers but
were sometimes treated as bit flags. They are now defined as bit
flags.

2) screen blinking (two fixes)

Removed a redundant call to timeout() in do_bell().

Don't let blink_screen() write to the video buffer if the screen is in
the graphics (UNKNOWN) mode.

3) screen saver timeout

The ioctl command CONS_BLANKTIME sets the screen saver's timeout.  The
value of zero will disable the screen saver. If the screen saver is
currently running it should be stopped.

4) border color and destructive cursor (two fixes)

The border color and the cursor type can be changed via escape
sequences.  But only VGA can change the border color and set the
cursor type to destructive (CHAR_CURSOR) in the current syscons.
scan_esc() failed to check this.

Reviewed by:	sos
This commit is contained in:
yokota 1997-05-15 05:43:59 +00:00
parent ea4abe276a
commit 3347d1b140
6 changed files with 111 additions and 66 deletions

View File

@ -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: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
* $Id: syscons.c,v 1.215 1997/05/07 20:02:38 peter Exp $
*/
#include "sc.h"
@ -759,7 +759,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return 0;
case CONS_BLANKTIME: /* set screen saver timeout (0 = no saver) */
if (*(int *)data < 0)
return EINVAL;
scrn_blank_time = *(int*)data;
if ((scrn_blank_time == 0) && scrn_blanked) {
(*current_saver)(FALSE);
mark_all(cur_console);
}
return 0;
case CONS_CURSORTYPE: /* set cursor type blink/noblink */
@ -958,6 +964,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
case SW_ENH_B40x25: case SW_ENH_C40x25:
case SW_ENH_B80x25: case SW_ENH_C80x25:
case SW_ENH_B80x43: case SW_ENH_C80x43:
case SW_EGAMONO80x25:
if (!crtc_vga || video_mode_ptr == NULL)
return ENXIO;
@ -984,6 +991,12 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
scp->xsize = 80;
scp->ysize = 30;
break;
case M_ENH_C40x25: case M_ENH_B40x25:
case M_ENH_C80x25: case M_ENH_B80x25:
case M_EGAMONO80x25:
if (!(fonts_loaded & FONT_14))
return EINVAL;
/* FALL THROUGH */
default:
if ((cmd & 0xff) > M_VGA_CG320)
return EINVAL;
@ -2176,10 +2189,11 @@ scan_esc(scr_stat *scp, u_char c)
break;
case 'A': /* set display border color */
if (scp->term.num_param == 1)
if ((scp->term.num_param == 1) && crtc_vga) {
scp->border=scp->term.param[0] & 0xff;
if (scp == cur_console)
set_border(scp->border);
}
break;
case 'B': /* set bell pitch and duration */
@ -2195,7 +2209,7 @@ scan_esc(scr_stat *scp, u_char c)
flags |= BLINK_CURSOR;
else
flags &= ~BLINK_CURSOR;
if (scp->term.param[0] & 0x02) {
if ((scp->term.param[0] & 0x02) && crtc_vga) {
flags |= CHAR_CURSOR;
set_destructive_cursor(scp);
} else
@ -2544,7 +2558,7 @@ init_scp(scr_stat *scp)
else
scp->mode = M_C80x25;
scp->font_size = FONT_16;
scp->font_size = 16;
scp->xsize = COL;
scp->ysize = ROW;
scp->xpos = scp->ypos = 0;
@ -3253,6 +3267,7 @@ set_mode(scr_stat *scp)
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
modetable = video_mode_ptr + (scp->mode * 64);
setup_mode:
@ -3260,11 +3275,11 @@ set_mode(scr_stat *scp)
scp->font_size = *(modetable + 2);
/* set font type (size) */
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
if (fonts_loaded & FONT_8)
copy_font(LOAD, FONT_8, font_8);
outb(TSIDX, 0x03); outb(TSREG, 0x0A); /* font 2 */
} else if (scp->font_size >= FONT_16) {
} else if (scp->font_size >= 16) {
if (fonts_loaded & FONT_16)
copy_font(LOAD, FONT_16, font_16);
outb(TSIDX, 0x03); outb(TSREG, 0x00); /* font 0 */
@ -3482,6 +3497,7 @@ set_normal_mode()
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
case M_BG320: case M_CG320: case M_BG640:
case M_CG320_D: case M_CG640_E:
@ -3576,11 +3592,11 @@ set_destructive_cursor(scr_stat *scp)
char *font_buffer;
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (scp->font_size >= FONT_16) {
else if (scp->font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3724,11 +3740,11 @@ draw_mouse_image(scr_stat *scp)
u_short *crt_pos = Crtat + (scp->mouse_pos - scp->scr_buf);
int font_size = scp->font_size;
if (font_size < FONT_14) {
if (font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (font_size >= FONT_16) {
else if (font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3873,7 +3889,6 @@ do_bell(scr_stat *scp, int pitch, int duration)
if (scp != cur_console)
blink_in_progress += 2;
blink_screen(cur_console);
timeout(blink_screen, cur_console, hz / 10);
} else {
if (scp != cur_console)
pitch *= 2;
@ -3886,7 +3901,13 @@ blink_screen(void *arg)
{
scr_stat *scp = arg;
if (blink_in_progress > 1) {
if ((scp->status & UNKNOWN_MODE) || (blink_in_progress <= 1)) {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
else {
if (blink_in_progress & 1)
fillw(kernel_default.std_color | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
@ -3896,12 +3917,6 @@ blink_screen(void *arg)
blink_in_progress--;
timeout(blink_screen, scp, hz / 10);
}
else {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
}
#ifdef SC_SPLASH_SCREEN

View File

@ -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$
* $Id: syscons.h,v 1.28 1997/02/22 09:37:17 peter Exp $
*/
#ifndef _I386_ISA_SYSCONS_H_
@ -98,9 +98,9 @@
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_NONE 1
#define FONT_8 8
#define FONT_14 14
#define FONT_16 16
#define FONT_8 2
#define FONT_14 4
#define FONT_16 8
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */

View File

@ -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: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
* $Id: syscons.c,v 1.215 1997/05/07 20:02:38 peter Exp $
*/
#include "sc.h"
@ -759,7 +759,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return 0;
case CONS_BLANKTIME: /* set screen saver timeout (0 = no saver) */
if (*(int *)data < 0)
return EINVAL;
scrn_blank_time = *(int*)data;
if ((scrn_blank_time == 0) && scrn_blanked) {
(*current_saver)(FALSE);
mark_all(cur_console);
}
return 0;
case CONS_CURSORTYPE: /* set cursor type blink/noblink */
@ -958,6 +964,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
case SW_ENH_B40x25: case SW_ENH_C40x25:
case SW_ENH_B80x25: case SW_ENH_C80x25:
case SW_ENH_B80x43: case SW_ENH_C80x43:
case SW_EGAMONO80x25:
if (!crtc_vga || video_mode_ptr == NULL)
return ENXIO;
@ -984,6 +991,12 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
scp->xsize = 80;
scp->ysize = 30;
break;
case M_ENH_C40x25: case M_ENH_B40x25:
case M_ENH_C80x25: case M_ENH_B80x25:
case M_EGAMONO80x25:
if (!(fonts_loaded & FONT_14))
return EINVAL;
/* FALL THROUGH */
default:
if ((cmd & 0xff) > M_VGA_CG320)
return EINVAL;
@ -2176,10 +2189,11 @@ scan_esc(scr_stat *scp, u_char c)
break;
case 'A': /* set display border color */
if (scp->term.num_param == 1)
if ((scp->term.num_param == 1) && crtc_vga) {
scp->border=scp->term.param[0] & 0xff;
if (scp == cur_console)
set_border(scp->border);
}
break;
case 'B': /* set bell pitch and duration */
@ -2195,7 +2209,7 @@ scan_esc(scr_stat *scp, u_char c)
flags |= BLINK_CURSOR;
else
flags &= ~BLINK_CURSOR;
if (scp->term.param[0] & 0x02) {
if ((scp->term.param[0] & 0x02) && crtc_vga) {
flags |= CHAR_CURSOR;
set_destructive_cursor(scp);
} else
@ -2544,7 +2558,7 @@ init_scp(scr_stat *scp)
else
scp->mode = M_C80x25;
scp->font_size = FONT_16;
scp->font_size = 16;
scp->xsize = COL;
scp->ysize = ROW;
scp->xpos = scp->ypos = 0;
@ -3253,6 +3267,7 @@ set_mode(scr_stat *scp)
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
modetable = video_mode_ptr + (scp->mode * 64);
setup_mode:
@ -3260,11 +3275,11 @@ set_mode(scr_stat *scp)
scp->font_size = *(modetable + 2);
/* set font type (size) */
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
if (fonts_loaded & FONT_8)
copy_font(LOAD, FONT_8, font_8);
outb(TSIDX, 0x03); outb(TSREG, 0x0A); /* font 2 */
} else if (scp->font_size >= FONT_16) {
} else if (scp->font_size >= 16) {
if (fonts_loaded & FONT_16)
copy_font(LOAD, FONT_16, font_16);
outb(TSIDX, 0x03); outb(TSREG, 0x00); /* font 0 */
@ -3482,6 +3497,7 @@ set_normal_mode()
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
case M_BG320: case M_CG320: case M_BG640:
case M_CG320_D: case M_CG640_E:
@ -3576,11 +3592,11 @@ set_destructive_cursor(scr_stat *scp)
char *font_buffer;
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (scp->font_size >= FONT_16) {
else if (scp->font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3724,11 +3740,11 @@ draw_mouse_image(scr_stat *scp)
u_short *crt_pos = Crtat + (scp->mouse_pos - scp->scr_buf);
int font_size = scp->font_size;
if (font_size < FONT_14) {
if (font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (font_size >= FONT_16) {
else if (font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3873,7 +3889,6 @@ do_bell(scr_stat *scp, int pitch, int duration)
if (scp != cur_console)
blink_in_progress += 2;
blink_screen(cur_console);
timeout(blink_screen, cur_console, hz / 10);
} else {
if (scp != cur_console)
pitch *= 2;
@ -3886,7 +3901,13 @@ blink_screen(void *arg)
{
scr_stat *scp = arg;
if (blink_in_progress > 1) {
if ((scp->status & UNKNOWN_MODE) || (blink_in_progress <= 1)) {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
else {
if (blink_in_progress & 1)
fillw(kernel_default.std_color | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
@ -3896,12 +3917,6 @@ blink_screen(void *arg)
blink_in_progress--;
timeout(blink_screen, scp, hz / 10);
}
else {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
}
#ifdef SC_SPLASH_SCREEN

View File

@ -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$
* $Id: syscons.h,v 1.28 1997/02/22 09:37:17 peter Exp $
*/
#ifndef _I386_ISA_SYSCONS_H_
@ -98,9 +98,9 @@
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_NONE 1
#define FONT_8 8
#define FONT_14 14
#define FONT_16 16
#define FONT_8 2
#define FONT_14 4
#define FONT_16 8
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */

View File

@ -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: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
* $Id: syscons.c,v 1.215 1997/05/07 20:02:38 peter Exp $
*/
#include "sc.h"
@ -759,7 +759,13 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return 0;
case CONS_BLANKTIME: /* set screen saver timeout (0 = no saver) */
if (*(int *)data < 0)
return EINVAL;
scrn_blank_time = *(int*)data;
if ((scrn_blank_time == 0) && scrn_blanked) {
(*current_saver)(FALSE);
mark_all(cur_console);
}
return 0;
case CONS_CURSORTYPE: /* set cursor type blink/noblink */
@ -958,6 +964,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
case SW_ENH_B40x25: case SW_ENH_C40x25:
case SW_ENH_B80x25: case SW_ENH_C80x25:
case SW_ENH_B80x43: case SW_ENH_C80x43:
case SW_EGAMONO80x25:
if (!crtc_vga || video_mode_ptr == NULL)
return ENXIO;
@ -984,6 +991,12 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
scp->xsize = 80;
scp->ysize = 30;
break;
case M_ENH_C40x25: case M_ENH_B40x25:
case M_ENH_C80x25: case M_ENH_B80x25:
case M_EGAMONO80x25:
if (!(fonts_loaded & FONT_14))
return EINVAL;
/* FALL THROUGH */
default:
if ((cmd & 0xff) > M_VGA_CG320)
return EINVAL;
@ -2176,10 +2189,11 @@ scan_esc(scr_stat *scp, u_char c)
break;
case 'A': /* set display border color */
if (scp->term.num_param == 1)
if ((scp->term.num_param == 1) && crtc_vga) {
scp->border=scp->term.param[0] & 0xff;
if (scp == cur_console)
set_border(scp->border);
}
break;
case 'B': /* set bell pitch and duration */
@ -2195,7 +2209,7 @@ scan_esc(scr_stat *scp, u_char c)
flags |= BLINK_CURSOR;
else
flags &= ~BLINK_CURSOR;
if (scp->term.param[0] & 0x02) {
if ((scp->term.param[0] & 0x02) && crtc_vga) {
flags |= CHAR_CURSOR;
set_destructive_cursor(scp);
} else
@ -2544,7 +2558,7 @@ init_scp(scr_stat *scp)
else
scp->mode = M_C80x25;
scp->font_size = FONT_16;
scp->font_size = 16;
scp->xsize = COL;
scp->ysize = ROW;
scp->xpos = scp->ypos = 0;
@ -3253,6 +3267,7 @@ set_mode(scr_stat *scp)
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
modetable = video_mode_ptr + (scp->mode * 64);
setup_mode:
@ -3260,11 +3275,11 @@ set_mode(scr_stat *scp)
scp->font_size = *(modetable + 2);
/* set font type (size) */
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
if (fonts_loaded & FONT_8)
copy_font(LOAD, FONT_8, font_8);
outb(TSIDX, 0x03); outb(TSREG, 0x0A); /* font 2 */
} else if (scp->font_size >= FONT_16) {
} else if (scp->font_size >= 16) {
if (fonts_loaded & FONT_16)
copy_font(LOAD, FONT_16, font_16);
outb(TSIDX, 0x03); outb(TSREG, 0x00); /* font 0 */
@ -3482,6 +3497,7 @@ set_normal_mode()
case M_B80x25: case M_C80x25:
case M_ENH_B40x25: case M_ENH_C40x25:
case M_ENH_B80x25: case M_ENH_C80x25:
case M_EGAMONO80x25:
case M_BG320: case M_CG320: case M_BG640:
case M_CG320_D: case M_CG640_E:
@ -3576,11 +3592,11 @@ set_destructive_cursor(scr_stat *scp)
char *font_buffer;
if (scp->font_size < FONT_14) {
if (scp->font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (scp->font_size >= FONT_16) {
else if (scp->font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3724,11 +3740,11 @@ draw_mouse_image(scr_stat *scp)
u_short *crt_pos = Crtat + (scp->mouse_pos - scp->scr_buf);
int font_size = scp->font_size;
if (font_size < FONT_14) {
if (font_size < 14) {
font_buffer = font_8;
address = (caddr_t)VIDEOMEM + 0x8000;
}
else if (font_size >= FONT_16) {
else if (font_size >= 16) {
font_buffer = font_16;
address = (caddr_t)VIDEOMEM;
}
@ -3873,7 +3889,6 @@ do_bell(scr_stat *scp, int pitch, int duration)
if (scp != cur_console)
blink_in_progress += 2;
blink_screen(cur_console);
timeout(blink_screen, cur_console, hz / 10);
} else {
if (scp != cur_console)
pitch *= 2;
@ -3886,7 +3901,13 @@ blink_screen(void *arg)
{
scr_stat *scp = arg;
if (blink_in_progress > 1) {
if ((scp->status & UNKNOWN_MODE) || (blink_in_progress <= 1)) {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
else {
if (blink_in_progress & 1)
fillw(kernel_default.std_color | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
@ -3896,12 +3917,6 @@ blink_screen(void *arg)
blink_in_progress--;
timeout(blink_screen, scp, hz / 10);
}
else {
blink_in_progress = FALSE;
mark_all(scp);
if (delayed_next_scr)
switch_scr(scp, delayed_next_scr - 1);
}
}
#ifdef SC_SPLASH_SCREEN

View File

@ -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$
* $Id: syscons.h,v 1.28 1997/02/22 09:37:17 peter Exp $
*/
#ifndef _I386_ISA_SYSCONS_H_
@ -98,9 +98,9 @@
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_NONE 1
#define FONT_8 8
#define FONT_14 14
#define FONT_16 16
#define FONT_8 2
#define FONT_14 4
#define FONT_16 8
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */