On Thursday, 26 January 2023 20:28:36 GMT Alan Mackenzie wrote:

--->8

> Again, on any problems please let me know and I'll try to fix them.  As
> ever, there are no guarantees, etc., etc., etc.  My only promise is that
> there's no malicious code in the patch.

Good news! Well, partly...  :)

I applied the new patch to 5.15.88 and it seems fine. I'll have to test it in 
use and let you know.

Patching 6.1.8 failed, though, whereas the previous 5.15.80-scroll.
20221212.diff succeeded:

# patch -p1 < /usr/local/src/5.15.80-GPM.20230126.diff
patching file drivers/tty/vt/vt.c
Hunk #37 succeeded at 4748 (offset -1 lines).
Hunk #38 succeeded at 5049 (offset -1 lines).
Hunk #39 FAILED at 5353.
1 out of 39 hunks FAILED -- saving rejects to file drivers/tty/vt/vt.c.rej
patching file drivers/video/console/Kconfig
Hunk #1 succeeded at 99 (offset 1 line).
patching file drivers/video/fbdev/core/fbcon.c
Hunk #1 succeeded at 3171 (offset 19 lines).
patching file include/linux/console_struct.h
Hunk #2 FAILED at 170.
1 out of 2 hunks FAILED -- saving rejects to file include/linux/
console_struct.h.rej
patching file include/linux/vt_kern.h
Hunk #1 succeeded at 114 (offset -1 lines).

I've attached the reject files.

-- 
Regards,
Peter.
--- drivers/tty/vt/vt.c
+++ drivers/tty/vt/vt.c
@@ -5353,10 +5965,19 @@ EXPORT_SYMBOL_GPL(screen_glyph);
 
 u32 screen_glyph_unicode(const struct vc_data *vc, int n)
 {
-	struct uni_screen *uniscr = get_vc_uniscr(vc);
+	int y = n / vc->vc_cols, x = n % vc->vc_cols;
+	uint32_t *ln = vc->vc_uniscr_curr + y * vc->vc_cols;
 
-	if (uniscr)
-		return uniscr->lines[n / vc->vc_cols][n % vc->vc_cols];
+	if (vc->vc_uniscr_curr) {
+		if (ln >= vc_uniscr_buf_end(vc))
+			ln -= vc->vc_uniscr_char_size;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_GPM
+		ln -= vc->vc_softback_lines * vc->vc_cols;
+		if (ln < vc->vc_uniscr_buf)
+			ln += vc->vc_uniscr_char_size;
+#endif
+		return ln[x];
+	}
 	return inverse_translate(vc, screen_glyph(vc, n * 2), 1);
 }
 EXPORT_SYMBOL_GPL(screen_glyph_unicode);
--- include/linux/console_struct.h
+++ include/linux/console_struct.h
@@ -170,7 +181,11 @@ struct vc_data {
 	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
 	struct uni_pagedir *vc_uni_pagedir;
 	struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
-	struct uni_screen *vc_uni_screen;	/* unicode screen content */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_GPM
+	uint32_t *vc_uniscr_buf;    /* Address of unicode screen content */
+	unsigned int vc_uniscr_char_size; /* Size of *vc-uniscr_buf in 32-bit chars */
+	uint32_t *vc_uniscr_curr;	/* Pos of first char of (unscrolled) screen */
+#endif
 	/* additional information is in vt_kern.h */
 };
 

Reply via email to