lkml.org 
[lkml]   [2023]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v2 5/9] vgacon: remove screen_info dependency
    From
    Hi Arnd,

    On 19/7/23 14:39, Arnd Bergmann wrote:
    > From: Arnd Bergmann <arnd@arndb.de>
    >
    > The vga console driver is fairly self-contained, and only used by
    > architectures that explicitly initialize the screen_info settings.
    >
    > Chance every instance that picks the vga console by setting conswitchp
    > to call a function instead, and pass a reference to the screen_info
    > there.
    >
    > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    > ---
    > arch/alpha/kernel/setup.c | 2 +-
    > arch/arm/kernel/setup.c | 2 +-
    > arch/ia64/kernel/setup.c | 2 +-
    > arch/mips/kernel/setup.c | 2 +-
    > arch/x86/kernel/setup.c | 2 +-
    > drivers/firmware/pcdp.c | 2 +-
    > drivers/video/console/vgacon.c | 68 ++++++++++++++++++++--------------
    > include/linux/console.h | 7 ++++
    > 8 files changed, 53 insertions(+), 34 deletions(-)


    > @@ -1074,13 +1077,13 @@ static int vgacon_resize(struct vc_data *c, unsigned int width,
    > * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed
    > * the video mode! Set the new defaults then and go away.
    > */
    > - screen_info.orig_video_cols = width;
    > - screen_info.orig_video_lines = height;
    > + vga_si->orig_video_cols = width;
    > + vga_si->orig_video_lines = height;
    > vga_default_font_height = c->vc_cell_height;
    > return 0;
    > }
    > - if (width % 2 || width > screen_info.orig_video_cols ||
    > - height > (screen_info.orig_video_lines * vga_default_font_height)/
    > + if (width % 2 || width > vga_si->orig_video_cols ||
    > + height > (vga_si->orig_video_lines * vga_default_font_height)/
    > c->vc_cell_height)
    > return -EINVAL;
    >
    > @@ -1110,8 +1113,8 @@ static void vgacon_save_screen(struct vc_data *c)
    > * console initialization routines.
    > */
    > vga_bootup_console = 1;
    > - c->state.x = screen_info.orig_x;
    > - c->state.y = screen_info.orig_y;
    > + c->state.x = vga_si->orig_x;
    > + c->state.y = vga_si->orig_y;

    Not really my area, so bare with me if this is obviously not
    possible :) If using DUMMY_CONSOLE, can we trigger a save_screen
    / resize? If so, we'd reach here with vga_si=NULL.

    > }
    >
    > /* We can't copy in more than the size of the video buffer,
    > @@ -1204,4 +1207,13 @@ const struct consw vga_con = {
    > };
    > EXPORT_SYMBOL(vga_con);
    >
    > +void vgacon_register_screen(struct screen_info *si)
    > +{
    > + if (!si || vga_si)
    > + return;
    > +
    > + conswitchp = &vga_con;
    > + vga_si = si;
    > +}

    \
     
     \ /
      Last update: 2023-07-19 15:50    [W:4.894 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site