Skip to contentSkip to conversation

fbcon: Allow fbcon to use the primary display driver

PATCH In review Antonino A. Daplas 1 participant 2 messages May 27, 2007 – May 28, 2007

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

PATCH 9/9 fbcon: Allow fbcon to use the primary display driver

Allow fbcon to select the primary display adapter using the fb_is_primary_device() arch-specific helper. If a a primary adapter is detected, fbcon will unbind the old adapter from the VT layer, then rebind using the new adapter. This requires that bind_/unbind_con_driver() be made public.

Because this feature may produce unexpected behavior (from the user's POV), this must be explicitly enabled in Kconfig.

---

 arch/i386/video/fbdev.c       |    4 +-
 drivers/char/vt.c             |    6 +--
 drivers/video/console/Kconfig |   20 ++++++++++
 drivers/video/console/fbcon.c |   80 +++++++++++++++++++++++++++++++++++++----
 include/linux/vt_kern.h       |    4 ++
 5 files changed, 100 insertions(+), 14 deletions(-)
arch/i386/video/fbdev.c +1 -3
index 7fc712c..48fb38d 100644
@@ -13,13 +13,11 @@ #include <linux/pci.h>
 
 int fb_is_primary_device(struct fb_info *info)
 {
-	struct device *device;
+	struct device *device = info->device;
 	struct pci_dev *pci_dev = NULL;
 	struct resource *res = NULL;
 	int retval = 0;
 
-	device = info->device;
-
 	if (device)
 		pci_dev = to_pci_dev(device);
 
drivers/char/vt.c +2 -4
index bbd9fc4..45baf04 100644
@@ -2863,8 +2863,7 @@ #include <linux/device.h>
 
 static struct class *vtconsole_class;
 
-static int bind_con_driver(const struct consw *csw, int first, int last,
-			   int deflt)
+int bind_con_driver(const struct consw *csw, int first, int last, int deflt)
 {
 	struct module *owner = csw->owner;
 	const char *desc = NULL;
@@ -2981,8 +2980,7 @@ static int con_is_graphics(const struct 
 	return retval;
 }
 
-static int unbind_con_driver(const struct consw *csw, int first, int last,
-			     int deflt)
+int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
 {
 	struct module *owner = csw->owner;
 	const struct consw *defcsw = NULL;
drivers/video/console/Kconfig +20 -0
index 63b85bf..1e11d30 100644
@@ -118,6 +118,26 @@ config FRAMEBUFFER_CONSOLE
 	help
 	  Low-level framebuffer-based console driver.
 
+config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
+       bool "Map the console to the primary display device"
+       depends on FRAMEBUFFER_CONSOLE && VT_HW_CONSOLE_BINDING
+       default n
+       ---help---
+         If this option is selected, the framebuffer console will
+         automatically select the primary display device (if the architecture
+	 supports this feature).  Otherwise, the framebuffer console will
+         always select the first framebuffer driver that is loaded. The latter
+         is the default behavior.
+
+	 You can always override the automatic selection of the primary device
+	 by using the fbcon=map: boot option.
+
+	 To select this feature, "Support for binding and unbinding console
+         drivers", under "Device Drivers"->"Character Devices" must be set to
+	 y.
+
+	 If unsure, select n.
+
 config FRAMEBUFFER_CONSOLE_ROTATION
        bool "Framebuffer Console Rotation"
        depends on FRAMEBUFFER_CONSOLE
drivers/video/console/fbcon.c +73 -7

135 lines not on this page · raw message

include/linux/vt_kern.h +4 -0
index d961635..0d034d8 100644
@@ -75,6 +75,10 @@ int con_copy_unimap(struct vc_data *dst_
 int vt_waitactive(int vt);
 void change_console(struct vc_data *new_vc);
 void reset_vc(struct vc_data *vc);
+extern int bind_con_driver(const struct consw *csw, int first, int last,
+			   int deflt);
+extern int unbind_con_driver(const struct consw *csw, int first, int last,
+			     int deflt);
 
 /*
  * vc_screen.c shares this temporary buffer with the console write code so that

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

#1 lore raw

PATCH 9/9 fbcon: Allow fbcon to use the primary display driver fix

unbind_con_driver() should be EXPORT_SYBOL.

---

Quoted 9 lines · Antonino A. Daplas

Allow fbcon to select the primary display adapter using the fb_is_primary_device() arch-specific helper. If a a primary adapter is detected, fbcon will unbind the old adapter from the VT layer, then rebind using the new adapter. This requires that bind_/unbind_con_driver() be made public.

Because this feature may produce unexpected behavior (from the user's POV), this must be explicitly enabled in Kconfig.

link errors if compiled as a module. Here's the fix.

Tony

 drivers/char/vt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/vt.c +1 -0
index 45baf04..e5f36e7 100644
@@ -2962,6 +2962,7 @@ err:
 	module_put(owner);
 	return retval;
 };
+EXPORT_SYMBOL(bind_con_driver);
 
 #ifdef CONFIG_VT_HW_CONSOLE_BINDING
 static int con_is_graphics(const struct consw *csw, int first, int last)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/