# Accelerated Xorg on AMDGPU Renoir



## JohnnySorocil (Feb 17, 2021)

I have AMD Ryzen 7 PRO 4750G with Radeon Graphics (Renoir) and I am trying to get accelerated X11 GUI.

Manually recompiled:
graphics/drm-fbsd13-kmod
graphics/mesa-dri
graphics/gpu-firmware-kmod

/usr/local/etc/X11/xorg.conf.d/ is empty

/boot/loader.conf

```
hw.amdgpu.exp_hw_support=1
```

/etc/rc.conf

```
kld_list="${kld_list} /boot/modules/amdgpu.ko amdtemp"
```

After running `startx` as user X doesn't start:

```
Fatal server error:
[    25.767] (EE) no screens found(EE)
```

If I add small config file /usr/local/etc/X11/xorg.conf.d/amdgpu.conf

```
Section "Device"
        Identifier      "Card0"
        Driver          "amdgpu"
EndSection
```

Then X seems to tries to start but stucks at black screen (which show mouse pointer at center of the scren and one white block/cursor at top left corner)

```
% ps aux | grep Xorg
root       1678    0.0  0.2 208372  55396 v1  D    21:41     0:00.07 /usr/local/bin/Xorg :0 -auth /home/johnny/.serverauth.1664
```
Trying to kill it (as root, logged over ssh) is not sucessful (as expected for process in D state).
Only option is to reboot (or use machine over ssh) - Ctrl-Alt-Fx keys won't change tty.


System information

