All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbcon: make cursor display conditional
@ 2009-11-05  9:17 Daniel Mack
  2009-11-06  8:16 ` Clemens Ladisch
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2009-11-05  9:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Daniel Mack, Andrew Morton, Geert Uytterhoeven, Andrea Righi

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 <daniel@caiaq.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrea Righi <righi.andrea@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] fbcon: make cursor display conditional
  2009-11-05  9:17 [PATCH] fbcon: make cursor display conditional Daniel Mack
@ 2009-11-06  8:16 ` Clemens Ladisch
  2009-11-06 14:39   ` Andrea Righi
  0 siblings, 1 reply; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-06  8:16 UTC (permalink / raw)
  To: Daniel Mack; +Cc: linux-kernel, Andrew Morton, Geert Uytterhoeven, Andrea Righi

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



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] fbcon: make cursor display conditional
  2009-11-06  8:16 ` Clemens Ladisch
@ 2009-11-06 14:39   ` Andrea Righi
  2009-11-06 16:45     ` Daniel Mack
  0 siblings, 1 reply; 25+ messages in thread
From: Andrea Righi @ 2009-11-06 14:39 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Daniel Mack, linux-kernel, Andrew Morton, Geert Uytterhoeven

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] fbcon: make cursor display conditional
  2009-11-06 14:39   ` Andrea Righi
@ 2009-11-06 16:45     ` Daniel Mack
  2009-11-09  8:35       ` Clemens Ladisch
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2009-11-06 16:45 UTC (permalink / raw)
  To: Andrea Righi
  Cc: Clemens Ladisch, linux-kernel, Andrew Morton, Geert Uytterhoeven

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 <daniel@caiaq.de>
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 <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
---
 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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] fbcon: make cursor display conditional
  2009-11-06 16:45     ` Daniel Mack
@ 2009-11-09  8:35       ` Clemens Ladisch
  2009-11-09  9:10         ` Daniel Mack
  0 siblings, 1 reply; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-09  8:35 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Andrea Righi, linux-kernel, Andrew Morton, Geert Uytterhoeven,
	Greg Kroah-Hartman

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 <clemens@ladisch.de>

--- 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] fbcon: make cursor display conditional
  2009-11-09  8:35       ` Clemens Ladisch
@ 2009-11-09  9:10         ` Daniel Mack
  2009-11-09  9:15           ` [PATCH] vt: make the default cursor shape configurable Clemens Ladisch
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2009-11-09  9:10 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Andrea Righi, linux-kernel, Andrew Morton, Geert Uytterhoeven,
	Greg Kroah-Hartman

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 <clemens@ladisch.de>

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH] vt: make the default cursor shape configurable
  2009-11-09  9:10         ` Daniel Mack
@ 2009-11-09  9:15           ` Clemens Ladisch
  2009-11-09  9:53             ` Alan Cox
  0 siblings, 1 reply; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-09  9:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Daniel Mack, Andrew Morton, Geert Uytterhoeven, linux-kernel

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

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>

--- 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09  9:15           ` [PATCH] vt: make the default cursor shape configurable Clemens Ladisch
@ 2009-11-09  9:53             ` Alan Cox
  2009-11-09 11:26               ` Clemens Ladisch
  0 siblings, 1 reply; 25+ messages in thread
From: Alan Cox @ 2009-11-09  9:53 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Greg Kroah-Hartman, Daniel Mack, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

On Mon, 09 Nov 2009 10:15:45 +0100
Clemens Ladisch <clemens@ladisch.de> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09  9:53             ` Alan Cox
@ 2009-11-09 11:26               ` Clemens Ladisch
  2009-11-09 11:46                 ` Alan Cox
  0 siblings, 1 reply; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-09 11:26 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, Daniel Mack, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

Alan Cox wrote:
> Clemens Ladisch <clemens@ladisch.de> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 11:26               ` Clemens Ladisch
@ 2009-11-09 11:46                 ` Alan Cox
  2009-11-09 12:21                   ` Clemens Ladisch
  2009-11-09 14:50                   ` Daniel Mack
  0 siblings, 2 replies; 25+ messages in thread
