From 94a0b2232c729c757547b88f2cbc035cef7e0bc1 Mon Sep 17 00:00:00 2001 From: luckfox-eng29 Date: Tue, 8 Oct 2024 21:50:54 +0800 Subject: [PATCH] patch:logo_center Signed-off-by: luckfox-eng29 --- .../source/kernel/drivers/video/fbdev/core/fbcon.c | 14 +++++++++++++- .../source/kernel/drivers/video/fbdev/core/fbmem.c | 7 ++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sysdrv/source/kernel/drivers/video/fbdev/core/fbcon.c b/sysdrv/source/kernel/drivers/video/fbdev/core/fbcon.c index 27828435d..c3ac676bb 100644 --- a/sysdrv/source/kernel/drivers/video/fbdev/core/fbcon.c +++ b/sysdrv/source/kernel/drivers/video/fbdev/core/fbcon.c @@ -88,6 +88,9 @@ # define DPRINTK(fmt, args...) #endif +#define CURSOR_ENABLE 0 +#define SHOW_CENTER 1 + /* * FIXME: Locking * @@ -365,6 +368,7 @@ static int get_color(struct vc_data *vc, struct fb_info *info, static void fb_flashcursor(struct work_struct *work) { +#if CURSOR_ENABLE struct fb_info *info = container_of(work, struct fb_info, queue); struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc = NULL; @@ -395,6 +399,7 @@ static void fb_flashcursor(struct work_struct *work) ops->cursor(vc, info, mode, get_color(vc, info, c, 1), get_color(vc, info, c, 0)); console_unlock(); +#endif } static void cursor_timer_handler(struct timer_list *t) @@ -601,7 +606,12 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, if (fb_get_color_depth(&info->var, &info->fix) == 1) erase &= ~0x400; logo_height = fb_prepare_logo(info, ops->rotate); - logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); + +#if SHOW_CENTER + logo_height += (info->var.yres/2) - (logo_height/2); +#endif + + logo_lines = DIV_ROUND_UP(logo_height, vc->vc_font.height); q = (unsigned short *) (vc->vc_origin + vc->vc_size_row * rows); step = logo_lines * cols; @@ -1331,6 +1341,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) static void fbcon_cursor(struct vc_data *vc, int mode) { +#if CURSOR_ENABLE struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; struct fbcon_ops *ops = info->fbcon_par; int c = scr_readw((u16 *) vc->vc_pos); @@ -1352,6 +1363,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode) ops->cursor(vc, info, mode, get_color(vc, info, c, 1), get_color(vc, info, c, 0)); +#endif } static int scrollback_phys_max = 0; diff --git a/sysdrv/source/kernel/drivers/video/fbdev/core/fbmem.c b/sysdrv/source/kernel/drivers/video/fbdev/core/fbmem.c index d787a344b..690d48fba 100644 --- a/sysdrv/source/kernel/drivers/video/fbdev/core/fbmem.c +++ b/sysdrv/source/kernel/drivers/video/fbdev/core/fbmem.c @@ -38,7 +38,7 @@ #include - +#define SHOW_CENTER 1 /* * Frame buffer device initialization and setup routines */ @@ -520,6 +520,11 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, image.dy = y; } +#if SHOW_CENTER +image.dx = (info->var.xres - logo->width) / 2; +image.dy = (info->var.yres - logo->height) / 2; +#endif + image.width = logo->width; image.height = logo->height; -- 2.34.1