2009-11-05 09:18:09

by Daniel Mack

[permalink] [raw]
Subject: [PATCH] fbcon: make cursor display conditional

For embedded systems, the blinking cursor at startup time can be
annoying and unintended. Add a new kernel parameter
'fbcon_disable_cursor' which disables it conditionally. The default
behaviour is unchanged.

Signed-off-by: Daniel Mack <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Andrea Righi <[email protected]>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/video/console/fbcon.c | 11 ++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 9107b38..80ac54e 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -743,6 +743,9 @@ and is between 256 and 4096 characters. It is defined in the file
Format: <interval>,<probability>,<space>,<times>
See also /Documentation/fault-injection/.

+ fbcon_disable_cursor
+ Disable the cursor in the framebuffer console
+
fd_mcs= [HW,SCSI]
See header of drivers/scsi/fd_mcs.c.

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 5a686ce..039aa86 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -116,6 +116,14 @@ static int fbcon_has_exited;
static int primary_device = -1;
static int fbcon_has_console_bind;

+static int fbcon_disable_cursor;
+static int __init _fbcon_disable_cursor(char *str)
+{
+ fbcon_disable_cursor = 1;
+ return 1;
+}
+__setup("fbcon_disable_cursor", _fbcon_disable_cursor);
+
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
static int map_override;

@@ -1288,7 +1296,8 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
int y;
int c = scr_readw((u16 *) vc->vc_pos);

- if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
+ if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1 ||
+ fbcon_disable_cursor)
return;

if (vc->vc_cursor_type & 0x10)
--
1.6.5


2009-11-06 08:16:43

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] fbcon: make cursor display conditional

Daniel Mack wrote:
> For embedded systems, the blinking cursor at startup time can be
> annoying and unintended. Add a new kernel parameter
> 'fbcon_disable_cursor' which disables it conditionally.

Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
end of <linux/console_struct.h>) into a kernel parameter, instead of
adding a new flag?


Best regards,
Clemens

2009-11-06 14:39:18

by Andrea Righi

[permalink] [raw]
Subject: Re: [PATCH] fbcon: make cursor display conditional

On Fri, Nov 06, 2009 at 09:16:44AM +0100, Clemens Ladisch wrote:
> Daniel Mack wrote:
> > For embedded systems, the blinking cursor at startup time can be
> > annoying and unintended. Add a new kernel parameter
> > 'fbcon_disable_cursor' which disables it conditionally.
>
> Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
> end of <linux/console_struct.h>) into a kernel parameter, instead of
> adding a new flag?

Agreed. There's no need to choose if we want the blinking cursor or not
at each boot. Better to make this decision at compile time.

-Andrea

2009-11-06 16:45:36

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] fbcon: make cursor display conditional

On Fri, Nov 06, 2009 at 03:39:18PM +0100, Andrea Righi wrote:
> On Fri, Nov 06, 2009 at 09:16:44AM +0100, Clemens Ladisch wrote:
> > Daniel Mack wrote:
> > > For embedded systems, the blinking cursor at startup time can be
> > > annoying and unintended. Add a new kernel parameter
> > > 'fbcon_disable_cursor' which disables it conditionally.
> >
> > Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
> > end of <linux/console_struct.h>) into a kernel parameter, instead of
> > adding a new flag?
>
> Agreed. There's no need to choose if we want the blinking cursor or not
> at each boot. Better to make this decision at compile time.

Ok, much better idea, I agree. See the patch below.

Thanks for the input,
Daniel


>From 8192226c1cdda90ef0d73a55c02f632693065310 Mon Sep 17 00:00:00 2001
From: Daniel Mack <[email protected]>
Date: Fri, 6 Nov 2009 17:31:00 +0100
Subject: [PATCH] char/console: make default cursor type configurable

Make the default console cursor type configurable rather than
hard-coding it.

Signed-off-by: Daniel Mack <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
---
drivers/char/Kconfig | 27 +++++++++++++++++++++++++++
drivers/char/vt.c | 23 +++++++++++++++++++++++
include/linux/console_struct.h | 2 --
3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 6aad99e..1e01ea4 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -88,6 +88,33 @@ config VT_HW_CONSOLE_BINDING
information. For framebuffer console users, please refer to
<file:Documentation/fb/fbcon.txt>.

+choice
+ prompt "Console default cursor type"
+ depends on HW_CONSOLE
+ default CONSOLE_DEF_CUR_UNDERLINE
+ help
+ This option selects the default cursor type for the text console.
+
+config CONSOLE_DEF_CUR_NONE
+ bool "none"
+
+config CONSOLE_DEF_CUR_UNDERLINE
+ bool "underline"
+
+config CONSOLE_DEF_CUR_LOWER_THIRD
+ bool "lower third"
+
+config CONSOLE_DEF_CUR_LOWER_HALF
+ bool "lower half"
+
+config CONSOLE_DEF_CUR_TWO_THIRDS
+ bool "two thirds"
+
+config CONSOLE_DEF_CUR_BLOCK
+ bool "block"
+
+endchoice
+
config DEVKMEM
bool "/dev/kmem virtual device support"
default y
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0c80c68..0078f6e 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -111,6 +111,29 @@
#define CON_DRIVER_FLAG_INIT 2
#define CON_DRIVER_FLAG_ATTR 4

