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).

Reply via email to