diff mbox series

[v2] drm: select DRM_KMS_HELPER from DRM_GEM_SHMEM_HELPER

Message ID 20250122090211.3161186-1-arnd@kernel.org (mailing list archive)
State New
Headers show
Series [v2] drm: select DRM_KMS_HELPER from DRM_GEM_SHMEM_HELPER | expand

Commit Message

Arnd Bergmann Jan. 22, 2025, 9:02 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

In the combination of DRM_KMS_HELPER=m, DRM_GEM_SHMEM_HELPER=y, DRM_FBDEV_EMULATION=y,
The shmem code fails to link against the KMS helpers:

x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_driver_fbdev_probe':
(.text+0xeec601): undefined reference to `drm_fb_helper_alloc_info'
x86_64-linux-ld: (.text+0xeec633): undefined reference to `drm_fb_helper_fill_info'
x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_get_page':
drm_fbdev_shmem.c:(.text+0xeec7d2): undefined reference to `drm_gem_fb_get_obj'
x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_fb_mmap':
drm_fbdev_shmem.c:(.text+0xeec9f6): undefined reference to `drm_gem_fb_get_obj'
x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_defio_imageblit':
(.rodata+0x5b2288): undefined reference to `drm_fb_helper_check_var'
x86_64-linux-ld: (.rodata+0x5b2290): undefined reference to `drm_fb_helper_set_par'

This can happen for a number of device drivers that select DRM_GEM_SHMEM_HELPER
without also selecting DRM_KMS_HELPER. To work around this, add another select
that forces DRM_KMS_HELPER to be built-in rather than a loadable module, but
only if FBDEV emulation is also enabled. DRM_TTM_HELPER and DRM_GEM_DMA_HELPER
look like they have the same problem in theory even if there is no possible
configuration that shows it. For consistency, do the same change to those.

Closes: https://lore.kernel.org/all/20250121-greedy-flounder-of-abundance-4d2ee8-mkl@pengutronix.de
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Zimmermann Jan. 22, 2025, 11:52 a.m. UTC | #1
Hi,

merged into drm-misc-fixes. Should reach upstream by next week. Thanks 
for the patch.

Best regards
Thomas


Am 22.01.25 um 10:02 schrieb Arnd Bergmann:
> From: Arnd Bergmann <arnd@arndb.de>
>
> In the combination of DRM_KMS_HELPER=m, DRM_GEM_SHMEM_HELPER=y, DRM_FBDEV_EMULATION=y,
> The shmem code fails to link against the KMS helpers:
>
> x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_driver_fbdev_probe':
> (.text+0xeec601): undefined reference to `drm_fb_helper_alloc_info'
> x86_64-linux-ld: (.text+0xeec633): undefined reference to `drm_fb_helper_fill_info'
> x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_get_page':
> drm_fbdev_shmem.c:(.text+0xeec7d2): undefined reference to `drm_gem_fb_get_obj'
> x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_fb_mmap':
> drm_fbdev_shmem.c:(.text+0xeec9f6): undefined reference to `drm_gem_fb_get_obj'
> x86_64-linux-ld: vmlinux.o: in function `drm_fbdev_shmem_defio_imageblit':
> (.rodata+0x5b2288): undefined reference to `drm_fb_helper_check_var'
> x86_64-linux-ld: (.rodata+0x5b2290): undefined reference to `drm_fb_helper_set_par'
>
> This can happen for a number of device drivers that select DRM_GEM_SHMEM_HELPER
> without also selecting DRM_KMS_HELPER. To work around this, add another select
> that forces DRM_KMS_HELPER to be built-in rather than a loadable module, but
> only if FBDEV emulation is also enabled. DRM_TTM_HELPER and DRM_GEM_DMA_HELPER
> look like they have the same problem in theory even if there is no possible
> configuration that shows it. For consistency, do the same change to those.
>
> Closes: https://lore.kernel.org/all/20250121-greedy-flounder-of-abundance-4d2ee8-mkl@pengutronix.de
> Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/gpu/drm/Kconfig | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 0fe99d440bfa..805c6c78498f 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -293,6 +293,7 @@ config DRM_TTM_HELPER
>   	tristate
>   	depends on DRM
>   	select DRM_TTM
> +	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
>   	select FB_CORE if DRM_FBDEV_EMULATION
>   	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
>   	help
> @@ -301,6 +302,7 @@ config DRM_TTM_HELPER
>   config DRM_GEM_DMA_HELPER
>   	tristate
>   	depends on DRM
> +	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
>   	select FB_CORE if DRM_FBDEV_EMULATION
>   	select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
>   	help
> @@ -309,6 +311,7 @@ config DRM_GEM_DMA_HELPER
>   config DRM_GEM_SHMEM_HELPER
>   	tristate
>   	depends on DRM && MMU
> +	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
>   	select FB_CORE if DRM_FBDEV_EMULATION
>   	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
>   	help
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 0fe99d440bfa..805c6c78498f 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -293,6 +293,7 @@  config DRM_TTM_HELPER
 	tristate
 	depends on DRM
 	select DRM_TTM
+	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
 	select FB_CORE if DRM_FBDEV_EMULATION
 	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help
@@ -301,6 +302,7 @@  config DRM_TTM_HELPER
 config DRM_GEM_DMA_HELPER
 	tristate
 	depends on DRM
+	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
 	select FB_CORE if DRM_FBDEV_EMULATION
 	select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help
@@ -309,6 +311,7 @@  config DRM_GEM_DMA_HELPER
 config DRM_GEM_SHMEM_HELPER
 	tristate
 	depends on DRM && MMU
+	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
 	select FB_CORE if DRM_FBDEV_EMULATION
 	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help