Solved Video hangs when amdgpu kernel module gets loaded with Radeon RX 580

Hello,

I recently upgraded my graphics card to a Radeon RX580 on my desktop system running FreeBSD 12.1-p1, I installed the xf86-video-amdgpu packgae and I already had the drm-kmod package installed from my previous graphics card. The problem I have is that when the "amdgpu" kernel module gets loaded either at bood or manually post boot the video hangs, and never seems to recover, even for the framebuffer FreeBSD uses during boot. If I don't load the kernel module then graphics works and I am able to successfully start Xorg just the performace seems slightly hang for a second or so. Nothing that makes the system seem unusable, but it it noticable and slightly annoying.

Package info:

- xf86-video-amdgpu-19.0.1
- drm-kmod-g20190710
- drm-fbsd12.0-kmod-4.16.g20191120

Dmesg output when the module gets loaded during boot:

Code:
[drm] amdgpu kernel modesetting enabled.
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] initializing kernel modesetting (POLARIS10 0x1002:0x67DF 0x1DA2:0xE353 0xE7).
[drm] register mmio base: 0xFE900000
[drm] register mmio size: 262144
[drm] PCI I/O BAR is not found.
[drm] probing gen 2 caps for device 1022:1453 = 737903/e
[drm] probing mlw for device 1002:67df = 440903
[drm] UVD is enabled in VM mode
[drm] UVD ENC is enabled in VM mode
[drm] VCE enabled in VM mode
ATOM BIOS: 113-4E353BU-O50
[drm] vm size is 64 GB, 2 levels, block size is 10-bit, fragment size is 9-bit
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_mc.bin
drmn0: VRAM: 8192M 0x000000F400000000 - 0x000000F5FFFFFFFF (8192M used)
drmn0: GTT: 256M 0x0000000000000000 - 0x000000000FFFFFFF
Successfully added WC MTRR for [0xe0000000-0xefffffff]: 0;
[drm] Detected VRAM RAM=8192M, BAR=256M
[drm] RAM width 256bits GDDR5
[TTM] Zone  kernel: Available graphics memory: 16730064 kiB
[TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[TTM] Initializing pool allocator
[drm] amdgpu: 8192M of VRAM memory ready
[drm] amdgpu: 8192M of GTT memory ready.
i_size_write unimplemented
[drm] GART: num cpu pages 65536, num gpu pages 65536
[drm] PCIE GART of 256M enabled (table at 0x000000F400040000).
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] Connector DP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector DP-2: get mode from tunables:
[drm]   - kern.vt.fb.modes.DP-2
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-2: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-2
[drm]   - kern.vt.fb.default_mode
[drm] Connector DVI-D-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.DVI-D-1
[drm]   - kern.vt.fb.default_mode
[drm] AMDGPU Display Connectors
[drm] Connector 0:
[drm]   DP-1
[drm]   HPD6
[drm]   DDC: 0x4868 0x4868 0x4869 0x4869 0x486a 0x486a 0x486b 0x486b
[drm]   Encoders:
[drm]     DFP1: INTERNAL_UNIPHY2
[drm] Connector 1:
[drm]   DP-2
[drm]   HPD4
[drm]   DDC: 0x4870 0x4870 0x4871 0x4871 0x4872 0x4872 0x4873 0x4873
[drm]   Encoders:
[drm]     DFP2: INTERNAL_UNIPHY2
[drm] Connector 2:
[drm]   HDMI-A-1
[drm]   HPD1
[drm]   DDC: 0x486c 0x486c 0x486d 0x486d 0x486e 0x486e 0x486f 0x486f
[drm]   Encoders:
[drm]     DFP3: INTERNAL_UNIPHY1
[drm] Connector 3:
[drm]   HDMI-A-2
[drm]   HPD5
[drm]   DDC: 0x4874 0x4874 0x4875 0x4875 0x4876 0x4876 0x4877 0x4877
[drm]   Encoders:
[drm]     DFP4: INTERNAL_UNIPHY1
[drm] Connector 4:
[drm]   DVI-D-1
[drm]   HPD3
[drm]   DDC: 0x487c 0x487c 0x487d 0x487d 0x487e 0x487e 0x487f 0x487f
[drm]   Encoders:
[drm]     DFP5: INTERNAL_UNIPHY
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_pfp_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_me_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_ce_2.bin
[drm] Chained IB support enabled!
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_rlc.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_mec_2.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_mec2_2.bin
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_sdma.bin
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_sdma1.bin
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_uvd.bin
[drm] Found UVD firmware Version: 1.130 Family ID: 16
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_vce.bin
[drm] Found VCE firmware Version: 53.26 Binary ID: 3
i_size_write unimplemented
i_size_write unimplemented
i_size_write unimplemented
drmn0: successfully loaded firmware image with name: amdgpu/polaris10_k_smc.bin
[drm:sdma_v3_0_ring_test_ring] amdgpu: ring 10 test failed (0xCAFEDEAD)
[drm:amdgpu_device_ip_init] hw_init of IP block <sdma_v3_0> failed -22
drmn0: amdgpu_device_ip_init failed
drmn0: 0xfffff80003b23800 unpin not necessary
drmn0: 0xfffff800043ef800 unpin not necessary
[TTM] Finalizing pool allocator
[TTM] Zone  kernel: Used memory at exit: 0 kiB
[TTM] Zone   dma32: Used memory at exit: 0 kiB
[drm] amdgpu: ttm finalized
drmn0: Fatal error during GPU init
[drm] amdgpu: finishing device.
vgapci0: child drmn0 requested pci_disable_io
vgapci0: child drmn0 requested pci_disable_io
device_attach: drmn0 attach returned 22

I have not tried the "hw.syscons.disable=1" work around as I'm not sure if that is still needed with FreeBSD 12.1 or not.
 
Don't use the packages, they're still being built for 12.0. This is not a problem for 99% of the packages but kernel modules are problematic and will often crash if the kernel version doesn't match up.

Build these from ports:
Code:
- xf86-video-amdgpu-19.0.1
- drm-kmod-g20190710
- drm-fbsd12.0-kmod-4.16.g20191120
That way they will match your kernel version.

This problem with 12.0 packages will get resolved soon, when 12.0 is truly EoL (probably end of January) and the packages are built for 12.1.
 
Well that certianly was the issue, just a bit odd that everything worked fine using the xf86-video-ati driver and the same drm-kmod and drm-fbsd12.0-kmod packages and my old graphics card.

Anyways thanks
 
I have similar error messages in dmesg after the latest update to the drm ports. The previous version from before the vulnerability affecting intel was fixed worked tho.
After seeing vendion mention a workaround in the first post I tried that. Now I can start Xwindows.
I better put a post-it note on the monitor to check if efiboot is useable after the next update.
Cheers
 
[EDIT] This DOES NOT work! it was loading the vesa driver instead of amdgpu and it gave me a very faulty graphical environment.

SirDice's solution worked for me just now, but I did have to add hw.syscons.disable=1 to boot/loader.conf for it to work. Otherwise, it never loaded and X said that there were no screens found.

Now, I don't know if it's related but I get stutters that are particularly noticeable when I move my mouse pointer fast enough. but, I'll tackle that when I can, for now, Plasma is running nicely I guess.

Thanks.
 
Back
Top