OSDN Git Service

fbdev: fbmem: convert CONFIG_FB_LOGO_CENTER into a cmd line option
authorPeter Rosin <peda@axentia.se>
Wed, 16 Jan 2019 16:42:35 +0000 (17:42 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Wed, 16 Jan 2019 16:42:35 +0000 (17:42 +0100)
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>
Documentation/fb/fbcon.txt
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbmem.c
drivers/video/logo/Kconfig
include/linux/fb.h

index 62af305..60a5ec0 100644 (file)
@@ -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
index 8976190..bfa1360 100644 (file)
@@ -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;
 }
index 558ed2e..cb43a22 100644 (file)
@@ -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;
@@ -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;
 
@@ -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;
 
@@ -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);
 }
index 1e972c4..d1f6196 100644 (file)
@@ -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
index 7cdd31a..f52ef0a 100644 (file)
@@ -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)              \