lkml.org 
[lkml]   [1998]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectConsole fixes for 2.1.113
Hi Linus,

There is the next console bugfix patch (only generic console code and vgacon).

Have a nice day
Martin

Summary of changes
~~~~~~~~~~~~~~~~~~

Martin Mares [mm]
Jakub Jelinek [jj]

o Moved CUR_DEFAULT where it belongs. [mm]

o Updated softcursor documentation [mm]

o vgacon: vga_video_font_height set for all display adapters, so the cursor
looks OK again. [mm]

o vgacon: Remember to use scr_readw in invert_region (thanks go to Richard Henderson
for finding this bug). [mm]

o vgacon: Compiles even if VGA_CAN_DO_64KB is defined. [mm]

o Fixed nasty races between normal console writes and keyboard echo. The console
write routine was _never_ reentrant (and it actually produced nasty problems
even in 2.0.X, but they were very rare since the console was much faster
than current fbcon is).
We now queue all incoming flip's to con_task_queue instead of tq_timer
and run this queue in console_bh. It might be neater to solve this in a
generic way for all existing tty devices, but I'm almost certain such
a change would be accepted until 2.3. [mm]

o vt_console_print now disables the CONSOLE_BH as well and works even with
kmsg_redirect set.

o Remove the ugly #ifdef CONFIG_SUN_CONSOLE from vt.c - it is not needed. [jj]

o Replaced KD_FONT_FLAG_NEW by KD_FONT_FLAG_OLD, so that KDFONTOP requests
receive no additional flags and (P|G)IO_FONT(|X) receive several compatibility
flags. [mm]

o Killed KD_FONT_FLAG_GLOBAL -- it wasn't implemented anyway and it will be
better to do this in user space by calling KDFONTOP for font copy. [mm]

o Dead key fixes by Jiri Hanika (already present in the VGER tree for some months)


--- /mj/linux-2.1/include/linux/console_struct.h Tue Aug 4 15:19:05 1998
+++ include/linux/console_struct.h Tue Aug 4 15:40:04 1998
@@ -9,12 +9,6 @@
* to achieve effects such as fast scrolling by changing the origin.
*/

-/*
- * You can set here how should the cursor look by default.
- * In case you set CONFIG_SOFTCURSOR, this might be really interesting.
- */
-#define CUR_DEFAULT CUR_UNDERLINE
-
#define NPAR 16

struct vc_data {
@@ -108,3 +102,5 @@
#define CUR_BLOCK 6
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0
+
+#define CUR_DEFAULT CUR_UNDERLINE
--- /mj/linux-2.1/Documentation/VGA-softcursor.txt Tue Aug 4 15:17:00 1998
+++ Documentation/VGA-softcursor.txt Tue Aug 4 15:15:20 1998
@@ -3,13 +3,12 @@

Linux now has some ability to manipulate cursor appearance. Normally, you
can set the size of hardware cursor (and also work around some ugly bugs in
-those miserable Trident cards--see #define TRIDENT_GLITCH in drivers/char/
-vga.c). In case you enable "Software generated cursor" in the system
-configuration, you can play a few new tricks: you can make your cursor look
-like a non-blinking red block, make it inverse background of the character
-it's over or to highlight that character and still choose whether the
-original hardware cursor should remain visible or not. There may be other
-things I have never thought of.
+those miserable Trident cards--see #define TRIDENT_GLITCH in drivers/video/
+vgacon.c). You can now play a few new tricks: you can make your cursor look
+like a non-blinking red block, make it inverse background of the character it's
+over or to highlight that character and still choose whether the original
+hardware cursor should remain visible or not. There may be other things I have
+never thought of.

The cursor appearance is controlled by a "<ESC>[?1;2;3c" escape sequence
where 1, 2 and 3 are parameters described below. If you omit any of them,
--- /mj/linux-2.1/drivers/char/console.c Tue Aug 4 15:17:58 1998
+++ drivers/char/console.c Tue Aug 4 15:21:58 1998
@@ -92,6 +92,7 @@
#include <linux/interrupt.h>
#include <linux/config.h>
#include <linux/version.h>
+#include <linux/tqueue.h>
#ifdef CONFIG_APM
#include <linux/apm_bios.h>
#endif
@@ -170,6 +171,14 @@
static struct vc_data *master_display_fg = NULL;

/*
+ * Unfortunately, we need to delay tty echo when we're currently writing to the
+ * console since the code is (and always was) not re-entrant, so we insert
+ * all filp requests to con_task_queue instead of tq_timer and run it from
+ * the console_bh.
+ */
+DECLARE_TASK_QUEUE(con_task_queue);
+
+/*
* Low-Level Functions
*/

