AMD GPU suddenly unusably slow (mesa issue?)

After a system reboot, wayland/sway takes multiple seconds to render each frame. I did verify that hardware rendering is still in use. It didn’t, as far as I can see, fall back to llvmpipe. It was working perfectly before.

Anyone else seeing this? I suspect this has to do with a debian package upgrade (Mesa drivers? I’m not sure).

  • kernel: 5.13.9 (unchanged, so unlikely to be the issue, also linux framebuffer terminal still works fine)
  • libgles2-mesa 21.2.5-1
  • AMD RX550 GPU
7:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] (rev c7)

I suspect it was this upgrade:

2021-11-06 15:51:31 upgrade libegl-mesa0:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:31 upgrade libgl1-mesa-dri:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:33 upgrade libglx-mesa0:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:33 upgrade libglapi-mesa:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:33 upgrade libegl1-mesa:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:33 upgrade libegl1-mesa-dev:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:35 upgrade libgl1-mesa-dev:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:36 upgrade libgles2-mesa-dev:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:45 upgrade mesa-va-drivers:riscv64 21.2.4-1 21.2.5-1
2021-11-06 15:51:46 upgrade mesa-vdpau-drivers:riscv64 21.2.4-1 21.2.5-1

Nothing new in dmesg. When I have some time I’ll try if reverting to the old version solves the issue.

Edit:

apt install libgbm-dev=21.2.4-1 libegl-mesa0=21.2.4-1 libgbm1=21.2.4-1 libgl1-mesa-dri=21.2.4-1 libglx-mesa0=21.2.4-1 libglapi-mesa=21.2.4-1 libegl1-mesa=21.2.4-1 libegl1-mesa-dev=21.2.4-1 libgl1-mesa-dev=21.2.4-1 libgles2-mesa-dev=21.2.4-1 mesa-va-drivers=21.2.4-1 mesa-vdpau-drivers=21.2.4-1

Fails, it cannot find the version anymore. I guess building from source is the only way, it’d be necessary for bisecting anyway…

It seems to be a problem with debian’s build. Building mesa (21.3.0, at least) from source solved the problem.

It seems the debian packaging change that caused this is:

mesa (21.2.3-1) unstable; urgency=medium

  [ Timo Aaltonen ]
  * New upstream release.
  * rules: Build with -O2 for ppc64el.
  * Build with llvm 13.

  [ Aurelien Jarno ]
  * Disable LLVM support on riscv64, it doesn't have JIT. (Closes: #995618)

 -- Timo Aaltonen <tjaalton@debian.org>  Mon, 04 Oct 2021 15:18:27 +0300

I suspect disabling LLVM also disappears radeonsi, as it uses LLVM for the shader compiler.

I’ve relayed this to Aurelien along with what I believe to be the fix (that still disables the broken llvmpipe)

1 Like

Thank you !

hello, i ve just upgraded from 21.10 to 22.04 Ubuntu and similar slowness immediately appears at next reboot (with new kernel 5.15 or even if trying the previoulsy fine recompiled 5.13). I know it was risky ;-). This omnipresent LLVM part has similar unexpected effect on VisionFive Riscv board, but it seems to be required by more and more software…
I’l try to recompile MESA next W.E., just to give a try.

I’m not able to try it myself, FWIW it looks like the change that fixed my issue did land in the Ubuntu release 22.04 http://changelogs.ubuntu.com/changelogs/pool/main/m/mesa/mesa_22.0.1-1ubuntu2/changelog

…
mesa (21.2.3-1) unstable; urgency=medium

  [ Timo Aaltonen ]
  * New upstream release.
  * rules: Build with -O2 for ppc64el.
  * Build with llvm 13.

  [ Aurelien Jarno ]
  * Disable LLVM support on riscv64, it doesn't have JIT. (Closes: #995618)

 -- Timo Aaltonen <tjaalton@debian.org>  Mon, 04 Oct 2021 15:18:27 +0300
…

packages.ubuntu.com doesn’t have a file listing for riscv64 so I’m not able to check if radeonsi driver is in there.

