Skip to content

Instantly share code, notes, and snippets.

@geerlingguy
Last active October 18, 2025 22:12
Show Gist options
  • Select an option

  • Save geerlingguy/fbdc2c52fcf8ba3b87f04323f3dc517c to your computer and use it in GitHub Desktop.

Select an option

Save geerlingguy/fbdc2c52fcf8ba3b87f04323f3dc517c to your computer and use it in GitHub Desktop.
Getting a newer Mesa version on Raspberry Pi (Debian)

Compile Mesa from source (note: doing this makes it difficult to get back to a clean package install):

  1. Allow sources to be installed via apt:
    1. Bookworm and earlier: Uncomment the deb-src line inside /etc/apt/sources.list.d/raspi.list and save it
    2. Trixie and later: Edit /etc/apt/sources.list.d/raspi.sources and add set Types to Types: deb deb-src and save it
  2. Install build dependencies:
    1. sudo apt update && sudo apt build-dep mesa -y
    2. sudo apt install python3-pycparser
  3. Install later version of meson:
    1. sudo apt remove meson -y
    2. sudo pip3 install meson --break-system-packages
  4. Clone mesa source: git clone --depth=1 --branch mesa-25.2.4 https://gitlab.freedesktop.org/mesa/mesa/
  5. Build and install Mesa:
    1. cd mesa
    2. meson setup --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu build
    3. meson compile -C build (takes a while; 25 min on Pi 5)
    4. sudo meson install -C build

Note: You might want to clone a different tag/branch depending on your needs. mesa-25.2.4 was the latest version as of October 2025, and mesa-25.0.7 was the version that shipped with Pi OS Trixie at that time.

Also, if you'd like to override defaults for the build, you can run meson configure build/ to see available options, and set them when running meson setup build like meson setup --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu -D gallium-drivers=iris,llvmpipe,v3d,vc4 -D vulkan-drivers=broadcom,intel build.

Update Mesa using Debian backports (if you're running Bookworm/12):

Add the following lines inside /etc/apt/sources.list:

deb https://deb.debian.org/debian/ bookworm-backports main contrib non-free
deb-src https://deb.debian.org/debian/ bookworm-backports main contrib non-free

Run sudo apt update, then install the updated mesa version:

sudo apt install -t bookworm-backports mesa-vulkan-drivers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment