# installing amdgpu-pro and getting vulkan

## newin

Hi all !

Well I'm opening this thread because it seems that almost no-one talk about that on the forum and I had a "pretty bad" experience with those drivers to say the least.

First it seems that there is no support from AMD to get other distros than ubuntu/steamOS. As fas as I know they will not try to make any portability effort as long as the driver isn't "good enough". I learned at my last GDC europe that the support of Vulkan in Redhat OSes are done by the redhat guy, not AMD.

On the gentoo side it seems that some wizard tried to make it possible: https://github.com/Lucretia/vulkan-overlay

But it didn't really worked for me. The overlay doesn't work (it is so broken that I used the ebuild as a "tutorial"...). After applying every patch by hand and fixing problem after problem I finally made the dkms part "work".

When I startX I get this: https://github.com/farmboy0/portage-overlay/issues/4

It seems that "AMDGPUPTR" could not get the pointer it wanted in this code: https://github.com/freedesktop-unofficial-mirror/xorg__driver__xf86-video-amdgpu/blob/master/src/amdgpu_kms.c

So I'm here to ask if someone achieved (or tried?) to make amdgpu-pro work on a gentoo 4.7 with a carrizo card.

If the driver is just "no yet ready" then I could help, if it works and I'm dumb then it will produce a basic knowledge for guys like me, if the overlay just needs a little patch then we can fix it and produce a tutorial here.

----------

## newin

I'm replying to myself to update the status of vulkan on AMD systems but this time it is not related to amdgpu-pro.

I just learned that there is a openSource initiative to get vulkan on AMD system called "RADV":

it seems to work pretty well:

http://www.phoronix.com/scan.php?page=news_item&px=RADV-Renders-Talos-Principle

and have good overall performance:

https://www.phoronix.com/scan.php?page=article&item=radeon-vulkan-radv&num=1

but I cannot find anything about it on gentoo's documentation or any documentation. I have no more information than "hey it works   :Very Happy:  " which is good but now I want to install it   :Crying or Very sad:  .

I would like to get Vulkan, I don't mind if it's from amdgpu-pro or RADV but both seems really hard to get. 

If anyone can give me a hint or help...

If I achieve to get Vulkan using amdgpu-pro or RADV (or any other way) I will write a full tutorial here.

----------

## paraw

I did something similar, but it works for me, on an overclocked Sapphire Nitro+ RX480 8GB. I'm using kernel 4.4.21.

I first installed vulkan, modifying Luke's ebuild. The modification I did is pretty much the same he also introduced about a week ago, i.e., installing also the header files.

Then I adapted his ebuild to install the latest version of the proprietary driver files (except the module).

Then I installed dkms from farmboy0's overlay, unpacked the dkms source by hand, and fixed that code in a certain number of points. Some of these patches, but not all of them, are the same as Luke's. Some of his I found were actually not needed, while I had to fix other things as well.

Then I built and installed the module, rebooted and all is fine.

Vulkan works, direct rendering works, no crashes, all is fine. I figured I didn't need a kernel > 4.4, since the module is written for Winbuntu 16.04, that uses a 4.4 kernel.

As for kernel options, I found you need CONFIG_VGA_SWITCHEROO, CONFIG_DRM, CONFIG_DRM_FBDEV_EMULATION, CONFIG_FB, CONFIG_FB_MODE_HELPERS, CONFIG_FB_VESA, CONFIG_FRAMEBUFFER_CONSOLE and CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY, some of which may be automatically selected. Also, you need CONFIG_DRM_AMDGPU built as a module with CONFIG_DRM_AMDGPU_USERPTR, and CONFIG_FB_RADEON, also built as a module, with CONFIG_FB_RADEON_I2C and CONFIG_FB_RADEON_BACKLIGHT. Note that you need these options even if you are not building for a laptop because the pro module needs them anyway.

As I wrote, all works fine for me.

----------

## newin

I'm curious to know which version of Xorg you have. After installing it X is complaining : 

```
(EE) ABI major version (8) doesn't match the server's version (9)

(EE) ABI major version (15) doesn't match the server's version (20)
```

and I have no idea that version is he talking about.

Did I miss something or I should downgrade X ?

[edit] the "version 8.0" is the the "ABI class : X.Org Server Extension version 8.0" of the module and Xorg seems to ask for 9.0. And this is the exact same problem for amdgpu which is "X.Org Video Driver, version 15" and Xorg ask for "20"...

[edit 2] I also would like to see your xorg.conf to know how you enable amdgpu-pro

----------

## Roman_Gruber

your kernel looks very old

----------

## asturm

 *Roman_Gruber wrote:*   

> your kernel looks very old

 

Roughly four weeks.

----------

## newin

 *Roman_Gruber wrote:*   

> your kernel looks very old

 

My kernel is a 4.7.2 which is fairly recent, it's not even flagged as "stable" by gentoo... I'm updating to 4.8 as I'm writing because it seems that amdgpu was updated pretty heavily those 3 last version ( 4.6 4.7 and 4.8 ).

PS: the "3.18" you are seeing in my signature is on my desktop and I'm trying to install amdgpu-pro on one of my 2 laptop.

[update] I am trying using the patches of "Lucretia": https://github.com/Lucretia/vulkan-overlay/tree/master/sys-kernel/amdgpu-pro-dkms it seems to be more up-to date but I ran into some problems and I had to make some "I-don't-know-what-I'm-doing" patches like deleting a "if" statement and things like that... I explained everything here if you want more details: https://github.com/Lucretia/vulkan-overlay/issues/18

At the end my kernel module crash when I startx with this dmesg: http://pastebin.com/raw/50r5HvgS

And optionally when I try to switch between TTY (CTRL+ALT+F2) my screen is freezing (I don't know if it's a full kernel panic or if the driver don't want to refresh my screen but I have to hard-reset my PC after doing this)

----------

## paraw

Sorry for the long absence. I just got the latest driver to work. Had to change the dkms source code, and made an ebuild for the rest of the driver. Works fine for me, including Vulkan. Screenshot of the Vulkan smoketest at http://www2.warwick.ac.uk/fac/cross_fac/complexity/people/staff/delgenio/Screenshot_20161029_210132.png. I'm a bit tired now, but at this point I'm thinking I should write a quick guide or something.

----------

## newin

I am finally getting something like look close to work !

I forgot the Idea of using amdgpu-pro it create too much problems so I'm trying to get RADV:

I updated my kernel to 4.9 (with sys-kernel/git-sources) and I switched to mesa 13 with media-libs/mesa-9999

for some weird reason I'm stuck to opengl 3.0 but I have shading language 4.30 which does not make any sense (mainly because glsl 430 is linked to opengl 4.3: https://en.wikipedia.org/wiki/OpenGL_Shading_Language )

```
glxinfo | grep opengl -i

OpenGL vendor string: X.Org

OpenGL renderer string: Gallium 0.4 on AMD CARRIZO (DRM 3.8.0 / 4.9.0-rc3, LLVM 3.9.0)

OpenGL core profile version string: 4.3 (Core Profile) Mesa 13.1.0-devel (git-bc4c09d)

OpenGL core profile shading language version string: 4.30

OpenGL core profile context flags: (none)

OpenGL core profile profile mask: core profile

OpenGL core profile extensions:

OpenGL version string: 3.0 Mesa 13.1.0-devel (git-bc4c09d)

OpenGL shading language version string: 1.30

OpenGL context flags: (none)

OpenGL extensions:

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 13.1.0-devel (git-bc4c09d)

OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

OpenGL ES profile extensions:
```

but anyway that is not the question here

but good news I can compile against Vulkan it find a driver without any problem except that the driver does not work:

```
vulkaninfo 

===========

VULKAN INFO

===========

Vulkan API Version: 1.0.29

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_unique_objects.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_threading.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_swapchain.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_parameter_validation.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_object_tracker.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_image.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /usr/share/vulkan/explicit_layer.d/VkLayer_core_validation.json, version "1.0.0"

INFO: [loader] Code 0 : Found manifest file /etc/vulkan/icd.d/amd_icd64.json, version "1.0.0"

vulkaninfo: symbol lookup error: /usr/lib/x86_64-linux-gnu/amdvlk64.so: undefined symbol: amdgpu_get_marketing_name
```

I get the error about "amdgpu_get_marketing_name" for every binary that use vulkan (obviously)

duckduckgo google (like 3 result and not about radv) aren't really helpful I have no idea where is should come from   :Sad: 

any guess here ?

----------

## newfuntek

The libdrm and xf86-amdgpu from AMD is missing, I think.   :Question: 

----------

## DHermit

Any news as the driver now left the beta state and reached version 16.50?

----------

## newin

Hey guys I'm coming back with a lot of test and news,

After everything I tried amdgpu-pro is by far the most complex to get vulkan. The easiest is by using Radv.

I did update to the kernel 4.9 and mesa 13.0.2 which leaded to a problem due to how portage is building llvm ( https://bugs.gentoo.org/show_bug.cgi?id=602850 )

 *Quote:*   

> CommandLine Error: Option 'asan-instrument-assembly' registered more
> 
> than once!
> 
> LLVM ERROR: inconsistency in registered CommandLine options

 

According to a mesa developper there is 2 ways to fix this problem:

1) using this patch: https://lists.freedesktop.org/archives/mesa-dev/2016-December/137277.html

2) "Compile LLVM using LLVM_BUILD_LLVM_DYLIB=ON mode instead of