```
% uname -sr
FreeBSD 13.0-BETA2

% kldstat | grep amdgpu
 5    1 0xffffffff83200000   32ed48 amdgpu.ko
10    1 0xffffffff83199000     21e8 amdgpu_renoir_gpu_info_bin.ko
11    1 0xffffffff8319c000     64a8 amdgpu_renoir_sdma_bin.ko
12    1 0xffffffff831a3000    292a8 amdgpu_renoir_asd_bin.ko
13    1 0xffffffff831cd000     7528 amdgpu_renoir_pfp_bin.ko
14    1 0xffffffff831d5000     6528 amdgpu_renoir_me_bin.ko
15    1 0xffffffff831dc000     4528 amdgpu_renoir_ce_bin.ko
16    1 0xffffffff831e1000     b8a0 amdgpu_renoir_rlc_bin.ko
17    1 0xffffffff8352f000    437b8 amdgpu_renoir_mec_bin.ko
18    1 0xffffffff83573000    437b8 amdgpu_renoir_mec2_bin.ko
19    1 0xffffffff835b7000    71d28 amdgpu_renoir_vcn_bin.ko

% pkg info drm-fbsd13-kmod-5.4.92.g20210202 mesa-dri-20.2.3_1 gpu-firmware-kmod-g20201213 xorg-server-1.20.9_3,1 xf86-\*
drm-fbsd13-kmod-5.4.92.g20210202
mesa-dri-20.2.3_1
gpu-firmware-kmod-g20201213
xorg-server-1.20.9_3,1
xf86-input-libinput-0.30.0_1
xf86-video-amdgpu-19.1.0_1

% dmesg | grep -i drm
[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 (RENOIR 0x1002:0x1636 0x1002:0x1636 0xD8).
[drm] register mmio base: 0xFCD00000
[drm] register mmio size: 524288
[drm] add ip block number 0 <soc15_common>
[drm] add ip block number 1 <gmc_v9_0>
[drm] add ip block number 2 <vega10_ih>
[drm] add ip block number 3 <psp>
[drm] add ip block number 4 <smu>
[drm] add ip block number 5 <gfx_v9_0>
[drm] add ip block number 6 <sdma_v4_0>
[drm] add ip block number 7 <vcn_v2_0>
drmn0: successfully loaded firmware image 'amdgpu/renoir_gpu_info.bin'
drmn0: kfd not supported on this ASIC
drmn0: successfully loaded firmware image 'amdgpu/renoir_sdma.bin'
[drm] VCN decode is enabled in VM mode
[drm] VCN encode is enabled in VM mode
[drm] VCN jpeg decode is enabled in VM mode
[drm] vm size is 262144 GB, 4 levels, block size is 9-bit, fragment size is 9-bit
drmn0: VRAM: 512M 0x000000F400000000 - 0x000000F41FFFFFFF (512M used)
drmn0: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
drmn0: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
[drm] Detected VRAM RAM=512M, BAR=256M
[drm] RAM width 128bits UNKNOWN
[drm] amdgpu: 512M of VRAM memory ready
[drm] amdgpu: 3072M of GTT memory ready.
[drm] GART: num cpu pages 262144, num gpu pages 262144
[drm] PCIE GART of 1024M enabled (table at 0x000000F400900000).
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
drmn0: successfully loaded firmware image 'amdgpu/renoir_asd.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_pfp.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_me.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_ce.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_rlc.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_mec.bin'
drmn0: successfully loaded firmware image 'amdgpu/renoir_mec2.bin'
[drm] use_doorbell being set to: [true]
drmn0: successfully loaded firmware image 'amdgpu/renoir_vcn.bin'
[drm] Found VCN firmware Version ENC: 1.7 DEC: 4 VEP: 0 Revision: 17
[drm] PSP loading VCN firmware
[drm] reserve 0x400000 from 0xf41f800000 for PSP TMR
[drm] VCN decode and encode initialized successfully(under DPG Mode).
drmn0: ring gfx uses VM inv eng 0 on hub 0
drmn0: ring comp_1.0.0 uses VM inv eng 1 on hub 0
drmn0: ring comp_1.1.0 uses VM inv eng 4 on hub 0
drmn0: ring comp_1.2.0 uses VM inv eng 5 on hub 0
drmn0: ring comp_1.3.0 uses VM inv eng 6 on hub 0
drmn0: ring comp_1.0.1 uses VM inv eng 7 on hub 0
drmn0: ring comp_1.1.1 uses VM inv eng 8 on hub 0
drmn0: ring comp_1.2.1 uses VM inv eng 9 on hub 0
drmn0: ring comp_1.3.1 uses VM inv eng 10 on hub 0
drmn0: ring kiq_2.1.0 uses VM inv eng 11 on hub 0
drmn0: ring sdma0 uses VM inv eng 0 on hub 1
drmn0: ring vcn_dec uses VM inv eng 1 on hub 1
drmn0: ring vcn_enc0 uses VM inv eng 4 on hub 1
drmn0: ring vcn_enc1 uses VM inv eng 5 on hub 1
drmn0: ring vcn_jpeg uses VM inv eng 6 on hub 1
[drm] Initialized amdgpu 3.35.0 20150101 for drmn0 on minor 0

% pciconf -lv
...
vgapci0@pci0:9:0:0:     class=0x030000 rev=0xd8 hdr=0x00 vendor=0x1002 device=0x1636 subvendor=0x1002 subdevice=0x1636
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Renoir'
    class      = display
    subclass   = VGA
```

Same results if `'efi_max_resolution="720p"'` is added to /boot/loader.conf (as suggested in this github comment)
dmesg with 720p:

```
VT(efifb): resolution 800x600
```
dmesg without efi_max_resolution set:

```
VT(efifb): resolution 1920x1080
```

Last week also tried with "5.5-wip" branch for freebsd/drm-kmod on 13.0 and -CURRENT without success but didn't write details.

I can start (non-accelerated) X with:

```
% pkg install xf86-video-scfb
% rm /usr/local/etc/X11/xorg.conf.d/amdgpu.conf
% startx
```

Attached are Xorg.0.log files - one when /usr/local/etc/X11/xorg.conf.d/amdgpu.conf is empty, other one when amdgpu.conf mentioned above is added.


----------



## Novolaska (Feb 23, 2021)

The drm-kmod source is https://github.com/unrelentingtech/drm-kmod/commits/5.5-wip-amd-pr.
With FreeBSD current source before commit 50180d2b.

For current (__FreeBSD__version >= 1300135) to work, some patches are needed.


----------



## Raffeale (Feb 24, 2021)

try this








						amd vega and radeon series vga card driver for FreeBSD 12.1 and 12.2 tutorial for beginner[update 2020-12-16]
					

