From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DDC2615800F for ; Fri, 27 Jan 2023 22:31:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 831AFE0A02; Fri, 27 Jan 2023 22:31:20 +0000 (UTC) Received: from mx3.muc.de (mx3.muc.de [193.149.48.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BC1FEE09F9 for ; Fri, 27 Jan 2023 22:31:19 +0000 (UTC) Received: (qmail 66409 invoked by uid 3782); 27 Jan 2023 23:31:18 +0100 Received: from acm.muc.de (p4fe15e95.dip0.t-ipconnect.de [79.225.94.149]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 27 Jan 2023 23:31:17 +0100 Received: (qmail 4344 invoked by uid 1000); 27 Jan 2023 22:31:17 -0000 Date: Fri, 27 Jan 2023 22:31:17 +0000 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Soft scrolling on framebuffer consoles - New version of the patch - with GPM handling. Message-ID: References: <4776889.GXAFRqVoOG@wstn> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4776889.GXAFRqVoOG@wstn> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Archives-Salt: 8dfd354a-229f-4488-9848-f5da09e5cfe1 X-Archives-Hash: 0fe3bb2da7d8e20d71f7dd556c7472d5 Hello, Peter. On Fri, Jan 27, 2023 at 12:24:41 +0000, Peter Humphrey wrote: > 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. I have since found a few bugs in that patch. Mainly they're to do with losing 18 lines[*] GPM-ability at the earliest boot messages, when changing font size, and things like that. [*] 18 lines is the difference between 49 lines (from an 11x22 font such as ter-122n) and 67 lines (from an 8x16 font like lat1-16) which fit on the screen. I've also discovered that when CONFIG_LOGO (i.e. displaying Tux at boot up) is enabled, all boot messages which preceded the Tuxes become invisible to GPM, and they cannot be selected. I don't (yet) know why this is happening, but the obvious workaround is to disable CONFIG_LOGO in one's kernel configuration. I've found yet another bug which it's taken me a few hours to determine is nothing to do with me. It goes like this: boot up in an 11x22 font such as ter-122n, and move the mouse on that screen. Run the command setfont lat1-16, which will resize the existing text. The GPM mouse is now restricted to the 174x49 rectangle in the top left of the screen. This is the bug. To free it, switch to a different tty and move the mouse there. On returning to the first tty, the mouse can now be moved over the entire screen. The cause of this bug is that GPM does not connect up with screen resizing events. The only time it determines a tty's size is when it detects the tty has been switched. Not a big bug, but somewhat annoying. > Patching 6.1.8 failed, though, whereas the previous 5.15.80-scroll. > 20221212.diff succeeded: I haven't actually looked at any versions except for 5.15.80 and 5.15.88 so far. > # 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. Thanks for these! It looks like it'll probably be straightforward to amend the patch for 6.1.8. Are you currently running 6.1.8 as your main kernel? Anyhow, I'll probably post another patch with corrections in the next day or two. Thanks for the testing! > -- > 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 */ > }; > -- Alan Mackenzie (Nuremberg, Germany).