From: Alan Cox @ 2009-11-09 11:46 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Greg Kroah-Hartman, Daniel Mack, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

> 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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 11:46                 ` Alan Cox
@ 2009-11-09 12:21                   ` Clemens Ladisch
  2009-11-09 14:50                   ` Daniel Mack
  1 sibling, 0 replies; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-09 12:21 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, Daniel Mack, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 11:46                 ` Alan Cox
  2009-11-09 12:21                   ` Clemens Ladisch
@ 2009-11-09 14:50                   ` Daniel Mack
  2009-11-09 17:58                     ` David Newall
  1 sibling, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2009-11-09 14:50 UTC (permalink / raw)
  To: Alan Cox
  Cc: Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 14:50                   ` Daniel Mack
@ 2009-11-09 17:58                     ` David Newall
  2009-11-09 18:07                       ` Daniel Mack
  2009-11-09 22:09                       ` Daniel Mack
  0 siblings, 2 replies; 25+ messages in thread
From: David Newall @ 2009-11-09 17:58 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 17:58                     ` David Newall
@ 2009-11-09 18:07                       ` Daniel Mack
  2009-11-09 22:09                       ` Daniel Mack
  1 sibling, 0 replies; 25+ messages in thread
From: Daniel Mack @ 2009-11-09 18:07 UTC (permalink / raw)
  To: David Newall
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 17:58                     ` David Newall
  2009-11-09 18:07                       ` Daniel Mack
@ 2009-11-09 22:09                       ` Daniel Mack
  2009-11-10 12:05                         ` David Newall
  2009-11-10 21:09                         ` Pavel Machek
  1 sibling, 2 replies; 25+ messages in thread
From: Daniel Mack @ 2009-11-09 22:09 UTC (permalink / raw)
  To: David Newall
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 22:09                       ` Daniel Mack
@ 2009-11-10 12:05                         ` David Newall
  2009-11-10 12:30                           ` Daniel Mack
  2009-11-10 21:09                         ` Pavel Machek
  1 sibling, 1 reply; 25+ messages in thread
From: David Newall @ 2009-11-10 12:05 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-10 12:05                         ` David Newall
@ 2009-11-10 12:30                           ` Daniel Mack
  2009-11-10 12:36                             ` David Newall
  0 siblings, 1 reply; 25+ messages in thread
From: Daniel Mack @ 2009-11-10 12:30 UTC (permalink / raw)
  To: David Newall
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-10 12:30                           ` Daniel Mack
@ 2009-11-10 12:36                             ` David Newall
  2009-11-10 12:39                               ` Daniel Mack
  0 siblings, 1 reply; 25+ messages in thread
From: David Newall @ 2009-11-10 12:36 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-10 12:36                             ` David Newall
@ 2009-11-10 12:39                               ` Daniel Mack
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Mack @ 2009-11-10 12:39 UTC (permalink / raw)
  To: David Newall
  Cc: Alan Cox, Clemens Ladisch, Greg Kroah-Hartman, Andrew Morton,
	Geert Uytterhoeven, linux-kernel

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.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-09 22:09                       ` Daniel Mack
  2009-11-10 12:05                         ` David Newall
@ 2009-11-10 21:09                         ` Pavel Machek
  2009-11-10 23:26                           ` Andrew Morton
  1 sibling, 1 reply; 25+ messages in thread
From: Pavel Machek @ 2009-11-10 21:09 UTC (permalink / raw)
  To: Daniel Mack
  Cc: David Newall, Alan Cox, Clemens Ladisch, Greg Kroah-Hartman,
	Andrew Morton, Geert Uytterhoeven, linux-kernel

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-10 21:09                         ` Pavel Machek
@ 2009-11-10 23:26                           ` Andrew Morton
  2009-11-11  6:56                             ` Clemens Ladisch
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew Morton @ 2009-11-10 23:26 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Daniel Mack, David Newall, Alan Cox, Clemens Ladisch,
	Greg Kroah-Hartman, Geert Uytterhoeven, linux-kernel

