2.1.105: console speedup patch ({delete,insert}_char)

Matija Nalis (mnalis@public.srce.hr)
Wed, 10 Jun 1998 03:11:31 +0200


--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii

This diff fixes problem with console, which was delaying for long enough
to stop for example sound playing while executing delete_char and
insert_char in loops (as executed by ESC[nP and ESC[n@ escape sequences,
where 'n' is number of chars to delete/insert).

Somethimes ncurses applications generate quite a few of those with big
numbers of 'n', which introduced me to a problem.

Diff is agains 2.1.105, but there should not be much problems to use it
against older versions.

Share & enjoy,
Matija

-- 
Opinions above are GNU-copylefted.

--opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="console_speedup_2.1.105.diff"

--- linux-2.1.105/drivers/char/console.c Wed Jun 10 01:10:29 1998 +++ linux/drivers/char/console.c Wed Jun 10 02:53:43 1998 @@ -1254,18 +1254,16 @@ } } -static void insert_char(int currcons) +static void insert_char(int currcons, unsigned int nr) { unsigned int i = x; - unsigned short tmp, old = video_erase_char; - unsigned short * p = (unsigned short *) pos; + unsigned short * p, * q = (unsigned short *) pos; - while (i++ < video_num_columns) { - tmp = scr_readw(p); - scr_writew(old, p); - old = tmp; + while (i++ <= video_num_columns - nr) { + scr_writew(scr_readw(p), p + nr); p++; } + memsetw(q, video_erase_char, nr*2); need_wrap = 0; } @@ -1275,16 +1273,16 @@ need_wrap = 0; } -static void delete_char(int currcons) +static void delete_char(int currcons, unsigned int nr) { unsigned int i = x; unsigned short * p = (unsigned short *) pos; - while (++i < video_num_columns) { - scr_writew(scr_readw(p+1), p); + while (++i <= video_num_columns - nr) { + scr_writew(scr_readw(p+nr), p); p++; } - scr_writew(video_erase_char, p); + memsetw(p, video_erase_char, nr*2); need_wrap = 0; } @@ -1300,8 +1298,7 @@ nr = video_num_columns; else if (!nr) nr = 1; - while (nr--) - insert_char(currcons); + insert_char(currcons, nr); } static void csi_L(int currcons, unsigned int nr) @@ -1319,8 +1316,7 @@ nr = video_num_columns; else if (!nr) nr = 1; - while (nr--) - delete_char(currcons); + delete_char(currcons, nr); } static void csi_M(int currcons, unsigned int nr) @@ -1583,7 +1579,7 @@ lf(currcons); } if (decim) - insert_char(currcons); + insert_char(currcons, 1); scr_writew( video_mode_512ch ? ((attr & 0xf7) << 8) + ((tc & 0x100) << 3) + (tc & 0x0ff) : (attr << 8) + tc,

--opJtzjQTFsWo+cga--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu