fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line option

A command line option is much more flexible than a config option and
the supporting code is small. Gets rid of #ifdefs in the code too...

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
This commit is contained in:
Peter Rosin 2019-01-16 17:42:35 +01:00 committed by Bartlomiej Zolnierkiewicz
parent 00257e0cc5
commit 890d14d2d4
5 changed files with 26 additions and 18 deletions

View File

@ -163,6 +163,14 @@ C. Boot options
be preserved until there actually is some text is output to the console. be preserved until there actually is some text is output to the console.
This option causes fbcon to bind immediately to the fbdev device. This option causes fbcon to bind immediately to the fbdev device.
7. fbcon=logo-pos:<location>
The only possible 'location' is 'center' (without quotes), and when
given, the bootup logo is moved from the default top-left corner
location to the center of the framebuffer. If more than one logo is
displayed due to multiple CPUs, the collected line of logos is moved
as a whole.
C. Attaching, Detaching and Unloading C. Attaching, Detaching and Unloading
Before going on to how to attach, detach and unload the framebuffer console, an Before going on to how to attach, detach and unload the framebuffer console, an

View File

@ -510,6 +510,13 @@ static int __init fb_console_setup(char *this_opt)
continue; continue;
} }
#endif #endif
if (!strncmp(options, "logo-pos:", 9)) {
options += 9;
if (!strcmp(options, "center"))
fb_center_logo = true;
continue;
}
} }
return 1; return 1;
} }

View File

@ -53,6 +53,9 @@ EXPORT_SYMBOL(registered_fb);
int num_registered_fb __read_mostly; int num_registered_fb __read_mostly;
EXPORT_SYMBOL(num_registered_fb); EXPORT_SYMBOL(num_registered_fb);
bool fb_center_logo __read_mostly;
EXPORT_SYMBOL(fb_center_logo);
static struct fb_info *get_fb_info(unsigned int idx) static struct fb_info *get_fb_info(unsigned int idx)
{ {
struct fb_info *fb_info; struct fb_info *fb_info;
@ -506,8 +509,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
fb_set_logo(info, logo, logo_new, fb_logo.depth); fb_set_logo(info, logo, logo_new, fb_logo.depth);
} }
#ifdef CONFIG_FB_LOGO_CENTER if (fb_center_logo) {
{
int xres = info->var.xres; int xres = info->var.xres;
int yres = info->var.yres; int yres = info->var.yres;
@ -520,11 +522,11 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
--n; --n;
image.dx = (xres - n * (logo->width + 8) - 8) / 2; image.dx = (xres - n * (logo->width + 8) - 8) / 2;
image.dy = y ?: (yres - logo->height) / 2; image.dy = y ?: (yres - logo->height) / 2;
} else {
image.dx = 0;
image.dy = y;
} }
#else
image.dx = 0;
image.dy = y;
#endif
image.width = logo->width; image.width = logo->width;
image.height = logo->height; image.height = logo->height;
@ -684,9 +686,8 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
} }
height = fb_logo.logo->height; height = fb_logo.logo->height;
#ifdef CONFIG_FB_LOGO_CENTER if (fb_center_logo)
height += (yres - fb_logo.logo->height) / 2; height += (yres - fb_logo.logo->height) / 2;
#endif
return fb_prepare_extra_logos(info, height, yres); return fb_prepare_extra_logos(info, height, yres);
} }

View File

@ -10,15 +10,6 @@ menuconfig LOGO
if LOGO if LOGO
config FB_LOGO_CENTER
bool "Center the logo"
depends on FB=y
help
When this option is selected, the bootup logo is centered both
horizontally and vertically. If more than one logo is displayed
due to multiple CPUs, the collected line of logos is centered
as a whole.
config FB_LOGO_EXTRA config FB_LOGO_EXTRA
bool bool
depends on FB=y depends on FB=y

View File

@ -653,6 +653,7 @@ extern int fb_new_modelist(struct fb_info *info);
extern struct fb_info *registered_fb[FB_MAX]; extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb; extern int num_registered_fb;
extern bool fb_center_logo;
extern struct class *fb_class; extern struct class *fb_class;
#define for_each_registered_fb(i) \ #define for_each_registered_fb(i) \