console/fbcon: Add support for deferred console takeover
Subsystems (6)
v4 cover console/fbcon: Add support for deferred console takeover
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.
The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Petr, the printk subsys change is really trivial (1 line addition) can we get your Acked-by for merging all 3 patches through the fbdev tree?
Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in place
Changes in v3:
-Export is_console_locke() for use in modules (as fbcon may be built as a .ko) -Use WARN_CONSOLE_UNLOCKED() in several places in the fbcon code to assert
proper locking (requested by Daniel)
-Unregister the fbcon-dummycon-output-notifier on fbcon_exit() (req. by Daniel) -Document the fbcon=nodefer commandline option (req. by Emil)
Changes in v2:
-Check the whole string when checking for erases in putcs, instead of just
the first char
-Make dummycon_blank return 1, so that a redraw gets triggered and any text
rendered while blanked gets output so that it can trigger a deferred takeover if one is pending
Regards,
Hans
PATCH v3 1/3 printk: Export is_console_locked
This is a preparation patch for adding a number of WARN_CONSOLE_UNLOCKED() calls to the fbcon code, which may be built as a module (event though usually it is not).
---
Changes in v3:
-New patch in v3 of this patchset
--- kernel/printk/printk.c | 1 + 1 file changed, 1 insertion(+)
kernel/printk/printk.c +1 -0
@@ -2243,6 +2243,7 @@ int is_console_locked(void) {return console_locked; } +EXPORT_SYMBOL (is_console_locked);/* * Check if we have any console that is capable of printing while cpu is
Signature · 1 line
2.17.1
Re: [PATCH v3 1/3] printk: Export is_console_locked
Hi,
As the cover letter's subject correctly indicates this is v4 of the patch-set, I forgot to bump the subject-prefix when sending, so the v3 in the subject here really should be v4.
Regards,
Hans
Quoted 26 lines · Hans de Goede
This is a preparation patch for adding a number of
WARN_CONSOLE_UNLOCKED()calls to the fbcon code, which may be built as a module (event though usually it is not).Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>---
Changes in v3:(quoted diff) +0
-2-New patch in v3 of this patchset --- kernel/printk/printk.c | 1 + 1 file changed, 1 insertion(+)kernel/printk/printk.c +1
-0@@ -2243,6 +2243,7 @@ int is_console_locked(void) {return console_locked; } +EXPORT_SYMBOL (is_console_locked);/* * Check if we have any console that is capable of printing while cpu is
Re: [PATCH v3 1/3] printk: Export is_console_locked
In reply to Hans de GoedeQuoted 6 lines · Hans de Goede
This is a preparation patch for adding a number of
WARN_CONSOLE_UNLOCKED()calls to the fbcon code, which may be built as a module (event though usually it is not).Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>
-ss
Re: [PATCH v3 1/3] printk: Export is_console_locked
In reply to Hans de GoedeQuoted 6 lines · Hans de Goede
This is a preparation patch for adding a number of
WARN_CONSOLE_UNLOCKED()calls to the fbcon code, which may be built as a module (event though usually it is not).Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>
Best Regards,
Petr
PATCH v3 2/3 fbcon: Call WARN_CONSOLE_UNLOCKED() where applicable
In reply to Hans de GoedeReplace comments about places where the console lock should be held with calls to WARN_CONSOLE_UNLOCKED() to assert that it is actually held.
---
Changes in v3:
-New patch in v3 of this patchset
Changes in v4:
-Keep the comments about which fbcon functions need locks in place
--- drivers/video/fbdev/core/fbcon.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/video/fbdev/core/fbcon.c +11 -0
@@ -828,6 +828,8 @@ static int set_con2fb_map(int unit, int newidx, int user)struct fb_info *oldinfo =NULL ;int found, err =0 ; +WARN_CONSOLE_UNLOCKED (); +if (oldidx = newidx)return 0 ;
@@ -3044,6 +3046,8 @@ static int fbcon_fb_unbind(int idx) {int i, new_idx =-1 , ret =0 ; +WARN_CONSOLE_UNLOCKED (); +if (!fbcon_has_console_bind)return 0 ;
@@ -3094,6 +3098,8 @@ static int fbcon_fb_unregistered(struct fb_info *info) {int i, idx; +WARN_CONSOLE_UNLOCKED (); + idx = info->node;for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map[i] = idx)
@@ -3131,6 +3137,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)static void fbcon_remap_all (int idx) {int i; + +WARN_CONSOLE_UNLOCKED (); +for (i = first_fb_vc; i <= last_fb_vc; i++)set_con2fb_map (i, idx,0 );
@@ -3177,6 +3186,8 @@ static int fbcon_fb_registered(struct fb_info *info) {int ret =0 , i, idx; +WARN_CONSOLE_UNLOCKED (); + idx = info->node;fbcon_select_primary (info);
Signature · 1 line
2.17.1
Re: [PATCH v3 2/3] fbcon: Call WARN_CONSOLE_UNLOCKED() where applicable
Quoted 5 lines · Hans de Goede
Replace comments about places where the console lock should be held with calls to
WARN_CONSOLE_UNLOCKED()to assert that it is actually held.Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>
-ss
PATCH v3 3/3 console/fbcon: Add support for deferred console takeover
In reply to Hans de GoedeCurrently fbcon claims fbdevs as soon as they are registered and takes over the console as soon as the first fbdev gets registered.
This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is.
The current solution for this problem (on embedded systems) is to not enable fbcon.
This commit adds a new FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER config option, which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the "quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as soon as e.g. an error message is logged.
---
Changes in v2:
-Check the whole string when checking for erases in putcs, instead of just
the first char
-Make dummycon_blank return 1, so that a redraw gets triggered and any text
rendered while blanked gets output so that it can trigger a deferred takeover if one is pending
Changes in v3:
-Call WARN_CONSOLE_UNLOCKED() from fbcon_output_notifier() -Unregister the notifier on fbcon_exit()
-Document the fbcon=nodefer commandline option in Documentation/fb/fbcon.txt
--- Documentation/fb/fbcon.txt | 7 ++++ drivers/video/console/Kconfig | 11 +++++ drivers/video/console/dummycon.c | 67 +++++++++++++++++++++++++---- drivers/video/fbdev/core/fbcon.c | 72 ++++++++++++++++++++++++++++++++ include/linux/console.h | 5 +++ 5 files changed, 154 insertions(+), 8 deletions(-)
Documentation/fb/fbcon.txt +7 -0
@@ -155,6 +155,13 @@ C. Boot options used by text. By default, this area will be black. The 'color' value is an integer number that depends on the framebuffer driver being used. +6. fbcon=nodefer + + If the kernel is compiled with deferred fbcon takeover support, normally + the framebuffer contents, left in place by the firmware/bootloader, will + be preserved until there actually is some text is output to the console. + This option causes fbcon to bind immediately to the fbdev device. + C. Attaching, Detaching and Unloading Before going on how to attach, detach and unload the framebuffer console, an
drivers/video/console/Kconfig +11 -0
@@ -150,6 +150,17 @@ config FRAMEBUFFER_CONSOLE_ROTATION such that other users of the framebuffer will remain normally oriented. +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + bool "Framebuffer Console Deferred Takeover" + depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y + help + If enabled this defers the framebuffer console taking over the + console from the dummy console until the first text is displayed on + the console. This is useful in combination with the "quiet" kernel + commandline option to keep the framebuffer contents initially put up + by the firmware in place, rather then replacing the contents with a + black screen as soon as fbcon loads. + config STI_CONSOLE bool "STI text console" depends on PARISC && HAS_IOMEM
drivers/video/console/dummycon.c +59 -8
85 lines not on this page · raw message
drivers/video/fbdev/core/fbcon.c +72 -0
116 lines not on this page · raw message
include/linux/console.h +5 -0
@@ -21,6 +21,7 @@ struct console_font_op;struct console_font ;struct module ;struct tty_struct ; +struct notifier_block ;/* * this is what the terminal answers to a ESC-Z or csi0c query.
@@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; }extern void console_init (void ); +/* For deferred console takeover */ +void dummycon_register_output_notifier (struct notifier_block *nb); +void dummycon_unregister_output_notifier (struct notifier_block *nb); +#endif /* _LINUX_CONSOLE_H */
Signature · 1 line
2.17.1
Quoted 17 lines · Hans de Goede
Currently fbcon claims fbdevs as soon as they are registered and takes over the console as soon as the first fbdev gets registered.
This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is.
The current solution for this problem (on embedded systems) is to not enable fbcon.
This commit adds a new
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVERconfig option, which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the "quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as soon as e.g. an error message is logged.
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>
A bit a late comment, and feel free to reject: Have you considered registering the fbcon driver, but not doing any modesets until the very first real message shows up?
That would make it work with any console driver setup, even when dummy console is deactivated. And it would avoid the notifier layering violation, which still irks me a bit with this approach here. -Daniel
Quoted 307 lines
---
Changes in v2:(quoted diff) +0
-2-Check the whole string when checking for erases in putcs, instead of just the first char -Make dummycon_blank return 1, so that a redraw gets triggered and any text rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingChanges in v3:
(quoted diff) +0
-4-Call WARN_CONSOLE_UNLOCKED() from fbcon_output_notifier() -Unregister the notifier on fbcon_exit() -Document the fbcon=nodefer commandline option in Documentation/fb/fbcon.txt --- Documentation/fb/fbcon.txt | 7 ++++ drivers/video/console/Kconfig | 11 +++++ drivers/video/console/dummycon.c | 67 +++++++++++++++++++++++++---- drivers/video/fbdev/core/fbcon.c | 72 ++++++++++++++++++++++++++++++++ include/linux/console.h | 5 +++ 5 files changed, 154 insertions(+), 8 deletions(-)Documentation/fb/fbcon.txt +7
-0@@ -155,6 +155,13 @@ C. Boot options used by text. By default, this area will be black. The 'color' value is an integer number that depends on the framebuffer driver being used. +6. fbcon=nodefer + + If the kernel is compiled with deferred fbcon takeover support, normally + the framebuffer contents, left in place by the firmware/bootloader, will + be preserved until there actually is some text is output to the console. + This option causes fbcon to bind immediately to the fbdev device. + C. Attaching, Detaching and Unloading Before going on how to attach, detach and unload the framebuffer console, andrivers/video/console/Kconfig +11
-0@@ -150,6 +150,17 @@ config FRAMEBUFFER_CONSOLE_ROTATION such that other users of the framebuffer will remain normally oriented. +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + bool "Framebuffer Console Deferred Takeover" + depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y + help + If enabled this defers the framebuffer console taking over the + console from the dummy console until the first text is displayed on + the console. This is useful in combination with the "quiet" kernel + commandline option to keep the framebuffer contents initially put up + by the firmware in place, rather then replacing the contents with a + black screen as soon as fbcon loads. + config STI_CONSOLE bool "STI text console" depends on PARISC && HAS_IOMEMdrivers/video/console/dummycon.c +59
-8@@ -26,6 +26,65 @@#define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS#endif +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +/* These are both protected by the console_lock */ +static RAW_NOTIFIER_HEAD (dummycon_output_nh); +static bool dummycon_putc_called; + +void dummycon_register_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_register (&dummycon_output_nh, nb); + +if (dummycon_putc_called) + nb->notifier_call (nb,0 ,NULL ); +} + +void dummycon_unregister_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_unregister (&dummycon_output_nh, nb); +} + +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) +{ + dummycon_putc_called = true; +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) +{ +int i; + +if (!dummycon_putc_called) { +/* Ignore erases */ +for (i =0 ; i < count; i++) { +if (s[i] != vc->vc_video_erase_char) +break ; + } +if (i = count) +return ; + + dummycon_putc_called = true; + } + +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +/* Redraw, so that we get putc(s) for output done while blanked */ +return 1 ; +} +#else +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) { } +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +return 0 ; +} +#endif +static const char *dummycon_startup (void ) {return "dummy device" ;@@ -44,9 +103,6 @@ static void dummycon_init(struct vc_data *vc, int init)static void dummycon_deinit (struct vc_data *vc) { }static void dummycon_clear (struct vc_data *vc,int sy,int sx,int height,int width) { } -static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } -static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, -int count,int ypos,int xpos) { }static void dummycon_cursor (struct vc_data *vc,int mode) { } static bool dummycon_scroll(struct vc_data *vc, unsigned int top,@@ -61,11 +117,6 @@ static int dummycon_switch(struct vc_data *vc)return 0 ; } -static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) -{ -return 0 ; -} -static int dummycon_font_set (struct vc_data *vc,struct console_font *font,unsigned int flags) {drivers/video/fbdev/core/fbcon.c +72
-0@@ -129,6 +129,12 @@ static inline void fbcon_map_override(void) }#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */ +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static bool deferred_takeover = true; +#else +#define deferred_takeover false +#endif +/* font data */ static char fontname[40 ];@@ -499,6 +505,12 @@ static int __init fb_console_setup(char *this_opt) margin_color =simple_strtoul (options, &options,0 );continue ; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (!strcmp (options,"nodefer" )) { + deferred_takeover = false; +continue ; + } +#endif }return 1 ; }@@ -3100,6 +3112,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)WARN_CONSOLE_UNLOCKED (); +if (deferred_takeover) +return 0 ; + idx = info->node;for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map[i] = idx)@@ -3140,6 +3155,13 @@ static void fbcon_remap_all(int idx)WARN_CONSOLE_UNLOCKED (); +if (deferred_takeover) { +for (i = first_fb_vc; i <= last_fb_vc; i++) + con2fb_map_boot[i] = idx; +fbcon_map_override (); +return ; + } +for (i = first_fb_vc; i <= last_fb_vc; i++)set_con2fb_map (i, idx,0 );@@ -3191,6 +3213,11 @@ static int fbcon_fb_registered(struct fb_info *info) idx = info->node;fbcon_select_primary (info); +if (deferred_takeover) { +pr_info ("fbcon: Deferring console take-over\n" ); +return 0 ; + } +if (info_idx =-1 ) {for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map_boot[i] = idx) {@@ -3566,8 +3593,46 @@ static int fbcon_init_device(void)return 0 ; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static struct notifier_block fbcon_output_nb; + +static int fbcon_output_notifier (struct notifier_block *nb, +unsigned long action,void *data) +{ +int i; + +WARN_CONSOLE_UNLOCKED (); + +pr_info ("fbcon: Taking over console\n" ); + +dummycon_unregister_output_notifier (&fbcon_output_nb); + deferred_takeover = false; + logo_shown =FBCON_LOGO_DONTSHOW ; + +for (i =0 ; i <FB_MAX ; i++) { +if (registered_fb[i]) +fbcon_fb_registered (registered_fb[i]); + } + +return NOTIFY_OK ; +} + +static void fbcon_register_output_notifier (void ) +{ + fbcon_output_nb.notifier_call = fbcon_output_notifier; +dummycon_register_output_notifier (&fbcon_output_nb); +} +#else +static inline void fbcon_register_output_notifier (void ) {} +#endif +static void fbcon_start (void ) { +if (deferred_takeover) { +fbcon_register_output_notifier (); +return ; + } +if (num_registered_fb) {int i;@@ -3594,6 +3659,13 @@ static void fbcon_exit(void)if (fbcon_has_exited)return ; +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (deferred_takeover) { +dummycon_unregister_output_notifier (&fbcon_output_nb); + deferred_takeover = false; + } +#endif +kfree ((void *)softback_buf); softback_buf =0UL ;include/linux/console.h +5
-0@@ -21,6 +21,7 @@ struct console_font_op;struct console_font ;struct module ;struct tty_struct ; +struct notifier_block ;/* * this is what the terminal answers to a ESC-Z or csi0c query. @@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; }extern void console_init (void ); +/* For deferred console takeover */ +void dummycon_register_output_notifier (struct notifier_block *nb); +void dummycon_unregister_output_notifier (struct notifier_block *nb); +#endif /* _LINUX_CONSOLE_H */ Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Hi,
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Hans de Goede
Currently fbcon claims fbdevs as soon as they are registered and takes over the console as soon as the first fbdev gets registered.
This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is.
The current solution for this problem (on embedded systems) is to not enable fbcon.
This commit adds a new
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVERconfig option, which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the "quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as soon as e.g. an error message is logged.
Quoted 6 lines
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>A bit a late comment, and feel free to reject: Have you considered registering the fbcon driver, but not doing any modesets until the very first real message shows up?
I have tried something like that, but it did not work out, this patch-set actually is my 3th attempt at this (the other 2 were never posted because they did not work).
The fbcon code is woven quite tightly into the console code, so this was the only clean way I could find to achieve what I want.
Regards,
Hans
Quoted 308 lines
Quoted 307 lines
---
Changes in v2:(quoted diff) +0
-2-Check the whole string when checking for erases in putcs, instead of just the first char -Make dummycon_blank return 1, so that a redraw gets triggered and any text rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingChanges in v3:
(quoted diff) +0
-4-Call WARN_CONSOLE_UNLOCKED() from fbcon_output_notifier() -Unregister the notifier on fbcon_exit() -Document the fbcon=nodefer commandline option in Documentation/fb/fbcon.txt --- Documentation/fb/fbcon.txt | 7 ++++ drivers/video/console/Kconfig | 11 +++++ drivers/video/console/dummycon.c | 67 +++++++++++++++++++++++++---- drivers/video/fbdev/core/fbcon.c | 72 ++++++++++++++++++++++++++++++++ include/linux/console.h | 5 +++ 5 files changed, 154 insertions(+), 8 deletions(-)Documentation/fb/fbcon.txt +7
-0@@ -155,6 +155,13 @@ C. Boot options used by text. By default, this area will be black. The 'color' value is an integer number that depends on the framebuffer driver being used. +6. fbcon=nodefer + + If the kernel is compiled with deferred fbcon takeover support, normally + the framebuffer contents, left in place by the firmware/bootloader, will + be preserved until there actually is some text is output to the console. + This option causes fbcon to bind immediately to the fbdev device. + C. Attaching, Detaching and Unloading Before going on how to attach, detach and unload the framebuffer console, andrivers/video/console/Kconfig +11
-0@@ -150,6 +150,17 @@ config FRAMEBUFFER_CONSOLE_ROTATION such that other users of the framebuffer will remain normally oriented. +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + bool "Framebuffer Console Deferred Takeover" + depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y + help + If enabled this defers the framebuffer console taking over the + console from the dummy console until the first text is displayed on + the console. This is useful in combination with the "quiet" kernel + commandline option to keep the framebuffer contents initially put up + by the firmware in place, rather then replacing the contents with a + black screen as soon as fbcon loads. + config STI_CONSOLE bool "STI text console" depends on PARISC && HAS_IOMEMdrivers/video/console/dummycon.c +59
-8@@ -26,6 +26,65 @@#define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS#endif +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +/* These are both protected by the console_lock */ +static RAW_NOTIFIER_HEAD (dummycon_output_nh); +static bool dummycon_putc_called; + +void dummycon_register_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_register (&dummycon_output_nh, nb); + +if (dummycon_putc_called) + nb->notifier_call (nb,0 ,NULL ); +} + +void dummycon_unregister_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_unregister (&dummycon_output_nh, nb); +} + +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) +{ + dummycon_putc_called = true; +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) +{ +int i; + +if (!dummycon_putc_called) { +/* Ignore erases */ +for (i =0 ; i < count; i++) { +if (s[i] != vc->vc_video_erase_char) +break ; + } +if (i = count) +return ; + + dummycon_putc_called = true; + } + +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +/* Redraw, so that we get putc(s) for output done while blanked */ +return 1 ; +} +#else +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) { } +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +return 0 ; +} +#endif +static const char *dummycon_startup (void ) {return "dummy device" ;@@ -44,9 +103,6 @@ static void dummycon_init(struct vc_data *vc, int init)static void dummycon_deinit (struct vc_data *vc) { }static void dummycon_clear (struct vc_data *vc,int sy,int sx,int height,int width) { } -static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } -static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, -int count,int ypos,int xpos) { }static void dummycon_cursor (struct vc_data *vc,int mode) { } static bool dummycon_scroll(struct vc_data *vc, unsigned int top,@@ -61,11 +117,6 @@ static int dummycon_switch(struct vc_data *vc)return 0 ; } -static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) -{ -return 0 ; -} -static int dummycon_font_set (struct vc_data *vc,struct console_font *font,unsigned int flags) {drivers/video/fbdev/core/fbcon.c +72
-0@@ -129,6 +129,12 @@ static inline void fbcon_map_override(void) }#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */ +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static bool deferred_takeover = true; +#else +#define deferred_takeover false +#endif +/* font data */ static char fontname[40 ];@@ -499,6 +505,12 @@ static int __init fb_console_setup(char *this_opt) margin_color =simple_strtoul (options, &options,0 );continue ; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (!strcmp (options,"nodefer" )) { + deferred_takeover = false; +continue ; + } +#endif }return 1 ; }@@ -3100,6 +3112,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)WARN_CONSOLE_UNLOCKED (); +if (deferred_takeover) +return 0 ; + idx = info->node;for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map[i] = idx)@@ -3140,6 +3155,13 @@ static void fbcon_remap_all(int idx)WARN_CONSOLE_UNLOCKED (); +if (deferred_takeover) { +for (i = first_fb_vc; i <= last_fb_vc; i++) + con2fb_map_boot[i] = idx; +fbcon_map_override (); +return ; + } +for (i = first_fb_vc; i <= last_fb_vc; i++)set_con2fb_map (i, idx,0 );@@ -3191,6 +3213,11 @@ static int fbcon_fb_registered(struct fb_info *info) idx = info->node;fbcon_select_primary (info); +if (deferred_takeover) { +pr_info ("fbcon: Deferring console take-over\n" ); +return 0 ; + } +if (info_idx =-1 ) {for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map_boot[i] = idx) {@@ -3566,8 +3593,46 @@ static int fbcon_init_device(void)return 0 ; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static struct notifier_block fbcon_output_nb; + +static int fbcon_output_notifier (struct notifier_block *nb, +unsigned long action,void *data) +{ +int i; + +WARN_CONSOLE_UNLOCKED (); + +pr_info ("fbcon: Taking over console\n" ); + +dummycon_unregister_output_notifier (&fbcon_output_nb); + deferred_takeover = false; + logo_shown =FBCON_LOGO_DONTSHOW ; + +for (i =0 ; i <FB_MAX ; i++) { +if (registered_fb[i]) +fbcon_fb_registered (registered_fb[i]); + } + +return NOTIFY_OK ; +} + +static void fbcon_register_output_notifier (void ) +{ + fbcon_output_nb.notifier_call = fbcon_output_notifier; +dummycon_register_output_notifier (&fbcon_output_nb); +} +#else +static inline void fbcon_register_output_notifier (void ) {} +#endif +static void fbcon_start (void ) { +if (deferred_takeover) { +fbcon_register_output_notifier (); +return ; + } +if (num_registered_fb) {int i;@@ -3594,6 +3659,13 @@ static void fbcon_exit(void)if (fbcon_has_exited)return ; +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (deferred_takeover) { +dummycon_unregister_output_notifier (&fbcon_output_nb); + deferred_takeover = false; + } +#endif +kfree ((void *)softback_buf); softback_buf =0UL ;include/linux/console.h +5
-0@@ -21,6 +21,7 @@ struct console_font_op;struct console_font ;struct module ;struct tty_struct ; +struct notifier_block ;/* * this is what the terminal answers to a ESC-Z or csi0c query. @@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; }extern void console_init (void ); +/* For deferred console takeover */ +void dummycon_register_output_notifier (struct notifier_block *nb); +void dummycon_unregister_output_notifier (struct notifier_block *nb); +#endif /* _LINUX_CONSOLE_H */ Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 36 lines · Hans de Goede
Hi,
Quoted 24 lines · Daniel Vetter
Quoted 22 lines · Hans de Goede
Currently fbcon claims fbdevs as soon as they are registered and takes over
the console as soon as the first fbdev gets registered.This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is.
The current solution for this problem (on embedded systems) is to not enable fbcon.
This commit adds a new
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVERconfig option,
which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the
"quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as
soon as e.g. an error message is logged.Quoted 7 lines
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>A bit a late comment, and feel free to reject: Have you considered registering the fbcon driver, but not doing any modesets until the very first real message shows up?
Quoted 6 lines
I have tried something like that, but it did not work out, this patch-set actually is my 3th attempt at this (the other 2 were never posted because they did not work).
The fbcon code is woven quite tightly into the console code, so this was the only clean way I could find to achieve what I want.
I assumed/feared as much. Would be good to cover that in the commit message, to justify your approach better.
-Daniel
Quoted 328 lines
Regards,
Hans
Quoted 311 lines
Quoted 311 lines
---
Changes in v2:
-Check the whole string when checking for erases in putcs, instead of just
the first char
-Makedummycon_blankreturn 1, so that a redraw gets triggered and any text
rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingChanges in v3:
(quoted diff) +0
-3-Call WARN_CONSOLE_UNLOCKED() from fbcon_output_notifier() -Unregister the notifier on fbcon_exit() -Document the fbcon=nodefer commandline option in
Documentation/fb/fbcon.txt--- Documentation/fb/fbcon.txt | 7 ++++ drivers/video/console/Kconfig | 11 +++++ drivers/video/console/dummycon.c | 67 +++++++++++++++++++++++++---- drivers/video/fbdev/core/fbcon.c | 72 ++++++++++++++++++++++++++++++++ include/linux/console.h | 5 +++ 5 files changed, 154 insertions(+), 8 deletions(-)Documentation/fb/fbcon.txt +0
-0@@ -155,6 +155,13 @@ C. Boot options used by text. By default, this area will be black. The 'color'value
is an integer number that depends on the framebuffer driver being
used.
+6. fbcon=nodeferDocumentation/fb/fbcon.txt +2
-0+ + If the kernel is compiled with deferred fbcon takeover support,normally
+ the framebuffer contents, left in place by thefirmware/bootloader, will
+ be preserved until there actually is some text is output to the
console.Documentation/fb/fbcon.txt +2
-0+ This option causes fbcon to bind immediately to the fbdev device. + C. Attaching, Detaching and Unloading Before going on how to attach, detach and unload the framebufferconsole, an
drivers/video/console/Kconfig +5
-0@@ -150,6 +150,17 @@ config FRAMEBUFFER_CONSOLE_ROTATION such that other users of the framebuffer will remain normally oriented. +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + bool "Framebuffer Console Deferred Takeover" + depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y + help + If enabled this defers the framebuffer console taking over the + console from the dummy console until the first text isdisplayed on
+ the console. This is useful in combination with the "quiet"
kernel
+ commandline option to keep the framebuffer contents initially
put up
+ by the firmware in place, rather then replacing the contents
with adrivers/video/console/Kconfig +2
-0+ black screen as soon as fbcon loads. + config STI_CONSOLE bool "STI text console" depends on PARISC && HAS_IOMEMdrivers/video/console/dummycon.c +53
-0@@ -26,6 +26,65 @@#define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS#endif +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +/* These are both protected by the console_lock */ +static RAW_NOTIFIER_HEAD (dummycon_output_nh); +static bool dummycon_putc_called; + +void dummycon_register_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_register (&dummycon_output_nh, nb); + +if (dummycon_putc_called) + nb->notifier_call (nb,0 ,NULL ); +} + +void dummycon_unregister_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_unregister (&dummycon_output_nh, nb); +} + +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) +{ + dummycon_putc_called = true; +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) +{ +int i; + +if (!dummycon_putc_called) { +/* Ignore erases */ +for (i =0 ; i < count; i++) { +if (s[i] != vc->vc_video_erase_char) +break ; + } +if (i = count) +return ; + + dummycon_putc_called = true; + } + +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +/* Redraw, so that we get putc(s) for output done while blanked */ +return 1 ; +} +#else +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) { } +static int dummycon_blank(struct vc_data *vc, int blank, int
mode_switch)drivers/video/console/dummycon.c +5
-3+{ +return 0 ; +} +#endif +static const char *dummycon_startup (void ) {return "dummy device" ;@@ -44,9 +103,6 @@ static void dummycon_init(struct vc_data *vc, int init) static void dummycon_deinit(struct vc_data *vc) { }static void dummycon_clear (struct vc_data *vc,int sy,int sx,int height,int width) { } -static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } -static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, -int count,int ypos,int xpos) { }static void
dummycon_cursor(struct vc_data *vc, int mode){ }
static bool dummycon_scroll(structvc_data*vc, unsigned int top,drivers/video/console/dummycon.c +0
-4@@ -61,11 +117,6 @@ static int dummycon_switch(struct vc_data *vc)return 0 ; } -static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch) -{ -return 0 ; -} - static int dummycon_font_set(struct vc_data *vc, struct console_font *font, unsigned int flags) {drivers/video/fbdev/core/fbcon.c +5
-0@@ -129,6 +129,12 @@ static inline void fbcon_map_override(void) }#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */ +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static bool deferred_takeover = true; +#else +#define deferred_takeover false +#endif +/* font data */ static char fontname[40 ]; @@ -499,6 +505,12 @@ static int __init fb_console_setup(char *this_opt) margin_color = simple_strtoul(options,&options, 0); continue; }drivers/video/fbdev/core/fbcon.c +61
-0+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (!strcmp (options,"nodefer" )) { + deferred_takeover = false; +continue ; + } +#endif }return 1 ; }@@ -3100,6 +3112,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)WARN_CONSOLE_UNLOCKED (); + if (deferred_takeover) +return 0 ; + idx = info->node;for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map[i] = idx)@@ -3140,6 +3155,13 @@ static void fbcon_remap_all(int idx)WARN_CONSOLE_UNLOCKED (); + if (deferred_takeover) { +for (i = first_fb_vc; i <= last_fb_vc; i++) + con2fb_map_boot[i] = idx; +fbcon_map_override (); +return ; + } +for (i = first_fb_vc; i <= last_fb_vc; i++)set_con2fb_map (i, idx,0 ); @@ -3191,6 +3213,11 @@ static int fbcon_fb_registered(struct fb_info *info) idx = info->node;fbcon_select_primary (info); + if (deferred_takeover) { +pr_info ("fbcon: Deferring console take-over\n" ); +return 0 ; + } +if (info_idx =-1 ) {for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map_boot[i] = idx) {@@ -3566,8 +3593,46 @@ static int fbcon_init_device(void) return 0; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static struct notifier_block fbcon_output_nb; + +static int fbcon_output_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + int i; + + WARN_CONSOLE_UNLOCKED(); + + pr_info("fbcon: Taking over console\n"); + + dummycon_unregister_output_notifier(&fbcon_output_nb); + deferred_takeover = false; + logo_shown = FBCON_LOGO_DONTSHOW; + + for (i = 0; i < FB_MAX; i++) { + if (registered_fb[i]) + fbcon_fb_registered(registered_fb[i]); + } + + return NOTIFY_OK; +} + +static void fbcon_register_output_notifier(void) +{ + fbcon_output_nb.notifier_call = fbcon_output_notifier; + dummycon_register_output_notifier(&fbcon_output_nb); +} +#else +static inline void fbcon_register_output_notifier(void) {} +#endif + static void fbcon_start(void) { + if (deferred_takeover) { + fbcon_register_output_notifier(); + return; + } + if (num_registered_fb) { int i; @@ -3594,6 +3659,13 @@ static void fbcon_exit(void) if (fbcon_has_exited) return; +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + if (deferred_takeover) { + dummycon_unregister_output_notifier(&fbcon_output_nb); + deferred_takeover = false; + } +#endif + kfree((void *)softback_buf); softback_buf = 0UL; diff --git a/include/linux/console.h b/include/linux/console.hindex
dfd6b0e97855..f59f3dbca65c100644include/linux/console.h +4
-1@@ -21,6 +21,7 @@ struct console_font_op;struct console_font ;struct module ;struct tty_struct ; +struct notifier_block ;/* * this is what the terminal answers to a ESC-Z or csi0c query. @@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; }extern void console_init (void ); +/* For deferred console takeover */ +void dummycon_register_output_notifier(struct notifier_block *nb); +void dummycon_unregister_output_notifier (struct notifier_block *nb); +#endif /* _LINUX_CONSOLE_H */ --2.17.1
Quoted 6 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Hi,
Quoted 41 lines · Daniel Vetter
Quoted 40 lines · Hans de Goede
Hi,
Quoted 24 lines · Daniel Vetter
Quoted 22 lines · Hans de Goede
Currently fbcon claims fbdevs as soon as they are registered and takes over
the console as soon as the first fbdev gets registered.This behavior is undesirable in cases where a smooth graphical bootup is desired, in such cases we typically want the contents of the framebuffer (typically a vendor logo) to stay in place as is.
The current solution for this problem (on embedded systems) is to not enable fbcon.
This commit adds a new
FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVERconfig option,
which when enabled defers fbcon taking over the console from the dummy console until the first text is displayed on the console. Together with the
"quiet" kernel commandline option, this allows fbcon to still be used together with a smooth graphical bootup, having it take over the console as
soon as e.g. an error message is logged.Quoted 7 lines
Quoted 2 lines
Reviewed-by Daniel Vetter <[email protected]>Signed-off-by Hans de Goede <[email protected]>A bit a late comment, and feel free to reject: Have you considered registering the fbcon driver, but not doing any modesets until the very first real message shows up?
I have tried something like that, but it did not work out, this patch-set actually is my 3th attempt at this (the other 2 were never posted because they did not work).
Quoted 5 lines
Quoted 2 lines
The fbcon code is woven quite tightly into the console code, so this was the only clean way I could find to achieve what I want.
I assumed/feared as much. Would be good to cover that in the commit message, to justify your approach better.
Ok, v5 with an updated commit message (and without any code changes) coming up.
Regards,
Hans
Quoted 324 lines
Quoted 321 lines
Quoted 311 lines
Quoted 311 lines
---
Changes in v2:
-Check the whole string when checking for erases in putcs, instead of just
the first char
-Makedummycon_blankreturn 1, so that a redraw gets triggered and any text
rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingChanges in v3:
(quoted diff) +0
-3-Call WARN_CONSOLE_UNLOCKED() from fbcon_output_notifier() -Unregister the notifier on fbcon_exit() -Document the fbcon=nodefer commandline option in
Documentation/fb/fbcon.txt--- Documentation/fb/fbcon.txt | 7 ++++ drivers/video/console/Kconfig | 11 +++++ drivers/video/console/dummycon.c | 67 +++++++++++++++++++++++++---- drivers/video/fbdev/core/fbcon.c | 72 ++++++++++++++++++++++++++++++++ include/linux/console.h | 5 +++ 5 files changed, 154 insertions(+), 8 deletions(-)Documentation/fb/fbcon.txt +0
-0@@ -155,6 +155,13 @@ C. Boot options used by text. By default, this area will be black. The 'color'value
is an integer number that depends on the framebuffer driver being
used.
+6. fbcon=nodeferDocumentation/fb/fbcon.txt +2
-0+ + If the kernel is compiled with deferred fbcon takeover support,normally
+ the framebuffer contents, left in place by thefirmware/bootloader, will
+ be preserved until there actually is some text is output to the
console.Documentation/fb/fbcon.txt +2
-0+ This option causes fbcon to bind immediately to the fbdev device. + C. Attaching, Detaching and Unloading Before going on how to attach, detach and unload the framebufferconsole, an
drivers/video/console/Kconfig +5
-0@@ -150,6 +150,17 @@ config FRAMEBUFFER_CONSOLE_ROTATION such that other users of the framebuffer will remain normally oriented. +config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + bool "Framebuffer Console Deferred Takeover" + depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y + help + If enabled this defers the framebuffer console taking over the + console from the dummy console until the first text isdisplayed on
+ the console. This is useful in combination with the "quiet"
kernel
+ commandline option to keep the framebuffer contents initially
put up
+ by the firmware in place, rather then replacing the contents
with adrivers/video/console/Kconfig +2
-0+ black screen as soon as fbcon loads. + config STI_CONSOLE bool "STI text console" depends on PARISC && HAS_IOMEMdrivers/video/console/dummycon.c +53
-0@@ -26,6 +26,65 @@#define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS#endif +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +/* These are both protected by the console_lock */ +static RAW_NOTIFIER_HEAD (dummycon_output_nh); +static bool dummycon_putc_called; + +void dummycon_register_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_register (&dummycon_output_nh, nb); + +if (dummycon_putc_called) + nb->notifier_call (nb,0 ,NULL ); +} + +void dummycon_unregister_output_notifier (struct notifier_block *nb) +{ +raw_notifier_chain_unregister (&dummycon_output_nh, nb); +} + +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) +{ + dummycon_putc_called = true; +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) +{ +int i; + +if (!dummycon_putc_called) { +/* Ignore erases */ +for (i =0 ; i < count; i++) { +if (s[i] != vc->vc_video_erase_char) +break ; + } +if (i = count) +return ; + + dummycon_putc_called = true; + } + +raw_notifier_call_chain (&dummycon_output_nh,0 ,NULL ); +} + +static int dummycon_blank (struct vc_data *vc,int blank,int mode_switch) +{ +/* Redraw, so that we get putc(s) for output done while blanked */ +return 1 ; +} +#else +static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } +static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, +int count,int ypos,int xpos) { } +static int dummycon_blank(struct vc_data *vc, int blank, int
mode_switch)drivers/video/console/dummycon.c +5
-3+{ +return 0 ; +} +#endif +static const char *dummycon_startup (void ) {return "dummy device" ;@@ -44,9 +103,6 @@ static void dummycon_init(struct vc_data *vc, int init) static void dummycon_deinit(struct vc_data *vc) { }static void dummycon_clear (struct vc_data *vc,int sy,int sx,int height,int width) { } -static void dummycon_putc (struct vc_data *vc,int c,int ypos,int xpos) { } -static void dummycon_putcs (struct vc_data *vc,const unsigned short *s, -int count,int ypos,int xpos) { }static void
dummycon_cursor(struct vc_data *vc, int mode){ }
static bool dummycon_scroll(structvc_data*vc, unsigned int top,drivers/video/console/dummycon.c +0
-4@@ -61,11 +117,6 @@ static int dummycon_switch(struct vc_data *vc)return 0 ; } -static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch) -{ -return 0 ; -} - static int dummycon_font_set(struct vc_data *vc, struct console_font *font, unsigned int flags) {drivers/video/fbdev/core/fbcon.c +5
-0@@ -129,6 +129,12 @@ static inline void fbcon_map_override(void) }#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */ +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static bool deferred_takeover = true; +#else +#define deferred_takeover false +#endif +/* font data */ static char fontname[40 ]; @@ -499,6 +505,12 @@ static int __init fb_console_setup(char *this_opt) margin_color = simple_strtoul(options,&options, 0); continue; }drivers/video/fbdev/core/fbcon.c +61
-0+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +if (!strcmp (options,"nodefer" )) { + deferred_takeover = false; +continue ; + } +#endif }return 1 ; }@@ -3100,6 +3112,9 @@ static int fbcon_fb_unregistered(struct fb_info *info)WARN_CONSOLE_UNLOCKED (); + if (deferred_takeover) +return 0 ; + idx = info->node;for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map[i] = idx)@@ -3140,6 +3155,13 @@ static void fbcon_remap_all(int idx)WARN_CONSOLE_UNLOCKED (); + if (deferred_takeover) { +for (i = first_fb_vc; i <= last_fb_vc; i++) + con2fb_map_boot[i] = idx; +fbcon_map_override (); +return ; + } +for (i = first_fb_vc; i <= last_fb_vc; i++)set_con2fb_map (i, idx,0 ); @@ -3191,6 +3213,11 @@ static int fbcon_fb_registered(struct fb_info *info) idx = info->node;fbcon_select_primary (info); + if (deferred_takeover) { +pr_info ("fbcon: Deferring console take-over\n" ); +return 0 ; + } +if (info_idx =-1 ) {for (i = first_fb_vc; i <= last_fb_vc; i++) {if (con2fb_map_boot[i] = idx) {@@ -3566,8 +3593,46 @@ static int fbcon_init_device(void) return 0; } +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER +static struct notifier_block fbcon_output_nb; + +static int fbcon_output_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + int i; + + WARN_CONSOLE_UNLOCKED(); + + pr_info("fbcon: Taking over console\n"); + + dummycon_unregister_output_notifier(&fbcon_output_nb); + deferred_takeover = false; + logo_shown = FBCON_LOGO_DONTSHOW; + + for (i = 0; i < FB_MAX; i++) { + if (registered_fb[i]) + fbcon_fb_registered(registered_fb[i]); + } + + return NOTIFY_OK; +} + +static void fbcon_register_output_notifier(void) +{ + fbcon_output_nb.notifier_call = fbcon_output_notifier; + dummycon_register_output_notifier(&fbcon_output_nb); +} +#else +static inline void fbcon_register_output_notifier(void) {} +#endif + static void fbcon_start(void) { + if (deferred_takeover) { + fbcon_register_output_notifier(); + return; + } + if (num_registered_fb) { int i; @@ -3594,6 +3659,13 @@ static void fbcon_exit(void) if (fbcon_has_exited) return; +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER + if (deferred_takeover) { + dummycon_unregister_output_notifier(&fbcon_output_nb); + deferred_takeover = false; + } +#endif + kfree((void *)softback_buf); softback_buf = 0UL; diff --git a/include/linux/console.h b/include/linux/console.hindex
dfd6b0e97855..f59f3dbca65c100644include/linux/console.h +4
-1@@ -21,6 +21,7 @@ struct console_font_op;struct console_font ;struct module ;struct tty_struct ; +struct notifier_block ;/* * this is what the terminal answers to a ESC-Z or csi0c query. @@ -220,4 +221,8 @@ static inline bool vgacon_text_force(void) { return false; }extern void console_init (void ); +/* For deferred console takeover */ +void dummycon_register_output_notifier(struct notifier_block *nb); +void dummycon_unregister_output_notifier (struct notifier_block *nb); +#endif /* _LINUX_CONSOLE_H */ --2.17.1
Quoted 6 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · On Tue, 26 Jun 2018 20:36:09 +0200 Hans de Goede <[email protected]> wrote:
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.
The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Quoted 8 lines
Petr, the printk subsys change is really trivial (1 line addition) can we get your Acked-by for merging all 3 patches through the fbdev tree?
Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in place
For 1 and 2:
I'll let others handle patch 3.
-- Steve
Quoted 30 lines · Hans de Goede
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.
The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Petr, the printk subsys change is really trivial (1 line addition) can we get your Acked-by for merging all 3 patches through the fbdev tree?
Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in placeChanges in v3:
(quoted diff) +0
-4-Export is_console_locke() for use in modules (as fbcon may be built as a .ko) -Use WARN_CONSOLE_UNLOCKED() in several places in the fbcon code to assert proper locking (requested by Daniel) -Unregister the fbcon-dummycon-output-notifier on fbcon_exit() (req. by Daniel) -Document the fbcon=nodefer commandline option (req. by Emil)Changes in v2:
Review
Quoted 5 lines
(quoted diff) +0
-2-Check the whole string when checking for erases in putcs, instead of just the first char -Make dummycon_blank return 1, so that a redraw gets triggered and any text rendered while blanked gets output so that it can trigger a deferred takeover if one is pending
Wrt merging I think it'd be best if we stuff this into drm-misc-next - that will increase testing by gpu drivers a lot, instead of a suprise when the fbdev pull lands in upstream.
Bart, is that ok with you?
Hans, if Bart acks this you can directly push this imo. -Daniel
Quoted 9 lines
Regards,
Hans
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Quoted 41 lines · Daniel Vetter
Quoted 30 lines · Hans de Goede
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.
The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Petr, the printk subsys change is really trivial (1 line addition) can we get your Acked-by for merging all 3 patches through the fbdev tree?
Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in placeChanges in v3:
(quoted diff) +0
-4-Export is_console_locke() for use in modules (as fbcon may be built as a .ko) -Use WARN_CONSOLE_UNLOCKED() in several places in the fbcon code to assert proper locking (requested by Daniel) -Unregister the fbcon-dummycon-output-notifier on fbcon_exit() (req. by Daniel) -Document the fbcon=nodefer commandline option (req. by Emil)Changes in v2:
Review
Quoted 5 lines
(quoted diff) +0
-2-Check the whole string when checking for erases in putcs, instead of just the first char -Make dummycon_blank return 1, so that a redraw gets triggered and any text rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingWrt merging I think it'd be best if we stuff this into drm-misc-next - that will increase testing by gpu drivers a lot, instead of a suprise when the fbdev pull lands in upstream.
Quoted 1 line
Bart, is that ok with you?
Not really, since there are efifb changes in the queue which depend on this series I would really prefer to merge all patches through fbdev tree.
Also fbdev tree is pulled into -next kernels so testing coverage should be okay (I assume that everybody are testing -next kernels in addition to their own branches :-)..
Quoted 2 lines
Hans, if Bart acks this you can directly push this imo. -Daniel
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Hi,
Quoted 44 lines · Bartlomiej Zolnierkiewicz
Quoted 41 lines · Daniel Vetter
Quoted 30 lines · Hans de Goede
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.
The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Petr, the printk subsys change is really trivial (1 line addition) can we get your Acked-by for merging all 3 patches through the fbdev tree?
Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in placeChanges in v3:
(quoted diff) +0
-4-Export is_console_locke() for use in modules (as fbcon may be built as a .ko) -Use WARN_CONSOLE_UNLOCKED() in several places in the fbcon code to assert proper locking (requested by Daniel) -Unregister the fbcon-dummycon-output-notifier on fbcon_exit() (req. by Daniel) -Document the fbcon=nodefer commandline option (req. by Emil)Changes in v2:
Review
Quoted 5 lines
(quoted diff) +0
-2-Check the whole string when checking for erases in putcs, instead of just the first char -Make dummycon_blank return 1, so that a redraw gets triggered and any text rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingWrt merging I think it'd be best if we stuff this into drm-misc-next - that will increase testing by gpu drivers a lot, instead of a suprise when the fbdev pull lands in upstream.
Quoted 1 line
Bart, is that ok with you?
Quoted 7 lines
Not really, since there are efifb changes in the queue which depend on this series I would really prefer to merge all patches through fbdev tree.
Also fbdev tree is pulled into -next kernels so testing coverage should be okay (I assume that everybody are testing -next kernels in addition to their own branches :-)..
If you are talking about the "efifb: Copy the ACPI BGRT boot graphics to the framebuffer" series, I could push those to drm-misc-next too (once acked).
I think most GPU driver developers are running drm-tip and not -next, so putting things in drm-misc-next would give the changes somewhat more test-exposure on a wider range of GPUs I believe. Where as -next testing will likely be more server use-case oriented.
Alternatively you could merge things in the fbdev tree, do an unmutable branch and then that could be merged into drm-misc-next by the drm-misc-next maintainers.
Note either way is fine with me. This is up to you and Daniel.
Regards,
Hans
Quoted 69 lines · Hans de Goede
Hi,
Quoted 65 lines · Bartlomiej Zolnierkiewicz
Quoted 53 lines · Daniel Vetter
Quoted 36 lines · Hans de Goede
Hi All,
Here is v4 of my patch-set, to delay fbcon taking over the console (and binding to fbdev devices) until there actually is some text output to the
console. This is intended for use with the "quiet" cmdline option, in combination with a bootloader which leaves the vendor's logo / EFI bootgraphics put up by the firmware intact on the EFI framebuffer.The end goal here is a boot where the firmware shows its boot graphics and these stay in place for a couple of seconds until the GUI loads and the GUI then smoothly takes over the framebuffer without any distruptions.
This patch-set spans 2 subsystems.
Petr, the printk subsys change is really trivial (1 line addition) can we
get your Acked-by for merging all 3 patches through the fbdev tree?Changelog:
Changes in v4:
-Keep the comments about which fbcon functions need locks in placeChanges in v3:
-Exportis_console_locke()for use in modules (as fbcon may be built as a .ko)
-UseWARN_CONSOLE_UNLOCKED()in several places in the fbcon code to assert
proper locking (requested by Daniel)
-Unregister the fbcon-dummycon-output-notifier onfbcon_exit()(req. by Daniel)
-Document the fbcon=nodefer commandline option (req. by Emil)Quoted 8 lines
Changes in v2:
-Check the whole string when checking for erases in putcs, instead of just
the first char
-Makedummycon_blankreturn 1, so that a redraw gets triggered and any text
rendered while blanked gets output so that it can trigger a deferred takeover if one is pendingWrt merging I think it'd be best if we stuff this into drm-misc-next - that will increase testing by gpu drivers a lot, instead of a suprise when
the fbdev pull lands in upstream.Quoted 1 line
Bart, is that ok with you?
Not really, since there are efifb changes in the queue which depend on this series I would really prefer to merge all patches through fbdev tree.
Also fbdev tree is pulled into -next kernels so testing coverage should be okay (I assume that everybody are testing -next kernels in addition to their own branches :-)..
Ime this is a rather unrealistic assumption ...
Quoted 8 lines
If you are talking about the "efifb: Copy the ACPI BGRT boot graphics to the framebuffer" series, I could push those to drm-misc-next too (once acked).
I think most GPU driver developers are running drm-tip and not -next, so putting things in drm-misc-next would give the changes somewhat more test-exposure on a wider range of GPUs I believe. Where as -next testing will likely be more server use-case oriented.
Quoted 5 lines
Alternatively you could merge things in the fbdev tree, do an unmutable branch and then that could be merged into drm-misc-next by the drm-misc-next maintainers.
Note either way is fine with me. This is up to you and Daniel.
Yeah pull request for a topic branch works too.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch