Ubuntu AMDGPU Drivers

I just came to the realisation that my Radeon HD 7850 is running the old radeon drivers, rather than the AMDGPU or even the RadeonSI drivers.

Running sudo lshw -c video confirms that this is the case.

Does anyone know how I can get the AMDGPU drivers up and running on the Ubuntu image provided by Canonical?
Furthermore, Vulkan under Wayland.

1 Like

im running ubuntu from canonical with upgraded kernel 15.12.4 (as shared on these forums) and i get

  *-display                 
       č©³ē“°: VGA compatible controller
       č£½å“: Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X]
       ćƒ™ćƒ³ćƒ€ćƒ¼: Advanced Micro Devices, Inc. [AMD/ATI]
       ē‰©ē†ID: 0
       ćƒć‚¹ęƒ…å ±: pci@0000:07:00.0
       č«–ē†å: /dev/fb0
       ćƒćƒ¼ć‚øćƒ§ćƒ³: c7
       幅: 64 bits
       ć‚Æ惭惃ć‚Æ: 33MHz
       ę€§čƒ½: pm pciexpress msi vga_controller bus_master cap_list rom fb
       čح定: depth=32 driver=amdgpu latency=0 mode=3840x2160 visual=truecolor xres=3840 yres=2160
       ćƒŖć‚½ćƒ¼ć‚¹: iomemory:200-1ff iomemory:210-20f irq:93 ćƒ”ćƒ¢ćƒŖćƒ¼:2000000000-20ffffffff ćƒ”ćƒ¢ćƒŖćƒ¼:2100000000-21001fffff IOćƒćƒ¼ćƒˆ:0(悵悤ć‚ŗ=256) ćƒ”ćƒ¢ćƒŖćƒ¼:60400000-6043ffff ćƒ”ćƒ¢ćƒŖćƒ¼:60440000-6045ffff

i think you are looking for driver=amdgpu right?

Would be very interested to know how to get the amdgpu drivers since Iā€™m still on radeon.

I gave up and moved on to other software things when my early searches found descriptions of how to change the driver in grubā€¦but then I realized we were in u-boot land.

If itā€™s just a matter of upgrading kernel, that would be swell too.

I began with the Ubuntu 21.04 image that was current when the boards started shipping.

Linux 5.11.0-1012-generic riscv64
  *-display                 
       description: VGA compatible controller
       product: Bonaire XTX [Radeon R7 260X/360]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:07:00.0
       logical name: /dev/fb0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom fb
       configuration: depth=32 driver=radeon latency=0 mode=1920x1200 visual=truecolor xres=1920 yres=1200
       resources: iomemory:200-1ff iomemory:200-1ff irq:93 memory:2000000000-200fffffff memory:2010000000-20107fffff ioport:0(size=256) memory:60400000-6043ffff memory:60440000-6045ffff

fwiw i booted back into ubuntu 5.11.0-1012-generic and i still get driver=amdgpu so im guessing it doesnt have anything to do with the particular kernelā€¦

maybe its some kind of issue with specific boards?

While both radeon and amdgpu are supported for some GPUs, the upstream kernel defaults to radeon for the AMD SI (a.k.a. GCN 1.0, including Pitcairn, which is the silicon underlying the 7850) and CKI (a.k.a. GCN 1.1, including Bonaire, the silicon underlying the 260X) GPU families, and our kernel respects that default. Thereā€™s some discussion in Ubuntu bug #1847198.

However, our kernels do enable the optional amdgpu support for those GPUs (by setting CONFIG_DRM_AMDGPU_SI=y and CONFIG_DRM_AMDGPU_CIK=y), itā€™s just not the default. You should be able to force the use of amdgpu by adding blacklist radeon to the end of /etc/modprobe.d/blacklist.conf, then running update-initramfs -u and rebooting.

(Polaris, a.k.a. GCN 4.0, the silicon underlying 540/540X/550/550X, is modern enough that it is only supported by amdgpu.)

1 Like

I was pretty excited to follow your directions @wgrant.

Unfortunately for kernels I tried (5.12.4 & 5.11.0-1012-generic) I got the following;

