vt: make vt_console_print() compatible with the unicode screen buffer
When kernel messages are printed to the console, they appear blank on the unicode screen. This is because vt_console_print() is lacking a call to vc_uniscr_putc(). However the later function assumes vc->vc_x is always up to date when called, which is not the case here as vt_console_print() uses it to mark the beginning of the display update. This patch reworks (and simplifies) vt_console_print() so that vc->vc_x is always valid and keeps the start of display update in a local variable instead, which finally allows for adding the missing vc_uniscr_putc() call. Signed-off-by: Nicolas Pitre <nico@linaro.org> Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
fc01d8c61c
commit
6609cff65c
|
@ -2884,8 +2884,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
static DEFINE_SPINLOCK(printing_lock);
|
static DEFINE_SPINLOCK(printing_lock);
|
||||||
const ushort *start;
|
const ushort *start;
|
||||||
ushort cnt = 0;
|
ushort start_x, cnt;
|
||||||
ushort myx;
|
|
||||||
int kmsg_console;
|
int kmsg_console;
|
||||||
|
|
||||||
/* console busy or not yet initialized */
|
/* console busy or not yet initialized */
|
||||||
|
@ -2898,10 +2897,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
|
||||||
if (kmsg_console && vc_cons_allocated(kmsg_console - 1))
|
if (kmsg_console && vc_cons_allocated(kmsg_console - 1))
|
||||||
vc = vc_cons[kmsg_console - 1].d;
|
vc = vc_cons[kmsg_console - 1].d;
|
||||||
|
|
||||||
/* read `x' only after setting currcons properly (otherwise
|
|
||||||
the `x' macro will read the x of the foreground console). */
|
|
||||||
myx = vc->vc_x;
|
|
||||||
|
|
||||||
if (!vc_cons_allocated(fg_console)) {
|
if (!vc_cons_allocated(fg_console)) {
|
||||||
/* impossible */
|
/* impossible */
|
||||||
/* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */
|
/* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */
|
||||||
|
@ -2916,53 +2911,41 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
|
||||||
hide_cursor(vc);
|
hide_cursor(vc);
|
||||||
|
|
||||||
start = (ushort *)vc->vc_pos;
|
start = (ushort *)vc->vc_pos;
|
||||||
|
start_x = vc->vc_x;
|
||||||
/* Contrived structure to try to emulate original need_wrap behaviour
|
cnt = 0;
|
||||||
* Problems caused when we have need_wrap set on '\n' character */
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
c = *b++;
|
c = *b++;
|
||||||
if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) {
|
if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) {
|
||||||
if (cnt > 0) {
|
if (cnt && con_is_visible(vc))
|
||||||
if (con_is_visible(vc))
|
vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x);
|
||||||
vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
|
|
||||||
vc->vc_x += cnt;
|
|
||||||
if (vc->vc_need_wrap)
|
|
||||||
vc->vc_x--;
|
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
}
|
|
||||||
if (c == 8) { /* backspace */
|
if (c == 8) { /* backspace */
|
||||||
bs(vc);
|
bs(vc);
|
||||||
start = (ushort *)vc->vc_pos;
|
start = (ushort *)vc->vc_pos;
|
||||||
myx = vc->vc_x;
|
start_x = vc->vc_x;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c != 13)
|
if (c != 13)
|
||||||
lf(vc);
|
lf(vc);
|
||||||
cr(vc);
|
cr(vc);
|
||||||
start = (ushort *)vc->vc_pos;
|
start = (ushort *)vc->vc_pos;
|
||||||
myx = vc->vc_x;
|
start_x = vc->vc_x;
|
||||||
if (c == 10 || c == 13)
|
if (c == 10 || c == 13)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
vc_uniscr_putc(vc, c);
|
||||||
scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
|
scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
|
||||||
notify_write(vc, c);
|
notify_write(vc, c);
|
||||||
cnt++;
|
cnt++;
|
||||||
if (myx == vc->vc_cols - 1) {
|
if (vc->vc_x == vc->vc_cols - 1) {
|
||||||
vc->vc_need_wrap = 1;
|
vc->vc_need_wrap = 1;
|
||||||
continue;
|
} else {
|
||||||
}
|
|
||||||
vc->vc_pos += 2;
|
vc->vc_pos += 2;
|
||||||
myx++;
|
vc->vc_x++;
|
||||||
}
|
|
||||||
if (cnt > 0) {
|
|
||||||
if (con_is_visible(vc))
|
|
||||||
vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
|
|
||||||
vc->vc_x += cnt;
|
|
||||||
if (vc->vc_x == vc->vc_cols) {
|
|
||||||
vc->vc_x--;
|
|
||||||
vc->vc_need_wrap = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cnt && con_is_visible(vc))
|
||||||
|
vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x);
|
||||||
set_cursor(vc);
|
set_cursor(vc);
|
||||||
notify_update(vc);
|
notify_update(vc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue