Skip to contentSkip to conversation

drm: rework FB_CORE dependency

PATCH Superseded Arnd Bergmann 4 participants 4 messages Nov 15, 2024 – Nov 17, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: rework FB_CORE dependency

From: Arnd Bergmann <[email protected]>

The 'select FB_CORE' statement moved from CONFIG_DRM to DRM_CLIENT_LIB, but there are now configurations that have code calling into fb_core as built-in even though the client_lib itself is a loadable module:

x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_driver_fbdev_probe':
drm_fbdev_shmem.c:(.text+0x1fc): undefined reference to `fb_deferred_io_init'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_fb_destroy':
drm_fbdev_shmem.c:(.text+0x2e1): undefined reference to `fb_deferred_io_cleanup'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_fb_mmap':
drm_fbdev_shmem.c:(.text+0x34c): undefined reference to `fb_deferred_io_mmap'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_imageblit':
drm_fbdev_shmem.c:(.text+0x35f): undefined reference to `sys_imageblit'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_copyarea':
drm_fbdev_shmem.c:(.text+0x38b): undefined reference to `sys_copyarea'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_fillrect':
drm_fbdev_shmem.c:(.text+0x3b7): undefined reference to `sys_fillrect'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_write':
drm_fbdev_shmem.c:(.text+0x3e9): undefined reference to `fb_sys_write'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_read':
drm_fbdev_shmem.c:(.text+0x413): undefined reference to `fb_sys_read'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend':
drm_fb_helper.c:(.text+0x2c6): undefined reference to `fb_set_suspend'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker':
drm_fb_helper.c:(.text+0x2e1): undefined reference to `fb_set_suspend'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_alloc_info':
drm_fb_helper.c:(.text+0x33a): undefined reference to `framebuffer_alloc'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x359): undefined reference to `fb_alloc_cmap'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x368): undefined reference to `framebuffer_release'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_release_info':
drm_fb_helper.c:(.text+0x3a4): undefined reference to `fb_dealloc_cmap'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x3ab): undefined reference to `framebuffer_release'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_unregister_info':
drm_fb_helper.c:(.text+0x3bb): undefined reference to `unregister_framebuffer'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `__drm_fb_helper_initial_config_and_unlock':
drm_fb_helper.c:(.text+0xb6d): undefined reference to `register_framebuffer'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend_unlocked':
drm_fb_helper.c:(.text+0x167a): undefined reference to `fb_set_suspend'

Since the code that calls into fb_core is not actually in the client_lib module but in other helper libraries, move the 'select' again to the places that actually call into fb_core, in this case DRM_GEM_SHMEM_HELPER and DRM_KMS_HELPER.

Fixes dadd28d4142f ("drm/client: Add client-lib module")

---
I have only given this light build testing. It seems sensible on the surface, but there is a chance that there are additional helpers that need the same 'select'. Moving it into CONFIG_DRM itself would be the safer option, but that seems to defeat the purpose of the client-lib module.

---
 drivers/gpu/drm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +2 -1
index a4a092ee70d9..4f21bff6282a 100644
@@ -98,6 +98,7 @@ config DRM_KUNIT_TEST
 config DRM_KMS_HELPER
 	tristate
 	depends on DRM
+	select FB_CORE if DRM_FBDEV_EMULATION
 	help
 	  CRTC helpers for KMS drivers.
 
@@ -220,7 +221,6 @@ config DRM_CLIENT_LIB
 	tristate
 	depends on DRM
 	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
-	select FB_CORE if DRM_FBDEV_EMULATION
 	help
 	  This option enables the DRM client library and selects all
 	  modules and components according to the enabled clients.
@@ -372,6 +372,7 @@ config DRM_GEM_SHMEM_HELPER
 	tristate
 	depends on DRM && MMU
 	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
+	select FB_CORE if DRM_FBDEV_EMULATION
 	help
 	  Choose this if you need the GEM shmem helper functions
 