[   61.064058] [drm] amdgpu kernel modesetting enabled.
[   61.074533] amdgpu 0000:07:00.0: amdgpu: SI support provided by radeon.
[   61.080920] amdgpu 0000:07:00.0: amdgpu: Use radeon.si_support=0 amdgpu.si_support=1 to override.

and then nothing ever appears on screen.

Ah, oops, try adding U_BOOT_PARAMETERS="ro earlycon amdgpu.si_support=1" to the end of /etc/default/u-boot, then run u-boot-update and reboot.

Unfortunately the directions above did not work for me.
But I did have more success with following this guide here AMDGPU - ArchWiki
And I removed the module black listing suggested originally.

I am successfully using the AMDGPU drivers now, but suffice to say, Iā€™m still having difficulties getting Vulkan working.

But I must thank you again for your advice @wgrant

Congrats to your endeavors @pierce. I had also been looking at that guide for Arch, but had only seen samples of setting kernel parameters in other guides using grubā€¦I was coming up short looking for u-boot help.

Did you have to recompile the kernel, or were you successful using the u-boot parameter passing as @wgrant suggested above?

If I understand the arch wiki and wgrantā€™s helpful u-boot guidance above correctly, I think Iā€™ve summarized what I need to do below. Also, note that Iā€™m CIK not SI like you are, but I guess turning both on would not hurt since I think I have an older SI card around here too)

Would you sanity check this list below against what you did to successfully get amdgpu going? Iā€™m not going to try something until I know exactly what Iā€™m in for :slight_smile:

EDITED: steps below were adjusted after @pierce confirmed the steps, and I successfully applied then and enabled amdgpu on the unmatched for my CIK card as well

  1. Set kernel parameters in u-boot by editing /etc/default/u-boot
    U_BOOT_PARAMETERS="ro earlycon radeon.cik_support=0 amdgpu.cik_support=1 radeon.si_support=0 amdgpu.si_support=1

  2. Run u-boot-update

  3. Create or Edit /etc/modprobe.d/amdgpu.conf to ensure it has the following entries
    options amdgpu si_support=1
    options amdgpu cik_support=1

  4. Create or Edit /etc/modprobe.d/radeon.conf to ensure it has the following entries
    options radeon si_support=0
    options radeon cik_support=0

  5. Regenerate initramfs
    sudo update-initramfs -k all -u -v

  6. Reboot

Actually, none of the 3 conf files mentioned in the wiki exist on my system now, so it looks like Iā€™d be creating them from scratch?

Thanks for all the guidance, folks.

============================
EDITED: step below was removed from the steps based on @pierce 's confirmation that is may be Arch specific

Create or Edit /etc/mkinitcpio.conf to ensure it has the following entries. *Here is where I am most confused since this file does not exist on my system and it seems more complicated than the 2 conf files above.
modconf is in the the HOOKS array
MODULES=(amdgpu radeon)

I didnā€™t have to recompile the kernel, I tested it against the 5.12.4 and 5.11.0.1012 kernels, and it appears fine. In the post for 5.12.4, the config for building shows that the modules we need are already supplied, and @wgrant confirmed that itā€™s already the case with the stock ubuntu kernels.

I just followed the instructions for both cik and si (because why not).
Editing u-boot on its own didnā€™t seem to work on its own, but I still have it there ā€œjust in caseā€.
I have both the amdgpu.conf and radeon.conf, as you have.
I didnā€™t touch mkinitcpio.conf, as I think this is not really a debian/ubuntu thing, but more an arch thing.
Then I ran sudo update-initramfs -k all -u to ensure all kernels are updated (this may take a while). It may be worthwhile chucking a -v in there, just in case youā€™re still having issues. There were a few warnings regarding missing firmware blobs for amdgpu cards that werenā€™t related to Pitcairn/Southern Islands, but if you fall into this category there are guides on stack overflow in how to import these firmware blobs.

Then I just rebooted and confirmed with lspci -k | grep -EA3 'VGA|3D|Display' and sudo lshw -c video