amd apu vga card driver for FreeBSD 12.1  tutorial for beginner  I’m a newbie for freebsd and have some experience for linux. I have just installed FreeBSD for one week, I met a lot of trouble when I use it. I just want to tell everyone that how to solve this problem  then you could  save you...




					forums.freebsd.org
				



 it looks like your device id is not in ids files. or the xorg amdgpu driver did not support your vga card. try about tutorial,maybe you can find the answer.


----------



## JohnnySorocil (Mar 3, 2021)

Raffeale said:


> try this
> 
> 
> 
> ...




```
pciconf -lv | grep -A4 vgapci
vgapci0@pci0:9:0:0:     class=0x030000 rev=0xd8 hdr=0x00 vendor=0x1002 device=0x1636 subvendor=0x1002 subdevice=0x1636
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Renoir'
    class      = display
    subclass   = VGA
```
device_id is 0x1636, PCI slot is 9:0:0


```
grep 1636 /usr/local/share/pciids/pci.ids
        1636  Renoir
                103c 1636  U98Z077.00 Half-size Mini PCIe Card
        1636  Broadwell-U Integrated Graphics
```
My device_id is in pci.ids files.



Novolaska said:


> The drm-kmod source is https://github.com/unrelentingtech/drm-kmod/commi85d028223bcts/5.5-wip-amd-pr.
> With FreeBSD current source before commit 50180d2b.
> 
> For current (__FreeBSD__version >= 1300135) to work, some patches are needed.



So, I should checkout commit 85d028223bc, build -CURRENT and then clone https://github.com/unrelentingtech/drm-kmod branch 5.5-wip-amd-pr to ports, build it and load that kernel modules and it should work?
Can I somehow do that on 13.0 branch?


----------



## Raffeale (Mar 3, 2021)

you can try freebsd13, maybe 13 has already included it, I use 12.2 now.
but it is not likes amd drivers problem, because the driver has already initialized.


----------



## Novolaska (Mar 5, 2021)

Stable/13 works without any problem. (Not work.)

Ports:


```
emulators/linux_base-c7
graphics/drm-kmod
graphics/gpu-firmware-kmod
x11-drivers/xf86-video-amdgpu
```


```
graphics/drm-kmod
graphics/gpu-firmware-kmod
x11-drivers/xf86-video-amdgpu
```

/boot/loader.conf


```
kern.vty=vt
#hw.amdgpu.exp_hw_support="1" # no more needed
linux64_load="YES"
```


```
kern.vty=vt
#hw.amdgpu.exp_hw_support="1" # no more needed
```

/etc/rc.conf

```
kld_list="amdgpu"
```

xorg.conf.d/amdgpu.conf

```
Section "Device"
        Identifier "Card0"
        Driver     "amdgpu"
        BusID      "PCI:12:0:0" # pciconf -lv | grep vgapci, vgapci0@pci0:12:0:0
        Option     "DRI" "3"
        Option     "TearFree" "on"             
EndSection
```


----------



## Raffeale (Mar 5, 2021)

you don't need load linux kernel module, amdgpu do not need it, the linux module is for linux applications


----------



## JohnnySorocil (Mar 5, 2021)

What GPUs are you using? Is is also Renoir (AMD 4xxxG APUs)? I tried your steps (on 13.0-BETA4 and 13.0-STABLE) without sucess. Should code from Linux 5.5 (or preferably 5.8) be used for Renoir?

Could you provide output of `pciconf -lv | grep -A4 vgapci`
Mine is:

```
vgapci0@pci0:9:0:0:     class=0x030000 rev=0xd8 hdr=0x00 vendor=0x1002 device=0x1636 subvendor=0x1002 subdevice=0x1636
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Renoir'
    class      = display
    subclass   = VGA
```


----------



## Novolaska (Mar 6, 2021)

pciconf -lv | grep -A4 vgapci

```
vgapci0@pci0:12:0:0:    class=0x030000 rev=0xd8 hdr=0x00 vendor=0x1002 device=0x1636 subvendor=0x1002 subdevice=0x1636
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Renoir'
    class      = display
    subclass   = VGA
```

uname -v

```
FreeBSD 13.0-STABLE #0 master-n244751-2b43cd2ea26: Fri Mar  5 04:39:39 CST 2021     root@r7s:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
```


Update:
I'll check the drm-kmod again. The loaded one is of a local ported version.


----------



## JohnnySorocil (Mar 8, 2021)

Thanks.
I updated to -STABLE:


```
make SRCCONF=/dev/null __MAKE_CONF=/dev/null buildworld buildkernel
install & reboot

pkg update -f
pkg update
Your packages are up to date.

pkg delete graphics/drm-kmod graphics/gpu-firmware-kmod x11-drivers/xf86-video-amdgpu
pkg install graphics/drm-kmod graphics/gpu-firmware-kmod x11-drivers/xf86-video-amdgpu

# sysctl kern.vty
kern.vty: vt

# cat /usr/local/etc/X11/xorg.conf.d/amdgpu.conf
Section "Device"
        Identifier "Card0"
        Driver     "amdgpu"
        BusID      "PCI:9:0:0"
        Option     "DRI" "3"
        Option     "TearFree" "on"
EndSection

# grep amdgpu /etc/rc.conf
kld_list="amdgpu"

reboot

# uname -srv
FreeBSD 13.0-STABLE FreeBSD 13.0-STABLE #3 stable13-n244806-fbc8ddde4c66: Mon Mar  8 14:52:12 CET 2021     root@zen-pobro:/usr/obj/usr/src/amd64.amd64/sys/GENERIC

# kldstat | grep amdgpu
 5    1 0xffffffff83800000   31fd70 amdgpu.ko
10    1 0xffffffff83798000     2218 amdgpu_renoir_gpu_info_bin.ko
11    1 0xffffffff8379b000     64d8 amdgpu_renoir_sdma_bin.ko
12    1 0xffffffff837a2000    292d8 amdgpu_renoir_asd_bin.ko
13    1 0xffffffff837cc000     7558 amdgpu_renoir_pfp_bin.ko
14    1 0xffffffff837d4000     6558 amdgpu_renoir_me_bin.ko
15    1 0xffffffff837db000     4558 amdgpu_renoir_ce_bin.ko
16    1 0xffffffff837e0000     b8d0 amdgpu_renoir_rlc_bin.ko
17    1 0xffffffff83b20000    437e8 amdgpu_renoir_mec_bin.ko
18    1 0xffffffff83b64000    437e8 amdgpu_renoir_mec2_bin.ko
19    1 0xffffffff83ba8000    71d58 amdgpu_renoir_vcn_bin.ko
```

As user:

```
% id
uid=1001(johnny) gid=1001(johnny) groups=1001(johnny),0(wheel),44(video)
% startx
<screen frozen until reboot>
```

Not sure if relevant, but I have noticed some differences in dmesg, such as:

```
ATOM BIOS: 113-RENOIR-026
ATOM BIOS: 113-RENOIR-031
```


----------



## JohnnySorocil (Mar 10, 2021)

Novolaska said:


> ```
> FreeBSD 13.0-STABLE #0 master-n244751-2b43cd2ea26: Fri Mar  5 04:39:39 CST 2021     root@r7s:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
> ```
> 
> ...



I built the same -STABLE as yours:

```
FreeBSD 13.0-STABLE FreeBSD 13.0-STABLE #12 stable13-n244751-2b43cd2ea26f: Tue Mar  9 21:51:30 CET 2021     root@zen-pobro:/usr/obj/usr/src/amd64.amd64/sys/POBRO
```
Rebuilt relevant packages and still endup with locked screen when try to start Xorg. 
In BIOS/UEFI VRAM is set to 2GB, various VM stuff are disabled and result is the same, last line printed in Xorg.log is as in the file uploaded earlier:

```
[   588.534] (II) Module "dri2" already built-in
```
Trying to build various branches from GregV and official drm-kmod results in compile errors.

I have noticed that you are using newer driver:

```
-[drm] Initialized amdgpu 3.36.0 20150101 for drmn0 on minor 0
+[drm] Initialized amdgpu 3.35.0 20150101 for drmn0 on minor 0
```
According to this it is equivalent of Linux 5.6. In tree drm is equivalent of Linux 5.4.
Could you provide your local ported version of drm-kmod?


----------



## Novolaska (Mar 11, 2021)

JohnnySorocil said:


