Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp282641imu; Tue, 8 Jan 2019 19:57:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Sjj34423r+El2agC/XVhXadRXZdBoZFCAHP2Tnreo8zybuBOVWXC1Ydt1xKWKxoy5jF68 X-Received: by 2002:a17:902:7e4f:: with SMTP id a15mr289881pln.149.1547006242256; Tue, 08 Jan 2019 19:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547006242; cv=none; d=google.com; s=arc-20160816; b=vH4+M/jJHs6wPzjNLKJ1mFiSw7jRAoqZw9ybN5YBcqesUrhnnFrKOgvtMeMbaN5Wlb QFFa/xeOoWB/IIOUVy3CBtC3YotydsXayl8e70NJZiRnybR/VJS7RWRPfMbv72nCDmNg 6F57bROQNYPJ2JIG7IfTeK/wRtjooAP1LEvj0kMC+v+sfsEQhVi7BSIIcbx3RfuGDNTu tgPgpFDIp87xrt5B7Hr8Q0aq2b/MHGMNh4nPNLac45j4ydDk6Tt/9UphpZA6aHXZySlj cE6NJWsTQ+rZN/rPOuRpGx20PTQIE9DqADjUBIqypBqRjadBKPnFYAfDdvEEinpyyJ1e YrBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AmyLjgBBCj6oc3J9NLEQ15OP3X0xj6BVkHsydRd3U60=; b=bgBDL9WFcPO0YShoJaRRbAE/dG9S6FZea9GMFpmoh1hmZX+YYdQVvWJJ6vGQ7LxYYa dnuZIOH+5H294H+lCZJr/AsBZTEoUMZxqVgsHJBjJiKpvRJiYwC7ZZtPQ287wAbg/e5W zCpPDuIVK7HZ7tMdijWYBrG81xBsFCLJGxwvxWn9qCGV+EpxUVrqrwA0+zipKa1NC3iR oi97rMMS71oubI4TLfDm1iTEvpIIyyZ+e2oXV0ObzxYiGM510QUU2AyVWeQsL5rnaH3Y MoNLykaWSdxDqB+vNuPgPm+JiWE4h1Rrus8Qx9TRVqE5C550kjCQ+XOqh7ae/OmFNJmX 9Mqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=RoISlc7J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5si6501054plk.360.2019.01.08.19.57.07; Tue, 08 Jan 2019 19:57:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=RoISlc7J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbfAIDzw (ORCPT + 99 others); Tue, 8 Jan 2019 22:55:52 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:56242 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbfAIDzt (ORCPT ); Tue, 8 Jan 2019 22:55:49 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 9390F119303; Tue, 8 Jan 2019 22:55:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=efjSLXWMsEa9kIKOsVZ02niDE Ro=; b=RoISlc7JQddGZ45MNYdE176p9Ar+pIL8qhRyTKO0eEmDr4WiYVv39CQOf 5jQp1V0CS/swp9JW/HN8f7pfKp88Cg/0Iw075poRKUPI6M2tliW/fMpGzPgUPR8m AsEyhYXYGKea+nn6bMyTR+XwHkrP2UajvkaTwUccc1USn01Jyk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 892491192FF; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from yoda.home (unknown [70.82.104.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 0CBEF1192FC; Tue, 8 Jan 2019 22:55:46 -0500 (EST) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 3069F2DA0419; Tue, 8 Jan 2019 22:55:45 -0500 (EST) From: Nicolas Pitre To: Greg Kroah-Hartman Cc: Dave Mielke , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] vt: make vt_console_print() compatible with the unicode screen buffer Date: Tue, 8 Jan 2019 22:54:59 -0500 Message-Id: <20190109035504.8413-2-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109035504.8413-1-nicolas.pitre@linaro.org> References: <20190109035504.8413-1-nicolas.pitre@linaro.org> MIME-Version: 1.0 X-Pobox-Relay-ID: 7186B80C-13C2-11E9-83F5-70EFDD2159A7-78420484!pb-smtp1.pobox.com Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: stable@vger.kernel.org # v4.19+ --- drivers/tty/vt/vt.c | 47 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 41ec8e5010..b9004bd087 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -2884,8 +2884,7 @@ static void vt_console_print(struct console *co, co= nst char *b, unsigned count) unsigned char c; static DEFINE_SPINLOCK(printing_lock); const ushort *start; - ushort cnt =3D 0; - ushort myx; + ushort start_x, cnt; int kmsg_console; =20 /* console busy or not yet initialized */ @@ -2898,10 +2897,6 @@ static void vt_console_print(struct console *co, c= onst char *b, unsigned count) if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) vc =3D vc_cons[kmsg_console - 1].d; =20 - /* read `x' only after setting currcons properly (otherwise - the `x' macro will read the x of the foreground console). */ - myx =3D vc->vc_x; - if (!vc_cons_allocated(fg_console)) { /* impossible */ /* 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); =20 start =3D (ushort *)vc->vc_pos; - - /* Contrived structure to try to emulate original need_wrap behaviour - * Problems caused when we have need_wrap set on '\n' character */ + start_x =3D vc->vc_x; + cnt =3D 0; while (count--) { c =3D *b++; if (c =3D=3D 10 || c =3D=3D 13 || c =3D=3D 8 || vc->vc_need_wrap) { - 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 +=3D cnt; - if (vc->vc_need_wrap) - vc->vc_x--; - cnt =3D 0; - } + if (cnt && con_is_visible(vc)) + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); + cnt =3D 0; if (c =3D=3D 8) { /* backspace */ bs(vc); start =3D (ushort *)vc->vc_pos; - myx =3D vc->vc_x; + start_x =3D vc->vc_x; continue; } if (c !=3D 13) lf(vc); cr(vc); start =3D (ushort *)vc->vc_pos; - myx =3D vc->vc_x; + start_x =3D vc->vc_x; if (c =3D=3D 10 || c =3D=3D 13) continue; } + vc_uniscr_putc(vc, c); scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); notify_write(vc, c); cnt++; - if (myx =3D=3D vc->vc_cols - 1) { - vc->vc_need_wrap =3D 1; - continue; - } - vc->vc_pos +=3D 2; - myx++; - } - 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 +=3D cnt; - if (vc->vc_x =3D=3D vc->vc_cols) { - vc->vc_x--; + if (vc->vc_x =3D=3D vc->vc_cols - 1) { vc->vc_need_wrap =3D 1; + } else { + vc->vc_pos +=3D 2; + vc->vc_x++; } } + if (cnt && con_is_visible(vc)) + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); set_cursor(vc); notify_update(vc); =20 --=20 2.20.1