This topic has some instructions that might be useful for building Mesa from source for this hardware combo: Ubuntu AMDGPU Drivers - #14 by vmedea

1 Like

thanks, i will test building it on the Unmatched soon. I’ve just rebuilt MESA on the VisionFive on Fedora -but an older MESA release- so the process is still fresh. I hope rebuilding the Radeon part will solve the problem for my Unmatched with its R570, to enjoy Ubuntu 22 on it :slight_smile:

hello,
Finally yesteday i built from sources the MESA 21.3.8, everything was fine, testing from local installation /usr/local/lib/riscv-linux-gnu and i shutdown, thinking i would need to adjust ldconfig to add this path permanently … but booting today the display was already ok, amdgpu driver was listed in lsmod… so fixed.
Looking in /etc/ld.so.conf.d/ there was a riscv64-linux-gnu.conf that contains already the path to compiled libraries. :slight_smile:
Thanks for the links above anyway.

1 Like

Would you mind clarifying what you did? I upgraded to 22.04 and having the same issue.

  • Does is specifically have to be 21.3.8?
  • Is there any launch options for X11, etc…

Would be very helpful if you could answer :slight_smile:

hello,
i rebuilt MESA from sources to ensure DRI drivers for Radeon to be built, but also i wanted to avoid LLVM related problem (JIT errors) from recents MESA built. So i found the 21.3.8 was perfect in that context. You can try rebuilt fresh MESA sources of course, but not sure of the final result. In my case everything is just fast as it was. I can try to found the exact cmd line and options i used to built MESA, if it helps, but the core is dri for radeon. I’ll add the detailed line this afternoon.

1 Like

so, shamely i noted a lot more details about MESA compilation for the RiscV VisionFive board, but much less for the Unmatched, which is on focus there.
However thanks to my shell command history, i’m able to give the main steps.
First : information sources : Mesa3d install
Now the main steps :

  • Get the pre requisite to compile Mesa from sources (this is what takes me more time , as i tried to install the minimal list of package, and had to redo multiple time the Meson … (configuration) step below until no missing dependency errors appears :
sudo apt install meson cmake clang llvm-dev llvm libelf-dev byacc flex bison
sudo apt install libdrm-devel libvdpau-devel libva-devel libomixl-bellagio-devel elfutils-libelf-devel
sudo apt-get install libzstd-dev wayland-protocols-dev wayland-protocols libwayland-egl-backend-dev
sudo apt-get install libxcb-glx0-dev libunwind-14-dev libxcb-shm0-dev libx11-xcb-dev  libxcb-dri2-0-dev  libxcb-dri3-dev 
sudo apt-get install libxcb-present-dev libxcb-xvmc0-dev libxshmfence-dev
sudo apt-get install python3-mako 
  • get the MESA sources (and point to 21.3.8 version):
    first open a shell and locate where you want to build from sources, then :
git clone https://gitlab.freedesktop.org/mesa/mesa.git
git checkout mesa-21.3.8

Now configure and build the sources :

mkdir build
cd build
meson ..
ninja

(if a dependency is missing, the “meson …” will end up with explicit display, just install missing package and restart from there)
ninja is just doing the compilation part.

  • Check presence of one of the resulting compiled lib, and optionally its dependencies (really optional):
ls src/gallium/targets/dri/libgallium_dri.so
ldd src/gallium/targets/dri/libgallium_dri.so

if you see that lib(s), its is perfect, let’s install the compiled libraries and dependencies:

  • Install (as Sudo):
sudo ninja install

(note the installation path, just in case, but in my case i didn’t event need to add an extra file in /etc/ld.so.conf.d to indicate installed library path, as there was already a riscv64-linux-gnu.conf doing the job.

  • Reboot ! (and it was it for me) > accelerated graphics were back with my radeon RX570.

I retype every command by hand above, so i hope there is no name/command errors.
I think there are all details to succeed in your compilation process. Let’s me known if you managed to fix the problem.
Good luck.

1 Like

Amazing, it worked!
Thank you so much :smiley:

1 Like