+#if defined(CONFIG_CONSOLE_DEF_CUR_NONE)
+#define CUR_DEFAULT CUR_NONE
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_UNDERLINE)
+#define CUR_DEFAULT CUR_UNDERLINE
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_LOWER_THIRD)
+#define CUR_DEFAULT CUR_LOWER_THIRD
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_LOWER_HALF)
+#define CUR_DEFAULT CUR_LOWER_HALF
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_TWO_THIRDS)
+#define CUR_DEFAULT CUR_TWO_THIRDS
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_BLOCK)
+#define CUR_DEFAULT CUR_BLOCK
+
+#else
+#warning "no default console cursor type defined, defaulting to 'underline'"
+#define CUR_DEFAULT CUR_UNDERLINE
+#endif
+
struct con_driver {
const struct consw *con;
const char *desc;
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59d..6c024a0 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *work);
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0

-#define CUR_DEFAULT CUR_UNDERLINE
-
#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)

#endif /* _LINUX_CONSOLE_STRUCT_H */
--
1.6.5.2

2009-11-09 08:35:06

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] fbcon: make cursor display conditional

Daniel Mack wrote:
> > On Fri, Nov 06, 2009 at 09:16:44AM +0100, Clemens Ladisch wrote:
> > > Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
> > > end of <linux/console_struct.h>) into a kernel parameter, instead of
> > > adding a new flag?
>
> Ok, much better idea, I agree. See the patch below.
>
> Subject: [PATCH] char/console: make default cursor type configurable
>
> --- a/drivers/char/vt.c
> +++ b/drivers/char/vt.c
> +#if defined(CONFIG_CONSOLE_DEF_CUR_NONE)
> +#define CUR_DEFAULT CUR_NONE
> +
> +#elif defined(CONFIG_CONSOLE_DEF_CUR_UNDERLINE)
> +#define CUR_DEFAULT CUR_UNDERLINE
> +...

With a separate Kconfig variable, we can avoid having to put the
parallel list into vt.c.

Furthermore, we can add options for the software cursor while we're
at it; something like this:

Signed-off-by: Clemens Ladisch <[email protected]>

--- linux-2.6/include/linux/console_struct.h
+++ linux-2.6/include/linux/console_struct.h
@@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *w
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0

-#define CUR_DEFAULT CUR_UNDERLINE
-
#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)

#endif /* _LINUX_CONSOLE_STRUCT_H */
--- linux-2.6/drivers/char/vt.c
+++ linux-2.6/drivers/char/vt.c
@@ -138,6 +138,11 @@ const struct consw *conswitchp;
#define DEFAULT_BELL_PITCH 750
#define DEFAULT_BELL_DURATION (HZ/8)

+#define CUR_DEFAULT (CONFIG_CUR_DEFAULT_HW | \
+ CONFIG_CUR_DEFAULT_SW_FLAGS | \
+ (CONFIG_CUR_DEFAULT_SW_ATTR_XOR << 8) | \
+ (CONFIG_CUR_DEFAULT_SW_ATTR_SET << 16))
+
struct vc vc_cons [MAX_NR_CONSOLES];

#ifndef VT_SINGLE_DRIVER
--- linux-2.6/drivers/char/Kconfig
+++ linux-2.6/drivers/char/Kconfig
@@ -88,6 +88,104 @@ config VT_HW_CONSOLE_BINDING
information. For framebuffer console users, please refer to
<file:Documentation/fb/fbcon.txt>.

