aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2017-08-18 13:56:40 -0400
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2017-08-18 13:56:40 -0400
commit74c1c8b3326a366d39aa74e1737a28d4cba151c8 (patch)
tree821b7647c8fc9e41f4b02eb1897d3e7e4569d980
parent16622a8e7e46fab31fd33ca5a23672385de240f6 (diff)
fbcon: add fbcon=margin:<color> command line option
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>
-rw-r--r--Documentation/fb/fbcon.txt7
-rw-r--r--drivers/video/fbdev/core/bitblit.c4
-rw-r--r--drivers/video/fbdev/core/fbcon.c12
-rw-r--r--drivers/video/fbdev/core/fbcon.h2
-rw-r--r--drivers/video/fbdev/core/fbcon_ccw.c4
-rw-r--r--drivers/video/fbdev/core/fbcon_cw.c4
-rw-r--r--drivers/video/fbdev/core/fbcon_ud.c4
-rw-r--r--drivers/video/fbdev/core/tileblit.c2
8 files changed, 28 insertions, 11 deletions
diff --git a/Documentation/fb/fbcon.txt b/Documentation/fb/fbcon.txt
index 4a9739abc860..1822b190ccd6 100644
--- a/Documentation/fb/fbcon.txt
+++ b/Documentation/fb/fbcon.txt
@@ -148,6 +148,13 @@ C. Boot options
148 Actually, the underlying fb driver is totally ignorant of console 148 Actually, the underlying fb driver is totally ignorant of console
149 rotation. 149 rotation.
150 150
1515. fbcon=margin:<color>
152
153 This option specifies the color of the margins. The margins are the
154 leftover area at the right and the bottom of the screen that are not
155 used by text. By default, this area will be black. The 'color' value
156 is 0 to 7 where 0 is black and 7 is white.
157
151C. Attaching, Detaching and Unloading 158C. Attaching, Detaching and Unloading
152 159
153Before going on how to attach, detach and unload the framebuffer console, an 160Before going on how to attach, detach and unload the framebuffer console, an
diff --git a/drivers/video/fbdev/core/bitblit.c b/drivers/video/fbdev/core/bitblit.c
index 99f3a1c3d093..790900d646c0 100644
--- a/drivers/video/fbdev/core/bitblit.c
+++ b/drivers/video/fbdev/core/bitblit.c
@@ -203,7 +203,7 @@ static void bit_putcs(struct vc_data *vc, struct fb_info *info,
203} 203}
204 204
205static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, 205static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
206 int bottom_only) 206 int color, int bottom_only)
207{ 207{
208 unsigned int cw = vc->vc_font.width; 208 unsigned int cw = vc->vc_font.width;
209 unsigned int ch = vc->vc_font.height; 209 unsigned int ch = vc->vc_font.height;
@@ -213,7 +213,7 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info,
213 unsigned int bs = info->var.yres - bh; 213 unsigned int bs = info->var.yres - bh;
214 struct fb_fillrect region; 214 struct fb_fillrect region;
215 215
216 region.color = 0; 216 region.color = color;
217 region.rop = ROP_COPY; 217 region.rop = ROP_COPY;
218 218
219 if (rw && !bottom_only) { 219 if (rw && !bottom_only) {
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index fcd5399949e0..4dd08b4af170 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -138,6 +138,7 @@ static int info_idx = -1;
138/* console rotation */ 138/* console rotation */
139static int initial_rotation = -1; 139static int initial_rotation = -1;
140static int fbcon_has_sysfs; 140static int fbcon_has_sysfs;
141static int margin_color;
141 142
142static const struct consw fb_con; 143static const struct consw fb_con;
143 144
@@ -492,6 +493,15 @@ static int __init fb_console_setup(char *this_opt)
492 initial_rotation = 0; 493 initial_rotation = 0;
493 continue; 494 continue;
494 } 495 }
496
497 if (!strncmp(options, "margin:", 7)) {
498 options += 7;
499 if (*options)
500 margin_color = simple_strtoul(options, &options, 0);
501 if (margin_color > 7)
502 margin_color = 0;
503 continue;
504 }
495 } 505 }
496 return 1; 506 return 1;
497} 507}
@@ -1306,7 +1316,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only)
1306 struct fbcon_ops *ops = info->fbcon_par; 1316 struct fbcon_ops *ops = info->fbcon_par;
1307 1317
1308 if (!fbcon_is_inactive(vc, info)) 1318 if (!fbcon_is_inactive(vc, info))
1309 ops->clear_margins(vc, info, bottom_only); 1319 ops->clear_margins(vc, info, margin_color, bottom_only);
1310} 1320}
1311 1321
1312static void fbcon_cursor(struct vc_data *vc, int mode) 1322static void fbcon_cursor(struct vc_data *vc, int mode)
diff --git a/drivers/video/fbdev/core/fbcon.h b/drivers/video/fbdev/core/fbcon.h
index 60e25e173fdb..18f3ac144237 100644
--- a/drivers/video/fbdev/core/fbcon.h
+++ b/drivers/video/fbdev/core/fbcon.h
@@ -60,7 +60,7 @@ struct fbcon_ops {
60 const unsigned short *s, int count, int yy, int xx, 60 const unsigned short *s, int count, int yy, int xx,
61 int fg, int bg); 61 int fg, int bg);
62 void (*clear_margins)(struct vc_data *vc, struct fb_info *info, 62 void (*clear_margins)(struct vc_data *vc, struct fb_info *info,
63 int bottom_only); 63 int color, int bottom_only);
64 void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode, 64 void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,
65 int softback_lines, int fg, int bg); 65 int softback_lines, int fg, int bg);
66 int (*update_start)(struct fb_info *info); 66 int (*update_start)(struct fb_info *info);
diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
index 2eeefa97bd4a..37a8b0b22566 100644
--- a/drivers/video/fbdev/core/fbcon_ccw.c
+++ b/drivers/video/fbdev/core/fbcon_ccw.c
@@ -189,7 +189,7 @@ static void ccw_putcs(struct vc_data *vc, struct fb_info *info,
189} 189}
190 190
191static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, 191static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
192 int bottom_only) 192 int color, int bottom_only)
193{ 193{
194 unsigned int cw = vc->vc_font.width; 194 unsigned int cw = vc->vc_font.width;
195 unsigned int ch = vc->vc_font.height; 195 unsigned int ch = vc->vc_font.height;
@@ -198,7 +198,7 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info,
198 unsigned int bs = vc->vc_rows*ch; 198 unsigned int bs = vc->vc_rows*ch;
199 struct fb_fillrect region; 199 struct fb_fillrect region;
200 200
201 region.color = 0; 201 region.color = color;
202 region.rop = ROP_COPY; 202 region.rop = ROP_COPY;
203 203
204 if (rw && !bottom_only) { 204 if (rw && !bottom_only) {
diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
index c321f7c59e5c..1888f8c866e8 100644
--- a/drivers/video/fbdev/core/fbcon_cw.c
+++ b/drivers/video/fbdev/core/fbcon_cw.c
@@ -172,7 +172,7 @@ static void cw_putcs(struct vc_data *vc, struct fb_info *info,
172} 172}
173 173
174static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, 174static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
175 int bottom_only) 175 int color, int bottom_only)
176{ 176{
177 unsigned int cw = vc->vc_font.width; 177 unsigned int cw = vc->vc_font.width;
178 unsigned int ch = vc->vc_font.height; 178 unsigned int ch = vc->vc_font.height;
@@ -181,7 +181,7 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info,
181 unsigned int rs = info->var.yres - rw; 181 unsigned int rs = info->var.yres - rw;
182 struct fb_fillrect region; 182 struct fb_fillrect region;
183 183
184 region.color = 0; 184 region.color = color;
185 region.rop = ROP_COPY; 185 region.rop = ROP_COPY;
186 186
187 if (rw && !bottom_only) { 187 if (rw && !bottom_only) {
diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
index c0b605d49cb3..f98eee263597 100644
--- a/drivers/video/fbdev/core/fbcon_ud.c
+++ b/drivers/video/fbdev/core/fbcon_ud.c
@@ -220,7 +220,7 @@ static void ud_putcs(struct vc_data *vc, struct fb_info *info,
220} 220}
221 221
222static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, 222static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
223 int bottom_only) 223 int color, int bottom_only)
224{ 224{
225 unsigned int cw = vc->vc_font.width; 225 unsigned int cw = vc->vc_font.width;
226 unsigned int ch = vc->vc_font.height; 226 unsigned int ch = vc->vc_font.height;
@@ -228,7 +228,7 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info,
228 unsigned int bh = info->var.yres - (vc->vc_rows*ch); 228 unsigned int bh = info->var.yres - (vc->vc_rows*ch);
229 struct fb_fillrect region; 229 struct fb_fillrect region;
230 230
231 region.color = 0; 231 region.color = color;
232 region.rop = ROP_COPY; 232 region.rop = ROP_COPY;
233 233
234 if (rw && !bottom_only) { 234 if (rw && !bottom_only) {
diff --git a/drivers/video/fbdev/core/tileblit.c b/drivers/video/fbdev/core/tileblit.c
index 4636a6110c27..93390312957f 100644
--- a/drivers/video/fbdev/core/tileblit.c
+++ b/drivers/video/fbdev/core/tileblit.c
@@ -74,7 +74,7 @@ static void tile_putcs(struct vc_data *vc, struct fb_info *info,
74} 74}
75 75
76static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, 76static void tile_clear_margins(struct vc_data *vc, struct fb_info *info,
77 int bottom_only) 77 int color, int bottom_only)
78{ 78{
79 return; 79 return;
80} 80}