berolinux
Posts: 4
Joined: Fri Nov 30, 2018 12:16 am

Enabling the VC4 DRM/KMS driver

Fri Nov 30, 2018 12:38 am

Hi,
I'm trying to enable the VC4 DRM/KMS driver (tried with current rpi-4.14.y and rpi-4.20.y branches) -- the result is always the same: the module builds and loads, but doesn't do anything (no /dev/dri/* created, nothing in dmesg). I presume the problem is that the devicetree bits aren't seen.

I tried activating the devicetree bits in various different ways, all without success so far:
  • config.txt -- added dtoverlay=vc4-kms-v3d,cma-128 (and a few variants thereof) to config.txt and rebooted, no apparent effect
  • used dtmerge on the dtb/dtbo files from my kernel build -- bombs out while running dtmerge:

    Code: Select all

    dtmerge arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb /boot/bcm2710-rpi-3-b-plus.dtb arch/arm/boot/dts/overlays/vc4-kms-v3d.dtbo
    DTOVERLAY[error]: No symbols found
    * Exiting with error code 1
    
  • used dtmerge on the dtb/dtbo files from the firmware git repository -- bombs out the same way:

    Code: Select all

    dtmerge ~/firmware/boot/bcm2710-rpi-3-b-plus.dtb /boot/bcm2710-rpi-3-b-plus.dtb ~/firmware/boot/overlays/vc4-kms-v3d.dtbo
    DTOVERLAY[error]: No symbols found
    * Exiting with error code 1
    
Am I doing anything wrong?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1914
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Enabling the VC4 DRM/KMS driver

Fri Nov 30, 2018 9:47 am

Use the config.txt method, and report the output of:

Code: Select all

$ sudo vcdbg log msg |& grep -v HDMI

berolinux
Posts: 4
Joined: Fri Nov 30, 2018 12:16 am

Re: Enabling the VC4 DRM/KMS driver

Fri Nov 30, 2018 3:59 pm

PhilE wrote:
Fri Nov 30, 2018 9:47 am

Code: Select all

$ sudo vcdbg log msg |& grep -v HDMI

Code: Select all

debug_sym: OpenVideoCoreMemoryFileWithOffset: Failed to get memory size via ioctl: Inappropriate ioctl for device(25)

Unable to open videocore memory access: -25
Probably vcdbg doesn't work on top of a 64-bit kernel?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1914
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Enabling the VC4 DRM/KMS driver

Fri Nov 30, 2018 4:13 pm

What do the following commands return? You may want to delete and rebuild the DT files to make sure they haven't been corrupted:

Code: Select all

$ fdtdump arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb | grep __
$ fdtdump arch/arm/boot/dts/overlays/vc4-kms-v3d.dtbo | grep __

berolinux
Posts: 4
Joined: Fri Nov 30, 2018 12:16 am

Re: Enabling the VC4 DRM/KMS driver

Sat Dec 01, 2018 9:23 am

PhilE wrote:
Fri Nov 30, 2018 4:13 pm
What do the following commands return? You may want to delete and rebuild the DT files to make sure they haven't been corrupted:
DT files have been rebuilt several times (after each unsuccessful attempt to use them). With the latest builds on the rpi-4.20.y based kernel:
PhilE wrote:
Fri Nov 30, 2018 4:13 pm

Code: Select all

$ fdtdump arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb | grep __

Code: Select all


**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

    __overrides__ {
        __overlay__ {
        __dormant__ {
        __dormant__ {
        __dormant__ {
        __dormant__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
PhilE wrote:
Fri Nov 30, 2018 4:13 pm

Code: Select all

$ fdtdump arch/arm/boot/dts/overlays/vc4-kms-v3d.dtbo | grep __

Code: Select all


**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

        __overlay__ {
        __dormant__ {
        __dormant__ {
        __dormant__ {
        __dormant__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
        __overlay__ {
    __overrides__ {
    __fixups__ {


PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1914
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Enabling the VC4 DRM/KMS driver

Sat Dec 01, 2018 11:58 am

The overlay is not being applied because the base DTB has no symbols; if it had then the grep would have included `__symbols__`. However you invoked the dtc tool, the command line must include the `[email protected]` option. The overlay looks good, though.

berolinux
Posts: 4
Joined: Fri Nov 30, 2018 12:16 am

Re: Enabling the VC4 DRM/KMS driver

Mon Dec 03, 2018 1:01 am

Thanks! This has done a lot to fix it!

I'm using the kernel's makefiles to generate the dtbs -- just "make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs".
The command being executed seems to be

Code: Select all

  mkdir -p arch/arm64/boot/dts/broadcom/ ; gcc -E -Wp,-MD,arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.d.pre.tmp -nostdinc -I./scripts/dtc/include-prefixes -undef -D__DTS__ -x assembler-with-cpp -o arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.dts.tmp arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts ; ./scripts/dtc/dtc -O dtb -o arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dtb -b 0 -iarch/arm64/boot/dts/broadcom/ -i./scripts/dtc/include-prefixes -Wno-unit_address_vs_reg -Wno-unit_address_format -Wno-gpios_property -Wno-avoid_unnecessary_addr_size -Wno-alias_paths -Wno-graph_child_address -Wno-graph_port -Wno-unique_unit_address -Wno-pci_device_reg  -d arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.d.dtc.tmp arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.dts.tmp ; cat arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.d.pre.tmp arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.d.dtc.tmp > arch/arm64/boot/dts/broadcom/.bcm2837-rpi-3-b-plus.dtb.d
which indeed doesn't have a [email protected]

I've fixed that (Patch: https://github.com/OpenMandrivaSoftware ... 8905da654b) -- now fdtdump output looks better:

Code: Select all

$ fdtdump kernel/arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b-plus.dtb |grep __

**** fdtdump is a low-level debugging tool, not meant for general use.
**** If you want to decompile a dtb, you probably want
****     dtc -I dtb -O dts <filename>

    __overrides__ {
    __symbols__ {
The overlay is getting loaded properly now, and the driver is starting to work.

Code: Select all

$ dmesg |grep vc4
[Mon Dec  3 00:41:22 2018] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
[Mon Dec  3 00:41:22 2018] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[Mon Dec  3 00:41:22 2018] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[Mon Dec  3 00:41:22 2018] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[Mon Dec  3 00:41:22 2018] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[Mon Dec  3 00:41:23 2018] vc4-drm soc:gpu: fb0: DRM emulated frame buffer device
$ cat /proc/fb
0 DRM emulated
Trying to start an X server on it still fails, but now has other reasons.

Code: Select all

[...]
[    41.784] Kernel command line: 8250.nr_uarts=0 cma=256M bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cma=128M gpu_mem=128
[...]
[    43.936] (II) xfree86: Adding drm device (/dev/dri/card0)
[    43.946] (II) no primary bus or device found
[    43.946]    falling back to /sys/devices/platform/soc/soc:gpu/drm/card0
[    43.946] (II) LoadModule: "glx"
[    43.964] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so
[    45.819] (II) Module glx: vendor="X.Org Foundation"
[    45.819]    compiled for 1.20.3, module version = 1.0.0
[    45.819]    ABI class: X.Org Server Extension, version 10.0
[    45.819] (==) Matched modesetting as autoconfigured driver 0
[    45.819] (==) Matched fbdev as autoconfigured driver 1
[    45.820] (==) Assigned the driver to the xf86ConfigLayout
[    45.820] (II) LoadModule: "modesetting"
[    45.830] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so
[    46.131] (II) Module modesetting: vendor="X.Org Foundation"
[    46.131]    compiled for 1.20.3, module version = 1.20.3
[    46.131]    Module class: X.Org Video Driver
[    46.131]    ABI class: X.Org Video Driver, version 24.0
[    46.131] (II) LoadModule: "fbdev"
[    46.132] (II) Loading /usr/lib64/xorg/modules/drivers/fbdev_drv.so
[    46.411] (II) Module fbdev: vendor="X.Org Foundation"
[    46.411]    compiled for 1.20.3, module version = 0.5.0
[    46.411]    Module class: X.Org Video Driver
[    46.411]    ABI class: X.Org Video Driver, version 24.0
[    46.412] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    46.412] (II) FBDEV: driver for framebuffer: fbdev
[    46.412] (WW) xf86OpenConsole: VT_ACTIVATE failed: No such device or address
[    46.412] (EE)
Fatal server error:
[    46.435] (EE) xf86OpenConsole: Switching VT failed


HiassofT
Posts: 134
Joined: Fri Jun 30, 2017 10:07 pm

Re: Enabling the VC4 DRM/KMS driver

Mon Dec 03, 2018 10:25 am

FYI: you don't need to patch the kernel tree to get dtb files with symbols, you can simply set DTC_FLAGS when calling make. eg

Code: Select all

ARCH=arm64 CROSS_COMPILE=... DTC_FLAGS="[email protected] -H epapr" make
This also works on upstream kernels and I've been using that both for RPi and other SBCs for quite some time now.

so long,

Hias

Return to “Device Tree”