Skip to content

Compiling Beatmup on Raspberry Pi 4

lnstadrum edited this page Apr 19, 2021 · 3 revisions

Beatmup is an easy thing to compile on Raspberry Pi. The only thing to care about is the set of flags to pass to cmake. This page provides a very detailed instruction on how to get Beatmup working from scratch on a new computer.

Hardware tested: Raspberry Pi 4 rev 1.2, 4 GB RAM Software tested: Raspberry Pi OS with desktop,

  • Release date: March 4th 2021
  • SHA256 checksum: d3de1a33d2d4f4990345b6369960b04c70b577519e6f25f4d7ec601e305e932a

The following four steps are exclusively for Raspberry Pi 4, not for older models.

(1) Flashing an SD card with the OS image

Nothing special.

(2) Headless setup

This is likely optional if you have a screen and a keyboard to connect to the board.

  • Enable ssh and a network connection (Wi-Fi in my test) as explained in countless headless setup tutorials.
  • Put the SD card in the board, power on, connect by SSH
  • To test the GLX backend, an X server connection is needed. In this test I used VNC. To get it working,
    • sudo raspi-config
    • Enable VNC in Interface Options > VNC
    • A virtual display needs to be set up by choosing a non-default resolution in Display Options > Resolution. I put DMT mode 16, any non-default choice likely works as well.
    • Hit "Finish", reboot

(3) Using Beatmup with GLX backend

Get a working X connection from your PC to Raspberry Pi.

  • VNC worked in this test.
  • ssh -X might presumably do the job if properly configured, but not just a simple ssh connection.
  • Should also work with a physical screen and keyboard connected to Pi (I could not test this).

Get the code:

git clone https://github.com/lnstadrum/beatmup.git
cd beatmup/

Get submodules:

git submodule update --init --recursive

Install the software: CMake and GLX-related libs

sudo apt install libgl1-mesa-dev libglu1-mesa-dev libglx-dev cmake

Build X2 app with GLX:

mkdir build && cd build
cmake -DUSE_GLX=ON ..
make -j4 X2

Test the app on an image

./X2 ../images/fecamp.bmp test.bmp

The output I got:

Preparing GPU... 
Broadcom | V3D 4.2
Compiling shaders... 9707.59 ms
Transfering input to GPU... 
Processing... 
  1797.55 ms
Saving result to test.bmp

The upscaled image is in test.bmp. Looks nice.

All the other apps can be built similarly.

(4) Using EGL backend

Beatmup also works with EGL. This option is usable both headless through a simple SSH connection without X and with graphic interface. A virtual display is still required to be set up (see step 2).

Install the software: CMake and EGL libs

sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libdrm-dev libgbm-dev

Build X2 app with EGL backend (run in build folder):

cmake -DUSE_GLX=OFF -DUSE_EGL_DRM=ON -DGLES_VERSION=20 ..
make -j4 X2
./X2 ../images/fecamp.bmp test.bmp

CMake is supplied with GLX=OFF option: the build is done in the same build folder after the GLX test above.

Test the app on an image. Same as above.

In case of error "Cannot get DRM resources", setting the DRI device from card1 to card0 before running any app may help:

export BEATMUP_DRI_DEVICE=/dev/dri/card0

Clone this wiki locally