On Fri, Jul 14, 2023, at 19:16, Javier Martinez Canillas wrote: > Currently the CONFIG_FB option has to be enabled even if no legacy fbdev > drivers are needed (e.g: only to have support for framebuffer consoles). > > 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 and/or the DRM fbdev emulation layer. > > This patch introduces a non-visible CONFIG_FB_CORE symbol that could be > enabled just to have core support needed for CONFIG_DRM_FBDEV_EMULATION, > allowing CONFIG_FB to be disabled (and automatically disabling all the > fbdev drivers). > > Nothing from fb_backlight.o and fbmon.o is used by the DRM fbdev emulation > layer so these two objects can be compiled out when CONFIG_FB is disabled. I gave this a spin in my randconfig build setup and found one small mistake: > diff --git a/drivers/video/fbdev/core/Makefile > b/drivers/video/fbdev/core/Makefile > index 9150bafd9e89..2cd213716c12 100644 > --- a/drivers/video/fbdev/core/Makefile > +++ b/drivers/video/fbdev/core/Makefile > @@ -1,10 +1,10 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-$(CONFIG_FB_NOTIFY) += fb_notify.o > -obj-$(CONFIG_FB) += fb.o > -fb-y := fb_backlight.o \ > - fb_info.o \ > - fbmem.o fbmon.o fbcmap.o \ > +obj-$(CONFIG_FB_CORE) += fb.o > +fb-y := fb_info.o \ > + fbmem.o fbcmap.o \ > modedb.o fbcvt.o fb_cmdline.o > fb_io_fops.o > +fb-$(CONFIG_FB) += fb_backlight.o fbmon.o With CONFIG_FB_CORE=y and CONFIG_FB=m, Kbuild does not include the fb_backlight.o and fbmon.o files in fb.ko because they are not set to =y, causing link failures for fbdev drivers later: ERROR: modpost: "of_get_fb_videomode" [drivers/video/fbdev/clps711x-fb.ko] undefined! ERROR: modpost: "fb_videomode_from_videomode" [drivers/video/fbdev/atmel_lcdfb.ko] undefined! ERROR: modpost: "of_get_fb_videomode" [drivers/video/fbdev/imxfb.ko] undefined! ERROR: modpost: "fb_destroy_modedb" [drivers/video/fbdev/udlfb.ko] undefined! ERROR: modpost: "fb_edid_to_monspecs" [drivers/video/fbdev/udlfb.ko] undefined! ERROR: modpost: "fb_destroy_modedb" [drivers/video/fbdev/smscufx.ko] undefined! ERROR: modpost: "fb_edid_to_monspecs" [drivers/video/fbdev/smscufx.ko] undefined! ERROR: modpost: "fb_destroy_modedb" [drivers/video/fbdev/uvesafb.ko] undefined! ERROR: modpost: "fb_validate_mode" [drivers/video/fbdev/uvesafb.ko] undefined! ERROR: modpost: "fb_get_mode" [drivers/video/fbdev/uvesafb.ko] undefined! Folding this fixup into the patch makes it work: diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index 2cd213716c12f..84ddc5d308b58 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -4,7 +4,9 @@ obj-$(CONFIG_FB_CORE) += fb.o fb-y := fb_info.o \ fbmem.o fbcmap.o \ modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o -fb-$(CONFIG_FB) += fb_backlight.o fbmon.o +ifdef CONFIG_FB +fb-y += fb_backlight.o fbmon.o +endif fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o fb-$(CONFIG_FB_DEVICE) += fb_chrdev.o \ fb_procfs.o \ Arnd