Gentoo Archives: gentoo-user

From: Alan Mackenzie <acm@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Soft scrolling on framebuffer consoles - New version of the patch - with GPM handling.
Date: Fri, 27 Jan 2023 22:31:24
Message-Id: Y9RQtTBCM+VWzARm@ACM
In Reply to: Re: [gentoo-user] Soft scrolling on framebuffer consoles - New version of the patch - with GPM handling. by Peter Humphrey
1 Hello, Peter.
2
3 On Fri, Jan 27, 2023 at 12:24:41 +0000, Peter Humphrey wrote:
4 > On Thursday, 26 January 2023 20:28:36 GMT Alan Mackenzie wrote:
5
6 > --->8
7
8 > > Again, on any problems please let me know and I'll try to fix them. As
9 > > ever, there are no guarantees, etc., etc., etc. My only promise is that
10 > > there's no malicious code in the patch.
11
12 > Good news! Well, partly... :)
13
14 > I applied the new patch to 5.15.88 and it seems fine. I'll have to test it in
15 > use and let you know.
16
17 I have since found a few bugs in that patch. Mainly they're to do with
18 losing 18 lines[*] GPM-ability at the earliest boot messages, when
19 changing font size, and things like that.
20
21 [*] 18 lines is the difference between 49 lines (from an 11x22 font such
22 as ter-122n) and 67 lines (from an 8x16 font like lat1-16) which fit on
23 the screen.
24
25 I've also discovered that when CONFIG_LOGO (i.e. displaying Tux at boot
26 up) is enabled, all boot messages which preceded the Tuxes become
27 invisible to GPM, and they cannot be selected. I don't (yet) know why
28 this is happening, but the obvious workaround is to disable CONFIG_LOGO
29 in one's kernel configuration.
30
31 I've found yet another bug which it's taken me a few hours to determine
32 is nothing to do with me. It goes like this: boot up in an 11x22 font
33 such as ter-122n, and move the mouse on that screen. Run the command
34 setfont lat1-16, which will resize the existing text. The GPM mouse is
35 now restricted to the 174x49 rectangle in the top left of the screen.
36 This is the bug. To free it, switch to a different tty and move the
37 mouse there. On returning to the first tty, the mouse can now be moved
38 over the entire screen.
39
40 The cause of this bug is that GPM does not connect up with screen
41 resizing events. The only time it determines a tty's size is when it
42 detects the tty has been switched. Not a big bug, but somewhat
43 annoying.
44
45 > Patching 6.1.8 failed, though, whereas the previous 5.15.80-scroll.
46 > 20221212.diff succeeded:
47
48 I haven't actually looked at any versions except for 5.15.80 and 5.15.88
49 so far.
50
51 > # patch -p1 < /usr/local/src/5.15.80-GPM.20230126.diff
52 > patching file drivers/tty/vt/vt.c
53 > Hunk #37 succeeded at 4748 (offset -1 lines).
54 > Hunk #38 succeeded at 5049 (offset -1 lines).
55 > Hunk #39 FAILED at 5353.
56 > 1 out of 39 hunks FAILED -- saving rejects to file drivers/tty/vt/vt.c.rej
57 > patching file drivers/video/console/Kconfig
58 > Hunk #1 succeeded at 99 (offset 1 line).
59 > patching file drivers/video/fbdev/core/fbcon.c
60 > Hunk #1 succeeded at 3171 (offset 19 lines).
61 > patching file include/linux/console_struct.h
62 > Hunk #2 FAILED at 170.
63 > 1 out of 2 hunks FAILED -- saving rejects to file include/linux/
64 > console_struct.h.rej
65 > patching file include/linux/vt_kern.h
66 > Hunk #1 succeeded at 114 (offset -1 lines).
67
68 > I've attached the reject files.
69
70 Thanks for these! It looks like it'll probably be straightforward to
71 amend the patch for 6.1.8. Are you currently running 6.1.8 as your main
72 kernel?
73
74 Anyhow, I'll probably post another patch with corrections in the next
75 day or two. Thanks for the testing!
76
77 > --
78 > Regards,
79 > Peter.
80
81 > --- drivers/tty/vt/vt.c
82 > +++ drivers/tty/vt/vt.c
83 > @@ -5353,10 +5965,19 @@ EXPORT_SYMBOL_GPL(screen_glyph);
84 >
85 > u32 screen_glyph_unicode(const struct vc_data *vc, int n)
86 > {
87 > - struct uni_screen *uniscr = get_vc_uniscr(vc);
88 > + int y = n / vc->vc_cols, x = n % vc->vc_cols;
89 > + uint32_t *ln = vc->vc_uniscr_curr + y * vc->vc_cols;
90 >
91 > - if (uniscr)
92 > - return uniscr->lines[n / vc->vc_cols][n % vc->vc_cols];
93 > + if (vc->vc_uniscr_curr) {
94 > + if (ln >= vc_uniscr_buf_end(vc))
95 > + ln -= vc->vc_uniscr_char_size;
96 > +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_GPM
97 > + ln -= vc->vc_softback_lines * vc->vc_cols;
98 > + if (ln < vc->vc_uniscr_buf)
99 > + ln += vc->vc_uniscr_char_size;
100 > +#endif
101 > + return ln[x];
102 > + }
103 > return inverse_translate(vc, screen_glyph(vc, n * 2), 1);
104 > }
105 > EXPORT_SYMBOL_GPL(screen_glyph_unicode);
106
107 > --- include/linux/console_struct.h
108 > +++ include/linux/console_struct.h
109 > @@ -170,7 +181,11 @@ struct vc_data {
110 > struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
111 > struct uni_pagedir *vc_uni_pagedir;
112 > struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
113 > - struct uni_screen *vc_uni_screen; /* unicode screen content */
114 > +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_GPM
115 > + uint32_t *vc_uniscr_buf; /* Address of unicode screen content */
116 > + unsigned int vc_uniscr_char_size; /* Size of *vc-uniscr_buf in 32-bit chars */
117 > + uint32_t *vc_uniscr_curr; /* Pos of first char of (unscrolled) screen */
118 > +#endif
119 > /* additional information is in vt_kern.h */
120 > };
121 >
122
123 --
124 Alan Mackenzie (Nuremberg, Germany).

Replies