Skip to contentSkip to conversation

gpu: drm: fix compilation errors in drm_vram_helper

PATCH Gary Chu(楚光庆) 2 participants 3 messages Aug 13, 2025

lore
Share & tools
lore
#0 lore raw

Hi Thomas

This is what I've done in the yhgch_drm driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#t

In fact, through modifications in Patch v2, it allows only the selection of DRM_VRAM_HELPER in the driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#m3e33f8e155275ea548223c21777c191ecd392159

Best regards
Chuguangqing

Quoted 57 lines

From: Thomas Zimmermann <[email protected]>
To:chuguangqing <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] gpu: drm: fix compilation errors in drm_vram_helper

Hi

Am 29.07.25 um 08:07 schrieb chuguangqing:

Quoted 3 lines

We encountered the following errors while compiling drm_vram_helper.ko

ERROR: modpost: "drm_gem_ttm_print_info"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 1 line

ERROR: modpost: "drm_gem_ttm_mmap"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 2 lines

The functions drm_gem_ttm_mmap and drm_gem_ttm_print_info are

defined in drm_gem_ttm_helper.c. This patch adds drm_gem_ttm_helper.o to DRM_VRAM_HELPER to resolve the undefined symbol errors.

You need to select DRM_TTM_HELPER for your driver.

Best regards
Thomas

Quoted 11 lines
---
  drivers/gpu/drm/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/Makefile index renamed from drivers/gpu/drm/Makefile +0 -0

4dafbdc8f86a..abbe32ddf6d0 100644

drivers/gpu/drm/Makefile drm_suballoc_helper-y := drm_suballoc.o

Quoted 9 lines
drivers/gpu/drm/Makefile +2 -1
@@ -125,7 +125,7 @@ drm_suballoc_helper-y := drm_suballoc.o
  obj-$(CONFIG_DRM_SUBALLOC_HELPER) += drm_suballoc_helper.o
 
  drm_vram_helper-y := drm_gem_vram_helper.o
-obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+drm_gem_ttm_helper.o
 
  drm_ttm_helper-y := drm_gem_ttm_helper.o
  drm_ttm_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=

drm_fbdev_ttm.o

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

#1 lore raw

Hi

Am 13.08.25 um 03:38 schrieb Gary Chu(楚光庆):

Quoted 5 lines

Hi Thomas

This is what I've done in the yhgch_drm driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#t

I see. I thought it was for an existing driver. In new drivers, please don't use VRAM helpers any longer. VRAM helpers are based on TTM and new drivers should use TTM directly. If you integrate the code from VRAM helpers into your driver, you should be good.

Note that for reliably using TTM, your hardware requires at least 3 times the memory as the largest resolution+depth requires. The driver says 1920*1200@32bpp, which amounts to ~9 MiB of VRAM. For TTM usage, your device requires at least 32 MiB of VRAM available.

If your devices have smaller VRAM, rather use GEM SHMEM helpers instead.

Best regards
Thomas

Quoted 64 lines

In fact, through modifications in Patch v2, it allows only the selection of DRM_VRAM_HELPER in the driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#m3e33f8e155275ea548223c21777c191ecd392159

Best regards
Chuguangqing

Quoted 55 lines

From: Thomas Zimmermann <[email protected]>
To:chuguangqing <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] gpu: drm: fix compilation errors in drm_vram_helper

Hi

Am 29.07.25 um 08:07 schrieb chuguangqing:

Quoted 3 lines

We encountered the following errors while compiling drm_vram_helper.ko

ERROR: modpost: "drm_gem_ttm_print_info"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 1 line

ERROR: modpost: "drm_gem_ttm_mmap"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 1 line

The functions drm_gem_ttm_mmap and drm_gem_ttm_print_info are

defined in drm_gem_ttm_helper.c. This patch adds drm_gem_ttm_helper.o to DRM_VRAM_HELPER to resolve the undefined symbol errors.

You need to select DRM_TTM_HELPER for your driver.

Best regards
Thomas

Quoted 10 lines
---
   drivers/gpu/drm/Makefile | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/Makefile index renamed from drivers/gpu/drm/Makefile +0 -0

4dafbdc8f86a..abbe32ddf6d0 100644

drivers/gpu/drm/Makefile drm_suballoc_helper-y := drm_suballoc.o

Quoted 9 lines
drivers/gpu/drm/Makefile +2 -1
@@ -125,7 +125,7 @@ drm_suballoc_helper-y := drm_suballoc.o
   obj-$(CONFIG_DRM_SUBALLOC_HELPER) += drm_suballoc_helper.o
 
   drm_vram_helper-y := drm_gem_vram_helper.o
-obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+drm_gem_ttm_helper.o
 
   drm_ttm_helper-y := drm_gem_ttm_helper.o
   drm_ttm_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=

drm_fbdev_ttm.o

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

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

Hi

Am 13.08.25 um 08:58 schrieb Thomas Zimmermann:

Quoted 10 lines

Hi

Am 13.08.25 um 03:38 schrieb Gary Chu(楚光庆):

Quoted 6 lines

Hi Thomas

This is what I've done in the yhgch_drm driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#t

Quoted 5 lines

I see. I thought it was for an existing driver. In new drivers, please don't use VRAM helpers any longer. VRAM helpers are based on TTM and new drivers should use TTM directly. If you integrate the code from VRAM helpers into your driver, you should be good.

Note that for reliably using TTM, your hardware requires at least 3 times the memory as the largest resolution+depth requires. The driver says 1920*1200@32bpp, which amounts to ~9 MiB of VRAM. For TTM usage, your device requires at least 32 MiB of VRAM available.

If your devices have smaller VRAM, rather use GEM SHMEM helpers instead.

And with TTM, buffer sharing is fairly hard to impossible. Shmem or DMA helpers provide it out of the box.

Best regards
Thomas

Quoted 70 lines

Best regards
Thomas

Quoted 65 lines

In fact, through modifications in Patch v2, it allows only the selection of DRM_VRAM_HELPER in the driver.
See the link below:
https://lore.kernel.org/all/[email protected]/T/#m3e33f8e155275ea548223c21777c191ecd392159

Best regards
Chuguangqing

Quoted 55 lines

From: Thomas Zimmermann <[email protected]>
To:chuguangqing <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] gpu: drm: fix compilation errors in drm_vram_helper

Hi

Am 29.07.25 um 08:07 schrieb chuguangqing:

Quoted 3 lines

We encountered the following errors while compiling drm_vram_helper.ko

ERROR: modpost: "drm_gem_ttm_print_info"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 1 line

ERROR: modpost: "drm_gem_ttm_mmap"

[drivers/gpu/drm/drm_vram_helper.ko] undefined!

Quoted 1 line

The functions drm_gem_ttm_mmap and drm_gem_ttm_print_info are

defined in drm_gem_ttm_helper.c. This patch adds drm_gem_ttm_helper.o to DRM_VRAM_HELPER to resolve the undefined symbol errors.

You need to select DRM_TTM_HELPER for your driver.

Best regards
Thomas

Quoted 17 lines

---
   drivers/gpu/drm/Makefile | 2 +-

   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/Makefile index renamed from drivers/gpu/drm/Makefile +0 -0

4dafbdc8f86a..abbe32ddf6d0 100644

drivers/gpu/drm/Makefile +0 -0
@@ -125,7 +125,7 @@ drm_suballoc_helper-y := drm_suballoc.o

   obj-$(CONFIG_DRM_SUBALLOC_HELPER) += drm_suballoc_helper.o

   drm_vram_helper-y := drm_gem_vram_helper.o

drivers/gpu/drm/Makefile +2 -1
-obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
+drm_gem_ttm_helper.o
Quoted 2 lines

   drm_ttm_helper-y := drm_gem_ttm_helper.o drm_ttm_helper-$(CONFIG_DRM_FBDEV_EMULATION) +=

drm_fbdev_ttm.o

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