Re: [PATCH 5.15 808/917] drm: fb_helper: improve CONFIG_FB dependency

Arnd Bergmann
2021-11-19T08:10:52Z

On Fri, Nov 19, 2021 at 8:56 AM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> On 19. 11. 21, 8:50, Jiri Slaby wrote:
> > On 15. 11. 21, 18:05, Greg Kroah-Hartman wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> [ Upstream commit 9d6366e743f37d36ef69347924ead7bcc596076e ]
> >
> > Hi,
> >
> > this breaks build on openSUSE's armv7hl config:
> > $ wget -O .config
> > https://raw.githubusercontent.com/openSUSE/kernel-source/stable/config/armv7hl/default
> >
> > $ make -j168 CROSS_COMPILE=arm-suse-linux-gnueabi- ARCH=arm vmlinux
> > ...
> > LD .tmp_vmlinux.btf
> > arm-suse-linux-gnueabi-ld: drivers/gpu/drm/panel/panel-simple.o: in
> > function `panel_simple_probe':
> > drivers/gpu/drm/panel/panel-simple.c:803: undefined reference to
> > `drm_panel_dp_aux_backlight'
> > $ grep -E 'CONFIG_(DRM|FB|DRM_KMS_HELPER|DRM_FBDEV_EMULATION)\>' .config
> > CONFIG_DRM=y
> > CONFIG_DRM_KMS_HELPER=m
> > CONFIG_DRM_FBDEV_EMULATION=y
> > CONFIG_FB=y
> >
> > 5.16-rc1 builds just fine -- investigating why…
>
> CLearly because the code moved to panel-edp.c. So doing:
> -CONFIG_DRM_PANEL_EDP=m
> +CONFIG_DRM_PANEL_EDP=y
> leads to the same error in that file:
> arm-suse-linux-gnueabi-ld: drivers/gpu/drm/panel/panel-edp.o: in
> function `panel_edp_probe':
> drivers/gpu/drm/panel/panel-edp.c:843: undefined reference to
> `drm_panel_dp_aux_backlight'

Ah right, I ran into a similar thing on my randconfig builds, this is
what I have
applied locally but wasn't completely sure about yet, it may need additional
'select DRM_KMS_CMA_HELPER' to cover all instances:

commit 8dd05af5243f3ab968b317ef82b3c0d04079b805
Author: Arnd Bergmann <arnd@arndb.de>
Date: Mon Nov 15 16:54:04 2021 +0100

drm/mipi-dbi: select CONFIG_DRM_KMS_HELPER

The driver fails to build when the KMS helpers are disabled:

ld.lld: error: undefined symbol: drm_gem_fb_get_obj
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_fb_dirty) in
archive drivers/built-in.a

ld.lld: error: undefined symbol: drm_gem_fb_begin_cpu_access
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

ld.lld: error: undefined symbol: drm_fb_swab
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

ld.lld: error: undefined symbol: drm_fb_xrgb8888_to_rgb565
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

ld.lld: error: undefined symbol: drm_fb_memcpy
>>> referenced by drm_mipi_dbi.c
>>> gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

This is fairly hard to hit in randconfig drivers, but it eventually
did trigger for me in a configuration where all other DRM drivers
are loadable modules, but DRM_PANEL_WIDECHIPS_WS2401 was built-in.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 0039df26854b..a03c2761c5f9 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -29,6 +29,7 @@ menuconfig DRM

config DRM_MIPI_DBI
tristate
+ select DRM_KMS_HELPER
depends on DRM

config DRM_MIPI_DSI
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 431b6e12a81f..17a8d603e7d8 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -8,7 +8,6 @@ config DRM_BRIDGE
config DRM_PANEL_BRIDGE
def_bool y
depends on DRM_BRIDGE
- depends on DRM_KMS_HELPER
select DRM_PANEL
help
DRM bridge wrapper of DRM panels
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index cfc8d644cedf..40ec20f3552d 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -140,9 +140,8 @@ config DRM_PANEL_ILITEK_IL9322
config DRM_PANEL_ILITEK_ILI9341
tristate "Ilitek ILI9341 240x320 QVGA panels"
depends on OF && SPI
- depends on DRM_KMS_HELPER
- depends on DRM_KMS_CMA_HELPER
depends on BACKLIGHT_CLASS_DEVICE
+ select DRM_KMS_CMA_HELPER
select DRM_MIPI_DBI
help
Say Y here if you want to enable support for Ilitek IL9341