BUILD_SHARED_LIBS=ON (requires a change in llvm ebuild or building

your own LLVM). If you go with the ebuild change, you will probably

have to rebuild everything that uses LLVM (I have not tried this;

there might be some problems in other packages due to this option,

though most other distributions apart from gentoo build LLVM in this

mode)." to quote the mail he sent to me.

(I choose to apply his patch to not broke the rest of my gentoo)

And that's it !

my vulkaninfo: http://pastebin.com/raw/jHrrcXcW

Now I'm having trouble running some vulkan example code because of an ERROR_EXTENSION_NOT_PRESENT error on VK_KHR_XCB_SURFACE_EXTENSION_NAME.

I also have a mid-2015 macbook-pro (which have a cape verde GCN 1.0 card) and the amdgpu driver black screen on my TTY (before startx) with 4.9 kernel without any error or warning in my dmesg. I will inform you if it works better in 4.10...

----------

## lost-distance

Hi all,

I just got the amdgpu-pro-16.50 driver to successfully run the Vulkan cube demo program on my AMD A10-7800 (Kaveri) desktop PC.

My kernel version is linux-4.9, built with the AMDGPU (CONFIG_DRM_AMDGPU) driver.

My LLVM package is sys-devel/llvm-3.9.0-r1

My X11 server package is x11-base/xorg-server-1.18.4

My Mesa package is media-libs/mesa-13.0.2 (built with -vulkan USE flag)

The steps to install the amdgpu-pro-16.50 driver are these:

1. emerge media-libs/vulkan-loader-1.0.30.0

2. Download amdgpu-pro-16.50-362463.tar.xz from AMD.

3. Extract vulkan-amdgpu-pro_16.50-362463_amd64.deb from the download.

4. Extract the contents of vulkan-amdgpu-pro_16.50-362463_amd64.deb into a local directory.

5. Extract libdrm-amdgpu-pro-amdgpu1_2.4.70-362463_amd64.deb from the download.

6. Extract the contents of libdrm-amdgpu-pro-amdgpu1_2.4.70-362463_amd64.deb into the same local directory

7. Copy the following from the local directory to the root directory (/):

```
/etc

/etc/vulkan

/etc/vulkan/icd.d

/etc/vulkan/icd.d/amd_icd64.json

/opt

/opt/amdgpu-pro

/opt/amdgpu-pro/lib

/opt/amdgpu-pro/lib/x86_64-linux-gnu

/opt/amdgpu-pro/lib/x86_64-linux-gnu/amdvlk64.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0
```

I built the cube demo program by hand from the latest Khronos Vulkan-LoaderAndValidationLayers software. I had to hack cube.c to ignore the return value of vkWaitForFences(), which was failing with VK_ERROR_INITIALIZATION_FAILED. After that it ran flawlessly.

----------

## newin

Hi all.

Like I said in my last post I cannot get any surface extension, which is a bit inconvenient for a API that aim to display things... I first thought I forgot to install something but trying to compile and install "Vulkan-LoaderAndValidationLayers" did not fix my problem...

when using RADV I get:

```
Presentable Surfaces:

=====================

None found
```

-> I must say that I coudn't use the ebuild "media-libs/vulkan-loader". It was trying to compile it with the wayland and mir support...

So I decided to return to amdgpu-pro. After installing amdgpu-pro following the steps given by lost-distance I get a SEGV:

```
Presentable Surfaces:

=====================

GPU id       : 0 (AMD RADV CARRIZO)

Surface type : VK_KHR_xcb_surface

Segmentation fault
```

Strangely when I use gdb to find where it come from, I get this

```
Presentable Surfaces:

=====================

GPU id       : 0 (AMD RADV CARRIZO)

Surface type : VK_KHR_xcb_surface

Program received signal SIGSEGV, Segmentation fault.

0x00007fffebd09c75 in radv_GetPhysicalDeviceSurfaceFormatsKHR (physicalDevice=0xdd2380, _surface=0xfa79b0, pSurfaceFormatCount=0x7fffffffe014, pSurfaceFormats=0x0)

    at radv_wsi.c:120

120      return iface->get_formats(surface, &device->wsi_device, pSurfaceFormatCount,
```

The name of the function show that it come from radv which does not make any sense after installing amdgpu-pro.

There is some clue in vulkaninfo that show both driver work at same time (I guess). There is new layers/extensions (that disappear when I "mv /opt/amdgpu-pro /root")

```

Layers: count = 8

=======

VK_LAYER_GOOGLE_unique_objects (Google Validation Layer) Vulkan version 1.0.29, layer version 1

        Layer Extensions        count = 0

        Devices         count = 3

                GPU id       : 0 (AMD RADV CARRIZO)

                Layer-Device Extensions count = 0

                GPU id       : 1 (AMD RADV CARRIZO)

                Layer-Device Extensions count = 0

                GPU id       : 2 (Unknown AMD GPU)

                Layer-Device Extensions count = 0

```

I've installed it like this:

cat /etc/X11/xorg.conf | tail -n 10

```
Section "OutputClass"

   Identifier "amdgpu-pro"

   MatchDriver "amdgpu"

   Driver "amdgpu"

EndSection

Section "Files"

   ModulePath "/opt/amdgpu-pro/lib/xorg/modules"

   ModulePath "/usr/lib/xorg/modules"

EndSection
```

And I also have mesa installed with radv because it seems mandatory for it to have vulkan support.

find /opt/amdgpu-pro/

```
/opt/amdgpu-pro/

/opt/amdgpu-pro/lib

/opt/amdgpu-pro/lib/x86_64-linux-gnu

/opt/amdgpu-pro/lib/x86_64-linux-gnu/amdvlk64.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libkms.so.1

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libkms.so.1.0.0

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm.so.2

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm.so.2.4.0

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libomxil-bellagio0

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libomxil-bellagio0/libomx_mesa.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_radeon.so.1

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_radeon.so.1.0.1

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm.a

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.a

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_radeon.a

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_radeon.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm.so

/opt/amdgpu-pro/lib/x86_64-linux-gnu/libkms.so

/opt/amdgpu-pro/lib/xorg

/opt/amdgpu-pro/lib/xorg/modules

/opt/amdgpu-pro/lib/xorg/modules/drivers

/opt/amdgpu-pro/lib/xorg/modules/drivers/amdgpu_drv.so

/opt/amdgpu-pro/bin

/opt/amdgpu-pro/bin/kms-universal-planes

/opt/amdgpu-pro/bin/vbltest

/opt/amdgpu-pro/bin/proptest

/opt/amdgpu-pro/bin/modetest

/opt/amdgpu-pro/bin/kms-steal-crtc

/opt/amdgpu-pro/bin/modeprint

/opt/amdgpu-pro/bin/kmstest

/opt/amdgpu-pro/bin/amdgpu_test

```

----------

## EoD

 *newin wrote:*   

> I did update to the kernel 4.9 and mesa 13.0.2 which leaded to a problem due to how portage is building llvm ( https://bugs.gentoo.org/show_bug.cgi?id=602850 )
> 
>  *Quote:*   CommandLine Error: Option 'asan-instrument-assembly' registered more
> 
> than once!
> ...

 

FYI I created a bug report for this issue: https://bugs.gentoo.org/show_bug.cgi?id=617154

----------

## newin

Hi ! that's me again !

I'm back on this thread because I tried to install vulkan on my CapeVerde card (R9 M370X, the MacBook pro 2015's GPU)

And everything that could go wrong with it did wrong with install. I even mistakenly deleted /etc in the process because of a typo but that's another story...

I'm posting here to say that:

```

the "CommandLine Error: Option 'asan-instrument-assembly' registered more"

```

is still not fixed so you still need to patch mesa or llvm.

"amdgpu" doesn't work with this card and will never work, If you are using a 2015 MBP believe me when I said "I tried everything" and in addition fglrx was apparently deleted from portage so your only option is radeon if you want a graphical acceleration (opengl or vulkan).

So, after fixing the same problems I had with the carrizo GPU I had a brand new problem:

```

===========

VULKAN INFO

===========

Vulkan API Version: 1.0.51

INFO: [loader] Code 0 : Found ICD manifest file /usr/share/vulkan/icd.d/radeon_icd.x86_64.json, version "1.0.0"

Instance Extensions:

====================

Instance Extensions     count = 5

        VK_KHR_surface                      : extension revision 25

        VK_KHR_xcb_surface                  : extension revision  6

        VK_KHR_xlib_surface                 : extension revision  6

        VK_KHR_get_physical_device_properties2: extension revision  1

        VK_EXT_debug_report                 : extension revision  8

/var/lib/jenkins/workspace/Create-Linux-VulkanSDK/Vulkan-LoaderAndValidationLayers/demos/vulkaninfo.c:1464: failed with VK_ERROR_INITIALIZATION_FAILED

```

I have "media-libs/mesa-17.1.4"(patched) "Linux 4.12.0-rc7" "sys-devel/llvm-4.0.1" "sys-devel/clang-4.0.1" "x11-base/xorg-server-1.19.3" "x11-drivers/xf86-video-ati-7.9.0" "media-libs/vulkan-loader-1.0.51.0" and the LunarG Vulkan SDK 1.0.51.0

According to this file: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/a0cd07209eef7aaaac689c0b2c3ce1b2b4651c24/demos/vulkaninfo.c the fail seems to come from "err = vkEnumeratePhysicalDevices(inst.instance, &gpu_count, NULL);" and I don't know why. My GPU isn't compatible with vulkan ? Do you think it's a bug and I should talk with a RADV dev ? I failed something in the install ?

Note: I noticed that some vulkan-related files given by mesa are also present in the lunarG SDK but I don't which I should keep (in doubt I trusted the mesa ones because they are compiled on my machine...).

----------

## pcmaster

Try with this: https://github.com/volumetricsteve/AMDGPU-INSTALL

----------

## newin

 *pcmaster wrote:*   

> Try with this: https://github.com/volumetricsteve/AMDGPU-INSTALL

 

AMDGPU-pro driver is a user-land driver that need amdgpu kernel-land driver to work. And like I said before amdgpu is giving a black-screen BEFORE startx (so the X11 user-land driver didn't even started yet) so I cannot use this solution.

----------

## EoD

 *newin wrote:*   

>  *pcmaster wrote:*   Try with this: https://github.com/volumetricsteve/AMDGPU-INSTALL 
> 
> AMDGPU-pro driver is a user-land driver that need amdgpu kernel-land driver to work. And like I said before amdgpu is giving a black-screen BEFORE startx (so the X11 user-land driver didn't even started yet) so I cannot use this solution.

 

If your kernel does not work for your hardware, you should report this upstream at https://bugs.freedesktop.org/enter_bug.cgi?product=DRI

You could try using one of the bleeding-edge kernels from AMD https://cgit.freedesktop.org/~agd5f/linux for example. Just get one of the active branches like "amd-staging-drm-next" or "drm-next-4.13" or whatever you see fit.

It might also be a good idea to ask in #radeon on freenode if any of those branches might fix  the issue.

----------

## bill7

Hi Folks,

Does anyone know why llvm and clang are (gentoo default) compiled with BUILD_SHARED_LIBS rather than with LLVM_BUILD_LLVM_DYLIB? 

From what I've seen it is not generally recommended

https://releases.llvm.org/5.0.0/docs/CMake.html

And leads to problems like:

https://bugs.gentoo.org/617154

When configured with LLVM_BUILD_LLVM_DYLIB, media-libs/mesa-17.3.0_rc2 installs successfully (provided the shared libs are disabled with --disable-llvm-shared-libs), then the runtime error mentioned in bug 61754 no longer exists.

I'm guessing that building with BUILD_SHARED_LIBS might be required by other packages? Tried a few like dev-libs/libclc, but this builds cleanly as well.

Any ideas?

----------

