Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

KBL G AMD VEGA Driver Getting Started Guide

ZhongXiaoxia edited this page Feb 18, 2019 · 16 revisions

KBL-G AMD VEGA Driver Getting Started Guide

This document covers installation of AMD driver on KBL-G platform.

It is verified with Ubuntu 18.04 on NUC8i7HVK with Intel(R) Core(TM) i7-8809G CPU @ 3.10GHz.

1 Install prerequisite libraries

Note: If you already have these libraries installed on you PC, just skip this step.

The prerequisite libraries for Linux kernel compiling:

sudo apt-get install -y gcc cmake autoconf automake libtool libdrm-dev git libx11-dev \
libpciaccess-dev libxext-dev libxfixes-dev bison flex expat patch \
rpm libudev-dev libpng-dev expect libssl-dev elfutils bc libelf-dev

The prerequisite libraries for mesa driver compiling:

sudo apt-get install -y pkg-config libxdamage-dev libx11-xcb-dev libxcb-glx0-dev \
libxcb-dri2-0-dev libxcb-xfixes0-dev libxcb-dri3-dev libxcb-present-dev \
libxshmfence-dev libxrandr-dev libexpat1-dev python-mako llvm-6.0-dev

2 Install Linux kernel-4.19

Note: If you already have Linux kernel-4.19 installed on you PC, just skip this step. Before starting the installation of Ubuntu 18.04, you need to set BIOS option "Intel" (Advanced→Performance→Graphic) as "disabled". Otherwise, there will be no graphics display output after the OS installation is completed.

2.1 Download i915 and amdgpu firmwares

wget -m -np --reject="index.html*" https://people.freedesktop.org/~agd5f/radeon_ucode/vegam/
sudo cp people.freedesktop.org/~agd5f/radeon_ucode/vegam/vegam*.bin /lib/firmware/amdgpu/
git clone https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
sudo cp linux-firmware/i915/*.bin  /lib/firmware/i915/

2.2 Download and compile kernel

The patch is used for media driver performance improvement. Without this patch, there will be performance decline for some cases. Besides Ubuntu, the patch can be applied to any other OS like Centos.

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.19.tar.gz
tar xvzf linux-4.19.tar.gz
cd linux-4.19
wget https://github.com/VCDP/linux-kmd/commit/d5cc059043749162c76285ea2c608da57bed8094.patch
patch -p1 < d5cc059043749162c76285ea2c608da57bed8094.patch
make olddefconfig
make –j8
sudo make modules_install
sudo make install
sudo reboot

Reboot and switch to the 4.19 kernel. Then run 'uname -r' to check whether the correct kernel was selected.

Note: After switching to new kernel, switch back the BIOS option Intel (Advanced→Performance→Graphic) to "enabled".

3 Install AMD GPU driver

3.1 Install mesa utilities

Install below tools which will be used for version check and smoke test:

sudo apt-get install -y mesa-utils
sudo apt-get install -y mesa-utils-extra
sudo apt-get install -y vulkan-utils
  • mesa-utils contains tool (glxinfo, glxgears, glxdemo, glxheads) for OpenGL
  • mesa-utils-extra contains tool (es2_info, es2gears) for OpenGL ES
  • vulkan-utils contains tools (vulkaninfo vulkan-smoketest) for Vulkan

3.2 Install AMD GPU driver package

Download AMD 18.40 GPU driver for Ubuntu 18.04 from AMD web page: https://www.amd.com/en/support/previous-drivers/graphics/radeon-rx-vega-series/radeon-rx-vega-series/radeon-rx-vega-56 Select 18.40 driver for Ubuntu 18.04.x. Then install it and reboot.

xz -d amdgpu-pro-18.40-697810-ubuntu-18.04.tar.xz
tar xvf amdgpu-pro-18.40-697810-ubuntu-18.04.tar
cd amdgpu-pro-18.40-697810-ubuntu-18.04
sudo ./amdgpu-install
sudo reboot

3.3 Check AMD GPU render

After boot up, run 'glxinfo | grep render' to check whether OpenGL hardware rendering is working.

glxinfo | grep render
direct rendering: Yes
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
    GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer, GLX_MESA_query_renderer,
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD VEGAM (DRM 3.27.0, 4.19.0, LLVM 6.0.1)
    GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted,
    GL_NVX_gpu_memory_info, GL_NV_conditional_render, GL_NV_depth_clamp,
    GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted,
    GL_NV_blend_square, GL_NV_conditional_render, GL_NV_depth_clamp,
    GL_OES_element_index_uint, GL_OES_fbo_render_mipmap, 

Note: if need to switch back to Intel GPU, please follow below steps to unset environment variable DISPLAY

unset DISPLAY
vainfo

Set environment variable DISPLAY to ":0.0" through "export DISPLAY=:0.0" to switch back to AMD GPU.

4 Compile and install mesa libs

4.1 Compile Mesa 18.2.2

Download mesa 18.2.2 source release package from https://mesa.freedesktop.org/archive/mesa-18.2.2.tar.gz. Then compile and install it.

wget https://mesa.freedesktop.org/archive/mesa-18.2.2.tar.gz
tar xvzf mesa-18.2.2.tar.gz
cd mesa-18.2.2
./configure --with-gallium-drivers=radeonsi --with-vulkan-drivers=radeon --with-llvm-prefix=/usr/lib/llvm-6.0/
make -j8
sudo make install

The mesa libs will be installed to /usr/local/lib by default.

4.2 Export environment variables

Export environment variables to link to mesa OpenGL and Vulkan libs. AMD GPU driver package also contains OpenGL and Vulkan libs, which were installed to /opt/amdgpu/lib/x86_64-linux-gnu/.

Set below environment variables to ensure mesa libs are linked and loaded.

(You may add these commands to "~/.bashrc" so that you needn't run them for each login with terminal.)

Ensure you set the correct path to mesa vulkan lib which are listed in the ICD ".json" file.

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export VK_ICD_FILENAMES=/usr/local/share/vulkan/icd.d/radeon_icd.x86_64.json

4.3 Sanity check for OpenGL and Vulkan

As OpenGL lib from AMD GPU driver package was installed to /opt/amdgpu/lib/x86_64-linux-gnu/, you need to confirm OpenGL lib from mesa 18.2.2 were loaded through 'glxinfo| grep version'.

export DISPLAY=:0.0
glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.5
    Max compat profile version: 4.4
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.2
OpenGL core profile shading language version string: 4.50
OpenGL version string: 4.4 (Compatibility Profile) Mesa 18.2.2
OpenGL shading language version string: 4.40
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 18.2.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 

After that, run 'glxgears' and 'vulkan-smoketest' to check both OpenGL and Vulkan can work on your platform.

Here's the snapshot for 'glxgears' test result: timg

Here's the snapshot for 'vulkan-smoketest' test result: timg