On Tue, 10 Nov 2009 22:09:41 +0100
Pavel Machek <pavel@ucw.cz> 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.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-10 23:26                           ` Andrew Morton
@ 2009-11-11  6:56                             ` Clemens Ladisch
  2009-11-11  7:54                               ` Pavel Machek
  2009-11-12 22:05                               ` Andrew Morton
  0 siblings, 2 replies; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-11  6:56 UTC (permalink / raw)
  To: Andrew Morton, Daniel Mack
  Cc: Pavel Machek, David Newall, Alan Cox, Greg Kroah-Hartman,
	Geert Uytterhoeven, linux-kernel

Andrew Morton wrote:
> Pavel Machek <pavel@ucw.cz> 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 <clemens@ladisch.de>

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;

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-11  6:56                             ` Clemens Ladisch
@ 2009-11-11  7:54                               ` Pavel Machek
  2009-11-12 22:05                               ` Andrew Morton
  1 sibling, 0 replies; 25+ messages in thread
From: Pavel Machek @ 2009-11-11  7:54 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Andrew Morton, Daniel Mack, David Newall, Alan Cox,
	Greg Kroah-Hartman, Geert Uytterhoeven, linux-kernel

> [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 <clemens@ladisch.de>

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-11  6:56                             ` Clemens Ladisch
  2009-11-11  7:54                               ` Pavel Machek
@ 2009-11-12 22:05                               ` Andrew Morton
  2009-11-13  7:28                                 ` Clemens Ladisch
  1 sibling, 1 reply; 25+ messages in thread
From: Andrew Morton @ 2009-11-12 22:05 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: Daniel Mack, Pavel Machek, David Newall, Alan Cox,
	Greg Kroah-Hartman, Geert Uytterhoeven, linux-kernel

On Wed, 11 Nov 2009 07:56:59 +0100
Clemens Ladisch <clemens@ladisch.de> 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 <clemens@ladisch.de>

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.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] vt: make the default cursor shape configurable
  2009-11-12 22:05                               ` Andrew Morton
@ 2009-11-13  7:28                                 ` Clemens Ladisch
  0 siblings, 0 replies; 25+ messages in thread
From: Clemens Ladisch @ 2009-11-13  7:28 UTC (permalink / raw)
  To: Andrew Morton, Daniel Mack
  Cc: Pavel Machek, David Newall, Alan Cox, Greg Kroah-Hartman,
	Geert Uytterhoeven, linux-kernel

Andrew Morton wrote:
> Clemens Ladisch <clemens@ladisch.de> 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 <clemens@ladisch.de>
Cc: Daniel Mack <daniel@caiaq.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
Daniel, could you ack this?

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-11-13  7:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05  9:17 [PATCH] fbcon: make cursor display conditional Daniel Mack
2009-11-06  8:16 ` Clemens Ladisch
2009-11-06 14:39   ` Andrea Righi
2009-11-06 16:45     ` Daniel Mack
2009-11-09  8:35       ` Clemens Ladisch
2009-11-09  9:10         ` Daniel Mack
2009-11-09  9:15           ` [PATCH] vt: make the default cursor shape configurable Clemens Ladisch
2009-11-09  9:53             ` Alan Cox
2009-11-09 11:26               ` Clemens Ladisch
2009-11-09 11:46                 ` Alan Cox
2009-11-09 12:21                   ` Clemens Ladisch
2009-11-09 14:50                   ` Daniel Mack
2009-11-09 17:58                     ` David Newall
2009-11-09 18:07                       ` Daniel Mack
2009-11-09 22:09                       ` Daniel Mack
2009-11-10 12:05                         ` David Newall
2009-11-10 12:30                           ` Daniel Mack
2009-11-10 12:36                             ` David Newall
2009-11-10 12:39                               ` Daniel Mack
2009-11-10 21:09                         ` Pavel Machek
2009-11-10 23:26                           ` Andrew Morton
2009-11-11  6:56                             ` Clemens Ladisch
2009-11-11  7:54                               ` Pavel Machek
2009-11-12 22:05                               ` Andrew Morton
2009-11-13  7:28                                 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.