ubuntu@ubuntu:~$ lspci -k | grep -EA3 'VGA|3D|Display'
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Pitcairn PRO [Radeon HD 7850 / R7 265 / R9 270 1024SP]
	Subsystem: Gigabyte Technology Co., Ltd Pitcairn PRO [Radeon HD 7850 / R7 265 / R9 270 1024SP]
	Kernel driver in use: amdgpu
	Kernel modules: radeon, amdgpu
ubuntu@ubuntu:~$ sudo lshw -c video
  *-display                 
       description: VGA compatible controller
       product: Pitcairn PRO [Radeon HD 7850 / R7 265 / R9 270 1024SP]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:07:00.0
       logical name: /dev/fb0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom fb
       configuration: depth=32 driver=amdgpu latency=0 mode=5120x1440 visual=truecolor xres=5120 yres=1440
       resources: iomemory:200-1ff irq:93 memory:2000000000-200fffffff memory:60500000-6053ffff ioport:0(size=256) memory:60540000-6055ffff

I had a precursory look at getting AMDVLK going but there are a couple dependencies that arenā€™t available in the Ubuntu repos.

So I was looking into getting audio over HDMI working with AMDGPU.
Unfortunately I found this AMDGPU-Driver - Community Help Wiki

Back to Radeon we go!

Thanks, @pierce I am successfully updated and now using amdgpu with my CIK family card. I updated my original steps post above with your clarifications, which worked perfectly for me.

So somehow, Iā€™m running AMDGPU with audio out of HDMI. If anyone has tried the above steps and hasnā€™t got audio out, Iā€™d love to compare notes.

The other thing Iā€™ve encountered is that there are THREE distinct Vulkan implementations for AMD GPUs.

  • AMDVLK
  • AMDGPU-PRO
  • RADV

The PRO driver is AMDā€™s binary only driver which I donā€™t believe will ever work on the Unmatched.
The AMDVLK driver is what comes bundled AMDPRO and is also maintained by AMD.
RADV is apparently not a product of AMD, but rather the Mesa team.

So we should technically have two options of Vulkan on the unmatched, AMDVLK or RADV. But there is some source building that needs to be had. What that source is, Iā€™m having trouble ascertaining.

Iā€™d love to know if anyone else has attempted to get Vulkan going, or has any idea on how to get it going.

1 Like

Iā€™m really interested in this too. I think the best bet is radv. Up into now I gave up at the ā€œdebian doesnā€™t build vulkan drivers for RISC-Vā€ step, though, havenā€™t tried compiling MESA myself, I have done so many times as part of a job years ago so I might try. But I donā€™t know why it isnā€™t built, if thereā€™s any non trivial dependency issues.

Tried to build the Mesa radv vulkan driver. It just worked (Debian Sid)ā€”

# YMMV - I may have had some requirements already installed
sudo apt install llvm-dev libelf-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-present-dev libxshmfence-dev libsensors-dev

git clone --depth=10 https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa
mkdir build
meson build/ -Dprefix=/opt/mesa -Ddri-drivers= -Dgallium-drivers= -Dvulkan-drivers=amd
ninja -C build
sudo mkdir /opt/mesa
sudo ninja -C build install

# show info
VK_ICD_FILENAMES="/opt/mesa/share/vulkan/icd.d/radeon_icd.riscv64.json" vulkaninfo

2 Likes

Nice. Iā€™ve also managed to get Vulkan working; on Ubuntu 21.04ā€¦ with mesa 21.1.8
[Ill try Mesa 21.2.x once Ubuntu 21.10 is releasedā€¦]
Iā€™m using a Radeon RX 550 [2 GB] gfx card.

Dependencies and build:
[Iā€™d already installed a GNOME desktop and built & run some OpenGL / libSDL games, so this isnā€™t the full list of dependencies on a clean systemā€¦]

sudo apt install meson cmake clang llvm-dev llvm libelf-dev byacc flex bison 
sudo apt install libwayland-egl-backend-dev libxshmfence-dev wayland-protocols 
sudo apt install libzstd-dev libx11-xcb-dev 
sudo apt install libxcb-glx0-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-present-dev libxcb-shm0-dev 
sudo apt install python3-mako libdrm-dev


# Build setup:
mkdir ./installdir 
export MESA_INSTALLDIR=/home/ubuntu/Build/Graphics/mesa3d/mesa-21.2.1/installdir 

