* [PATCH v2 0/2] Invert margin colors when terminal is inverted
@ 2017-07-31 19:09 David Lechner
2017-07-31 19:09 ` [PATCH v2 1/2] fbcon: " David Lechner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: David Lechner @ 2017-07-31 19:09 UTC (permalink / raw)
To: linux-fbdev; +Cc: David Lechner, Bartlomiej Zolnierkiewicz, linux-kernel
This is v2 of "fbcon: Use background color for margins​"[1].
It turns out that using the text background color was not a good choice. So,
I've started over.
In this series, the margin color depends on the terminal's inversion state. If
it is not inverted, then the margins are black as they currently are. But now,
if the terminal is inverted, the margin color is also inverted, so it is white.
In order to detect when the terminal is inverted, I had to add a notifier
callback for the VT_UPDATE event. Otherwise, running `setterm -inverse on`
would not change the margins until I also ran `clear`.
[1]: https://patchwork.kernel.org/patch/9869421/
David Lechner (2):
fbcon: Invert margin colors when terminal is inverted
fbcon: add VT notifier for VT_UPDATE event
drivers/video/console/bitblit.c | 2 +-
drivers/video/console/fbcon.c | 28 ++++++++++++++++++++++++++++
drivers/video/console/fbcon_ccw.c | 2 +-
drivers/video/console/fbcon_cw.c | 2 +-
drivers/video/console/fbcon_ud.c | 2 +-
5 files changed, 32 insertions(+), 4 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] fbcon: Invert margin colors when terminal is inverted
2017-07-31 19:09 [PATCH v2 0/2] Invert margin colors when terminal is inverted David Lechner
@ 2017-07-31 19:09 ` David Lechner
2017-07-31 19:09 ` [PATCH v2 2/2] fbcon: add VT notifier for VT_UPDATE event David Lechner
2017-07-31 19:30 ` [PATCH v2 0/2] Invert margin colors when terminal is inverted Alan Cox
2 siblings, 0 replies; 5+ messages in thread
From: David Lechner @ 2017-07-31 19:09 UTC (permalink / raw)
To: linux-fbdev; +Cc: David Lechner, Bartlomiej Zolnierkiewicz, linux-kernel
This uses white (7) for the margin color when a fbcon terminal is inverted,
e.g. with `setterm -inverse on`.
The motivation for this is screens where the black does not blend into 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, if the margins are not also inverted, it leaves ugly black bars
on the right and bottom of the text area.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/video/console/bitblit.c | 2 +-
drivers/video/console/fbcon_ccw.c | 2 +-
drivers/video/console/fbcon_cw.c | 2 +-
drivers/video/console/fbcon_ud.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c
index dbfe4ee..13cad9e 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/console/bitblit.c
@@ -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 = vc->vc_decscnm ? 7 : 0;
region.rop = ROP_COPY;
if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c
index 5a3cbf6..371f0155 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/console/fbcon_ccw.c
@@ -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 = vc->vc_decscnm ? 7 : 0;
region.rop = ROP_COPY;
if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c
index e7ee44d..541e66c 100644
--- a/drivers/video/console/fbcon_cw.c
+++ b/drivers/video/console/fbcon_cw.c
@@ -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 = vc->vc_decscnm ? 7 : 0;
region.rop = ROP_COPY;
if (rw && !bottom_only) {
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c
index 19e3714..61fe137 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/console/fbcon_ud.c
@@ -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 = vc->vc_decscnm ? 7 : 0;
region.rop = ROP_COPY;
if (rw && !bottom_only) {
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] fbcon: add VT notifier for VT_UPDATE event
2017-07-31 19:09 [PATCH v2 0/2] Invert margin colors when terminal is inverted David Lechner
2017-07-31 19:09 ` [PATCH v2 1/2] fbcon: " David Lechner
@ 2017-07-31 19:09 ` David Lechner
2017-07-31 19:30 ` [PATCH v2 0/2] Invert margin colors when terminal is inverted Alan Cox
2 siblings, 0 replies; 5+ messages in thread
From: David Lechner @ 2017-07-31 19:09 UTC (permalink / raw)
To: linux-fbdev; +Cc: David Lechner, Bartlomiej Zolnierkiewicz, linux-kernel
This adds notifier callback for VT events. We are currently interested
in the VT_UPDATE event, which indicates there was some major change to
the VT. This is used to redraw the margins. For example when the console
is inverted we receive the VT_UPDATE event. The color of the margins depend
on the inverted state, so it is necessary redraw the margins at this time.
Signed-off-by: David Lechner <david@lechnology.com>
---
drivers/video/console/fbcon.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 12ded23..8e7ac2f 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3329,6 +3329,28 @@ static int fbcon_event_notify(struct notifier_block *self,
return ret;
}
+static int vt_notifier_call(struct notifier_block *blk,
+ unsigned long code, void *_param)
+{
+ struct vt_notifier_param *param = _param;
+ struct vc_data *vc = param->vc;
+
+ switch (code) {
+ case VT_UPDATE:
+ /*
+ * This event could indicate that the terminal has been
+ * inverted (or there was some other major change), in which
+ * case we need to re-draw the margins.
+ */
+ if (con_is_visible(vc) && vc->vc_mode = KD_TEXT)
+ fbcon_clear_margins(vc, 0);
+ break;
+ default:
+ break;
+ }
+ return NOTIFY_OK;
+}
+
/*
* The console `switch' structure for the frame buffer based console
*/
@@ -3364,6 +3386,10 @@ static struct notifier_block fbcon_event_notifier = {
.notifier_call = fbcon_event_notify,
};
+static struct notifier_block vt_notifier_block = {
+ .notifier_call = vt_notifier_call,
+};
+
static ssize_t store_rotate(struct device *device,
struct device_attribute *attr, const char *buf,
size_t count)
@@ -3612,6 +3638,7 @@ static int __init fb_console_init(void)
console_lock();
fb_register_client(&fbcon_event_notifier);
+ register_vt_notifier(&vt_notifier_block);
fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
"fbcon");
@@ -3650,6 +3677,7 @@ static void __exit fbcon_deinit_device(void)
static void __exit fb_console_exit(void)
{
console_lock();
+ unregister_vt_notifier(&vt_notifier_block);
fb_unregister_client(&fbcon_event_notifier);
fbcon_deinit_device();
device_destroy(fb_class, MKDEV(0, 0));
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] Invert margin colors when terminal is inverted
2017-07-31 19:09 [PATCH v2 0/2] Invert margin colors when terminal is inverted David Lechner
2017-07-31 19:09 ` [PATCH v2 1/2] fbcon: " David Lechner
2017-07-31 19:09 ` [PATCH v2 2/2] fbcon: add VT notifier for VT_UPDATE event David Lechner
@ 2017-07-31 19:30 ` Alan Cox
2017-07-31 20:43 ` David Lechner
2 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2017-07-31 19:30 UTC (permalink / raw)
To: David Lechner; +Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel
On Mon, 31 Jul 2017 14:09:43 -0500
David Lechner <david@lechnology.com> wrote:
> This is v2 of "fbcon: Use background color for margins​"[1].
>
> It turns out that using the text background color was not a good choice. So,
> I've started over.
Can you explain why making the margins simply match the border colour
(when possible) isn't a better option ? They are after all simply
software extensions to the border.
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] Invert margin colors when terminal is inverted
2017-07-31 19:30 ` [PATCH v2 0/2] Invert margin colors when terminal is inverted Alan Cox
@ 2017-07-31 20:43 ` David Lechner
0 siblings, 0 replies; 5+ messages in thread
From: David Lechner @ 2017-07-31 20:43 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel
On 07/31/2017 02:30 PM, Alan Cox wrote:
> On Mon, 31 Jul 2017 14:09:43 -0500
> David Lechner <david@lechnology.com> wrote:
>
>> This is v2 of "fbcon: Use background color for margins​"[1].
>>
>> It turns out that using the text background color was not a good choice. So,
>> I've started over.
>
> Can you explain why making the margins simply match the border colour
> (when possible) isn't a better option ? They are after all simply
> software extensions to the border.
>
So, basically, you are proposing that it would be better to add a module
parameter to select the margin color? That does sound like a better
option to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-31 20:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-31 19:09 [PATCH v2 0/2] Invert margin colors when terminal is inverted David Lechner
2017-07-31 19:09 ` [PATCH v2 1/2] fbcon: " David Lechner
2017-07-31 19:09 ` [PATCH v2 2/2] fbcon: add VT notifier for VT_UPDATE event David Lechner
2017-07-31 19:30 ` [PATCH v2 0/2] Invert margin colors when terminal is inverted Alan Cox
2017-07-31 20:43 ` David Lechner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).