# amdgpu and DRI problem



## pan-te (Dec 18, 2020)

Good evening,
I recently installed FreeBSD for second time in my life, and I experienced trouble with DRI.
I can't find it anywhere, so I will ask here.
Is amdgpu_dri.so provided by any package or port? I've tried to launch linux-enemyterritory and I'm only able to run it in swrast mode because of this:

```
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: pci id for fd 8: 1002:7340, driver (null)
pci id for fd 9: 1002:7340, driver (null)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
Using 4/4/4 Color bits, 24 depth, 0 stencil display.
GL_RENDERER: llvmpipe (LLVM 7.0, 128 bits)
WARNNING: GL extensions string too long (5771), truncated to 4096
Initializing OpenGL extensions [...]
```
 Similar problem occurred with wined3d:

```
libGL error: pci id for fd 12: 1002:7340, driver (null)
libGL error: No driver found
libGL error: failed to load driver: (null)
libGL error: pci id for fd 12: 1002:7340, driver (null)
pci id for fd 13: 1002:7340, driver (null)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi [...]
```
I'm using FreeBSD 13.0-CURRENT with latest drm-devel-kmod and xf86-video-amdgpu.


----------



## pan-te (Dec 19, 2020)

I configured Xorg for DRI3, and I find out that 64bit libGL has no problem with 3d acceleration. But 32bit apps (while DRI3) now crashes amdgpu driver.


----------



## Alexander88207 (Dec 19, 2020)

Hello, pan-te

how do you have setup your gpu?

The fast right way would be:

1. Install graphics/drm-kmod from ports
2. Write the entry (kld_list="amdgpu") in `/etc/rc.conf`
3. Add your $USER to the video group. (`pw groupmod video -M $USER`)
4. Done
---
Extra:

x11-drivers/xf86-video-amdgpu is not strictly needed but also should work for you if you want to use it too.

4. Install x11-drivers/xf86-video-amdgpuxf86-video-amdgpu
5. Create an amdgpu.conf in /usr/local/share/X11/xorg.conf.d with (This is an example for an one card setup)


```
Section "Device"

    Identifier "Card0"

    Driver     "amdgpu"

EndSection
```

I recommend you as a newbie to take the releases (Unless you have to use it because you have a newer graphics card.), the -current images are experimental and some things can break fast from time to time. Also you need to maintain such a system from source.

BTW: For me wine32 is working fine also had no problem with linux stuff in the past.


----------



## Raffeale (Dec 20, 2020)

i think the probelm is that mantainer forgot to compile admgpu_dri  in it , so you can compile it from port! 
compile these package from port
mesa-dri
mesa-libs


----------



## Alexander88207 (Dec 20, 2020)

amdgpu.dri.so gets shipped by x11-drivers/xf86-video-amdgpu via pkg and ports, sits in /usr/local/lib/xorg/modules/drivers and is working fine:


```
[    34.517] (II) LoadModule: "amdgpu"
[    34.517] (II) Loading /usr/local/lib/xorg/modules/drivers/amdgpu_drv.so
[    34.564] (II) Module amdgpu: vendor="X.Org Foundation"
[    34.564]     compiled for 1.20.9, module version = 19.1.0
[    34.564]     Module class: X.Org Video Driver
[    34.564]     ABI class: X.Org Video Driver, version 24.1
[    34.564] (II) AMDGPU: Driver for AMD Radeon:
    All GPUs supported by the amdgpu kernel driver
```


----------



## pan-te (Dec 30, 2020)

Alexander88207 said:


> amdgpu.dri.so gets shipped by x11-drivers/xf86-video-amdgpu via pkg and ports, sits in /usr/local/lib/xorg/modules/drivers and is working fine:
> 
> 
> ```
> ...


Upgrading system from source isn't painful. I decided for 13.0-CURRENT branch because of lacking support for NAVI14 GPUs.
With BSD-native, 64bit applications, I didn't experience any problems. All kernel modules related with amdgpu are loading flawlessly. Maybe with older GPU, which uses radeonkms, 3d acceleration with linux compatibility should work.
With propertly set up Xorg and amdgpu loaded:

zandronum x86_64 (linux compat mode):


> libGL: Can't open configuration file /etc/drirc: No such file or directory.
> libGL: Can't open configuration file /home/sadlikd/.drirc: No such file or directory.
> libGL: Can't open configuration file /etc/drirc: No such file or directory.
> libGL: Can't open configuration file /home/sadlikd/.drirc: No such file or directory.
> ...



dhewm3 x86_64 (native):


> Initializing OpenGL subsystem
> libGL: Can't open configuration file /usr/local/etc/drirc: No such file or directory.
> libGL: Can't open configuration file /home/sadlikd/.drirc: No such file or directory.
> libGL: using driver amdgpu for 14
> ...


As You can see, dhewm3 works fine.


----------



## Argentum (Dec 31, 2020)

pan-te said:


> I'm using FreeBSD 13.0-CURRENT with latest drm-devel-kmod and xf86-video-amdgpu.


That seems to be the whole point - *do not use 13.0* before it is ready. Use 12.2. 

Another point is that DRM will be removed from base stating from v 13.x. In the future, the DRM should be installed from ports. Also, considering that, it could be a good practice to remove the DRM from 12.2 base by inserting `WITHOUT_MODULES=drm drm2` into /etc/make.conf before building the kernel.


----------



## Raffeale (Jan 23, 2021)

reinstall mesa-dri or compile mesa-dri
from port  , /usr/ports/graphic/mesa-dri
 before you do it xi recommend you update your ports to the last version, 
compile xf86-video-amdgpu from port


----------

