RetroArch + Raspberry Pi 4 + Vulkan without X: HowTo

Yo komrades!

Since I have been recently experimenting with Vulkan on the Raspberry Pi 4, and now that Vulkan is official on the platform (, and seeing that some people think that they lack the skill to build and enjoy this gem called RetroArch against the new generation graphics API, I have decided to write an small tutorial EVERYBODY can follow. I will start with simple instructions that worked for me, and you can try and report so I can add new details or steps.

We have three problems to solve here, so you should struct your thinking for these three parts: 1- Get libdrm working 2- Get MESA with Vulkan support working 3- Get Vulkan-enabled RetroArch working Solving these three quests, you will prove to be worth of being an early “RetroArch with Vulkan without X” user.

Let’s get busy!

First of all, update your GNU/Linux system! sudo apt-get update && sudo apt-get upgrade You must also disable X11, ideally disable them on boot. That’s outside the scope of this tutorial, but I can provide instructions if someone needs them.

BOOK 1: The MESA adventure

0- Remove your current MESA version. MESA comes in Raspberry Pi OS in outdated fashion that doesn’t even come near of supporting Vulkan in years. Meh.

sudo apt-get purge mesa-* libgl* libdrm*

WARNING: This will destroy your desktop system if you are using one. Np way I am supporting desktop systems here: I am not interested in running a desktop on a Raspberry, that’s just absurd (in my mind, that is!)


Prior to MESA, we need libdrm. This library let’s MESA access the graphics hardware via the low-level DRM interface, so it’s fundamental for X-less MESA.

0- Install previous dependencies for libdrm: This will install the build system, the compiler and some other utils for accessing the grpahics hardware that libdrm needs! sudo apt-get install xsltproc libpciaccess-dev xutils-dev libtool make automake pkg-config gcc g++ meson --no-install-recommends

1- Get latest stable libdrm version from here: Directly with:


2- Decompress libdrm:

tar xvpf libdrm-2.4.103.tar.xz

3- CD into the libdrm sources, and create a directory called “build” or whathever you want it, and CD into that new directory:

cd libdrm-2.4.103
mkdir build
cd build

4- Configure libdrm with these exact flags and options:

FLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72" CXXFLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72" meson -Dudev=true -Dvc4=true -Dintel=false -Dvmwgfx=false -Dradeon=false -Damdgpu=false -Dnouveau=false -Dfreedreno=false -Dinstall-test-programs=true ..

5- Build libdrm and install it!

ninja -j3
sudo ninja install

6- Test libdrm with something like:

modetest -s 32:1360x768

(Where 32 is a valic CONNECTOR ID. You can see your connectors and available modes with modetest|more). You shuld see a color pattern like those old TV stations used to let users adjust their TVs (I don’t know how’s that called in english). Don’t go any further if modetest doesn’t succeed! Ask for help or review previous steps!

BOOK 1, PART 2: MESA itself

0- Install some previous MESA dependencies. Many of them!

sudo apt-get install --no-install-recommends flex bison python3-mako python3-setuptools libexpat1-dev libudev-dev gettext ca-certificates xz-utils zlib1g-dev pkg-config meson

1- Clone the MESA repo. This will get you the latest MESA souces, which are needed for Vulkan-without-X. Current releases don’t support this yet. First, please learn that Vulkan-without-X is possible thanks to a Vulkan extension called VK_KHR_Display. So, VK_KHR_Display is our friend! If you even find an opensource Vulkan implementation supporting VK_KHR_Display, then you’re in for X-less fun!

git clone --depth 1

2- Install some Vulkan-related dependencies, namely the Vulkan headers, the Vulkan loader, and the Vulkan tools:

sudo apt-get install libvulkan-dev libvulkan1 vulkan-tools --no-install-recommends

3- CD into the MESA sources, create a directory called “build” or whatever you like, and CD into it. Don’t be shy to use the console, it’s an ally of the working class! :smiley:

cd mesa
mkdir build
cd build

4- Configure MESA with this exact set of options and flags:

CFLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72" CXXFLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72" meson -Dglx=disabled -Dplatforms= -Dllvm=disabled -Dvulkan-drivers=broadcom -Ddri-drivers='' -Dgallium-drivers=v3d,vc4,kmsro -Dbuildtype=release ..

5- Build MESA! Don’t use all the four cores on the machine, so we can ssh into it if needed, etc.

ninja -j3

6- Run “vulkaninfo”. PLEASE BE SURE THAT “vulkaninfo” WORKS! If it returns an error, please revisit previous steps or ask for help to other GNU/Linux comrades!

PART 2: The quest for the holy Vulkan-enabled RetroArch

0- Install some previous dependencies for the GSLANG shader compiler: these are needed for Vulkan!

sudo apt-get install glslang-dev glslang-tools spirv-tools

1- Get the latest stable RetroArch version from:

You can simply wget the latest version (1.9.0 as of this writing) with:

wget -O RetroArch1.9.0.tar.gz

2- Uncompress it!

tar xvpf RetroArch-v1.9.0.tar.gz

3- CD into the sources

cd RetroArch-v1.9.0

4- Configure the sources with these exact options and flags:

CFLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72 -DEGL_NO_X11" CXXFLAGS="-O2 -march=armv8-a+crc+simd -mtune=cortex-a72 -DEGL_NO_X11" ./configure --disable-ibxm --disable-vg --disable-x11 --disable-wayland --disable-sdl2 --disable-al --disable-cheevos --disable-ffmpeg --disable-networking --disable-netplaydiscovery --disable-libretrodb --enable-udev --disable-sdl --disable-pulse --disable-oss --disable-freetype --disable-7zip --disable-imageviewer --disable-rjpeg --disable-rbmp --disable-rtga --disable-flac --disable-qt --disable-materialui --disable-xmb --enable-rgui --disable-ozone --disable-gfx_widgets --disable-langextra --disable-cdrom --disable-accessibility --disable-tinyalsa --disable-builtinglslang --disable-rpiled --enable-egl --enable-opengles --enable-opengles3 --enable-opengles3_1 --enable-vulkan

5- Copy the resulting executable to your local bin directory: sudo cp retroach /usr/local/bin/

6- Run RetroArch! X11 must NOT be running. You should be able to select either Vulkan or GL as video drivers in Settings->Drivers!


What fun is Vulkan if we don’t have a core that runs on it? DuckStation is a good test!

1- Clone the DuckStation repo: git clone --depth 1

2- CD into it, create a build dir, CD into the build dir:

cd duckstation mkdir build cd build

3- Configure duckstation for libretro building:

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON -DCMAKE_CXX_FLAGS="-march=armv8-a+crc+simd -mtune=cortex-a72" ..

4- Build DuckStation!

make -j3

You should now be able to select the core, and use it’s Vulkan renderer. Anyway, GLES or software renderers both seem faster for now, so…


Very exhaustive and informative! Thanks for posting!

I am glad you like it! I may put it on the Raspberry Pi forums, too.

1 Like

I got “Unknown option --enable-opengles3_1” when ran step 4 in Part 2. What should I do?

nice writeup, surely going to give this a try when I get a pi 4, thx

@vanfanel: I got “Unknown option --enable-opengles3_1” when ran step 4 in Part 2. What should I do?