> According to this it is equivalent of Linux 5.6. In tree drm is equivalent of Linux 5.4.
> Could you provide your local ported version of drm-kmod?











						GitHub - novolaska/drm-kmod at backport-stable-13
					

drm driver for FreeBSD. Contribute to novolaska/drm-kmod development by creating an account on GitHub.




					github.com
				



Hope this helps!


----------



## JohnnySorocil (Apr 1, 2021)

Cloned your repo to /usr/ports/graphics/drm-kmod-novolaska, built branch backport-stable-13.
Rebooted, try it on FreeBSD 13.0-RC4

Rebuild ports:
graphics/gpu-firmware-kmod


```
# kldload amdgpu

# dmesg
[drm] amdgpu kernel modesetting enabled.
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
sysctl_warn_reuse: can't re-use a leaf (hw.dri.debug)!
[drm] initializing kernel modesetting (RENOIR 0x1002:0x1636 0x1002:0x1636 0xD8).
[drm] register mmio base: 0xFCB00000
[drm] register mmio size: 524288
[drm] add ip block number 0 <soc15_common>
[drm] add ip block number 1 <gmc_v9_0>
[drm] add ip block number 2 <vega10_ih>
[drm] add ip block number 3 <psp>
[drm] add ip block number 4 <smu>
[drm] add ip block number 5 <gfx_v9_0>
[drm] add ip block number 6 <sdma_v4_0>
[drm] add ip block number 7 <dm>
[drm] add ip block number 8 <vcn_v2_0>
amdgpu/renoir_gpu_info.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_gpu_info.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_gpu_info_bin
ATOM BIOS: 113-RENOIR-033
amdgpu/renoir_sdma.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_sdma.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_sdma_bin
[drm] VCN decode is enabled in VM mode
[drm] VCN encode is enabled in VM mode
[drm] VCN jpeg decode is enabled in VM mode
[drm] vm size is 262144 GB, 4 levels, block size is 9-bit, fragment size is 9-bit
drmn0: VRAM: 512M 0x000000F400000000 - 0x000000F41FFFFFFF (512M used)
drmn0: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
drmn0: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
Successfully added WC MTRR for [0xd0000000-0xdfffffff]: 0;
[drm] Detected VRAM RAM=512M, BAR=256M
[drm] RAM width 64bits UNKNOWN
[TTM] Zone  kernel: Available graphics memory: 16436432 KiB
[TTM] Zone   dma32: Available graphics memory: 2097152 KiB
[TTM] Initializing pool allocator
[drm] amdgpu: 512M of VRAM memory ready
[drm] amdgpu: 3072M of GTT memory ready.
[drm] GART: num cpu pages 262144, num gpu pages 262144
[drm] PCIE GART of 1024M enabled (table at 0x000000F400900000).
amdgpu/renoir_asd.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_asd.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_asd_bin
amdgpu/renoir_pfp.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_pfp.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_pfp_bin
amdgpu/renoir_me.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_me.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_me_bin
amdgpu/renoir_ce.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_ce.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_ce_bin
amdgpu/renoir_rlc.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_rlc.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_rlc_bin
amdgpu/renoir_mec.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_mec.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_mec_bin
amdgpu/renoir_mec2.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_mec2.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_mec2_bin
[drm] use_doorbell being set to: [true]
amdgpu/renoir_vcn.bin: could not load firmware image, error 2
drmn0: fail (0) to get firmware image with name: amdgpu/renoir_vcn.bin
drmn0: successfully loaded firmware image with mapped name: amdgpu_renoir_vcn_bin
[drm] Found VCN firmware Version ENC: 1.7 DEC: 4 VEP: 0 Revision: 17
[drm] PSP loading VCN firmware
sos fw version = 0x110065.
[drm] reserve 0x400000 from 0xf41f800000 for PSP TMR
amdgpu: [powerplay] smu driver if version = 0x0000000a, smu fw if version = 0x0000000e, smu fw version = 0x00374e00 (55.78.0)
amdgpu: [powerplay] SMU driver if version not matched
amdgpu: [powerplay] dpm has been disabled
amdgpu: [powerplay] SMU is initialized successfully!
[drm] Display Core initialized with v3.2.56!
[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 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] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] VCN decode and encode initialized successfully(under DPG Mode).
[drm] Cannot find any crtc or sizes
drmn0: ring gfx uses VM inv eng 0 on hub 0
drmn0: ring comp_1.0.0 uses VM inv eng 1 on hub 0
drmn0: ring comp_1.1.0 uses VM inv eng 4 on hub 0
drmn0: ring comp_1.2.0 uses VM inv eng 5 on hub 0
drmn0: ring comp_1.3.0 uses VM inv eng 6 on hub 0
drmn0: ring comp_1.0.1 uses VM inv eng 7 on hub 0
drmn0: ring comp_1.1.1 uses VM inv eng 8 on hub 0
drmn0: ring comp_1.2.1 uses VM inv eng 9 on hub 0
drmn0: ring comp_1.3.1 uses VM inv eng 10 on hub 0
drmn0: ring kiq_2.1.0 uses VM inv eng 11 on hub 0
drmn0: ring sdma0 uses VM inv eng 0 on hub 1
drmn0: ring vcn_dec uses VM inv eng 1 on hub 1
drmn0: ring vcn_enc0 uses VM inv eng 4 on hub 1
drmn0: ring vcn_enc1 uses VM inv eng 5 on hub 1
drmn0: ring vcn_jpeg uses VM inv eng 6 on hub 1
[drm] Initialized amdgpu 3.36.0 20150101 for drmn0 on minor 0

# ls -lh /boot/modules/amdgpu_renoir_*
-r-xr-xr-x  1 root  wheel   188K Mar 31 20:20 /boot/modules/amdgpu_renoir_asd_bin.ko
-r-xr-xr-x  1 root  wheel    21K Mar 31 20:20 /boot/modules/amdgpu_renoir_ce_bin.ko
-r-xr-xr-x  1 root  wheel    68K Mar 31 20:20 /boot/modules/amdgpu_renoir_dmcub_bin.ko
-r-xr-xr-x  1 root  wheel    12K Mar 31 20:20 /boot/modules/amdgpu_renoir_gpu_info_bin.ko
-r-xr-xr-x  1 root  wheel    29K Mar 31 20:20 /boot/modules/amdgpu_renoir_me_bin.ko
-r-xr-xr-x  1 root  wheel   274K Mar 31 20:20 /boot/modules/amdgpu_renoir_mec_bin.ko
-r-xr-xr-x  1 root  wheel   274K Mar 31 20:20 /boot/modules/amdgpu_renoir_mec2_bin.ko
-r-xr-xr-x  1 root  wheel    33K Mar 31 20:20 /boot/modules/amdgpu_renoir_pfp_bin.ko
-r-xr-xr-x  1 root  wheel    50K Mar 31 20:20 /boot/modules/amdgpu_renoir_rlc_bin.ko
-r-xr-xr-x  1 root  wheel    29K Mar 31 20:20 /boot/modules/amdgpu_renoir_sdma_bin.ko
-r-xr-xr-x  1 root  wheel    45K Mar 31 20:20 /boot/modules/amdgpu_renoir_ta_bin.ko
-r-xr-xr-x  1 root  wheel   459K Mar 31 20:20 /boot/modules/amdgpu_renoir_vcn_bin.ko
```

