mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zsolt Kajtar <soci@c64.rulez.org>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, jirislaby@kernel.org
Cc: Zsolt Kajtar <soci@c64.rulez.org>
Subject: [PATCH v2 4/4] tty/vt: use correct attribute mask in do_update_region
Date: Mon,  1 Sep 2025 07:26:36 +0200	[thread overview]
Message-ID: <20250901052636.8981-5-soci@c64.rulez.org> (raw)
In-Reply-To: <20250901052636.8981-1-soci@c64.rulez.org>

The original code assumes all bits in the attribute byte are for
attributes. If 512 glyphs are in use then one is used as the 8th bit of
the glyph. This can unnecessarily split up a region of uniform
attributes whenever that bit changes.

Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
---
 drivers/tty/vt/vt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 5d458211b..eb60f69f3 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -613,22 +613,23 @@ static void do_update_region(struct vc_data *vc, unsigned long start, int count)
 {
 	unsigned int xx, yy, offset;
 	u16 *p = (u16 *)start;
+	u16 mask = 0xff00 & ~vc->vc_hi_font_mask;
 
 	offset = (start - vc->vc_origin) / 2;
 	xx = offset % vc->vc_cols;
 	yy = offset / vc->vc_cols;
 
 	for(;;) {
-		u16 attrib = scr_readw(p) & 0xff00;
+		u16 attrib = scr_readw(p) & mask;
 		int startx = xx;
 		u16 *q = p;
 		while (xx < vc->vc_cols && count) {
-			if (attrib != (scr_readw(p) & 0xff00)) {
+			if (attrib != (scr_readw(p) & mask)) {
 				if (p > q)
 					vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
 				startx = xx;
 				q = p;
-				attrib = scr_readw(p) & 0xff00;
+				attrib = scr_readw(p) & mask;
 			}
 			p++;
 			xx++;
-- 
2.30.2


  parent reply	other threads:[~2025-09-01  5:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  5:26 [PATCH v2 0/4] tty/vt: fix various 512 glyph font issues Zsolt Kajtar
2025-09-01  5:26 ` [PATCH v2 1/4] tty/vt: 8th bit location in vc_uniscr routines Zsolt Kajtar
2025-09-01  5:26 ` [PATCH v2 2/4] tty/vt: Prevent 8th bit corruption with soft cursor Zsolt Kajtar
2025-09-01  5:26 ` [PATCH v2 3/4] tty/vt: Fix unreadable kernel messages on vgacon Zsolt Kajtar
2025-09-01  5:26 ` Zsolt Kajtar [this message]
2025-09-06 11:42 ` [PATCH v2 0/4] tty/vt: fix various 512 glyph font issues Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250901052636.8981-5-soci@c64.rulez.org \
    --to=soci@c64.rulez.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®