Accelerated Xorg on AMDGPU Renoir

JohnnySorocil

Active Member

Reaction score: 21
Messages: 106

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
Code:
hw.amdgpu.exp_hw_support=1

/etc/rc.conf
Code:
kld_list="${kld_list} /boot/modules/amdgpu.ko amdtemp"

After running startx as user X doesn't start:
Code:
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
Code:
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)
Code:
% 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
Code:
% 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:
Code:
VT(efifb): resolution 800x600
dmesg without efi_max_resolution set:
Code:
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:
Code:
% 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.
 

Attachments

  • Xorg.no-conf.txt
    5 KB · Views: 16
  • Xorg.with-conf.txt
    4.9 KB · Views: 17
Last edited by a moderator:

Raffeale

Active Member

Reaction score: 33
Messages: 194

try this
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.
 
OP
JohnnySorocil

JohnnySorocil

Active Member

Reaction score: 21
Messages: 106

try this
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.

Code:
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

Code:
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.

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

Active Member

Reaction score: 33
Messages: 194

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

New Member


Messages: 3

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

Ports:
Code:
emulators/linux_base-c7
graphics/drm-kmod
graphics/gpu-firmware-kmod
x11-drivers/xf86-video-amdgpu
Code:
graphics/drm-kmod
graphics/gpu-firmware-kmod
x11-drivers/xf86-video-amdgpu

/boot/loader.conf
Code:
kern.vty=vt
#hw.amdgpu.exp_hw_support="1" # no more needed
linux64_load="YES"
Code:
kern.vty=vt
#hw.amdgpu.exp_hw_support="1" # no more needed

/etc/rc.conf
Code:
kld_list="amdgpu"

xorg.conf.d/amdgpu.conf
Code:
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
 

Attachments

  • Xorg.0.log.txt
    27.4 KB · Views: 3
OP
JohnnySorocil

JohnnySorocil

Active Member

Reaction score: 21
Messages: 106

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:
Code:
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

New Member


Messages: 3

pciconf -lv | grep -A4 vgapci
Code:
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
Code:
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.
 

Attachments

  • dmesg.today.txt
    17.8 KB · Views: 1
Top