• Re: [gentoo-user] Soft scrolling on framebuffer consoles - New (?final)

    From Alan Mackenzie@21:1/5 to Peter Humphrey on Fri Feb 3 20:00:01 2023
    Hello, Peter.

    I have another version of the patch which makes GPM usable on scrolled consoles. I'd like to think that it's now final.

    On Sat, Jan 28, 2023 at 14:41:53 +0000, Peter Humphrey wrote:
    On Friday, 27 January 2023 22:31:17 GMT Alan Mackenzie wrote:
    On Fri, Jan 27, 2023 at 12:24:41 +0000, Peter Humphrey wrote:

    8

    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?

    Yes Alan, I'm running ~amd64, so 6.1.8 is the current kernel. I have 5.15.88 as a backup.

    OK, I'm enclosing a patch for each version, 5.15.x and 6.1.y. I'm not
    aware of any outstanding bugs in these patches. In particular, the
    following have been fixed since the previous version:
    (i) The synchronisation between the "mouse" character buffer and the
    contents of the screen is now 100%. In particular, when changing
    fonts (e.g. at bootup), and when the Tux logos get removed from the
    screen, things continue working.
    (ii) CONFIG_LOGO (i.e. the Tuxes on bootup) can now be freely configured
    without losing functionality.

    Just a quick reminder of how to use these files for anybody else who
    might be interested:
    (i) cd /usr/src/linux-5.15.88-gentoo, or similar. (Or
    ...-6.1.x-gentoo).
    (ii) patch -p1 < 5.15.80-GPM.20230203.diff (or the other one).
    (iii) Configure the kernel as normal. Additionally, under Device
    drivers/Graphic Support/Console display driver support, enable
    CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK, set the buffer size to
    taste (it's default is 128 kB) and accept the default enablement of
    CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_GPM.
    (iv) Build the kernel and install it into your boot manager.
    (v) Reboot and enjoy! You can now use GPM in scrolled consoles.

    --
    Regards,
    Peter.

    --
    Alan Mackenzie (Nuremberg, Germany).


    diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
    index b8f5bc19416d..5d5508209164 100644
    --- a/drivers/tty/vt/vt.c
    +++ b/drivers/tty/vt/vt.c
    @@ -134,6 +134,11 @@ const struct consw *conswitchp;
    #define DEFAULT_BELL_DURATION (HZ/8)
    #define DEFAULT_CURSOR_BLINK_MS 200

    +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
    +static unsigned int console_soft_scrollback_size =
    + 1024 * CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE;
    +#endif
    +
    struct vc vc_cons [MAX_NR_CONSOLES];

    #ifndef VT_SINGLE_DRIVER
    @@ -286,8 +291,31 @@ static inline bool con_should_update(const struct vc_data *vc)
    static inline unsigned short *screenpos(const struct vc_data *vc, int offset,
    bool viewed)
    {
    +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
    + unsigned long softback_pos, scrolled_expanse;
    +
    + if (vc->vc_softback_curr == vc->vc_origin) /* Should never happen! */
    + return (unsigned short *)(vc->vc_origin + offset);
    + else {
    + if (vc->vc_softback_in >= vc->vc_softback_curr)
    + scrolled_expanse = vc->vc_softback_in - vc->vc_softback_curr;
    + else
    + scrolled_expanse = vc->vc_softbac