]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
fbcon: add fbcon=margin:<color> command line option
authorDavid Lechner <david@lechnology.com>
Fri, 18 Aug 2017 17:56:40 +0000 (19:56 +0200)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Fri, 18 Aug 2017 17:56:40 +0000 (19:56 +0200)
This adds a new command line option to select the fbcon margin color.

The motivation for this is screens where black does not blend into the
physical surroundings of the screen. For example, using an LCD (not the
backlit kind), white text on a black background is hard to read, so
inverting the colors is preferred. However, when you do this, most of the
screen is filled with white but the margins are still filled with black.
This makes a big, black, backwards 'L' on the screen. By setting
fbcon=margin:7, the margins will be filled with white and the LCD looks as
expected.

Signed-off-by: David Lechner <david@lechnology.com>
[b.zolnierkie: ported over fbcon changes]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Documentation/fb/fbcon.txt
drivers/video/fbdev/core/bitblit.c
drivers/video/fbdev/core/fbcon.c
drivers/video/fbdev/core/fbcon.h
drivers/video/fbdev/core/fbcon_ccw.c
drivers/video/fbdev/core/fbcon_cw.c
drivers/video/fbdev/core/fbcon_ud.c
drivers/video/fbdev/core/tileblit.c

index 4a9739abc860651825f62e6ffb71f9b592d57015..1822b190ccd6083cfccc61dd3e1f10ff7ff601a8 100644 (file)
@@ -148,6 +148,13 @@ C. Boot options
        Actually, the underlying fb driver is totally ignorant of console
        rotation.
 
+5. fbcon=margin:<color>
+
+       This option specifies the color of the margins. The margins are the
+       leftover area at the right and the bottom of the screen that are not
+       used by text. By default, this area will be black. The 'color' value
+       is 0 to 7 where 0 is black and 7 is white.
+
 C. Attaching, Detaching and Unloading
 
 Before going on how to attach, detach and unload the framebuffer console, an
index 99f3a1c3d093efb1e72db1bfc310b7c7f039375a..790900d646c03cf2c96871e9373c367a58edc83e 100644 (file)
@@ -203,7 +203,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
 }
 
 static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
-                             int bottom_only)
+                             int color, int bottom_only)
 {
        unsigned int cw = vc->vc_font.width;
        unsigned int ch = vc->vc_font.height;
@@ -213,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
        unsigned int bs = info->var.yres - bh;
        struct fb_fillrect region;
 
-       region.color = 0;
+       region.color = color;
        region.rop = ROP_COPY;
 
        if (rw && !bottom_only) {
index fcd5399949e0ea23d9c3f891f142133f2491261b..4dd08b4af1703f55bc148c93680a83ebc4769431 100644 (file)
@@ -138,6 +138,7 @@ static int info_idx = -1;
 /* console rotation */
 static int initial_rotation = -1;
 static int fbcon_has_sysfs;
+static int margin_color;
 
 static const struct consw fb_con;
 
@@ -492,6 +493,15 @@ static int __init fb_console_setup(char *this_opt)
                                initial_rotation = 0;
                        continue;
                }
+
+               if (!strncmp(options, "margin:", 7)) {
+                       options += 7;
+                       if (*options)
+                               margin_color = simple_strtoul(options, &options, 0);
+                       if (margin_color > 7)
+                               margin_color = 0;
+                       continue;
+               }
        }
        return 1;
 }
@@ -1306,7 +1316,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
        struct fbcon_ops *ops = info->fbcon_par;
 
        if (!fbcon_is_inactive(vc, info))
-               ops->clear_margins(vc, info, bottom_only);
+               ops->clear_margins(vc, info, margin_color, bottom_only);
 }
 
 static void fbcon_cursor(struct vc_data *vc, int mode)
index 60e25e173fdb673917539599630a790cf7ca4dc5..18f3ac14423706adc006f37bee55b1241627f99d 100644 (file)
@@ -60,7 +60,7 @@ struct fbcon_ops {
                      const unsigned short *s, int count, int yy, int xx,
                      int fg, int bg);
        void (*clear_margins)(struct vc_data *vc, struct fb_info *info,
-                             int bottom_only);
+                             int color, int bottom_only);
        void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,
                       int softback_lines, int fg, int bg);
        int  (*update_start)(struct fb_info *info);
index 2eeefa97bd4a09ae5530668ee8dd58b439f89c22..37a8b0b225663780e6e28dd4ba239a6be9581071 100644 (file)
@@ -189,7 +189,7 @@ static void ccw_putcs(struct vc_data *vc, struct fb_info *info,
 }
 
 static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
-                            int bottom_only)
+                             int color, int bottom_only)
 {
        unsigned int cw = vc->vc_font.width;
        unsigned int ch = vc->vc_font.height;
@@ -198,7 +198,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
        unsigned int bs = vc->vc_rows*ch;
        struct fb_fillrect region;
 
-       region.color = 0;
+       region.color = color;
        region.rop = ROP_COPY;
 
        if (rw && !bottom_only) {
index c321f7c59e5c27ac6d91d42dcc56cc42339dec3c..1888f8c866e82ecc35571fe9ad35493f0feedef2 100644 (file)
@@ -172,7 +172,7 @@ static void cw_putcs(struct vc_data *vc, struct fb_info *info,
 }
 
 static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
-                            int bottom_only)
+                            int color, int bottom_only)
 {
        unsigned int cw = vc->vc_font.width;
        unsigned int ch = vc->vc_font.height;
@@ -181,7 +181,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
        unsigned int rs = info->var.yres - rw;
        struct fb_fillrect region;
 
-       region.color = 0;
+       region.color = color;
        region.rop = ROP_COPY;
 
        if (rw && !bottom_only) {
index c0b605d49cb3033f656e8efb1de28cae71b761b4..f98eee263597b08a9677dc8f0072fc62a2cba022 100644 (file)
@@ -220,7 +220,7 @@ static void ud_putcs(struct vc_data *vc, struct fb_info *info,
 }
 
 static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
-                            int bottom_only)
+                            int color, int bottom_only)
 {
        unsigned int cw = vc->vc_font.width;
        unsigned int ch = vc->vc_font.height;
@@ -228,7 +228,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
        unsigned int bh = info->var.yres - (vc->vc_rows*ch);
        struct fb_fillrect region;
 
-       region.color = 0;
+       region.color = color;
        region.rop = ROP_COPY;
 
        if (rw && !bottom_only) {
index 4636a6110c277c1a602c586da43e34a5d5ea66a4..93390312957ffa3d89627deffc8eb6643cfb74f5 100644 (file)
@@ -74,7 +74,7 @@ static void tile_putcs(struct vc_data *vc, struct fb_info *info,
 }
 
 static void tile_clear_margins(struct vc_data *vc, struct fb_info *info,
-                              int bottom_only)
+                              int color, int bottom_only)
 {
        return;
 }