@@ -1068,7 +1077,7 @@
tty_insert_flip_char(tty, *p, 0);
p++;
}
- tty_schedule_flip(tty);
+ con_schedule_flip(tty);
}

static void cursor_report(int currcons, struct tty_struct * tty)
@@ -1735,11 +1744,6 @@
struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
u16 himask, charmask;

-#if CONFIG_AP1000
- ap_write(1,buf,count);
- return(count);
-#endif
-
currcons = vt->vc_num;
if (!vc_cons_allocated(currcons)) {
/* could this happen? */
@@ -1893,6 +1897,7 @@
*/
static void console_bh(void)
{
+ run_task_queue(&con_task_queue);
if (want_console >= 0) {
if (want_console != fg_console && vc_cons_allocated(want_console)) {
hide_cursor(fg_console);
@@ -1924,10 +1929,6 @@
ushort cnt = 0;
ushort myx = x;

-#if CONFIG_AP1000
- prom_printf(b);
- return;
-#endif
if (!printable || printing)
return; /* console not yet initialized */
printing = 1;
@@ -1938,21 +1939,26 @@
if (!vc_cons_allocated(currcons)) {
/* impossible */
printk("vt_console_print: tty %d not allocated ??\n", currcons+1);
- return;
+ goto quit;
}

/* undraw cursor first */
- hide_cursor(currcons);
-
+ if (IS_FG)
+ hide_cursor(currcons);
+
start = (ushort *)pos;

/* Contrived structure to try to emulate original need_wrap behaviour
* Problems caused when we have need_wrap set on '\n' character */
+ disable_bh(CONSOLE_BH);
while (count--) {
+ enable_bh(CONSOLE_BH);
c = *b++;
+ disable_bh(CONSOLE_BH);
if (c == 10 || c == 13 || c == 8 || need_wrap) {
if (cnt > 0) {
- sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
+ if (IS_VISIBLE)
+ sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
x += cnt;
if (need_wrap)
x--;
@@ -1982,15 +1988,19 @@
myx++;
}
if (cnt > 0) {
- sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
+ if (IS_VISIBLE)
+ sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
x += cnt;
if (x == video_num_columns) {
x--;
need_wrap = 1;
}
}
+ enable_bh(CONSOLE_BH);
set_cursor(currcons);
poke_blanked_console();
+
+quit:
printing = 0;
}

@@ -2127,10 +2137,8 @@
console_num = MINOR(tty->device) - (tty->driver.minor_start);
if (!vc_cons_allocated(console_num))
return;
-#if !CONFIG_AP1000
set_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK);
set_leds();
-#endif
}

/*
@@ -2144,10 +2152,8 @@
console_num = MINOR(tty->device) - (tty->driver.minor_start);
if (!vc_cons_allocated(console_num))
return;
-#if !CONFIG_AP1000
clr_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK);
set_leds();
-#endif
}

static void con_flush_chars(struct tty_struct *tty)
@@ -2256,10 +2272,6 @@
if (tty_register_driver(&console_driver))
panic("Couldn't register console driver\n");

-#if CONFIG_AP1000
- return kmem_start;
-#endif
-
timer_table[BLANK_TIMER].fn = blank_screen;
timer_table[BLANK_TIMER].expires = 0;
if (blankinterval) {
@@ -2597,7 +2615,7 @@

/* If from KDFONTOP ioctl, don't allow things which can be done in userland,
so that we can get rid of this soon */
- if (op->flags & KD_FONT_FLAG_NEW)
+ if (!(op->flags & KD_FONT_FLAG_OLD))
goto quit;
rc = -EFAULT;
for (h = 32; h > 0; h--)
@@ -2640,7 +2658,7 @@

if (op->data && op->charcount > old_op.charcount)
rc = -ENOSPC;
- if (op->flags & KD_FONT_FLAG_NEW) {
+ if (!(op->flags & KD_FONT_FLAG_OLD)) {
if (op->width > old_op.width ||
op->height > old_op.height)
rc = -ENOSPC;
@@ -2694,7 +2712,7 @@

u16 vcs_scr_readw(int currcons, u16 *org)
{
- if (org == (u16 *)pos && softcursor_original != -1)
+ if ((unsigned long)org == pos && softcursor_original != -1)
return softcursor_original;
return scr_readw(org);
}
@@ -2702,7 +2720,7 @@
void vcs_scr_writew(int currcons, u16 val, u16 *org)
{
scr_writew(val, org);
- if (org == (u16 *)pos) {
+ if ((unsigned long)org == pos) {
softcursor_original = -1;
add_softcursor(currcons);
}
--- /mj/linux-2.1/drivers/video/vgacon.c Tue Aug 4 15:19:04 1998
+++ drivers/video/vgacon.c Tue Aug 4 15:32:34 1998
@@ -190,6 +190,7 @@
display_desc = "*MDA";
request_region(0x3b0,12,"mda");
request_region(0x3bf, 1,"mda");
+ vga_video_font_height = 16;
}
}
else /* If not, it is color. */
@@ -256,6 +257,7 @@
vga_vram_end = 0xba000;
display_desc = "*CGA";
request_region(0x3d4,2,"cga");
+ vga_video_font_height = 8;
}
}
vga_vram_base = VGA_MAP_MEM(vga_vram_base);
@@ -284,11 +286,12 @@
|| vga_video_type == VIDEO_TYPE_EGAM) {
vga_hardscroll_enabled = vga_hardscroll_user_enable;
vga_default_font_height = ORIG_VIDEO_POINTS;
- vga_video_font_height = video_font_height = ORIG_VIDEO_POINTS;
+ vga_video_font_height = ORIG_VIDEO_POINTS;
/* This may be suboptimal but is a safe bet - go with it */
video_scan_lines =
- video_font_height * vga_video_num_lines;
+ vga_video_font_height * vga_video_num_lines;
}
+ video_font_height = vga_video_font_height;

return display_desc;
}
@@ -356,19 +359,15 @@

static void vgacon_invert_region(struct vc_data *c, u16 *p, int count)
{
- if (vga_can_do_color) {
- while (count--) {
- u16 a = scr_readw(p);
- a = (((a) & 0x88ff) | (((a) & 0x7000) >> 4)
- | (((a) & 0x0700) << 4));
- scr_writew(a, p++);
- }
- } else {
- while (count--) {
- u16 a = scr_readw(p);
+ int col = vga_can_do_color;
+
+ while (count--) {
+ u16 a = scr_readw(p);
+ if (col)
+ a = ((a) & 0x88ff) | (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4);
+ else
a ^= ((a & 0x0700) == 0x0100) ? 0x7000 : 0x7700;
- scr_writew(a, p++);
- }
+ scr_writew(a, p++);
}
}

@@ -684,7 +683,7 @@
charmap = (char *)VGA_MAP_MEM(colourmap);
beg = 0x0e;
#ifdef VGA_CAN_DO_64KB
- if (video_type == VIDEO_TYPE_VGAC)
+ if (vga_video_type == VIDEO_TYPE_VGAC)
beg = 0x06;
#endif
} else {
--- /mj/linux-2.1/drivers/char/keyboard.c Tue Aug 4 15:14:40 1998
+++ drivers/char/keyboard.c Tue Aug 4 15:22:08 1998
@@ -19,6 +19,7 @@
* parts by Geert Uytterhoeven, May 1997
*
* 27-05-97: Added support for the Magic SysRq Key (Martin Mares)
+ * 16-01-97: Dead-key-twice behavior now configurable (Jiri Hanika)
*/

#include <linux/config.h>
@@ -140,7 +141,8 @@

const int NR_TYPES = SIZE(max_vals);

-static void put_queue(int);
+/* N.B. drivers/macintosh/mac_keyb.c needs to call put_queue */
+void put_queue(int);
static unsigned char handle_diacr(unsigned char);

/* kbd_pt_regs - set by keyboard_interrupt(), used by show_ptregs() */
@@ -310,12 +312,12 @@
}


-static void put_queue(int ch)
+void put_queue(int ch)
{
wake_up(&keypress_wait);
if (tty) {
tty_insert_flip_char(tty, ch, 0);
- tty_schedule_flip(tty);
+ con_schedule_flip(tty);
}
}

@@ -329,7 +331,7 @@
tty_insert_flip_char(tty, *cp, 0);
cp++;
}
- tty_schedule_flip(tty);
+ con_schedule_flip(tty);
}