+choice
+ prompt "Default hardware cursor shape"
+ depends on HW_CONSOLE
+ default CUR_DEFAULT_UNDERLINE
+ help
+ Select the default shape of the blinking hardware cursor.
+
+ config CUR_DEFAULT_DEF
+ bool "Default"
+ config CUR_DEFAULT_NONE
+ bool "None"
+ config CUR_DEFAULT_UNDERLINE
+ bool "Underline"
+ config CUR_DEFAULT_LOWER_THIRD
+ bool "Lower third"
+ config CUR_DEFAULT_LOWER_HALF
+ bool "Lower half"
+ config CUR_DEFAULT_TWO_THIRDS
+ bool "Two thirds"
+ config CUR_DEFAULT_BLOCK
+ bool "Block"
+endchoice
+
+config CUR_DEFAULT_HW
+ depends on HW_CONSOLE
+ int
+ default 0 if CUR_DEFAULT_DEF
+ default 1 if CUR_DEFAULT_NONE
+ default 2 if CUR_DEFAULT_UNDERLINE
+ default 3 if CUR_DEFAULT_LOWER_THIRD
+ default 4 if CUR_DEFAULT_LOWER_HALF
+ default 5 if CUR_DEFAULT_TWO_THIRDS
+ default 6 if CUR_DEFAULT_BLOCK
+
+config CUR_DEFAULT_SW
+ bool "Use software cursor by default"
+ depends on HW_CONSOLE
+ default n
+ help
+ The software cursor allows you to customize the appearance of the
+ cursor; this is done by changing the attributes (the color) of the
+ character under the cursor.
+
+ See <file:Documentation/VGA-softcursor.txt> for more information.
+
+config CUR_DEFAULT_SW_ATTR_XOR
+ depends on HW_CONSOLE
+ prompt "Software cursor changed attribute bits" if CUR_DEFAULT_SW
+ int
+ range 0 255
+ default 0
+ help
+ Enter the character attribute bits that are changed by the
+ software cursor. This is equivalent to the second parameter
+ of the <ESC>[?1;2;3c escape sequence; for more information,
+ see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_ATTR_SET
+ depends on HW_CONSOLE
+ prompt "Software cursor set attribute bits" if CUR_DEFAULT_SW
+ int
+ range 0 255
+ default 0
+ help
+ Enter the character attribute bits that are set by the
+ software cursor. This is equivalent to the third parameter
+ of the <ESC>[?1;2;3c escape sequence; for more information,
+ see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_CHANGE_BKGND
+ bool "Software cursor always changes background"
+ depends on CUR_DEFAULT_SW
+ default y
+ help
+ If you say Y here, the software cursor will ensure that the
+ background color of the character under the cursor is changed,
+ even if the cursor color is the same as the original character's
+ color.
+
+config CUR_DEFAULT_SW_BKGND_DIFFERENT
+ bool "Software cursor makes foreground color different from background"
+ depends on CUR_DEFAULT_SW
+ default y
+ help
+ If you say Y here, the software cursor will ensure that the
+ foreground color of the character under the cursor is different
+ from the background color.
+
+config CUR_DEFAULT_SW_FLAGS
+ depends on HW_CONSOLE
+ int
+ default 0 if !CUR_DEFAULT_SW
+ # 16 + (32 if CHANGE_BKGND) + (64 if BKGND_DIFFERENT):
+ default 16 if !CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 48 if CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 80 if !CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 112 if CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+
config DEVKMEM
bool "/dev/kmem virtual device support"
default y

2009-11-09 09:10:51

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] fbcon: make cursor display conditional

On Mon, Nov 09, 2009 at 09:35:05AM +0100, Clemens Ladisch wrote:
> Daniel Mack wrote:
> > > On Fri, Nov 06, 2009 at 09:16:44AM +0100, Clemens Ladisch wrote:
> > > > Wouldn't it be more useful to change the CUR_DEFAULT symbol (see the
> > > > end of <linux/console_struct.h>) into a kernel parameter, instead of
> > > > adding a new flag?
> >
> > Ok, much better idea, I agree. See the patch below.
> >
> > Subject: [PATCH] char/console: make default cursor type configurable
> >
> > --- a/drivers/char/vt.c
> > +++ b/drivers/char/vt.c
> > +#if defined(CONFIG_CONSOLE_DEF_CUR_NONE)
> > +#define CUR_DEFAULT CUR_NONE
> > +
> > +#elif defined(CONFIG_CONSOLE_DEF_CUR_UNDERLINE)
> > +#define CUR_DEFAULT CUR_UNDERLINE
> > +...
>
> With a separate Kconfig variable, we can avoid having to put the
> parallel list into vt.c.
>
> Furthermore, we can add options for the software cursor while we're
> at it; something like this:
>
> Signed-off-by: Clemens Ladisch <[email protected]>

Wonderful, thank you. For my bits, you can add my Signed-off-by if
that's appropriate.

Daniel