Signature · 1 line
2.39.5
#1 lore raw

Hi

Am 15.11.24 um 16:27 schrieb Arnd Bergmann:

Quoted 40 lines

From: Arnd Bergmann <[email protected]>

The 'select FB_CORE' statement moved from CONFIG_DRM to DRM_CLIENT_LIB, but there are now configurations that have code calling into fb_core as built-in even though the client_lib itself is a loadable module:

x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_driver_fbdev_probe':
drm_fbdev_shmem.c:(.text+0x1fc): undefined reference to `fb_deferred_io_init'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_fb_destroy':
drm_fbdev_shmem.c:(.text+0x2e1): undefined reference to `fb_deferred_io_cleanup'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_fb_mmap':
drm_fbdev_shmem.c:(.text+0x34c): undefined reference to `fb_deferred_io_mmap'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_imageblit':
drm_fbdev_shmem.c:(.text+0x35f): undefined reference to `sys_imageblit'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_copyarea':
drm_fbdev_shmem.c:(.text+0x38b): undefined reference to `sys_copyarea'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_fillrect':
drm_fbdev_shmem.c:(.text+0x3b7): undefined reference to `sys_fillrect'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_write':
drm_fbdev_shmem.c:(.text+0x3e9): undefined reference to `fb_sys_write'
x86_64-linux-ld: drivers/gpu/drm/drm_fbdev_shmem.o: in function `drm_fbdev_shmem_defio_read':
drm_fbdev_shmem.c:(.text+0x413): undefined reference to `fb_sys_read'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend':
drm_fb_helper.c:(.text+0x2c6): undefined reference to `fb_set_suspend'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker':
drm_fb_helper.c:(.text+0x2e1): undefined reference to `fb_set_suspend'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_alloc_info':
drm_fb_helper.c:(.text+0x33a): undefined reference to `framebuffer_alloc'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x359): undefined reference to `fb_alloc_cmap'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x368): undefined reference to `framebuffer_release'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_release_info':
drm_fb_helper.c:(.text+0x3a4): undefined reference to `fb_dealloc_cmap'
x86_64-linux-ld: drm_fb_helper.c:(.text+0x3ab): undefined reference to `framebuffer_release'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_unregister_info':
drm_fb_helper.c:(.text+0x3bb): undefined reference to `unregister_framebuffer'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `__drm_fb_helper_initial_config_and_unlock':
drm_fb_helper.c:(.text+0xb6d): undefined reference to `register_framebuffer'
x86_64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend_unlocked':
drm_fb_helper.c:(.text+0x167a): undefined reference to `fb_set_suspend'

Quoted 4 lines

Since the code that calls into fb_core is not actually in the client_lib module but in other helper libraries, move the 'select' again to the places that actually call into fb_core, in this case DRM_GEM_SHMEM_HELPER and DRM_KMS_HELPER.

Thanks a lot for the fix. The dependency handling of among the modules is nightmare-ish.

Quoted 8 lines
Fixes dadd28d4142f ("drm/client: Add client-lib module")

---
I have only given this light build testing. It seems sensible on the surface, but there is a chance that there are additional helpers that need the same 'select'. Moving it into CONFIG_DRM itself would be the safer option, but that seems to defeat the purpose of the client-lib module.

This patch's idea looks correct to me. It's likely a matter of finding all corner cases. As you say, selecting FB_CORE from CONFIG_DRM is too strong a dependency. Fbdev emulation is implemented throughout a number of helper and driver modules. So fbdev should be an independent module if possible.

Quoted 17 lines
---
  drivers/gpu/drm/Kconfig | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/Kconfig +1 -0
index a4a092ee70d9..4f21bff6282a 100644
@@ -98,6 +98,7 @@ config DRM_KUNIT_TEST
  config DRM_KMS_HELPER
  	tristate
  	depends on DRM
+	select FB_CORE if DRM_FBDEV_EMULATION
  	help
  	  CRTC helpers for KMS drivers.
 