# Build lavapipe:
meson builddir/ -Dprefix="$MESA_INSTALLDIR" -Ddri-drivers= -Dgallium-drivers=swrast -Dvulkan-drivers=swrast 
time ninja -C builddir/ install

# Build radeon_si and RADV: 
meson --reconfigure builddir/ -Dprefix="$MESA_INSTALLDIR" -Ddri-drivers= -Dgallium-drivers=radeonsi -Dvulkan-drivers=amd 
time ninja -C builddir/ install

vulkaninfo and vkcube work with no issues.
vulkaninfo output:

$ VK_ICD_FiLENAME="%MESA_INSTALLDIR/share/vulkan/icd.d/radeon_icd.riscv64.json" vulkaninfo | grep "GPU id "
GPU id : 0 (AMD RADV POLARIS12 (ACO)):

Iā€™ve also just finished building the Vulkan demos from source [from Sacha Willems github] - they seem to run fineā€¦
Vulkan Demos

Build times for the above builds:
Lavapipe:

$ time ninja -C builddir/ install 
real 39m6.155s 
user 126m55.227s 
sys 9m18.602s 

RadeonSI / RADV:

$ time ninja -C builddir/ install 
real 24m59.488s 
user 74m16.966s 
sys 4m35.029s 

Vulkan demos:

$ make -j4
real	71m14.828s
user	246m26.641s
sys	4m12.089s

Running ā€œcomputeparticlesā€:

3 Likes

As a follow up to my previous post, Iā€™ve also built the latest version [from Git] of CoreCtrl, with seems to be working perfectly with the GPU [the CPU info is blank for obvious resasons].

This, IMHO, shows the great work the mesa team, the community, and AMD have done on the open source AMD drivers and Mesa software stackā€¦
Next, I may try my Radeon 5700 XT, which I expect to work without any issuesā€¦ :grinning:

CoreCtrl Dependencies:

# Build:
sudo apt install qttools5-dev extra-cmake-modules libdrm-dev libqt5quick5 libqt5charts5-dev qtdeclarative5-dev libbotan-2-dev libkf5archive-dev libkf5auth-dev libqt5svg5-dev botan

# Run:
sudo apt install hwdata  qml-module-qt-labs-platform qml-module-qtquick-controls2 qml-module-qtcharts qml-module-qtquick-layouts qml-module-qtquick2 qml-module-qtquick-extras


does enabling mesa + amd vulcan have any performance (window resizing, compositing, drawing etc) impact on the (gnome) desktop?

e.g does it improve things at all, or is there some other bottleneck?

An older version of Mesa [including OpenGL] is already installed [& ā€œactiveā€] in the base installation of Ubuntu 21.04 [once you install desktop, with X, GPU drivers, etcā€¦], so itā€™s already there.

All I did was build a later version, and include the Vulkan ā€œdriverā€ - RADV - in the build. I didnā€™t overwrite the system default Mesa install, so unable to see if newer Mesa version made a difference, but I highly doubt it will make any noticeable difference in the desktop performance.

Ubuntu 21.10 will have an even newer version of Mesa [since the version of Mesa I could build was limited by the amdgpu driver version in the included 5.11.x kernel version]. Iā€™m hoping a working RADV Vulkan driver will be included as part of the available packages.
Once 21.10 releases, Iā€™ll switch to that and see if I can notice any subjective [or objective] differencesā€¦but again, I donā€™t really expect any noticeable improvement.

amdgpu kernel driver and Mesa RaseonSI/RADV are very mature at this point, especially for the RX 5xx series [Iā€™ve tried an RX 550 and RX 580 with my Unmatched]; I honestly think the Desktop ā€œlagginessā€ is due to the relatively low CPU performanceā€¦ not the graphics software stackā€¦

A new version of Mesa can sometimes improve performance (or, worsen in case of a regression). Vulkan, noā€”wonā€™t make a difference. None of the commonplace Linux desktop programs support using that for rendering, not even blender yet.

And this. Any kind of discrete PCI-e GPU will be really overpowered already compared to the CPU.

1 Like