> --- linux-2.6/include/linux/console_struct.h
> +++ linux-2.6/include/linux/console_struct.h
> @@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *w
> #define CUR_HWMASK 0x0f
> #define CUR_SWMASK 0xfff0
>
> -#define CUR_DEFAULT CUR_UNDERLINE
> -
> #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
>
> #endif /* _LINUX_CONSOLE_STRUCT_H */
> --- linux-2.6/drivers/char/vt.c
> +++ linux-2.6/drivers/char/vt.c
> @@ -138,6 +138,11 @@ const struct consw *conswitchp;
> #define DEFAULT_BELL_PITCH 750
> #define DEFAULT_BELL_DURATION (HZ/8)
>
> +#define CUR_DEFAULT (CONFIG_CUR_DEFAULT_HW | \
> + CONFIG_CUR_DEFAULT_SW_FLAGS | \
> + (CONFIG_CUR_DEFAULT_SW_ATTR_XOR << 8) | \
> + (CONFIG_CUR_DEFAULT_SW_ATTR_SET << 16))
> +
> struct vc vc_cons [MAX_NR_CONSOLES];
>
> #ifndef VT_SINGLE_DRIVER
> --- linux-2.6/drivers/char/Kconfig
> +++ linux-2.6/drivers/char/Kconfig
> @@ -88,6 +88,104 @@ config VT_HW_CONSOLE_BINDING
> information. For framebuffer console users, please refer to
> <file:Documentation/fb/fbcon.txt>.
>
> +choice
> + prompt "Default hardware cursor shape"
> + depends on HW_CONSOLE
> + default CUR_DEFAULT_UNDERLINE
> + help
> + Select the default shape of the blinking hardware cursor.
> +
> + config CUR_DEFAULT_DEF
> + bool "Default"
> + config CUR_DEFAULT_NONE
> + bool "None"
> + config CUR_DEFAULT_UNDERLINE
> + bool "Underline"
> + config CUR_DEFAULT_LOWER_THIRD
> + bool "Lower third"
> + config CUR_DEFAULT_LOWER_HALF
> + bool "Lower half"
> + config CUR_DEFAULT_TWO_THIRDS
> + bool "Two thirds"
> + config CUR_DEFAULT_BLOCK
> + bool "Block"
> +endchoice
> +
> +config CUR_DEFAULT_HW
> + depends on HW_CONSOLE
> + int
> + default 0 if CUR_DEFAULT_DEF
> + default 1 if CUR_DEFAULT_NONE
> + default 2 if CUR_DEFAULT_UNDERLINE
> + default 3 if CUR_DEFAULT_LOWER_THIRD
> + default 4 if CUR_DEFAULT_LOWER_HALF
> + default 5 if CUR_DEFAULT_TWO_THIRDS
> + default 6 if CUR_DEFAULT_BLOCK
> +
> +config CUR_DEFAULT_SW
> + bool "Use software cursor by default"
> + depends on HW_CONSOLE
> + default n
> + help
> + The software cursor allows you to customize the appearance of the
> + cursor; this is done by changing the attributes (the color) of the
> + character under the cursor.
> +
> + See <file:Documentation/VGA-softcursor.txt> for more information.
> +
> +config CUR_DEFAULT_SW_ATTR_XOR
> + depends on HW_CONSOLE
> + prompt "Software cursor changed attribute bits" if CUR_DEFAULT_SW
> + int
> + range 0 255
> + default 0
> + help
> + Enter the character attribute bits that are changed by the
> + software cursor. This is equivalent to the second parameter
> + of the <ESC>[?1;2;3c escape sequence; for more information,
> + see <file:Documentation/VGA-softcursor.txt>.
> +
> +config CUR_DEFAULT_SW_ATTR_SET
> + depends on HW_CONSOLE
> + prompt "Software cursor set attribute bits" if CUR_DEFAULT_SW
> + int
> + range 0 255
> + default 0
> + help
> + Enter the character attribute bits that are set by the
> + software cursor. This is equivalent to the third parameter
> + of the <ESC>[?1;2;3c escape sequence; for more information,
> + see <file:Documentation/VGA-softcursor.txt>.
> +
> +config CUR_DEFAULT_SW_CHANGE_BKGND
> + bool "Software cursor always changes background"
> + depends on CUR_DEFAULT_SW
> + default y
> + help
> + If you say Y here, the software cursor will ensure that the
> + background color of the character under the cursor is changed,
> + even if the cursor color is the same as the original character's
> + color.
> +
> +config CUR_DEFAULT_SW_BKGND_DIFFERENT
> + bool "Software cursor makes foreground color different from background"
> + depends on CUR_DEFAULT_SW
> + default y
> + help
> + If you say Y here, the software cursor will ensure that the
> + foreground color of the character under the cursor is different
> + from the background color.
> +
> +config CUR_DEFAULT_SW_FLAGS
> + depends on HW_CONSOLE
> + int
> + default 0 if !CUR_DEFAULT_SW
> + # 16 + (32 if CHANGE_BKGND) + (64 if BKGND_DIFFERENT):
> + default 16 if !CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
> + default 48 if CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
> + default 80 if !CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
> + default 112 if CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
> +
> config DEVKMEM
> bool "/dev/kmem virtual device support"
> default y

2009-11-09 09:15:42

by Clemens Ladisch

[permalink] [raw]
Subject: [PATCH] vt: make the default cursor shape configurable

Make the default console cursor type configurable rather than
hard-coding it.

Signed-off-by: Daniel Mack <[email protected]>
Signed-off-by: Clemens Ladisch <[email protected]>

--- linux-2.6/include/linux/console_struct.h
+++ linux-2.6/include/linux/console_struct.h
@@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *w
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0

-#define CUR_DEFAULT CUR_UNDERLINE
-
#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)

#endif /* _LINUX_CONSOLE_STRUCT_H */
--- linux-2.6/drivers/char/vt.c
+++ linux-2.6/drivers/char/vt.c
@@ -138,6 +138,11 @@ const struct consw *conswitchp;
#define DEFAULT_BELL_PITCH 750
#define DEFAULT_BELL_DURATION (HZ/8)

+#define CUR_DEFAULT (CONFIG_CUR_DEFAULT_HW | \
+ CONFIG_CUR_DEFAULT_SW_FLAGS | \
+ (CONFIG_CUR_DEFAULT_SW_ATTR_XOR << 8) | \
+ (CONFIG_CUR_DEFAULT_SW_ATTR_SET << 16))
+
struct vc vc_cons [MAX_NR_CONSOLES];

#ifndef VT_SINGLE_DRIVER
--- linux-2.6/drivers/char/Kconfig
+++ linux-2.6/drivers/char/Kconfig
@@ -88,6 +88,104 @@ config VT_HW_CONSOLE_BINDING
information. For framebuffer console users, please refer to
<file:Documentation/fb/fbcon.txt>.

+choice
+ prompt "Default hardware cursor shape"
+ depends on HW_CONSOLE
+ default CUR_DEFAULT_UNDERLINE
+ help
+ Select the default shape of the blinking hardware cursor.
+
+ config CUR_DEFAULT_DEF
+ bool "Default"
+ config CUR_DEFAULT_NONE
+ bool "None"
+ config CUR_DEFAULT_UNDERLINE
+ bool "Underline"
+ config CUR_DEFAULT_LOWER_THIRD
+ bool "Lower third"
+ config CUR_DEFAULT_LOWER_HALF
+ bool "Lower half"
+ config CUR_DEFAULT_TWO_THIRDS
+ bool "Two thirds"
+ config CUR_DEFAULT_BLOCK
+ bool "Block"
+endchoice
+
+config CUR_DEFAULT_HW
+ depends on HW_CONSOLE
+ int
+ default 0 if CUR_DEFAULT_DEF
+ default 1 if CUR_DEFAULT_NONE
+ default 2 if CUR_DEFAULT_UNDERLINE
+ default 3 if CUR_DEFAULT_LOWER_THIRD
+ default 4 if CUR_DEFAULT_LOWER_HALF
+ default 5 if CUR_DEFAULT_TWO_THIRDS
+ default 6 if CUR_DEFAULT_BLOCK
+
+config CUR_DEFAULT_SW
+ bool "Use software cursor by default"
+ depends on HW_CONSOLE
+ default n
+ help
+ The software cursor allows you to customize the appearance of the
+ cursor; this is done by changing the attributes (the color) of the
+ character under the cursor.
+
+ See <file:Documentation/VGA-softcursor.txt> for more information.
+
+config CUR_DEFAULT_SW_ATTR_XOR
+ depends on HW_CONSOLE
+ prompt "Software cursor changed attribute bits" if CUR_DEFAULT_SW
+ int
+ range 0 255
+ default 0
+ help
+ Enter the character attribute bits that are changed by the
+ software cursor. This is equivalent to the second parameter
+ of the <ESC>[?1;2;3c escape sequence; for more information,
+ see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_ATTR_SET
+ depends on HW_CONSOLE
+ prompt "Software cursor set attribute bits" if CUR_DEFAULT_SW
+ int
+ range 0 255
+ default 0
+ help
+ Enter the character attribute bits that are set by the
+ software cursor. This is equivalent to the third parameter
+ of the <ESC>[?1;2;3c escape sequence; for more information,
+ see <file:Documentation/VGA-softcursor.txt>.
+
+config CUR_DEFAULT_SW_CHANGE_BKGND
+ bool "Software cursor always changes background"
+ depends on CUR_DEFAULT_SW
+ default y
+ help
+ If you say Y here, the software cursor will ensure that the
+ background color of the character under the cursor is changed,
+ even if the cursor color is the same as the original character's
+ color.
+
+config CUR_DEFAULT_SW_BKGND_DIFFERENT
+ bool "Software cursor makes foreground color different from background"
+ depends on CUR_DEFAULT_SW
+ default y
+ help
+ If you say Y here, the software cursor will ensure that the
+ foreground color of the character under the cursor is different
+ from the background color.
+
+config CUR_DEFAULT_SW_FLAGS
+ depends on HW_CONSOLE
+ int
+ default 0 if !CUR_DEFAULT_SW
+ # 16 + (32 if CHANGE_BKGND) + (64 if BKGND_DIFFERENT):
+ default 16 if !CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 48 if CUR_DEFAULT_SW_CHANGE_BKGND && !CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 80 if !CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+ default 112 if CUR_DEFAULT_SW_CHANGE_BKGND && CUR_DEFAULT_SW_BKGND_DIFFERENT
+
config DEVKMEM
bool "/dev/kmem virtual device support"
default y

2009-11-09 09:52:34

by Alan

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Mon, 09 Nov 2009 10:15:45 +0100
Clemens Ladisch <[email protected]> wrote:

> Make the default console cursor type configurable rather than
> hard-coding it.

You can set the cursor type at runtime so this all seems unjustified and
doing this kind of thing at build time is definitely the wrong place.

Alan

2009-11-09 11:26:31

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Alan Cox wrote:
> Clemens Ladisch <[email protected]> wrote:
> > Make the default console cursor type configurable rather than
> > hard-coding it.
>
> You can set the cursor type at runtime so this all seems unjustified and
> doing this kind of thing at build time is definitely the wrong place.

The justification from Daniel's original patch was:
| For embedded systems, the blinking cursor at startup time can be
| annoying and unintended.

Would a simple "Disable cursor by default" switch more acceptable?


Clemens

2009-11-09 11:45:33

by Alan

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

> The justification from Daniel's original patch was:
> | For embedded systems, the blinking cursor at startup time can be
> | annoying and unintended.
>
> Would a simple "Disable cursor by default" switch more acceptable?

Well I guess you could just make the default cursor define a variable and
mark it MODULE_PARAM ?

Alan

2009-11-09 12:21:29

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Alan Cox wrote:
> > The justification from Daniel's original patch was:
> > | For embedded systems, the blinking cursor at startup time can be
> > | annoying and unintended.
> >
> > Would a simple "Disable cursor by default" switch more acceptable?
>
> Well I guess you could just make the default cursor define a variable and
> mark it MODULE_PARAM ?

The original thread started here: <http://lkml.org/lkml/2009/11/5/71>.
To quote Andrea:
| There's no need to choose if we want the blinking cursor or not
| at each boot.


Clemens

2009-11-09 14:50:59

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Mon, Nov 09, 2009 at 11:46:00AM +0000, Alan Cox wrote:
> > The justification from Daniel's original patch was:
> > | For embedded systems, the blinking cursor at startup time can be
> > | annoying and unintended.
> >
> > Would a simple "Disable cursor by default" switch more acceptable?
>
> Well I guess you could just make the default cursor define a variable and
> mark it MODULE_PARAM ?

I had that previously and the response was that there is no reason to
define that setting per-boot process, as it is rather unlikely that you
want to change it from one boot to the next. Hence, it should be set at
compile time.

And even if the cursor behaviour is changable at runtime, I don't see
why it shouldn't have a selectable compile time default. Which is what
the patch adds.

Daniel

2009-11-09 17:57:55

by David Newall

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Daniel Mack wrote:
> I had that previously and the response was that there is no reason to
> define that setting per-boot process, as it is rather unlikely that you
> want to change it from one boot to the next. Hence, it should be set at
> compile time.
>

It should be set as a boot parameter, since this is fixed at system
installation and then left untouched.


> And even if the cursor behaviour is changable at runtime, I don't see
> why it shouldn't have a selectable compile time default. Which is what
> the patch adds.


It seems like adding cruft to the kernel that is just as effectively
available at run-time. Where does it end? Do we eventually add bash to
the kernel?

2009-11-09 18:07:18

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
> Daniel Mack wrote:
> > I had that previously and the response was that there is no reason to
> > define that setting per-boot process, as it is rather unlikely that you
> > want to change it from one boot to the next. Hence, it should be set at
> > compile time.
> >
>
> It should be set as a boot parameter, since this is fixed at system
> installation and then left untouched.

I'd be fine with either way. As long as it disables the blinking cursor.

> It seems like adding cruft to the kernel that is just as effectively
> available at run-time. Where does it end? Do we eventually add bash to
> the kernel?

Well, all I need is a way to disable the cursor at boot time, as we
don't want it to be in our boot screen on a embedded system. It is not
only ruin the aesthetics but also gives the wrong assumption that the
system awaits input. There is no userspace at this point, so that's no
option.

My first approach was adding a __setup variable to select that, but it
wasn't beloved by the people get_maintainer.pl spit out. So I made it
compile-time definable, and Clemens extended that to a more powerful
interface of settings.

I don't really have a strong opinion on which way to go, all I need is a
cursor-free system startup :) And I would of course prefer that patch to
be in mainline.

Daniel

2009-11-09 22:09:43

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
> Daniel Mack wrote:
> > And even if the cursor behaviour is changable at runtime, I don't see
> > why it shouldn't have a selectable compile time default. Which is what
> > the patch adds.
>
>
> It seems like adding cruft to the kernel that is just as effectively
> available at run-time. Where does it end? Do we eventually add bash to
> the kernel?

One more thing:

Clemens' last patch didn't add anything to the kernel's binary size.
It didn't slow down anything either, as there is no run-time condition
evaluation. It just makes something configurable which was hard
coded before. So where's the cruft?

The comparison to 'bash in the kernel' is really inappropriate.

Daniel

2009-11-10 12:05:07

by David Newall

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Daniel Mack wrote:
> On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
>
>> Daniel Mack wrote:
>>
>>> And even if the cursor behaviour is changable at runtime, I don't see
>>> why it shouldn't have a selectable compile time default. Which is what
>>> the patch adds.
>>>
>> It seems like adding cruft to the kernel that is just as effectively
>> available at run-time. Where does it end? Do we eventually add bash to
>> the kernel?
>>
>
> One more thing:
>
> Clemens' last patch didn't add anything to the kernel's binary size.
> It didn't slow down anything either, as there is no run-time condition
> evaluation. It just makes something configurable which was hard
> coded before. So where's the cruft?
>

In this case the cruft is yet more kernel configuration choices to
confuse and bewilder. The problems caused by cruft are more from its
accretion than from any single part of it. Being able to argue that a
crufty feature causes no change to speed or size misses that point.

Everything should be in the kernel, except those things that don't need
to be (with apologies to Enstein).

I'm having trouble seeing a flashing cursor during device startup as a
problem. I expect it will prove a useful diagnostic, one day. I think
you can turn it off (from user space) within a couple of seconds of
power on; you did say embedded, didn't you? Perhaps you even can
configure your hardware to not display the cursor on startup, which is
the second likeliest (after user-space) place to satisfy your needs.

2009-11-10 12:30:12

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Tue, Nov 10, 2009 at 10:35:12PM +1030, David Newall wrote:
> I'm having trouble seeing a flashing cursor during device startup as a
> problem. I expect it will prove a useful diagnostic, one day. I think
> you can turn it off (from user space) within a couple of seconds of
> power on; you did say embedded, didn't you? Perhaps you even can
> configure your hardware to not display the cursor on startup, which is
> the second likeliest (after user-space) place to satisfy your needs.

I'm talking about an embedded device with no keyboard connected but
only a touch screen. In this case, the cursor is clearly misleading, as
there is no input device to use it. And for such a case (and I'm sure
I'm not the only one having it), a way to switch the cursor off is much
appreciated. I don't believe that's so hard to understand, really.

"A couple of seconds" is still too much. We don't want to give the
impression of a terminal at all. The whole application starting
afterwards has no cursor either.

Daniel

2009-11-10 12:36:50

by David Newall

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Daniel Mack wrote:
> "A couple of seconds" is still too much. We don't want to give the
> impression of a terminal at all. The whole application starting
> afterwards has no cursor either.

Or even half a second. Devices regularly flash and squiggle on startup,
often as a diagnostic. Did you look at initialising your display
controller in graphics mode, or with the cursor off?

2009-11-10 12:39:16

by Daniel Mack

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Tue, Nov 10, 2009 at 11:06:58PM +1030, David Newall wrote:
> Daniel Mack wrote:
> > "A couple of seconds" is still too much. We don't want to give the
> > impression of a terminal at all. The whole application starting
> > afterwards has no cursor either.
>
> Or even half a second. Devices regularly flash and squiggle on startup,
> often as a diagnostic. Did you look at initialising your display
> controller in graphics mode, or with the cursor off?

It's a dumb framebuffer device, fbcon handles the rest. From the moment
when the framebuffer is initalized until the userspace comes up, it
takes ~5 secs, and at this time, we don't want to see the cursor.

2009-11-10 21:09:46

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Mon 2009-11-09 23:09:44, Daniel Mack wrote:
> On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
> > Daniel Mack wrote:
> > > And even if the cursor behaviour is changable at runtime, I don't see
> > > why it shouldn't have a selectable compile time default. Which is what
> > > the patch adds.
> >
> >
> > It seems like adding cruft to the kernel that is just as effectively
> > available at run-time. Where does it end? Do we eventually add bash to
> > the kernel?
>
> One more thing:
>
> Clemens' last patch didn't add anything to the kernel's binary size.
> It didn't slow down anything either, as there is no run-time condition
> evaluation. It just makes something configurable which was hard
> coded before. So where's the cruft?

The number of configs to test just got bigger. 100% bigger in
fact. Every single developer will have to answer 'do you want blinking
cursor?' when your patch is merged.

config options _are_ expensive.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2009-11-10 23:26:46

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Tue, 10 Nov 2009 22:09:41 +0100
Pavel Machek <[email protected]> wrote:

> On Mon 2009-11-09 23:09:44, Daniel Mack wrote:
> > On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
> > > Daniel Mack wrote:
> > > > And even if the cursor behaviour is changable at runtime, I don't see
> > > > why it shouldn't have a selectable compile time default. Which is what
> > > > the patch adds.
> > >
> > >
> > > It seems like adding cruft to the kernel that is just as effectively
> > > available at run-time. Where does it end? Do we eventually add bash to
> > > the kernel?
> >
> > One more thing:
> >
> > Clemens' last patch didn't add anything to the kernel's binary size.
> > It didn't slow down anything either, as there is no run-time condition
> > evaluation. It just makes something configurable which was hard
> > coded before. So where's the cruft?
>
> The number of configs to test just got bigger. 100% bigger in
> fact. Every single developer will have to answer 'do you want blinking
> cursor?' when your patch is merged.
>
> config options _are_ expensive.
>

Plus it's nice not to have to rebuild and reinstall the kernel to flip
a single bit...

The module_param() approach seems OK to me.


The initial patch was busted, IMO:

> @@ -1288,7 +1296,8 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
> int y;
> int c = scr_readw((u16 *) vc->vc_pos);
>
> - if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
> + if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1 ||
> + fbcon_disable_cursor)
> return;

this will disable the cursor forever, afacit. So if you boot with the
fbcon_disable_cursor option, you cannot later enable the cursor.

2009-11-11 06:57:05

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Andrew Morton wrote:
> Pavel Machek <[email protected]> wrote:
> > On Mon 2009-11-09 23:09:44, Daniel Mack wrote:
> > > On Tue, Nov 10, 2009 at 04:28:03AM +1030, David Newall wrote:
> > > > Daniel Mack wrote:
> > > > > And even if the cursor behaviour is changable at runtime, I don't see
> > > > > why it shouldn't have a selectable compile time default. Which is what
> > > > > the patch adds.
> > > >
> > > > It seems like adding cruft to the kernel that is just as effectively
> > > > available at run-time. Where does it end? Do we eventually add bash to
> > > > the kernel?
> > >
> > > One more thing:
> > >
> > > Clemens' last patch didn't add anything to the kernel's binary size.
> > > It didn't slow down anything either, as there is no run-time condition
> > > evaluation. It just makes something configurable which was hard
> > > coded before. So where's the cruft?
> >
> > The number of configs to test just got bigger. 100% bigger in
> > fact. Every single developer will have to answer 'do you want blinking
> > cursor?' when your patch is merged.
> >
> > config options _are_ expensive.
>
> Plus it's nice not to have to rebuild and reinstall the kernel to flip
> a single bit...
>
> The module_param() approach seems OK to me.

[PATCH] vt: make the default cursor shape configurable

Make the default console cursor type configurable rather than
hard-coding it.

Signed-off-by: Clemens Ladisch <[email protected]>

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 9107b38..750a42f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2704,6 +2704,11 @@ and is between 256 and 4096 characters. It is defined in the file
vmpoff= [KNL,S390] Perform z/VM CP command after power off.
Format: <command>

+ vt.cur_default= [VT] Default cursor shape.
+ Format: 0xCCBBAA, where AA, BB, and CC are the same as
+ the parameters of the <Esc>[?A;B;Cc escape sequence;
+ see VGA-softcursor.txt. Default: 2 = underline.
+
vt.default_blu= [VT]
Format: <blue0>,<blue1>,<blue2>,...,<blue15>
Change the default blue palette of the console.
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0c80c68..21dd136 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -162,6 +162,9 @@ static int printable; /* Is console ready for printing? */
int default_utf8 = true;
module_param(default_utf8, int, S_IRUGO | S_IWUSR);

+static int cur_default = CUR_DEFAULT;
+module_param(cur_default, int, S_IRUGO | S_IWUSR);
+
/*
* ignore_poke: don't unblank the screen when things are typed. This is
* mainly for the privacy of braille terminal users.
@@ -1630,7 +1633,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
/* do not do set_leds here because this causes an endless tasklet loop
when the keyboard hasn't been initialized yet */

- vc->vc_cursor_type = CUR_DEFAULT;
+ vc->vc_cursor_type = cur_default;
vc->vc_complement_mask = vc->vc_s_complement_mask;

default_attr(vc);
@@ -1832,7 +1835,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
if (vc->vc_par[0])
vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
else
- vc->vc_cursor_type = CUR_DEFAULT;
+ vc->vc_cursor_type = cur_default;
return;
}
break;

2009-11-11 07:54:51

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

> [PATCH] vt: make the default cursor shape configurable
>
> Make the default console cursor type configurable rather than
> hard-coding it.
>
> Signed-off-by: Clemens Ladisch <[email protected]>

ACK.

> @@ -2704,6 +2704,11 @@ and is between 256 and 4096 characters. It is defined in the file
> vmpoff= [KNL,S390] Perform z/VM CP command after power off.
> Format: <command>
>
> + vt.cur_default= [VT] Default cursor shape.
> + Format: 0xCCBBAA, where AA, BB, and CC are the same as
> + the parameters of the <Esc>[?A;B;Cc escape sequence;
> + see VGA-softcursor.txt. Default: 2 = underline.
> +
> vt.default_blu= [VT]
> Format: <blue0>,<blue1>,<blue2>,...,<blue15>
> Change the default blue palette of the console.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

2009-11-12 22:06:32

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

On Wed, 11 Nov 2009 07:56:59 +0100
Clemens Ladisch <[email protected]> wrote:

> [PATCH] vt: make the default cursor shape configurable
>
> Make the default console cursor type configurable rather than
> hard-coding it.
>
> Signed-off-by: Clemens Ladisch <[email protected]>

The changelog omitted the most important piece of information: the
reason why we're making this change to the kernel.

I could type that in myself, but writing people's changelog for them
gets a bit dull after the first few thousand. Please send a new,
complete changelog for this patch.

2009-11-13 07:28:36

by Clemens Ladisch

[permalink] [raw]
Subject: Re: [PATCH] vt: make the default cursor shape configurable

Andrew Morton wrote:
> Clemens Ladisch <[email protected]> wrote:
> > [PATCH] vt: make the default cursor shape configurable
> >
> > Make the default console cursor type configurable rather than
> > hard-coding it.
>
> The changelog omitted the most important piece of information: the
> reason why we're making this change to the kernel.

[PATCH] vt: make the default cursor shape configurable

For embedded systems, the blinking cursor at startup time can be
annoying and unintended. Add a new kernel parameter to change the
default cursor shape.

Signed-off-by: Clemens Ladisch <[email protected]>
Cc: Daniel Mack <[email protected]>
Acked-by: Pavel Machek <[email protected]>
---
Daniel, could you ack this?