static void applkey(int key, char mode)
@@ -441,7 +443,7 @@
if (!tty)
return;
tty_insert_flip_char(tty, 0, TTY_BREAK);
- tty_schedule_flip(tty);
+ con_schedule_flip(tty);
}

static void scroll_forw(void)
@@ -539,8 +541,8 @@
static unsigned char ret_diacr[NR_DEAD] =
{A_GRAVE, A_ACUTE, A_CFLEX, A_TILDE, A_DIAER, A_CEDIL };

-/* If a dead key pressed twice, output a character corresponding to it, */
-/* otherwise just remember the dead key. */
+/* If a dead key pressed twice, output a character corresponding to it, */
+/* unless overriden in accent_table; otherwise just remember the dead key. */

static void do_dead(unsigned char value, char up_flag)
{
@@ -549,8 +551,7 @@

value = ret_diacr[value];
if (diacr == value) { /* pressed twice */
- diacr = 0;
- put_queue(value);
+ put_queue(handle_diacr(value));
return;
}
diacr = value;
@@ -574,7 +575,8 @@
return accent_table[i].result;
}

- put_queue(d);
+ if (ch != d) /* dead key pressed twice, put once */
+ put_queue(d);
return ch;
}

--- /mj/linux-2.1/include/linux/kbd_kern.h Tue Aug 4 15:15:04 1998
+++ include/linux/kbd_kern.h Tue Aug 4 15:40:23 1998
@@ -151,4 +151,14 @@

extern unsigned int keymap_count;

+/* console.c */
+
+extern task_queue con_task_queue;
+
+extern inline void con_schedule_flip(struct tty_struct *t)
+{
+ queue_task(&t->flip.tqueue, &con_task_queue);
+ mark_bh(CONSOLE_BH);
+}
+
#endif
--- /mj/linux-2.1/drivers/char/vt.c Tue Aug 4 15:17:59 1998
+++ drivers/char/vt.c Tue Aug 4 15:22:43 1998
@@ -393,7 +393,7 @@
if (!perm)
return -EPERM;
op.op = KD_FONT_OP_SET;
- op.flags = 0;
+ op.flags = KD_FONT_FLAG_OLD;
op.width = 8;
op.height = cfdarg.charheight;
op.charcount = cfdarg.charcount;
@@ -401,7 +401,7 @@
return con_font_op(fg_console, &op);
case GIO_FONTX: {
op.op = KD_FONT_OP_GET;
- op.flags = 0;
+ op.flags = KD_FONT_FLAG_OLD;
op.width = 8;
op.height = cfdarg.charheight;
op.charcount = cfdarg.charcount;
@@ -955,7 +955,7 @@
if (!perm)
return -EPERM;
op.op = KD_FONT_OP_SET;
- op.flags = KD_FONT_FLAG_DONT_RECALC; /* Compatibility */
+ op.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC; /* Compatibility */
op.width = 8;
op.height = 0;
op.charcount = 256;
@@ -966,7 +966,7 @@
case GIO_FONT: {
struct console_font_op op;
op.op = KD_FONT_OP_GET;
- op.flags = 0;
+ op.flags = KD_FONT_FLAG_OLD;
op.width = 8;
op.height = 32;
op.charcount = 256;
@@ -1014,7 +1014,6 @@
return -EFAULT;
if (!perm && op.op != KD_FONT_OP_GET)
return -EPERM;
- op.flags |= KD_FONT_FLAG_NEW;
i = con_font_op(console, &op);
if (i) return i;
if (copy_to_user((void *) arg, &op, sizeof(op)))
@@ -1249,14 +1248,6 @@
if (vt_cons[new_console]->vc_mode == KD_TEXT)
set_palette() ;

- /* FIXME: Do we still need this? */
-#ifdef CONFIG_SUN_CONSOLE
- if (old_vc_mode != vt_cons[new_console]->vc_mode)
- {
- if (old_vc_mode == KD_GRAPHICS)
- update_screen(new_console);
- }
-#endif
/*
* Wake anyone waiting for their VT to activate
*/
--- /mj/linux-2.1/include/linux/kd.h Tue Aug 4 15:19:05 1998
+++ include/linux/kd.h Tue Aug 4 15:40:24 1998
@@ -168,10 +168,9 @@
#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
#define KD_FONT_OP_COPY 3 /* Copy from another console */

-#define KD_FONT_FLAG_GLOBAL 1 /* Change on _all_ consoles */
-#define KD_FONT_FLAG_DONT_RECALC 2 /* Don't recalculate hw charcell size [compat] */
+#define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */
#ifdef __KERNEL__
-#define KD_FONT_FLAG_NEW 0x80000000 /* Indicate new KDFONTOP interface, which should be more strict */
+#define KD_FONT_FLAG_OLD 0x80000000 /* Invoked via old interface [compat] */
#endif

/* note: 0x4B00-0x4B4E all have had a value at some time;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.172 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site