# Changed AMD Video Cards, Radeon Driver Won't Go Away

## tabanus

I've just upgraded a PC re-using hard drives, but with a new motherboard, CPU, graphics.

The old PC used the radeon graphics driver, and the new one is an AMD APU with Carrizo graphics. This uses the newer amdgpu driver. I've changed all the settings I can think of, re-compiled the kernel and libdrm for the new driver, but portage insists on compiling mesa with radeon graphics support. How do I nuke this?

```
$ cat /etc/portage/make.conf

CFLAGS="-march=bdver4 -pipe -O2"

CHOST="x86_64-pc-linux-gnu"

CXXFLAGS="${CFLAGS}"

CPU_FLAGS_X86="aes avx avx2 fma3 fma4 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop"

LINGUAS="en_GB"

L10N="en-GB"

MAKEOPTS="-j4"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"

USE="alsa cdr corefonts cups dri dvd ffmpeg foomaticdb icu nptl nsplugin opengl truetype type1 -bluetooth -firefox -gnome -gstreamer -gtk -introspection -ipv6 -libav -libnotify -oss -quicktime -samba -semantic-desktop -startup-notification -xinerama"

FEATURES="parallel-fetch buildpkg"

EMERGE_DEFAULT_OPTS="--verbose"

INPUT_DEVICES="evdev"

VIDEO_CARDS="amdgpu radeonsi"

PORTAGE_ELOG_SYSTEM="save_summary echo"

PORTDIR_OVERLAY="/usr/portage/local"

ACCEPT_LICENSE="dlj-1.1 google-chrome Google-TOS"

PORTAGE_NICENESS="15"

SANE_BACKENDS=""

GRUB_PLATFORMS="pc"

PORTDIR="/usr/portage" 
```

```
# emerge -p mesa

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] x11-libs/libdrm-2.4.80::gentoo  USE="-libkms -static-libs -valgrind" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="amdgpu radeon* (-exynos) (-freedreno) -intel -nouveau (-omap) (-tegra) (-vc4) (-vivante) -vmware" 0 KiB

[ebuild   R    ] media-libs/mesa-17.0.6::gentoo  USE="classic dri3 egl gallium gbm gles2 llvm nptl wayland -bindist -d3d9 -debug -gles1 -opencl -openmax -osmesa -pax_kernel -pic (-selinux) -vaapi -valgrind -vdpau -vulkan -xa -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="radeonsi* (-freedreno) -i915 -i965 -imx -intel -nouveau -r100 -r200 -r300 -r600 -radeon* (-vc4) (-vivante) -vmware" 0 KiB

Total: 2 packages (2 reinstalls), Size of downloads: 0 KiB

The following USE changes are necessary to proceed:

 (see "package.use" in the portage(5) man page for more details)

# required by media-libs/mesa-17.0.6::gentoo[-video_cards_r100,-video_cards_r300,-video_cards_r200,-video_cards_r600,-video_cards_radeon,video_cards_radeonsi]

# required by mesa (argument)

>=x11-libs/libdrm-2.4.80 video_cards_radeon
```

----------

## cyrillic

You could always try leaving out the radeon module from the kernel, and see how it goes.

 */proc/config.gz wrote:*   

> # CONFIG_DRM_RADEON is not set
> 
> CONFIG_DRM_AMDGPU=m
> 
> CONFIG_DRM_AMDGPU_SI=y
> ...

 

I think the amdgpu module is mainly for polaris and vega chips, but I have tried it with a hawaii chip and it seems to work.

----------

## pjp

Mesa itself doesn't appear to be using radeon in that output. And libdrm doesn't have an option for radeonsi, only radeon. I wonder if that is the issue? 

Maybe this helps?

----------

## fedeliallalinea

You tried with 

```
# emerge -ND --with-bdeps y @world
```

----------

## duby2291

That's perfectly normal. The kernel has the radeon driver and the amdgpu driver. But mesa also has some drivers r300g, r600g and radeonsi. But there are shared components between them called radeon. It's not itself a driver, it's just a place where they can share stuff.

----------

## tabanus

Thanks for the replies

```

# emerge -ND --with-bdeps y @world
```

Allowed me to compile mesa without VIDEO_CARDS="radeon", but the system still wants to install x11-drivers/xf86-video-ati which is pulled in by libdrm. Upgrading to the latest mesa/libdrm/llvm as suggested on the reddit page that pjp linked doesn't appear to improve the situation.

I guess for now at least I'll have to stick with VIDEO_CARDS="amdgpu radeonsi radeon"

It doesn't really make sense that you have to install multiple drivers for the one chip. Seems to be working anyway. X starts & glx gears works.

----------

## cyrillic

You can check which kernel module your video card is using like this :

```
# lspci -k

...

03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Hawaii XT / Grenada XT [Radeon R9 290X/390X]

   Subsystem: PC Partner Limited / Sapphire Technology Hawaii XT / Grenada XT [Radeon R9 290X/390X]

   Kernel driver in use: amdgpu

   Kernel modules: amdgpu

```

I think most AMD chips default to the radeon driver unless you leave it out of the kernel like I did.

----------

## vaxbrat

It's fine to have radeon in your VIDEO_CARDS for your amdgpu.  Here's what I have with an installed RX-460.  I do leave out the radeon from kernel though.

```
# grep RADEON /usr/src/linux/.config

# CONFIG_DRM_RADEON is not set

# CONFIG_FB_RADEON is not set

# grep AMDGPU /usr/src/linux/.config

CONFIG_DRM_AMDGPU=m

CONFIG_DRM_AMDGPU_SI=y

CONFIG_DRM_AMDGPU_CIK=y

CONFIG_DRM_AMDGPU_USERPTR=y

CONFIG_DRM_AMDGPU_GART_DEBUGFS=y
```

```
0c:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Baffin [Polaris11] (rev cf)

        Subsystem: Gigabyte Technology Co., Ltd Baffin [Polaris11]

        Kernel driver in use: amdgpu

        Kernel modules: amdgpu

```

```
# grep VIDEO /etc/portage/make.conf

VIDEO_CARDS="vesa radeonsi amdgpu radeon"

```

```
# emerge -pv mesa

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ~] media-libs/mesa-17.2.1::gentoo  USE="classic dri3 egl gallium gbm gles1 gles2 llvm nptl opencl osmesa vaapi valgrind vdpau vulkan wayland xa xvmc -bindist -d3d9 -debug -openmax -pax_kernel -pic (-selinux) -unwind" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="radeon radeonsi (-freedreno) -i915 -i965 -imx -intel -nouveau -r100 -r200 -r300 -r600 (-vc4) (-vivante) -vmware" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

```

```
# emerge -pv libdrm                                                                                    

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ~] x11-libs/libdrm-2.4.83::gentoo  USE="libkms static-libs valgrind" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="amdgpu radeon (-exynos) (-freedreno) -intel -nouveau (-omap) (-tegra) (-vc4) (-vivante) -vmware" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

```

And so I have the xf86-video-ati emerged but it will never get used:

```
# ls /var/db/pkg/x11-drivers

xf86-input-evdev-2.10.5     xf86-input-mouse-1.9.2   xf86-video-fbdev-0.4.4

xf86-input-keyboard-1.9.0   xf86-video-amdgpu-1.4.0  xf86-video-qxl-0.1.5

xf86-input-libinput-0.25.1  xf86-video-ati-7.10.0    xf86-video-vesa-2.3.4

```

----------

## tabanus

This has to be a bug in the ebuild/portage.

It's pulling in completely unnecessary dependencies, ie x11-drivers/xf86-video-ati, and radeon in mesa.

Not sure who I would report this to

----------

## Jaglover

It is more likely your world file is contaminated.

----------

## Hu

```
    36  RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi"

    77  LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.74"

   136  for card in ${RADEON_CARDS}; do

   137      RDEPEND="${RDEPEND}

   138          video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )

   139      "

   140  done
```

That explains why mesa with radeonsi requests x11-libs/libdrm with VIDEO_CARDS=radeon.  None of the output shown supports the statement that x11-libs/libdrm requires x11-drivers/xf86-video-ati, nor does the x11-libs/libdrm ebuild support that.  However, if you installed x11-drivers/xorg-drivers with the right flags, that would require x11-drivers/xf86-video-ati.

----------

## Gordex

indeed @ Hu.. encountered the same problem just today

----------