drivers/gpu/drm/Kconfig config DRM_CLIENT_LIB · line 223

Quoted 4 lines
drivers/gpu/drm/Kconfig +0 -1
@@ -220,7 +221,6 @@ config DRM_CLIENT_LIB
  	tristate
  	depends on DRM
  	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
-	select FB_CORE if DRM_FBDEV_EMULATION

This should remain. More fbdev code will move into drm_fbdev_client.c and that will require FB_CORE.

drivers/gpu/drm/Kconfig config DRM_GEM_SHMEM_HELPER · line 375

Quoted 8 lines
drivers/gpu/drm/Kconfig +1 -0
  	help
  	  This option enables the DRM client library and selects all
  	  modules and components according to the enabled clients.
@@ -372,6 +372,7 @@ config DRM_GEM_SHMEM_HELPER
  	tristate
  	depends on DRM && MMU
  	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
+	select FB_CORE if DRM_FBDEV_EMULATION

This select is also needed by DRM_GEM_DMA_HELPER and DRM_GEM_TTM_HELPER.

Please sort these select statements alphabetically.

Best regards
Thomas

Quoted 3 lines
drivers/gpu/drm/Kconfig +0 -0
  	help
  	  Choose this if you need the GEM shmem helper functions
 
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
#2 lore raw
Quoted 10 lines · Thomas Zimmermann

Am 15.11.24 um 16:27 schrieb Arnd Bergmann:

drivers/gpu/drm/Kconfig config DRM_CLIENT_LIB · line 223

Quoted 6 lines
drivers/gpu/drm/Kconfig +0 -1
@@ -220,7 +221,6 @@ config DRM_CLIENT_LIB
  	tristate
  	depends on DRM
  	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
-	select FB_CORE if DRM_FBDEV_EMULATION

This should remain. More fbdev code will move into drm_fbdev_client.c and that will require FB_CORE.

Got it.

Quoted 11 lines

drivers/gpu/drm/Kconfig config DRM_GEM_SHMEM_HELPER · line 375

Quoted 8 lines
drivers/gpu/drm/Kconfig +1 -0
  	help
  	  This option enables the DRM client library and selects all
  	  modules and components according to the enabled clients.
@@ -372,6 +372,7 @@ config DRM_GEM_SHMEM_HELPER
  	tristate
  	depends on DRM && MMU
  	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
+	select FB_CORE if DRM_FBDEV_EMULATION

This select is also needed by DRM_GEM_DMA_HELPER and DRM_GEM_TTM_HELPER.

Quoted 1 line

Please sort these select statements alphabetically.

Sent a v2 now.

Arnd

#3 lore raw
In reply to Arnd Bergmann
kernel test robot noticed the following build errors:

Hi Arnd,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on next-20241115]
[cannot apply to linus/master v6.12-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/drm-rework-FB_CORE-dependency/20241117-003714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link:    https://lore.kernel.org/r/20241115152722.3537630-1-arnd%40kernel.org
patch subject: [PATCH] drm: rework FB_CORE dependency
config: arc-randconfig-052-20241117 (attached as .config)
compiler: arc-elf-gcc (GCC) 13.2.0
dtschema version: 2024.12.dev1+gcabb5b9
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241117/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> error: recursive dependency detected!

symbol BACKLIGHT_CLASS_DEVICE is selected by FB_BACKLIGHT symbol FB_BACKLIGHT is selected by FB_SH_MOBILE_LCDC symbol FB_SH_MOBILE_LCDC depends on FB_DEVICE
symbol FB_DEVICE depends on FB_CORE
symbol FB_CORE is selected by DRM_KMS_HELPER
symbol DRM_KMS_HELPER is selected by DRM_MIPI_DBI
symbol DRM_MIPI_DBI is selected by DRM_PANEL_ILITEK_ILI9341 symbol DRM_PANEL_ILITEK_ILI9341 depends on BACKLIGHT_CLASS_DEVICE For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations"

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki