Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spundun/f01346a8d8789be861597690c7a849b8 to your computer and use it in GitHub Desktop.
Save spundun/f01346a8d8789be861597690c7a849b8 to your computer and use it in GitHub Desktop.
How to install vulkan drivers on Debian on Crostini

Compiling/installing the experimental mesa virtio-venus-experimental driver-(below done with new linux container)

In chrome browser type or paste

chrome://flags

type in "search flags" box "crostini" without quotes.

Enable "Crostini GPU Support" and select "Bullseye" for

"Debian version for new Crostini containers"

Restart your chromebook

In chrome os settings, enable "Linux development environment"

Close the "Terminal" program that opens.

In chrome browser press "ctrl+alt+t" to get crosh

Always start with the below command(s) in crosh and add to your existing vmc start cmdline (before starting any linux program that you want to use the vulkan driver!).

--enable-gpu --enable-vulkan termina

Example in crosh:

vmc start --enable-gpu --enable-vulkan termina

After your cmdline is entered wait until it is finished you should see "(termina) chronos@localhost ~ $"

Open the linux "Terminal" program located in linux apps.

Type or paste two following cmd(s) one at a time in linux terminal program:

sudo apt-get install nano

sudo nano /etc/apt/sources.list

Add the (type or copy/paste) below lines to the opened text file:

deb-src [arch=amd64,i386] http://deb.debian.org/debian bullseye main

deb http://http.us.debian.org/debian sid main non-free contrib

Press ctrl+x, press the "y" key and press enter to save.

Type or paste the following cmd(s) one at a time in the linux terminal program:

sudo apt update

git clone https://gitlab.freedesktop.org/mesa/mesa.git

sudo apt-get build-dep mesa

(Press the "y" key if prompted and wait for the process to complete)

cd mesa

64 bit driver

Paste the below in the linux terminal program and press enter (the part in quotes, but don't paste the quotes, note that this a sample one can edit it for their system):

"meson build64 --libdir /usr/lib/x86_64-linux-gnu
-Ddri3=enabled
-Dprefix=/usr
-Dglx=dri
-Degl=enabled
-Dgbm=enabled
-Dgallium-vdpau=disabled
-Dvalgrind=disabled
-Ddri-drivers=[]
-Dgallium-drivers=virgl
-Dvulkan-drivers=virtio-experimental
-Dvulkan-layers=device-select "

Type or paste the following cmd in the linux termina l program (the compiling/installation process may take some time):

sudo ninja -C build64 install

if you need to rebuild the 64 bit mesa driver, just delete the build64 folder and repaste the build/install cmdlines.

32 bit mesa driver

Type or paste the following cmd(s) one at a time in the linux terminal program:

mkdir -p ~/.local/share/meson/cross

sudo nano ~/.local/share/meson/cross/gcc-i686

Paste the below into the opened text file:

gcc-i686

[binaries] c = '/usr/bin/gcc' cpp = '/usr/bin/g++' ar = '/usr/bin/gcc-ar' strip = '/usr/bin/strip' pkgconfig = '/usr/bin/i686-linux-gnu-pkg-config' llvm-config = '/usr/bin/llvm-config' cmake = '/usr/bin/cmake'

[properties] c_args = ['-m32'] c_link_args = ['-m32'] cpp_args = ['-m32'] cpp_link_args = ['-m32']

[host_machine] system = 'linux' cpu_family = 'x86' cpu = 'i686' endian = 'little'

Press ctrl+x, press the "y" key and press enter to save.

Type or paste the following cmd(s) one at a time in the linux terminal program and Press the "y" key if prompted at any time. (The reason why one has to enter so many commands is because I don't know if mesa has a 32 bit build dependency package for debian, welcome to find out if they do which would greatly simplify the process)

sudo apt-get install gcc-multilib

sudo apt-get install g++-multilib

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get -t sid install libdrm-dev:i386

sudo apt-get install libwayland-dev:i386

sudo apt-get install libwayland-egl-backend-dev:i386

sudo apt-get install libxext-dev:i386

sudo apt-get install libxfixes-dev:i386

sudo apt-get install x11proto-dev:i386

sudo apt-get install libxcb-glx0-dev:i386

sudo apt-get install libxcb-shm0-dev:i386

sudo apt-get install libx11-xcb-dev:i386

sudo apt-get install libxcb-dri2-0-dev:i386

sudo apt-get install libxcb-dri3-dev:i386

sudo apt-get install libxcb-present-dev:i386

sudo apt-get install libxshmfence-dev:i386

sudo apt-get install libxxf86vm-dev:i386

sudo apt-get install libxrandr-dev:i386

Paste the below in the linux terminal program and press enter (the part in quotes, but don't paste the quotes, note that this a sample one can edit it for their system):

"meson build32 --cross-file gcc-i686 --libdir /usr/lib/i386-linux-gnu -- -Ddri3=enabled
-Dprefix=/usr
-Dglx=dri
-Degl=enabled
-Dgbm=enabled
-Dgallium-vdpau=disabled
-Dvalgrind=disabled
-Ddri-drivers=[]
-Dgallium-drivers=virgl
-Dvulkan-drivers=virtio-experimental
-Dvulkan-layers=device-select "

Type or paste the following cmd in the linux terminal program (the compiling/installation process may take some time):

sudo ninja -C build32 install

Type or paste the following cmd(s) into the linux terminal program:

sudo apt-get install vulkan-tools

sudo apt-get install libvulkan-dev:i386

You can then list your installed vulkan drivers with the cmd below:

ls /usr/share/vulkan/icd.d/

You should see "virtio_icd.x86_64.json"and

"virtio_icd.i686.json"

To test drivers:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/virtio_icd.i686.json:/usr/share/vulkan/icd.d/virtio_icd.x86_64.json vkcube

For permanent 32/64 bit driver(no need to enter the above command with every program you want to use vulkan driver).

Type/paste the following cmd:

sudo nano /etc/environment

In the text file paste the below:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/virtio_icd.i686.json:/usr/share/vulkan/icd.d/virtio_icd.x86_64.json

Press ctrl+x, press the "y" key and press enter to save.

If you enter the below "vkcube" in the linux terminal program, you should see something like below, and also a spinning cube:

usulyre@penguin:~$ vkcube

Selected GPU 0: Virtio-GPU Venus (AMD RADV STONEY), type: 1

On an intel based chromebook:

usulyre@penguin:~$ vkcube

Selected GPU 0: Virtio-GPU Venus (Intel(R) UHD Graphics 600 (GLK 2)), type: 1

If vkcube doesn't work, restart the chromebook and go to crosh enter your vmc start cmdline and try vkcube again in terminal.

Useful/optional flags in "chrome://flags:"

chrome://flags/#exo-ordinal-motion

chrome://flags/#exo-pointer-lock

Some notes:

There may be bugs, errors, etc. You can update the driver by deleting the mesa folder and use git clone to redownload the latest version of the driver,then go to the mesa folder and build/install the driver. No need to redownload the dependencies, etc.

For Lutris:

After installing Lutris you need to go to the mesa folder and run the install cmds again .

sudo ninja -C build64 install

sudo ninja -C build32 install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment