linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dummycon: Add dummycon_(un)register_switch_notifier
@ 2024-02-02  8:53 Daniel van Vugt
  2024-02-02  8:53 ` [PATCH 2/2] fbcon: Defer console takeover for splash screens to first switch Daniel van Vugt
  0 siblings, 1 reply; 26+ messages in thread
From: Daniel van Vugt @ 2024-02-02  8:53 UTC (permalink / raw)
  Cc: Daniel van Vugt, Greg Kroah-Hartman, Helge Deller, linux-fbdev,
	dri-devel, linux-kernel

To detect switch attempts before a real console exists. This will be
used for the same purpose as dummycon_(un)register_output_notifier,
for fbcon to detect a more polite time to take over.

Signed-off-by: Daniel van Vugt <daniel.van.vugt@canonical.com>
---
 drivers/video/console/dummycon.c | 35 +++++++++++++++++++++++++++-----
 include/linux/console.h          |  2 ++
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index 14af5d9e13..55e9b600ce 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -83,6 +83,32 @@ 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;
 }
+
+/* This is protected by the console_lock */
+static RAW_NOTIFIER_HEAD(dummycon_switch_nh);
+
+void dummycon_register_switch_notifier(struct notifier_block *nb)
+{
+	WARN_CONSOLE_UNLOCKED();
+
+	raw_notifier_chain_register(&dummycon_switch_nh, nb);
+}
+
+void dummycon_unregister_switch_notifier(struct notifier_block *nb)
+{
+	WARN_CONSOLE_UNLOCKED();
+
+	raw_notifier_chain_unregister(&dummycon_switch_nh, nb);
+}
+
+static int dummycon_switch(struct vc_data *vc)
+{
+	WARN_CONSOLE_UNLOCKED();
+
+	raw_notifier_call_chain(&dummycon_switch_nh, 0, vc);
+
+	return 0;
+}
 #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,
@@ -91,6 +117,10 @@ static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
 {
 	return 0;
 }
+static int dummycon_switch(struct vc_data *vc)
+{
+	return 0;
+}
 #endif
 
 static const char *dummycon_startup(void)
@@ -120,11 +150,6 @@ static bool dummycon_scroll(struct vc_data *vc, unsigned int top,
 	return false;
 }
 
-static int dummycon_switch(struct vc_data *vc)
-{
-	return 0;
-}
-
 /*
  *  The console `switch' structure for the dummy console
  *
diff --git a/include/linux/console.h b/include/linux/console.h
index 779d388af8..8fd70ae623 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -531,5 +531,7 @@ 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);
+void dummycon_register_switch_notifier(struct notifier_block *nb);
+void dummycon_unregister_switch_notifier(struct notifier_block *nb);
 
 #endif /* _LINUX_CONSOLE_H */
-- 
2.43.0


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

end of thread, other threads:[~2024-02-28 18:09 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02  8:53 [PATCH 1/2] dummycon: Add dummycon_(un)register_switch_notifier Daniel van Vugt
2024-02-02  8:53 ` [PATCH 2/2] fbcon: Defer console takeover for splash screens to first switch Daniel van Vugt
2024-02-02 19:46   ` Mario Limonciello
2024-02-06 10:10     ` [PATCH v2 1/2] dummycon: Add dummycon_(un)register_switch_notifier Daniel van Vugt
2024-02-06 10:10       ` [PATCH v2 2/2] fbcon: Defer console takeover for splash screens to first switch Daniel van Vugt
2024-02-06 14:21         ` Daniel Vetter
2024-02-06 15:41           ` Mario Limonciello
2024-02-07  2:03             ` Daniel van Vugt
2024-02-07  9:51               ` Daniel Vetter
2024-02-07 20:21                 ` Mario Limonciello
2024-02-08  1:16                   ` Daniel van Vugt
2024-02-09 10:58                     ` Daniel Vetter
2024-02-13  7:01                       ` Daniel van Vugt
2024-02-14  5:24                         ` [PATCH v3 1/2] dummycon: Add dummycon_(un)register_switch_notifier Daniel van Vugt
2024-02-14  5:24                           ` [PATCH v3 2/2] fbcon: Defer console takeover for splash screens to first switch Daniel van Vugt
2024-02-15 19:40                             ` Mario Limonciello
2024-02-19  9:02                               ` [PATCH v4 1/2] dummycon: Add dummycon_(un)register_switch_notifier Daniel van Vugt
2024-02-19  9:02                                 ` [PATCH v4 2/2] fbcon: Defer console takeover for splash screens to first switch Daniel van Vugt
2024-02-22 11:08                                   ` Maxime Ripard
2024-02-22 16:25                                     ` Mario Limonciello
2024-02-26 18:23   ` [PATCH " Hans de Goede
2024-02-27  1:06     ` Daniel van Vugt
2024-02-27 13:47       ` Hans de Goede
2024-02-28  2:00         ` Daniel van Vugt
2024-02-28 11:54           ` Hans de Goede
2024-02-28 18:09             ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).