[PATCH] drm: rework FB_CORE dependency

Thomas Zimmermann tzimmermann at suse.de
Fri Nov 15 15:54:57 UTC 2024


Hi


Am 15.11.24 um 16:27 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd at arndb.de>
>
> 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.

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

>
> Fixes: dadd28d4142f ("drm/client: Add client-lib module")
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> ---
> 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.

> ---
>   drivers/gpu/drm/Kconfig | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index a4a092ee70d9..4f21bff6282a 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -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

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

>   	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

>   	help
>   	  Choose this if you need the GEM shmem helper functions
>   

-- 
--
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)



More information about the dri-devel mailing list