lkml.org 
[lkml]   [2024]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH v1 5/5] fbcon: Allow to get max font width and height
    Date
    Signed-off-by: Alexey Gladkov <legion@kernel.org>
    ---
    drivers/video/fbdev/core/fbcon.c | 18 +++++++++++++++++-
    1 file changed, 17 insertions(+), 1 deletion(-)

    diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
    index 1183e7a871f8..6f9015868cac 100644
    --- a/drivers/video/fbdev/core/fbcon.c
    +++ b/drivers/video/fbdev/core/fbcon.c
    @@ -101,6 +101,9 @@ enum {
    FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */
    };

    +#define FBCON_MAX_FONT_WIDTH 32
    +#define FBCON_MAX_FONT_HEIGHT 32
    +
    static struct fbcon_display fb_display[MAX_NR_CONSOLES];

    static struct fb_info *fbcon_registered_fb[FB_MAX];
    @@ -2458,6 +2461,17 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
    return ret;
    }

    +
    +static int fbcon_font_info(struct vc_data *vc, struct console_font *font)
    +{
    + font->width = FBCON_MAX_FONT_WIDTH;
    + font->height = FBCON_MAX_FONT_HEIGHT;
    + font->charcount = 512;
    +
    + return 0;
    +}
    +
    +
    /*
    * User asked to set font; we are guaranteed that charcount does not exceed 512
    * but lets not assume that, since charcount of 512 is small for unicode support.
    @@ -2485,7 +2499,8 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
    h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
    return -EINVAL;

    - if (font->width > 32 || font->height > 32)
    + if (font->width > FBCON_MAX_FONT_WIDTH ||
    + font->height > FBCON_MAX_FONT_HEIGHT)
    return -EINVAL;

    /* Make sure drawing engine can handle the font */
    @@ -3160,6 +3175,7 @@ static const struct consw fb_con = {
    .con_scroll = fbcon_scroll,
    .con_switch = fbcon_switch,
    .con_blank = fbcon_blank,
    + .con_font_info = fbcon_font_info,
    .con_font_set = fbcon_set_font,
    .con_font_get = fbcon_get_font,
    .con_font_default = fbcon_set_def_font,
    --
    2.43.0

    \
     
     \ /
      Last update: 2024-05-27 15:05    [W:7.067 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site