Compiling/installing the experimental mesa virtio-venus driver-(below done with new linux container)
For: Chrome OS crostini-default debian container bullseye
In chrome browser type or paste
chrome://flags
type in search flags
box crostini
.
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-vulkan termina
Example in crosh:
vmc start --enable-vulkan termina
After your cmdline is entered wait until it is finished you should see "(termina) chronos@localhost ~ $"
Make sure to keep that tab/window open.
Open the linux "Terminal" program located in linux apps.
Type or paste the following cmd(s) one at a time in linux terminal:
sudo apt update
sudo apt upgrade -y
sudo apt-get install nano -y
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
sudo apt full-upgrade -y
git clone https://gitlab.freedesktop.org/mesa/mesa.git
sudo apt-get build-dep mesa
sudo apt-get install libunwind-dev libudev-dev -y
cd mesa
If you want to update the mesa git repository use the cmd below in mesa folder
git pull origin
Special Note: If having trouble running
vkcube
or running any program requiring vulkan with latest mesa use this branch/commit of mesa, type or paste the following cmds as is:
git checkout -t origin/23.1
git checkout 2c40215ab9 .
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 setup build64 --libdir /usr/lib/x86_64-linux-gnu
-Ddri3=enabled \
-Dprefix=/usr \
-Dglx=dri \
-Degl=enabled \
-Dgbm=enabled \
-Dgallium-vdpau=disabled \
-Dvalgrind=disabled \
-Dgallium-drivers=virgl \
-Dvulkan-drivers=virtio \
-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 build64 install
If you need to rebuild the 64 bit mesa driver, just delete the build64 folder which is inside the mesa folder and repaste the build/install cmdlines.
Example: sudo rm -rf build64
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'
[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.
Note: At this time, llvm doesn't build/install for 32 bit. Don't actually know if it is necessary at all.
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 g++-multilib
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install pkg-config:i386
sudo apt-get -t sid install libdrm-dev:i386
sudo apt-get install libwayland-dev:i386 libwayland-egl-backend-dev:i386 libxext-dev:i386 libxfixes-dev:i386 x11proto-dev:i386 libxcb-glx0-dev:i386 libxcb-shm0-dev:i386 libx11-xcb-dev:i386 libxcb-dri2-0-dev:i386 libxcb-dri3-dev:i386 libxcb-present-dev:i386 libxshmfence-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libunwind-dev:i386 libudev-dev:i386 libelf-dev:i386 libzstd-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 setup 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 \
-Dgallium-drivers=virgl \
-Dvulkan-drivers=virtio \
-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
If you need to rebuild the 32 bit mesa driver, just delete the build32 folder which is inside the mesa folder and repaste the build/install cmdlines.
Example: sudo rm -rf build32
Type or paste the following cmd(s) into the linux terminal program:
sudo apt-get install vulkan-tools
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
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.
Try typing vulkaninfo
without quotes to get vulkan driver information.
The command vulkaninfo | grep driverName
should return something like this:
driverName = venus
driverName = venus
If you enter the below "vkcube" without quotes 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, either restart the chromebook and go to crosh enter your vmc start cmdline and try vkcube again in terminal or go to crosh and type "exit" and then after that in crosh type "vmc stop termina" then you enter your vmc start cmdline and try vkcube again in termina.
Useful/optional flags in "chrome://flags:"
chrome://flags/#exo-ordinal-motion
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. Or go to the mesa folder and type without quotes "git pull origin" which will pull the newest updates to mesa to your system. You can then run the install cmds which should incorporate the newest updates. No need to redownload the dependencies, etc.
For an FPS counter vulkan apps only: add to /etc/environment this VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay
.
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