Skip to contentSkip to conversation

fbdev: Split frame buffer support in FB and FB_CORE symbols

RFC PATCH In review Javier Martinez Canillas 1 participant 1 message Aug 27, 2021

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

RFC PATCH 3/4 fbdev: Split frame buffer support in FB and FB_CORE symbols

Currently the CONFIG_FB option has to be enabled even if no legacy fbdev drivers are needed, in order to have support for a framebuffer console.

The DRM subsystem has a fbdev emulation layer, but depends on CONFIG_FB and so it can only be enabled if that dependency is enabled as well.

That means fbdev drivers have to be explicitly disabled if users want to enable CONFIG_FB, only to use fbcon with the DRM fbdev emulation layer.

This patch introduces a CONFIG_FB_CORE option that could be enabled just to have the core support needed for CONFIG_DRM_FBDEV_EMULATION, allowing CONFIG_FB to be disabled (and automatically disabling all fbdev drivers).

The fbsysfs.o object is left out of fb_core.o, because that's not needed for KMS drivers and the DRM fbdev emulation layer.

---

 arch/x86/Makefile                 |  2 +-
 arch/x86/video/Makefile           |  2 +-
 drivers/video/console/Kconfig     |  2 +-
 drivers/video/fbdev/Kconfig       | 57 ++++++++++++++++++-------------
 drivers/video/fbdev/core/Makefile | 13 ++++---
 include/linux/fb.h                | 14 ++++++++
 6 files changed, 59 insertions(+), 31 deletions(-)
arch/x86/Makefile +1 -1
index 44dd071d836..dc409539218 100644
@@ -229,7 +229,7 @@ drivers-$(CONFIG_PCI)            += arch/x86/pci/
 # suspend and hibernation support
 drivers-$(CONFIG_PM) += arch/x86/power/
 
-drivers-$(CONFIG_FB) += arch/x86/video/
+drivers-$(CONFIG_FB_CORE) += arch/x86/video/
 
 ####
 # boot loader support. Several targets are kept for legacy purposes
arch/x86/video/Makefile +1 -1
index 11640c11611..cb0735bd662 100644
@@ -1,2 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_FB)               += fbdev.o
+obj-$(CONFIG_FB_CORE)               += fbdev.o
drivers/video/console/Kconfig +1 -1
index 840d9813b0b..0c562ed3495 100644
@@ -71,7 +71,7 @@ config DUMMY_CONSOLE_ROWS
 
 config FRAMEBUFFER_CONSOLE
 	bool "Framebuffer Console support"
-	depends on FB && !UML
+	depends on FB_CORE && !UML
 	select VT_HW_CONSOLE_BINDING
 	select CRC32
 	select FONT_SUPPORT
drivers/video/fbdev/Kconfig +34 -23

170 lines not on this page · raw message

drivers/video/fbdev/core/Makefile +8 -5
index 26cbc965497..328a017c78b 100644
@@ -1,22 +1,25 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_FB_CMDLINE)          += fb_cmdline.o
 obj-$(CONFIG_FB_NOTIFY)           += fb_notify.o
+obj-$(CONFIG_FB_CORE)             += fb_core.o
 obj-$(CONFIG_FB)                  += fb.o
-fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
+fb_core-y                         := fbmem.o fbmon.o fbcmap.o \
                                      modedb.o fbcvt.o
-fb-$(CONFIG_FB_DEFERRED_IO)       += fb_defio.o
+fb_core-$(CONFIG_FB_DEFERRED_IO)  += fb_defio.o
 
 ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y)
-fb-y				  += fbcon.o bitblit.o softcursor.o
+fb_core-y			  += fbcon.o bitblit.o softcursor.o
 ifeq ($(CONFIG_FB_TILEBLITTING),y)
-fb-y				  += tileblit.o
+fb_core-y			  += tileblit.o
 endif
 ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
-fb-y				  += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
+fb_core-y			  += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
 				     fbcon_ccw.o
 endif
 endif
 
+fb-y				  := fbsysfs.o
+
 obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
 obj-$(CONFIG_FB_CFB_COPYAREA)  += cfbcopyarea.o
 obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
include/linux/fb.h +14 -0
index 96111248a25..f66eefbf1ee 100644
@@ -689,9 +689,23 @@ static inline bool fb_be_math(struct fb_info *info)
 /* drivers/video/fbsysfs.c */
 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
 extern void framebuffer_release(struct fb_info *info);
+#if IS_ENABLED(CONFIG_FB)
 extern int fb_register_sysfs(struct fb_info *fb_info);
 extern void fb_unregister_sysfs(struct fb_info *head);
 extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
+#else
+static inline int fb_register_sysfs(struct fb_info *fb_info)
+{
+	return 0;
+}
+static inline void fb_unregister_sysfs(struct fb_info *head)
+{
+}
+static inline void fb_bl_default_curve(struct fb_info *fb_info, u8 off,
+				       u8 min, u8 max)
+{
+}
+#endif
 
 /* drivers/video/fbmon.c */
 #define FB_MAXTIMINGS		0
Signature · 1 line
2.31.1