rpi(4): rpi os + kms + retroarch (no X)

Here is some direction to get the full vc4-kms driver working without X under Raspberry OS (buster) with RetroArch. While this has been tested on the pi4, it should work on the pi3 too. Some time ago, it was needed to manually compile the latest kernel from sources for this to work, which is not required anymore. As of today, the vc4 kms (and not vc4 fkms) driver seems to be pretty stable and usable.

sudo apt -y update
sudo apt -y full-upgrade
sudo reboot
sudo rpi-update
sudo reboot
  • Build and install retroarch frontend (on device)
sudo apt install -y build-essential git libasound2-dev libudev-dev libgles2-mesa-dev libdrm-dev libgbm-dev
git clone https://github.com/libretro/RetroArch.git
cd RetroArch
CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --disable-pulse --disable-oss --disable-videocore --disable-x11 --disable-opengl1 --enable-kms --enable-opengles --enable-opengles3 --enable-alsa --enable-udev --enable-neon --enable-floathard
make -j4
sudo make install
  • Run retroarch and verify it’s working fine…
cpasjuste@raspberrypi:~ $ retroarch -v
[INFO] RetroArch 1.9.0 (Git 54eb22dd2b)
[INFO] === Build =======================================
[INFO] Capacités:  NEON VFPv3 VFPv4
[INFO] Built: Nov 25 2020
[INFO] Version: 1.9.0
[INFO] Git: 54eb22dd2b
[INFO] =================================================
[INFO] Version de l'API libretro: 1
[INFO] Compilé avec l'API: 1
[INFO] [DRM]: Found 1 connectors.
[INFO] [DRM]: Connector 0 connected: yes
[INFO] [DRM]: Connector 0 has 27 modes.
[INFO] [DRM]: Connector 0 assigned to monitor index: #1.
[INFO] [DRM]: Mode 0: (1920x1080) 1920 x 1080, 60 Hz
[INFO] [DRM]: Mode 26: (720x400) 720 x 400, 70 Hz
[INFO] [GL]: Found GL context: kms
[INFO] [GL]: Detecting screen resolution 1920x1080.
[INFO] [EGL] Found EGL client version >= 1.5, trying eglGetPlatformDisplay
[INFO] [EGL]: EGL version: 1.4
[INFO] [EGL]: Current context: 0x1a4f968.
[INFO] [KMS]: New FB: 1920x1080 (stride: 7680).
[INFO] [GL]: Vendor: VMware, Inc., Renderer: llvmpipe (LLVM 9.0.1, 128 bits).
[INFO] [GL]: Version: OpenGL ES 3.1 Mesa 19.3.2.
[INFO] [GL]: Using resolution 1920x1080
[INFO] [Display]: Found display driver: "gl".
[INFO] [GL]: VSync => on
[INFO] [KMS]: New FB: 1920x1080 (stride: 7680).

Leave a Reply

Your email address will not be published. Required fields are marked *