amdgpu.conf

```
Section "Device"
        Identifier      "Card0"
        Driver           "amdgpu"
        BusID           "PCI:6:0:0"
        Option          "DRI"   "3"
        Option          "TearFree"              "true"
EndSection
```

Then screen blanks (I was on physical ttyv0 console) even before starting Xorg.
Same results with and without `efi_max_resolution="720p"` in loader.conf
Blindy typing startx() in console won't unblank screen.


When Xorg is started it seems stuck in D state (unable to kill it with -9)

```
ps aux | grep Xorg
root       1653    0.0  0.2 208376  55376 v0  D    20:09    0:00.07 /usr/local/bin/Xorg :0 -auth /home/johnny/.serverauth.1639
```

Xorg.0.log attached


----------



## Novolaska (Apr 9, 2021)

FreeBSD r7s 13.0-RC5-p1 FreeBSD 13.0-RC5-p1 #4 releng-n244730-273977acb0a: Fri Apr  9 20:23:50 CST 2021

ports/gpu-firmware-kmod, distinfo:

```
TIMESTAMP = 1616130029
SHA256 (freebsd-drm-kmod-firmware-g20210224-d15ea6e_GH0.tar.gz) = 93db8caa4423f1553aaf8f7ae2e874425548890054028b44ed696e5ef73aef86
SIZE (freebsd-drm-kmod-firmware-g20210224-d15ea6e_GH0.tar.gz) = 24466018
```


----------



## JohnnySorocil (Sep 14, 2021)

Finally get my workstation to work with amdgpu.ko

TL;DR: Don't put 

```
kern.vt.fb.default_mode=...
```
 in /boot/loader.conf

As stated earlier you need at least DRM 5.5 for Renoir.
Currently it won't compile on 13.0-RELEASE so you'll need 13.0-STABLE src and running system.

DRM 5.5 is not yet merged into ports tree, you need to get it and compile manually.
(assuming that you are running 13-STABLE and /usr/src has checkouted origin/stable/13 branch)

```
cd /usr/ports/graphics
mkdir /usr/ports/graphics/drm-kmod-git
cd /usr/ports/graphics/drm-kmod-git
git clone https://github.com/freebsd/drm-kmod .
git checkout -b 5.5-stable origin/5.5-stable
make && make install
```

To successfully load built module you need to be running FreeBSD 13-STABLE.

My versions and config files:

```
git -C /usr/src log -1 | head -1
commit 69d2ba675a6d567b86a022022ba3fcc64ed4c1f6 (HEAD -> refs/heads/stable13, refs/remotes/origin/stable/13)

git -C /usr/ports/graphics/drm-kmod-git log -1 | head -1
commit 93009bacca9117d102e574596e565f6337ed83b7 (HEAD -> refs/heads/5.5-stable, tag: refs/tags/drm_v5.5.19_2, refs/remotes/origin/5.5-stable)

pkg info mesa-dri mesa-libs gpu-firmware-kmod xorg-server-1.20.11_3,1 xf86-video\*
mesa-dri-21.1.5
mesa-libs-21.1.5_2
gpu-firmware-kmod-g20210330
xorg-server-1.20.11_3,1
xf86-video-amdgpu-19.1.0_2
xf86-video-scfb-0.0.5_2

cat /usr/local/etc/X11/xorg.conf.d/amdgpu.conf
Section "OutputClass"
        Identifier "Card0"
        Driver "amdgpu"
EndSection

# grep amdgpu /etc/rc.conf
kld_list="{kld_list} amdtemp /boot/modules/amdgpu.ko"
```

If you get black screen at this stage check for "kern.vt.fb.default_mode" in /boot/loader.conf.

In my case it will start Xorg with 640x480 resolution but you can fix it with something like:

```
xrandr --output HDMI-A-0 --mode 1920x1080
```
You can put it in your ~/.xinitrc or something similar for GUI login manager.

I still can't use my 2nd monitor connected to DisplayPort to integrated AMDGPU (xrandr recognized it but doesn't work). It doesn't work under Linux 5.10 either so I guess I have to wait some months/years before it works but this is good enough for now


----------



## SirDice (Sep 14, 2021)

JohnnySorocil said:


> DRM 5.5 is not yet merged into ports tree, you need to get it and compile manually.


graphics/drm-devel-kmod

You should be able to install it on a recent 13-STABLE

```
.if ${OPSYS} == FreeBSD && (${OSVERSION} < 1300513 || \
	(${OSVERSION} < 1400024 && ${OSVERSION} >= 1400000))
IGNORE=		not supported on older CURRENT/STABLE, no kernel support
.endif
```


----------



## laufdi (Aug 6, 2022)

JohnnySorocil said:


> Finally get my workstation to work with amdgpu.ko
> 
> As stated earlier you need at least DRM 5.5 for Renoir.
> Currently it won't compile on 13.0-RELEASE so you'll need 13.0-STABLE src and running system.
> ...


Hi, have you updated since then? Is it still working?


----------



## JohnnySorocil (Aug 28, 2022)

Yes, I am now on 13.1 RELEASE p1 with drm-510-kmod-5.10.113_1 package and it is working as expected


----------



## laufdi (Aug 28, 2022)

Thanks, in the meantime my problems disappeared, too (I still don't know why)


----------

