Skip to contentSkip to conversation

console/fbcon: Add support for deferred console takeover

PATCH In review Hans de Goede 2 participants 3 messages May 28, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover console/fbcon: Add support for deferred console takeover

Hi All,

Allthough this patch has turned out pleasantly small / simpel, I guess it still might be somewhat controversial. So let me explain why this patch is necessary.

Various (desktop oriented) Linux distributions have spend a lot of time to not show way too technial boot messages to end users during bootup. What we would really like for the boot experience is something like MacOS X / Windows 10 do. The (EFI) firmware boots up a logo and we leave that in place until the login-manager (e.g. gdm) starts and then the login-manager takes over the framebuffer including the current logo contents and fades that into the login screen.

I've already written and upstreamed a patch for shim to not switch the EFI framebuffer to text-mode, unless it has some error message to display this is upstream now:
https://github.com/rhboot/shim/commit/1ff4a36a23ac5c17144275ccb3e1e1061750a137

I've written a similar patch for grub2 to not switch to text-mode when using timeout_style=hidden for the menu and no key to show the menu is pressed. This has been posted upstream and I need to do a v2 addressing some small remarks.

This brings us to the next piece of software taking over control of the framebuffer, the kernel.

I already have a patch in -next to fix the i915 driver not taking over the BIOS used framebuffer (and thus loosing the vendor logo) on newer hardware:
https://cgit.freedesktop.org/drm-intel/commit?id1f22eb545a35f972036bb6a245c95c2e7e15a0

But this is only useful if we don't get fbcon binding to any fbdev devices showing up and replacing there contents with a black screen right away.

That is where this patch comes in it defers fbcon binding to any registered fbdevs, until some output, any output at all, is send to the console (tty0), this way error messages will still get shown, but a well behaved userspace which does not spam the console with messages will retain the vendor logo from the EFI firmware all the way to the login screen.

Regards,

Hans

#1 lore raw

PATCH 1/1 console/fbcon: Add support for deferred console takeover

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

---
 drivers/video/console/Kconfig    | 11 ++++++
 drivers/video/console/dummycon.c | 46 ++++++++++++++++++++--
 drivers/video/fbdev/core/fbcon.c | 65 ++++++++++++++++++++++++++++++++
 include/linux/console.h          |  5 +++
 4 files changed, 124 insertions(+), 3 deletions(-)
drivers/video/console/Kconfig +11 -0
index 4110ba7d7ca9..e91edef98633 100644
@@ -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 +43 -3

58 lines not on this page · raw message

drivers/video/fbdev/core/fbcon.c +65 -0

103 lines not on this page · raw message

include/linux/console.h +5 -0
index dfd6b0e97855..f59f3dbca65c 100644
@@ -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.0
#2 lore raw
In reply to Hans de Goede
Quoted 30 lines · Hans de Goede

Various (desktop oriented) Linux distributions have spend a lot of time to not show way too technial boot messages to end users during bootup. What we would really like for the boot experience is something like MacOS X / Windows 10 do. The (EFI) firmware boots up a logo and we leave that in place until the login-manager (e.g. gdm) starts and then the login-manager takes over the framebuffer including the current logo contents and fades that into the login screen.

I've already written and upstreamed a patch for shim to not switch the EFI framebuffer to text-mode, unless it has some error message to display this is upstream now:
https://github.com/rhboot/shim/commit/1ff4a36a23ac5c17144275ccb3e1e1061750a137

I've written a similar patch for grub2 to not switch to text-mode when using timeout_style=hidden for the menu and no key to show the menu is pressed. This has been posted upstream and I need to do a v2 addressing some small remarks.

This brings us to the next piece of software taking over control of the framebuffer, the kernel.

I already have a patch in -next to fix the i915 driver not taking over the BIOS used framebuffer (and thus loosing the vendor logo) on newer hardware:
https://cgit.freedesktop.org/drm-intel/commit?id=011f22eb545a35f972036bb6a245c95c2e7e15a0

But this is only useful if we don't get fbcon binding to any fbdev devices showing up and replacing there contents with a black screen right away.

Quoted 5 lines

That is where this patch comes in it defers fbcon binding to any registered fbdevs, until some output, any output at all, is send to the console (tty0), this way error messages will still get shown, but a well behaved userspace which does not spam the console with messages will retain the vendor logo from the EFI firmware all the way to the login screen.

FWIW I think the main idea here is sound: just preserve whatever image the firmware decided to display until something noteworthy happens or gdm takes over. (And you could perhaps override the image in grub if you like, and preserve that until gdm instead.)

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel