Skip to content

Commit

Permalink
fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line option
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Signed-off-by: Peter Rosin <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
  • Loading branch information
peda-r authored and bzolnier committed Jan 16, 2019
1 parent 00257e0 commit 890d14d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
8 changes: 8 additions & 0 deletions Documentation/fb/fbcon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ C. Boot options
be preserved until there actually is some text is output to the console.
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

Before going on to how to attach, detach and unload the framebuffer console, an
Expand Down
7 changes: 7 additions & 0 deletions drivers/video/fbdev/core/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ static int __init fb_console_setup(char *this_opt)
continue;
}
#endif

if (!strncmp(options, "logo-pos:", 9)) {
options += 9;
if (!strcmp(options, "center"))
fb_center_logo = true;
continue;
}
}
return 1;
}
Expand Down
19 changes: 10 additions & 9 deletions drivers/video/fbdev/core/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ EXPORT_SYMBOL(registered_fb);
int num_registered_fb __read_mostly;
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)
{
struct fb_info *fb_info;
Expand Down Expand Up @@ -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);
}

#ifdef CONFIG_FB_LOGO_CENTER
{
if (fb_center_logo) {
int xres = info->var.xres;
int yres = info->var.yres;

Expand All @@ -520,11 +522,11 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
--n;
image.dx = (xres - n * (logo->width + 8) - 8) / 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.height = logo->height;

Expand Down Expand Up @@ -684,9 +686,8 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
}

height = fb_logo.logo->height;
#ifdef CONFIG_FB_LOGO_CENTER
height += (yres - fb_logo.logo->height) / 2;
#endif
if (fb_center_logo)
height += (yres - fb_logo.logo->height) / 2;

return fb_prepare_extra_logos(info, height, yres);
}
Expand Down
9 changes: 0 additions & 9 deletions drivers/video/logo/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ menuconfig 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
bool
depends on FB=y
Expand Down
1 change: 1 addition & 0 deletions include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ extern int fb_new_modelist(struct fb_info *info);

extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb;
extern bool fb_center_logo;
extern struct class *fb_class;

#define for_each_registered_fb(i) \
Expand Down

0 comments on commit 890d14d

Please sign in to comment.