Skip to content

Instantly share code, notes, and snippets.

@Venemo
Last active March 16, 2024 21:44
  • Star 34 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Venemo/a9483106565df3a83fc67a411191edbd to your computer and use it in GitHub Desktop.
How to build and use mesa from source

Building and using mesa for development and testing

This explains how to build mesa from source, and how to use the custom built mesa to run some apps and games, without needing to replace the mesa libraries that your operating system runs on.

Let's assume that you are using an x86_64 system.

Building mesa

Overview

Here is what we are going to do:

  • Install all build dependencies for mesa
  • Clone the mesa repo to ~/Projects/mesa
  • Build mesa
  • Install the mesa version you just built into ~/mesa (not the same as the above directory)
  • Create a script which can tell games / apps to use the libraries from ~/mesa instead of what is on your system out of the box.

Step 1. Install dependencies

Use your distro package manager to install mesa dependencies. If you're on a different distro, you will need to substitute with the correct commands for your package manager. The packages are usually named similarly but maybe have a different naming convention (eg. -dev vs. -devel, etc.).

This works on Fedora 35:

dnf install git meson ninja-build gcc gcc-c++ cmake.i686 cmake.x86_64 glibc-devel.i686 glibc-devel.x86_64 valgrind-devel.i686 valgrind-devel.x86_64 bison flex vulkan*.x86_64 vulkan*.i686 libdrm-devel.x86_64 libdrm-devel.i686 libvdpau-devel.x86_64 libvdpau-devel.i686 libva-devel.x86_64 libva-devel.i686 libomxil-bellagio-devel.x86_64 libomxil-bellagio-devel.i686 zlib-devel.x86_64 zlib-devel.i686 llvm-devel.x86_64 llvm-devel.i686 elfutils-libelf-devel.x86_64 elfutils-libelf-devel.i686 wayland*-devel.x86_64 wayland*-devel.i686 wayland-protocols-devel libX*-devel.x86_64 libX*-devel.i686 libunwind-devel.x86_64 libunwind-devel.i686 libxshmfence-devel.x86_64 libxshmfence-devel.i686 lm_sensors-devel.x86_64 lm_sensors-devel.i686 expat-devel.x86_64 expat-devel.i686 libzstd-devel.x86_64 libzstd-devel.i686 pkgconf-pkg-config.i686 pkgconf-pkg-config.x86_64 libffi-devel.i686 libffi-devel.x86_64 libxcb-devel.i686 libxcb-devel.x86_64

Step 2. Clone the mesa repo

I usually put every git repo I work with into a directory such as ~/Projects - I recommend the same to you.

mkdir -p ~/Projects
cd ~/Projects
git clone https://gitlab.freedesktop.org/mesa/mesa.git

Step 3. 64-bit build

We're assuming that your distro uses lib64 for the 64-bit libraries like Fedora. If not, adjust the meson commands below according to your distro. The compiled libraries will go into ~/mesa for the sake of simplicity.

This command will build both Intel and AMD drivers in release mode, including codecs:

# Enter the mesa root directory
cd mesa
# Configure the build with meson
meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
# Compile with ninja
ninja -C build64 install

Config with AMD drivers only in release mode, including codecs:

meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
ninja -C build64 install

Config with AMD drivers only in release mode (recommended for AMD performance testing):

meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dbuildtype=release
ninja -C build64 install

Config with RADV only in debug mode (recommended for bisecting RADV crashes, etc.)

meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuild-aco-tests=true -Dbuildtype=debug
ninja -C build64radvdebug install

Config with RADV only in debug mode without LLVM (recommended for bisecting RADV crashes without LLVM)

meson build64radvdebug --libdir lib64 --prefix $HOME/mesa -Dllvm=disabled -Dgallium-drivers= -Dvulkan-drivers=amd -Dbuildtype=debug
ninja -C build64radvdebug install

You can compile one with ninja -C build64radvdebug and the other with ninja -C build64 - they don't interfere with each other. Of course if you use the same install prefix they will overwrite each other when you install them.

Note about upgrading to a different version of mesa

You can use the usual git commands for updating, for example git pull etc. You don't need to re-run meson but you do need to re-run ninja (eg. ninja -C build64 install) to compile and install the changes in the new version.

Step 4. 32-bit build on an x86_64 system (skip when only testing a 64-bit game)

If you don't use Fedora (or another Red Hat family distro), replace i686-redhat-linux-gnu-pkg-config with the correct 32-bit pkg-config executable for your distro. Also verify the location of llvm-config-32 which might be different on another distro.

Make sure the meson cross directory exists:

mkdir -p ~/.local/share/meson/cross

Create a meson cross file here: ~/.local/share/meson/cross/gcc-i686 with the following content:

[binaries]
c='gcc'
cpp='g++'
ar='ar'
strip='strip'
pkgconfig='i686-redhat-linux-gnu-pkg-config'
llvm-config='/usr/bin/llvm-config-32'

[properties]
c_args=['-m32', '-march=native']
c_link_args=['-m32']
cpp_args=['-m32', '-march=native']
cpp_link_args=['-m32']

[host_machine]
system='linux'
cpu_family='x86'
cpu='x86'
endian='little'

Now you can use it to build 32-bit mesa libs.

32-bit config with Intel and AMD drivers only in release mode, including codecs:

cd ~/Projects/mesa
meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,iris,zink -Dvulkan-drivers=intel,amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
ninja -C build32 install

32-bit config with AMD drivers only, including codecs:

meson build32 --cross-file gcc-i686 --libdir lib --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release
ninja -C build32 install

Note that you can build both the x86_64 and the i686 libraries together and they can still all go to ~/mesa, meaning there is no need to configure anything else when you need both 32 and 64-bit. You can use all of that with either 32-bit or 64-bit games.

Using the compiled mesa binaries

Running through a script (recommended for testing a single game or app)

Create a script file like this, eg. nano ~/mesa-run.sh
If you used a different install prefix or a different lib dir above, you will need to adjust this script accordingly.

#!/bin/sh

MESA=$HOME/mesa \
LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH \
LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.x86.json \
LIBVA_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
VDPAU_DRIVER_PATH=$MESA/lib64/vdpau \
D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1 \
    exec "$@"

Don't forget to add executable permissions to the script:

chmod +x ~/mesa-run.sh

Now you can run your games like:

~/mesa-run.sh vkcube

Note about games with a 32-bit launcher

Some games have a launcher which is a small app that doesn't do anything useful other than launching the game. These are usually 32-bit, so if you want to run a game that has such a launcher and it doesn't work, you may need to do the 32-bit build to make it work.

Testing a Steam game with your custom built mesa:

  1. Compile mesa as written above
  2. Create the ~/mesa-run.sh script as above
  3. First make sure it works correctly with vkcube or another simple sample app outside of Steam
  4. Open Steam, go to your Library
  5. Right-click the game, click "Properties"
  6. In the "Launch options" type:
    ~/mesa-run.sh %command%

Alternative: sourcing a script method

Use this when you want all apps you launch from a terminal to use your custom built mesa.

Create a script at ~/mesa.sh with the following content.
If you used a different install prefix or a different lib dir above, you will need to adjust this script accordingly.

#!/bin/sh

MESA=$HOME/mesa

export LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH
export LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri
export VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.i686.json
export LIBVA_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri
export VDPAU_DRIVER_PATH=$MESA/lib64/vdpau
export D3D_MODULE_PATH=$MESA/lib64/d3d/d3dadapter9.so.1:$MESA/lib/d3d/d3dadapter9.so.1

Now you can just source mesa.sh and then anything launched from that terminal will use the mesa libs you just built.

For example:

source ~/mesa.sh
vkcube

To verify that it uses the version of mesa you want:

source ~/mesa.sh
vulkaninfo

Using RADV with RGP

# Run RADV with pipeline tracing enabled, and specify a trigger file
RADV_THREAD_TRACE_PIPELINE=1 RADV_THREAD_TRACE_TRIGGER=/tmp/trigger ~/mesa-run.sh ./bin/triangle

# From a different terminal, touch the trigger file. This will make RADV create an RGP capture in /tmp
touch /tmp/trigger

Building LLVM and using it with mesa (skip this unless you know you specifically need it)

Sometimes you need to test the very latest LLVM and use it without messing up your system packages.

Here are some useful cmake options:

  • CMAKE_INSTALL_PREFIX - for simplicity, let's just use the same prefix as used by your mesa build
  • LLVM_LIBDIR_SUFFIX - for distros that use /usr/lib64 or a similar convention, eg. set this to 64 on Fedora

Example:

cd llvm-project/llvm
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/mesa -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_TARGETS_TO_BUILD="AMDGPU" -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_INCLUDE_EXAMPLES=OFF
ninja
ninja install

After this, you need to rebuild mesa. First, tell mesa's meson to use the LLVM that you just built.

Create a meson native file at $HOME/.local/share/meson/native/my-llvm-x64 with the following content. Substitute Timur with your own username.

[binaries]
llvm-config = "/home/Timur/mesa/bin/llvm-config"

Finally, specify this to meson using the --native-file=my-llvm-x64 argument, for example:

meson build64 --libdir lib64 --prefix $HOME/mesa -Dgallium-drivers=radeonsi,swrast -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dbuildtype=release --native-file=my-llvm-x64
ninja -C build64 install
@Venemo
Copy link
Author

Venemo commented Dec 23, 2022

@maitpate It's unclear which command gives you this error, and you also forgot to mention what system you are using. I can't help you without knowing those things.

@maitpate
Copy link

I am using this cmd in created build directory : "meson .." . I am running on linux.

@Venemo
Copy link
Author

Venemo commented Dec 23, 2022

I am using this cmd in created build directory : "meson .." .

Please follow the above instructions exactly. I never used this command.

I am running on linux.

Which Linux distro do you use?

@maitpate
Copy link

I found it in README.rst : https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/README.rst . It has been given under Build and Install section :
$ mkdir build
$ cd build
$ meson ..
$ sudo ninja install

using Ubuntu 22.04.1 LTS

@Venemo
Copy link
Author

Venemo commented Dec 23, 2022

I don't use Ubuntu so I can't help with that. Have you made sure that all dependencies are installed? If yes, then I recommend asking this question on a Ubuntu forum.

@maitpate
Copy link

sure. Thanks for the response !

@alosarjos
Copy link

I see the dri-drivers flag now shows an error saying it's not valid. Just removed it for now, but maybe wanna update the gist? I find this really useful to be honest

@Venemo
Copy link
Author

Venemo commented Feb 14, 2023

@alosarjos Thanks, yes I removed dri-drivers now

@GinShio
Copy link

GinShio commented Aug 21, 2023

Hi Venemo, I built mesa following this guide.
running glxgears (32-bit and 64-bit) & vkcube successfully.
when i added environment variable LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri, failed to run apps.
error message:

libGL: using driver amdgpu for 4
libGL: pci id for fd 4: 1002:73f0, driver radeonsi
libGL: MESA-LOADER: failed to open /home/russell/.local/lib/mesa/lib64/dri/radeonsi_dri.so: /home/russell/.local/lib/mesa/lib64/dri/radeonsi_dri.so: wrong ELF class: ELFCLASS64
libGL: MESA-LOADER: dlopen(/home/russell/.local/lib/mesa/lib/dri/radeonsi_dri.so)
libGL error: DRI driver not from this Mesa build ('23.1.5 (git-6133279365)' vs '23.1.5')
libGL error: failed to load driver: radeonsi
libGL: using driver amdgpu for 4
libGL: pci id for fd 4: 1002:73f0, driver radeonsi
libGL: MESA-LOADER: failed to open /home/russell/.local/lib/mesa/lib64/dri/radeonsi_dri.so: /home/russell/.local/lib/mesa/lib64/dri/radeonsi_dri.so: wrong ELF class: ELFCLASS64
libGL: MESA-LOADER: dlopen(/home/russell/.local/lib/mesa/lib/dri/radeonsi_dri.so)
libGL error: DRI driver not from this Mesa build ('23.1.5 (git-6133279365)' vs '23.1.5')
libGL error: failed to load driver: radeonsi
libGL: MESA-LOADER: failed to open /home/russell/.local/lib/mesa/lib64/dri/swrast_dri.so: /home/russell/.local/lib/mesa/lib64/dri/swrast_dri.so: wrong ELF class: ELFCLASS64
libGL: MESA-LOADER: dlopen(/home/russell/.local/lib/mesa/lib/dri/swrast_dri.so)
libGL: did not find extension DRI_Kopper version 1
libGL error: DRI driver not from this Mesa build ('23.1.5 (git-6133279365)' vs '23.1.5')
libGL error: failed to load driver: swrast
Error: glXCreateContext failed

configuration command:

CC='gcc' CXX='g++' LDFLAGS='-fuse-ld=gold' \
    meson setup . _build --libdir=lib64 --prefix $HOME/.local/lib/mesa -Dbuildtype=debug \
    -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd \
    -Dplatforms=x11 -Dosmesa=false -Dgallium-nine=true

complete command:

MESA=$HOME/.local/lib/mesa \
    LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri \
    VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json:$MESA/share/vulkan/icd.d/radeon_icd.i686.json \
    LIBGL_DEBUG=verbose AMD_DEBUG=shaders MESA_SHADER_CACHE_DISABLE=true \
    MESA_SHADER_CAPTURE_PATH=(pwd) MESA_SHADER_DUMP_PATH=(pwd) \
    glxgears

@Venemo
Copy link
Author

Venemo commented Aug 22, 2023

@GinShio Not enough information to tell what is wrong there. Best guess is that you are trying to run a 32-bit app but you only did a 64-bit build.

@GinShio
Copy link

GinShio commented Aug 23, 2023

Thanks a lot! Venemo.

additional more info:

64-bit setup command
CC='gcc' CXX='g++' LDFLAGS='-fuse-ld=gold' \
    meson setup . _build --libdir=lib64 --prefix $HOME/.local/lib/mesa -Dbuildtype=debug \
    -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd \
    -Dplatforms=x11 -Dosmesa=false -Dgallium-nine=true
64-bit setup output

C compiler for the host machine: gcc (gcc 13.2.1 "gcc (SUSE Linux) 13.2.1 20230803 [revision cc279d6c64562f05019e1d12d0d825f9391b5553]")
C linker for the host machine: gcc ld.gold 2.40.0.20230412-5
C++ compiler for the host machine: g++ (gcc 13.2.1 "g++ (SUSE Linux) 13.2.1 20230803 [revision cc279d6c64562f05019e1d12d0d825f9391b5553]")
C++ linker for the host machine: g++ ld.gold 2.40.0.20230412-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Checking if "-mtls-dialect=gnu2" runs: ${\color{green}YES}$
Checking if "split TLSDESC" : links: ${\color{green}YES}$
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Run-time dependency vdpau found: ${\color{green}YES}$ 1.5
Program glslangValidator found: ${\color{green}YES}$ (/usr/bin/glslangValidator)
Run-time dependency libomxil-bellagio found: ${\color{green}YES}$ 0.9.3
Found CMake: /usr/bin/cmake (3.27.2)
Run-time dependency libtizonia found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency libtizplatform found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency tizilheaders found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency libva found: ${\color{green}YES}$ 1.19.0
Header "va/va.h" has symbol "VASurfaceAttribDRMFormatModifiers" with dependency libva: ${\color{green}YES}$
Program python3 found: ${\color{green}YES}$ (/usr/bin/python3)
Fetching value of define "ETIME" : 62
Checking for function "bswap32" : ${\color{green}YES}$
Checking for function "bswap64" : ${\color{green}YES}$
Checking for function "clz" : ${\color{green}YES}$
Checking for function "clzll" : ${\color{green}YES}$
Checking for function "ctz" : ${\color{green}YES}$
Checking for function "expect" : ${\color{green}YES}$
Checking for function "ffs" : ${\color{green}YES}$
Checking for function "ffsll" : ${\color{green}YES}$
Checking for function "popcount" : ${\color{green}YES}$
Checking for function "popcountll" : ${\color{green}YES}$
Checking for function "unreachable" : ${\color{green}YES}$
Checking for function "types_compatible_p" : ${\color{green}YES}$
Compiler for C supports function attribute const: ${\color{green}YES}$
Compiler for C supports function attribute flatten: ${\color{green}YES}$
Compiler for C supports function attribute malloc: ${\color{green}YES}$
Compiler for C supports function attribute pure: ${\color{green}YES}$
Compiler for C supports function attribute unused: ${\color{green}YES}$
Compiler for C supports function attribute warn_unused_result: ${\color{green}YES}$
Compiler for C supports function attribute weak: ${\color{green}YES}$
Compiler for C supports function attribute format: ${\color{green}YES}$
Compiler for C supports function attribute packed: ${\color{green}YES}$
Compiler for C supports function attribute returns_nonnull: ${\color{green}YES}$
Compiler for C supports function attribute alias: ${\color{green}YES}$
Compiler for C supports function attribute noreturn: ${\color{green}YES}$
Compiler for C supports function attribute visibility:hidden: ${\color{green}YES}$
Checking if "__uint128_t" compiles: ${\color{green}YES}$
Checking for function "reallocarray" : ${\color{green}YES}$
Checking for function "fmemopen" : ${\color{green}YES}$
Checking if "gc-sections" : links: ${\color{green}YES}$
Compiler for C supports arguments -Werror=implicit-function-declaration: ${\color{green}YES}$
Compiler for C supports arguments -Werror=missing-prototypes: ${\color{green}YES}$
Compiler for C supports arguments -Werror=return-type: ${\color{green}YES}$
Compiler for C supports arguments -Werror=empty-body: ${\color{green}YES}$
Compiler for C supports arguments -Werror=incompatible-pointer-types: ${\color{green}YES}$
Compiler for C supports arguments -Werror=int-conversion: ${\color{green}YES}$
Compiler for C supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$
Compiler for C supports arguments -Wmisleading-indentation: ${\color{green}YES}$
Compiler for C supports arguments -Wno-missing-field-initializers: ${\color{green}YES}$
Compiler for C supports arguments -Wno-format-truncation: ${\color{green}YES}$
Compiler for C supports arguments -Wno-nonnull-compare: ${\color{green}YES}$
Compiler for C supports arguments -fno-math-errno: ${\color{green}YES}$
Compiler for C supports arguments -fno-trapping-math: ${\color{green}YES}$
Compiler for C supports arguments -Qunused-arguments: ${\color{red}NO}$
Compiler for C supports arguments -fno-common: ${\color{green}YES}$
Compiler for C supports arguments -Wno-microsoft-enum-value: ${\color{red}NO}$
Compiler for C supports arguments -Wno-unused-function: ${\color{green}YES}$
Compiler for C supports arguments -Werror=format: ${\color{green}YES}$
Compiler for C supports arguments -Wformat-security: ${\color{green}YES}$
Compiler for C supports arguments -Werror=thread-safety: ${\color{red}NO}$
Compiler for C supports arguments -ffunction-sections: ${\color{green}YES}$
Compiler for C supports arguments -fdata-sections: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=return-type: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=empty-body: ${\color{green}YES}$
Compiler for C++ supports arguments -Wmisleading-indentation: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-non-virtual-dtor: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-missing-field-initializers: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-format-truncation: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-math-errno: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-trapping-math: ${\color{green}YES}$
Compiler for C++ supports arguments -Qunused-arguments: ${\color{red}NO}$
Compiler for C++ supports arguments -flifetime-dse=1: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-microsoft-enum-value: ${\color{red}NO}$
Compiler for C++ supports arguments -Werror=format: ${\color{green}YES}$
Compiler for C++ supports arguments -Wformat-security: ${\color{green}YES}$
Compiler for C++ supports arguments -ffunction-sections: ${\color{green}YES}$
Compiler for C++ supports arguments -fdata-sections: ${\color{green}YES}$
Compiler for C supports arguments -Wno-override-init: ${\color{green}YES}$
Compiler for C supports arguments -Wno-initializer-overrides: ${\color{red}NO}$
Compiler for C supports arguments -Werror=pointer-arith: ${\color{green}YES}$
Compiler for C supports arguments -Werror=vla: ${\color{green}YES}$
Compiler for C supports arguments -Werror=gnu-empty-initializer: ${\color{red}NO}$
Compiler for C++ supports arguments -Werror=pointer-arith: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=vla: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=gnu-empty-initializer: ${\color{red}NO}$
Checking if "GCC atomic builtins" compiles: ${\color{green}YES}$
Checking if "GCC atomic builtins required -latomic" : links: ${\color{green}YES}$
Checking if "GCC 64bit atomics" with dependency : links: ${\color{green}YES}$
Library ws2_32 found: ${\color{red}NO}$
Header "sys/sysmacros.h" has symbol "major" : ${\color{green}YES}$
Header "sys/sysmacros.h" has symbol "minor" : ${\color{green}YES}$
Header "sys/sysmacros.h" has symbol "makedev" : ${\color{green}YES}$
Header "sys/mkdev.h" has symbol "major" : ${\color{red}NO}$
Check usable header "sched.h" : ${\color{green}YES}$
Checking for function "sched_getaffinity" : ${\color{green}YES}$
Check usable header "xlocale.h" : ${\color{red}NO}$
Check usable header "linux/futex.h" : ${\color{green}YES}$
Check usable header "endian.h" : ${\color{green}YES}$
Check usable header "dlfcn.h" : ${\color{green}YES}$
Check usable header "sys/shm.h" : ${\color{green}YES}$
Check usable header "cet.h" : ${\color{green}YES}$
Check usable header "pthread_np.h" : ${\color{red}NO}$
Check usable header "renderdoc_app.h" : ${\color{red}NO}$
Check usable header "sys/inotify.h" : ${\color{green}YES}$
Checking for function "strtof" : ${\color{green}YES}$
Checking for function "mkostemp" : ${\color{green}YES}$
Checking for function "memfd_create" : ${\color{green}YES}$
Checking for function "random_r" : ${\color{green}YES}$
Checking for function "flock" : ${\color{green}YES}$
Checking for function "strtok_r" : ${\color{green}YES}$
Checking for function "getrandom" : ${\color{green}YES}$
Checking for function "qsort_s" : ${\color{red}NO}$
Checking for function "posix_fallocate" : ${\color{green}YES}$
Checking if "GNU qsort_r" : links: ${\color{green}YES}$
Header "time.h" has symbol "struct timespec" : ${\color{green}YES}$
Checking for function "thrd_create" : ${\color{green}YES}$
Header "errno.h" has symbol "program_invocation_name" : ${\color{green}YES}$
Header "math.h" has symbol "issignaling" : ${\color{green}YES}$
Checking for function "posix_memalign" : ${\color{green}YES}$
Checking whether type "struct dirent" has member "d_type" : ${\color{green}YES}$
Checking if "strtod has locale support" : links: ${\color{green}YES}$
Checking if "Bsymbolic" : links: ${\color{green}YES}$
Checking if "version-script" : links: ${\color{green}YES}$
Checking if "dynamic-list" : links: ${\color{green}YES}$
Compiler for C supports link arguments -Wl,--build-id=sha1: ${\color{green}YES}$
Checking for function "dlopen" : ${\color{green}YES}$
Checking for function "dladdr" with dependency : ${\color{green}YES}$
Checking for function "dl_iterate_phdr" : ${\color{green}YES}$
Checking for function "clock_gettime" : ${\color{green}YES}$
Run-time dependency zlib found: ${\color{green}YES}$ 1.2.13
Run-time dependency libzstd found: ${\color{green}YES}$ 1.5.5
Run-time dependency threads found: ${\color{green}YES}$
Checking for function "pthread_setaffinity_np" with dependency threads: ${\color{green}YES}$
Run-time dependency expat found: ${\color{green}YES}$ 2.5.0
Library m found: ${\color{green}YES}$
Message: libdrm 2.4.110 needed because amdgpu has the highest requirement
Run-time dependency libdrm_amdgpu found: ${\color{green}YES}$ 2.4.115
Run-time dependency libdrm_radeon found: ${\color{green}YES}$ 2.4.115
Run-time dependency libdrm found: ${\color{green}YES}$ 2.4.115
Run-time dependency libudev found: ${\color{green}YES}$ 253
Run-time dependency LLVM (modules: LLVM) found: ${\color{green}YES}$ 16.0.6
Run-time dependency libelf found: ${\color{green}YES}$ 0.189
Run-time dependency valgrind found: ${\color{red}NO}$ (tried pkgconfig)
Program bison found: ${\color{green}YES}$ (/usr/bin/bison)
Program bison found: ${\color{green}YES}$ 3.8.2 (/usr/bin/bison)
Program flex found: ${\color{green}YES}$ (/usr/bin/flex)
Run-time dependency libunwind found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency OpenMP found: ${\color{green}YES}$ 4.5
Run-time dependency x11 found: ${\color{green}YES}$ 1.8.6
Run-time dependency xext found: ${\color{green}YES}$ 1.3.5
Run-time dependency xfixes found: ${\color{green}YES}$ 6.0.1
Run-time dependency xcb-glx found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-shm found: ${\color{green}YES}$ 1.15
Run-time dependency xcb found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-keysyms found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency x11-xcb found: ${\color{green}YES}$ 1.8.6
Run-time dependency xcb-dri2 found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-dri3 found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-present found: ${\color{green}YES}$ 1.15
Dependency xcb-shm found: ${\color{green}YES}$ 1.15 (${\color{ProcessBlue}cached}$)
Run-time dependency xcb-sync found: ${\color{green}YES}$ 1.15
Run-time dependency xshmfence found: ${\color{green}YES}$ 1.3.2
Run-time dependency glproto found: ${\color{green}YES}$ 1.4.17
Run-time dependency dri2proto found: ${\color{green}YES}$ 2.8
Run-time dependency xxf86vm found: ${\color{green}YES}$ 1.1.5
Run-time dependency xcb-xfixes found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-randr found: ${\color{green}YES}$ 1.15
Run-time dependency xrandr found: ${\color{green}YES}$ 1.5.3
Library sensors found: ${\color{red}NO}$
Program nm found: ${\color{green}YES}$ (/usr/bin/nm)
Program symbols-check.py found: ${\color{green}YES}$ (/usr/bin/python3.11 /home/russell/Projects/mesa/bin/symbols-check.py)
Program install_megadrivers.py found: ${\color{green}YES}$ (/usr/bin/python3.11 /home/russell/Projects/mesa/bin/install_megadrivers.py)
Program decode.py found: ${\color{green}YES}$ (/home/russell/Projects/mesa/src/compiler/isaspec/decode.py)
Program encode.py found: ${\color{green}YES}$ (/home/russell/Projects/mesa/src/compiler/isaspec/encode.py)
Compiler for C++ supports arguments -Wno-unused-variable: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-unused-local-typedefs: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-unused-but-set-variable: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-maybe-uninitialized: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-self-assign: ${\color{red}NO}$
Compiler for C++ supports arguments /wd4189: ${\color{red}NO}$
Compiler for C++ supports arguments -fno-exceptions: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-rtti: ${\color{green}YES}$
Compiler for C++ supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$
Compiler for C++ supports arguments -Wshadow: ${\color{green}YES}$
Compiler for C supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$ (${\color{ProcessBlue}cached}$)
Compiler for C supports arguments -Wshadow: ${\color{green}YES}$
Program ln found: ${\color{green}YES}$ (/usr/bin/ln)
Checking for function "mincore" : ${\color{green}YES}$
Build targets in project: 196

mesa 23.2.0-rc2

Directories
prefix : /home/russell/.local/lib/mesa
libdir : lib64
includedir : include

Common C and C++ arguments
c_cpp_args : -mtls-dialect=gnu2

OpenGL
OpenGL : ${\color{green}YES}$
ES1 : ${\color{green}YES}$
ES2 : ${\color{green}YES}$
Shared glapi : ${\color{green}YES}$

DRI
Platform : drm
Driver dir : /home/russell/.local/lib/mesa/lib64/dri

GLX
Enabled : ${\color{green}YES}$
Provider : dri

EGL
Enabled : ${\color{green}YES}$
Drivers : builtin:egl_dri2 builtin:egl_dri3
Platforms : x11 surfaceless drm xcb

GBM
Enabled : ${\color{green}YES}$
Backends path : /home/russell/.local/lib/mesa/lib64/gbm

Vulkan
Drivers : amd
Platforms : x11 surfaceless drm xcb
ICD dir : share/vulkan/icd.d
Video codecs : ${\color{red}NO}$
Intel Ray tracing : ${\color{red}NO}$

LLVM
Enabled : ${\color{green}YES}$
Version : 16.0.6

Gallium
Enabled : ${\color{green}YES}$
Drivers : radeonsi swrast zink
Platforms : x11 surfaceless drm xcb
Frontends : mesa vdpau va nine
Off-screen rendering (OSMesa): ${\color{red}NO}$
HUD lm-sensors : ${\color{red}NO}$

Perfetto
Enabled : ${\color{red}NO}$

User defined options
buildtype : debug
libdir : lib64
prefix : /home/russell/.local/lib/mesa
gallium-drivers : radeonsi,swrast,zink
gallium-nine : true
osmesa : false
platforms : x11
vulkan-drivers : amd

directory tree of 64-bit installed

/home/russell/.local/lib/mesa/lib64
├── d3d
│   ├── d3dadapter9.so -> d3dadapter9.so.1
│   ├── d3dadapter9.so.1 -> d3dadapter9.so.1.0.0
│   └── d3dadapter9.so.1.0.0
├── dri
│   ├── kms_swrast_dri.so
│   ├── radeonsi_dri.so
│   ├── radeonsi_drv_video.so
│   ├── swrast_dri.so
│   └── zink_dri.so
├── libEGL.so -> libEGL.so.1
├── libEGL.so.1 -> libEGL.so.1.0.0
├── libEGL.so.1.0.0
├── libgbm.so -> libgbm.so.1
├── libgbm.so.1 -> libgbm.so.1.0.0
├── libgbm.so.1.0.0
├── libglapi.so -> libglapi.so.0
├── libglapi.so.0 -> libglapi.so.0.0.0
├── libglapi.so.0.0.0
├── libGLESv1_CM.so -> libGLESv1_CM.so.1
├── libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.1.0
├── libGLESv1_CM.so.1.1.0
├── libGLESv2.so -> libGLESv2.so.2
├── libGLESv2.so.2 -> libGLESv2.so.2.0.0
├── libGLESv2.so.2.0.0
├── libGL.so -> libGL.so.1
├── libGL.so.1 -> libGL.so.1.2.0
├── libGL.so.1.2.0
├── libvulkan_radeon.so
├── pkgconfig
│   ├── d3d.pc
│   ├── dri.pc
│   ├── egl.pc
│   ├── gbm.pc
│   ├── glesv1_cm.pc
│   ├── glesv2.pc
│   └── gl.pc
└── vdpau
├── libvdpau_radeonsi.so -> libvdpau_radeonsi.so.1.0.0
├── libvdpau_radeonsi.so.1 -> libvdpau_radeonsi.so.1.0.0
├── libvdpau_radeonsi.so.1.0 -> libvdpau_radeonsi.so.1.0.0
└── libvdpau_radeonsi.so.1.0.0

  • lib64/dri/radeonsi_dri.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1e0bb40c7ce0235b92d6ebcf824ac4a73ba9df24, with debug_info, not stripped
  • lib64/libGL.so.1.2.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=d44e49def14e4c771d570b55b91cee5a8bce5de5, with debug_info, not stripped
  • lib64/libvulkan_radeon.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=d3613d414f8ccb173ab1ec85b35f65987652dae3, with debug_info, not stripped
32-bit setup command
CC='gcc -m32' CXX='g++ -m32' LDFLAGS='-fuse-ld=gold -m32' PKG_CONFIG_PATH=/usr/lib/pkgconfig \
    meson setup . _build32 --libdir=lib --prefix $HOME/.local/lib/mesa -Dbuildtype=debug \
    -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd \
    -Dplatforms=x11 -Dosmesa=false -Dgallium-nine=true
32-bit setup output

C compiler for the host machine: gcc -m32 (gcc 13.2.1 "gcc (SUSE Linux) 13.2.1 20230803 [revision cc279d6c64562f05019e1d12d0d825f9391b5553]")
C linker for the host machine: gcc -m32 ld.gold 2.40.0.20230412-5
C++ compiler for the host machine: g++ -m32 (gcc 13.2.1 "g++ (SUSE Linux) 13.2.1 20230803 [revision cc279d6c64562f05019e1d12d0d825f9391b5553]")
C++ linker for the host machine: g++ -m32 ld.gold 2.40.0.20230412-5
Host machine cpu family: x86
Host machine cpu: i686
Checking if "-mtls-dialect=gnu2" runs: ${\color{green}YES}$
Found pkg-config: /usr/bin/pkg-config (1.8.0)
Run-time dependency vdpau found: ${\color{green}YES}$ 1.5
Program glslangValidator found: ${\color{green}YES}$ (/usr/bin/glslangValidator)
Run-time dependency libomxil-bellagio found: ${\color{green}YES}$ 0.9.3
Found CMake: /usr/bin/cmake (3.27.2)
Run-time dependency libtizonia found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency libtizplatform found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency tizilheaders found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency libva found: ${\color{green}YES}$ 1.19.0
Header "va/va.h" has symbol "VASurfaceAttribDRMFormatModifiers" with dependency libva: ${\color{green}YES}$
Program python3 found: ${\color{green}YES}$ (/usr/bin/python3)
Fetching value of define "ETIME" : 62
Checking for function "bswap32" : ${\color{green}YES}$
Checking for function "bswap64" : ${\color{green}YES}$
Checking for function "clz" : ${\color{green}YES}$
Checking for function "clzll" : ${\color{green}YES}$
Checking for function "ctz" : ${\color{green}YES}$
Checking for function "expect" : ${\color{green}YES}$
Checking for function "ffs" : ${\color{green}YES}$
Checking for function "ffsll" : ${\color{green}YES}$
Checking for function "popcount" : ${\color{green}YES}$
Checking for function "popcountll" : ${\color{green}YES}$
Checking for function "unreachable" : ${\color{green}YES}$
Checking for function "types_compatible_p" : ${\color{green}YES}$
Compiler for C supports function attribute const: ${\color{green}YES}$
Compiler for C supports function attribute flatten: ${\color{green}YES}$
Compiler for C supports function attribute malloc: ${\color{green}YES}$
Compiler for C supports function attribute pure: ${\color{green}YES}$
Compiler for C supports function attribute unused: ${\color{green}YES}$
Compiler for C supports function attribute warn_unused_result: ${\color{green}YES}$
Compiler for C supports function attribute weak: ${\color{green}YES}$
Compiler for C supports function attribute format: ${\color{green}YES}$
Compiler for C supports function attribute packed: ${\color{green}YES}$
Compiler for C supports function attribute returns_nonnull: ${\color{green}YES}$
Compiler for C supports function attribute alias: ${\color{green}YES}$
Compiler for C supports function attribute noreturn: ${\color{green}YES}$
Compiler for C supports function attribute visibility:hidden: ${\color{green}YES}$
Checking if "__uint128_t" compiles: ${\color{red}NO}$
Checking for function "reallocarray" : ${\color{green}YES}$
Checking for function "fmemopen" : ${\color{green}YES}$
Checking if "gc-sections" : links: ${\color{green}YES}$
Compiler for C supports arguments -Werror=implicit-function-declaration: ${\color{green}YES}$
Compiler for C supports arguments -Werror=missing-prototypes: ${\color{green}YES}$
Compiler for C supports arguments -Werror=return-type: ${\color{green}YES}$
Compiler for C supports arguments -Werror=empty-body: ${\color{green}YES}$
Compiler for C supports arguments -Werror=incompatible-pointer-types: ${\color{green}YES}$
Compiler for C supports arguments -Werror=int-conversion: ${\color{green}YES}$
Compiler for C supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$
Compiler for C supports arguments -Wmisleading-indentation: ${\color{green}YES}$
Compiler for C supports arguments -Wno-missing-field-initializers: ${\color{green}YES}$
Compiler for C supports arguments -Wno-format-truncation: ${\color{green}YES}$
Compiler for C supports arguments -Wno-nonnull-compare: ${\color{green}YES}$
Compiler for C supports arguments -fno-math-errno: ${\color{green}YES}$
Compiler for C supports arguments -fno-trapping-math: ${\color{green}YES}$
Compiler for C supports arguments -Qunused-arguments: ${\color{red}NO}$
Compiler for C supports arguments -fno-common: ${\color{green}YES}$
Compiler for C supports arguments -Wno-microsoft-enum-value: ${\color{red}NO}$
Compiler for C supports arguments -Wno-unused-function: ${\color{green}YES}$
Compiler for C supports arguments -Werror=format: ${\color{green}YES}$
Compiler for C supports arguments -Wformat-security: ${\color{green}YES}$
Compiler for C supports arguments -Werror=thread-safety: ${\color{red}NO}$
Compiler for C supports arguments -ffunction-sections: ${\color{green}YES}$
Compiler for C supports arguments -fdata-sections: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=return-type: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=empty-body: ${\color{green}YES}$
Compiler for C++ supports arguments -Wmisleading-indentation: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-non-virtual-dtor: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-missing-field-initializers: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-format-truncation: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-math-errno: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-trapping-math: ${\color{green}YES}$
Compiler for C++ supports arguments -Qunused-arguments: ${\color{red}NO}$
Compiler for C++ supports arguments -flifetime-dse=1: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-microsoft-enum-value: ${\color{red}NO}$
Compiler for C++ supports arguments -Werror=format: ${\color{green}YES}$
Compiler for C++ supports arguments -Wformat-security: ${\color{green}YES}$
Compiler for C++ supports arguments -ffunction-sections: ${\color{green}YES}$
Compiler for C++ supports arguments -fdata-sections: ${\color{green}YES}$
Compiler for C supports arguments -Wno-override-init: ${\color{green}YES}$
Compiler for C supports arguments -Wno-initializer-overrides: ${\color{red}NO}$
Compiler for C supports arguments -Werror=pointer-arith: ${\color{green}YES}$
Compiler for C supports arguments -Werror=vla: ${\color{green}YES}$
Compiler for C supports arguments -Werror=gnu-empty-initializer: ${\color{red}NO}$
Compiler for C++ supports arguments -Werror=pointer-arith: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=vla: ${\color{green}YES}$
Compiler for C++ supports arguments -Werror=gnu-empty-initializer: ${\color{red}NO}$
Checking if "GCC atomic builtins" compiles: ${\color{green}YES}$
Checking if "GCC atomic builtins required -latomic" : links: ${\color{green}YES}$
Checking if "GCC 64bit atomics" with dependency : links: ${\color{green}YES}$
Library ws2_32 found: ${\color{red}NO}$
Header "sys/sysmacros.h" has symbol "major" : ${\color{green}YES}$
Header "sys/sysmacros.h" has symbol "minor" : ${\color{green}YES}$
Header "sys/sysmacros.h" has symbol "makedev" : ${\color{green}YES}$
Header "sys/mkdev.h" has symbol "major" : ${\color{red}NO}$
Check usable header "sched.h" : ${\color{green}YES}$
Checking for function "sched_getaffinity" : ${\color{green}YES}$
Check usable header "xlocale.h" : ${\color{red}NO}$
Check usable header "linux/futex.h" : ${\color{green}YES}$
Check usable header "endian.h" : ${\color{green}YES}$
Check usable header "dlfcn.h" : ${\color{green}YES}$
Check usable header "sys/shm.h" : ${\color{green}YES}$
Check usable header "cet.h" : ${\color{green}YES}$
Check usable header "pthread_np.h" : ${\color{red}NO}$
Check usable header "renderdoc_app.h" : ${\color{red}NO}$
Check usable header "sys/inotify.h" : ${\color{green}YES}$
Checking for function "strtof" : ${\color{green}YES}$
Checking for function "mkostemp" : ${\color{green}YES}$
Checking for function "memfd_create" : ${\color{green}YES}$
Checking for function "random_r" : ${\color{green}YES}$
Checking for function "flock" : ${\color{green}YES}$
Checking for function "strtok_r" : ${\color{green}YES}$
Checking for function "getrandom" : ${\color{green}YES}$
Checking for function "qsort_s" : ${\color{red}NO}$
Checking for function "posix_fallocate" : ${\color{green}YES}$
Checking if "GNU qsort_r" : links: ${\color{green}YES}$
Header "time.h" has symbol "struct timespec" : ${\color{green}YES}$
Checking for function "thrd_create" : ${\color{green}YES}$
Header "errno.h" has symbol "program_invocation_name" : ${\color{green}YES}$
Header "math.h" has symbol "issignaling" : ${\color{green}YES}$
Checking for function "posix_memalign" : ${\color{green}YES}$
Checking whether type "struct dirent" has member "d_type" : ${\color{green}YES}$
Checking if "strtod has locale support" : links: ${\color{green}YES}$
Checking if "Bsymbolic" : links: ${\color{green}YES}$
Checking if "version-script" : links: ${\color{green}YES}$
Checking if "dynamic-list" : links: ${\color{green}YES}$
Compiler for C supports link arguments -Wl,--build-id=sha1: ${\color{green}YES}$
Checking for function "dlopen" : ${\color{green}YES}$
Checking for function "dladdr" with dependency : ${\color{green}YES}$
Checking for function "dl_iterate_phdr" : ${\color{green}YES}$
Checking for function "clock_gettime" : ${\color{green}YES}$
Run-time dependency zlib found: ${\color{green}YES}$ 1.2.13
Run-time dependency libzstd found: ${\color{green}YES}$ 1.5.5
Run-time dependency threads found: ${\color{green}YES}$
Checking for function "pthread_setaffinity_np" with dependency threads: ${\color{green}YES}$
Run-time dependency expat found: ${\color{green}YES}$ 2.5.0
Library m found: ${\color{green}YES}$
Message: libdrm 2.4.110 needed because amdgpu has the highest requirement
Run-time dependency libdrm_amdgpu found: ${\color{green}YES}$ 2.4.115
Run-time dependency libdrm_radeon found: ${\color{green}YES}$ 2.4.115
Run-time dependency libdrm found: ${\color{green}YES}$ 2.4.115
Run-time dependency libudev found: ${\color{green}YES}$ 253
llvm-config found: ${\color{green}YES}$ (/usr/bin/llvm-config) 16.0.6
Run-time dependency LLVM (modules: amdgpu, bitreader, bitwriter, core, engine, executionengine, instcombine, ipo, mcdisassembler, mcjit, native, scalaropts, transformutils, coroutines, lto) found: ${\color{green}YES}$ 16.0.6
Run-time dependency libelf found: ${\color{green}YES}$ 0.189
Run-time dependency valgrind found: ${\color{red}NO}$ (tried pkgconfig)
Program bison found: ${\color{green}YES}$ (/usr/bin/bison)
Program bison found: ${\color{green}YES}$ 3.8.2 (/usr/bin/bison)
Program flex found: ${\color{green}YES}$ (/usr/bin/flex)
Run-time dependency libunwind found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency x11 found: ${\color{green}YES}$ 1.8.6
Run-time dependency xext found: ${\color{green}YES}$ 1.3.5
Run-time dependency xfixes found: ${\color{green}YES}$ 6.0.1
Run-time dependency xcb-glx found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-shm found: ${\color{green}YES}$ 1.15
Run-time dependency xcb found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-keysyms found: ${\color{red}NO}$ (tried pkgconfig and cmake)
Run-time dependency x11-xcb found: ${\color{green}YES}$ 1.8.6
Run-time dependency xcb-dri2 found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-dri3 found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-present found: ${\color{green}YES}$ 1.15
Dependency xcb-shm found: ${\color{green}YES}$ 1.15 (${\color{ProcessBlue}cached}$)
Run-time dependency xcb-sync found: ${\color{green}YES}$ 1.15
Run-time dependency xshmfence found: ${\color{green}YES}$ 1.3.2
Run-time dependency glproto found: ${\color{green}YES}$ 1.4.17
Run-time dependency dri2proto found: ${\color{green}YES}$ 2.8
Run-time dependency xxf86vm found: ${\color{green}YES}$ 1.1.5
Run-time dependency xcb-xfixes found: ${\color{green}YES}$ 1.15
Run-time dependency xcb-randr found: ${\color{green}YES}$ 1.15
Run-time dependency xrandr found: ${\color{green}YES}$ 1.5.3
Library sensors found: ${\color{red}NO}$
Program nm found: ${\color{green}YES}$ (/usr/bin/nm)
Program symbols-check.py found: ${\color{green}YES}$ (/usr/bin/python3.11 /home/russell/Projects/mesa/bin/symbols-check.py)
Program install_megadrivers.py found: ${\color{green}YES}$ (/usr/bin/python3.11 /home/russell/Projects/mesa/bin/install_megadrivers.py)
Program decode.py found: ${\color{green}YES}$ (/home/russell/Projects/mesa/src/compiler/isaspec/decode.py)
Program encode.py found: ${\color{green}YES}$ (/home/russell/Projects/mesa/src/compiler/isaspec/encode.py)
Compiler for C++ supports arguments -Wno-unused-variable: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-unused-local-typedefs: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-unused-but-set-variable: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-maybe-uninitialized: ${\color{green}YES}$
Compiler for C++ supports arguments -Wno-self-assign: ${\color{red}NO}$
Compiler for C++ supports arguments /wd4189: ${\color{red}NO}$
Compiler for C++ supports arguments -fno-exceptions: ${\color{green}YES}$
Compiler for C++ supports arguments -fno-rtti: ${\color{green}YES}$
Compiler for C++ supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$
Compiler for C++ supports arguments -Wshadow: ${\color{green}YES}$
Compiler for C supports arguments -Wimplicit-fallthrough: ${\color{green}YES}$ (${\color{ProcessBlue}cached}$)
Compiler for C supports arguments -Wshadow: ${\color{green}YES}$
Program ln found: ${\color{green}YES}$ (/usr/bin/ln)
Checking for function "mincore" : ${\color{green}YES}$
Build targets in project: 196

mesa 23.2.0-rc2

Directories
prefix : /home/russell/.local/lib/mesa
libdir : lib
includedir : include

Common C and C++ arguments
c_cpp_args : -mtls-dialect=gnu2
-msse2
-mfpmath=sse
-mstackrealign

OpenGL
OpenGL : ${\color{green}YES}$
ES1 : ${\color{green}YES}$
ES2 : ${\color{green}YES}$
Shared glapi : ${\color{green}YES}$

DRI
Platform : drm
Driver dir : /home/russell/.local/lib/mesa/lib/dri

GLX
Enabled : ${\color{green}YES}$
Provider : dri

EGL
Enabled : ${\color{green}YES}$
Drivers : builtin:egl_dri2 builtin:egl_dri3
Platforms : x11 surfaceless drm xcb

GBM
Enabled : ${\color{green}YES}$
Backends path : /home/russell/.local/lib/mesa/lib/gbm

Vulkan
Drivers : amd
Platforms : x11 surfaceless drm xcb
ICD dir : share/vulkan/icd.d
Video codecs : ${\color{red}NO}$
Intel Ray tracing : ${\color{red}NO}$

LLVM
Enabled : ${\color{green}YES}$
Version : 16.0.6

Gallium
Enabled : ${\color{green}YES}$
Drivers : radeonsi swrast zink
Platforms : x11 surfaceless drm xcb
Frontends : mesa vdpau va nine
Off-screen rendering (OSMesa): ${\color{red}NO}$
HUD lm-sensors : ${\color{red}NO}$

Perfetto
Enabled : ${\color{red}NO}$

User defined options
buildtype : debug
libdir : lib
prefix : /home/russell/.local/lib/mesa
gallium-drivers : radeonsi,swrast,zink
gallium-nine : true
osmesa : false
platforms : x11
vulkan-drivers : amd

directory tree of 32-bit installed

/home/russell/.local/lib/mesa/lib
├── d3d
│   ├── d3dadapter9.so -> d3dadapter9.so.1
│   ├── d3dadapter9.so.1 -> d3dadapter9.so.1.0.0
│   └── d3dadapter9.so.1.0.0
├── dri
│   ├── kms_swrast_dri.so
│   ├── radeonsi_dri.so
│   ├── radeonsi_drv_video.so
│   ├── swrast_dri.so
│   └── zink_dri.so
├── libEGL.so -> libEGL.so.1
├── libEGL.so.1 -> libEGL.so.1.0.0
├── libEGL.so.1.0.0
├── libgbm.so -> libgbm.so.1
├── libgbm.so.1 -> libgbm.so.1.0.0
├── libgbm.so.1.0.0
├── libglapi.so -> libglapi.so.0
├── libglapi.so.0 -> libglapi.so.0.0.0
├── libglapi.so.0.0.0
├── libGLESv1_CM.so -> libGLESv1_CM.so.1
├── libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.1.0
├── libGLESv1_CM.so.1.1.0
├── libGLESv2.so -> libGLESv2.so.2
├── libGLESv2.so.2 -> libGLESv2.so.2.0.0
├── libGLESv2.so.2.0.0
├── libGL.so -> libGL.so.1
├── libGL.so.1 -> libGL.so.1.2.0
├── libGL.so.1.2.0
├── libvulkan_radeon.so
├── pkgconfig
│   ├── d3d.pc
│   ├── dri.pc
│   ├── egl.pc
│   ├── gbm.pc
│   ├── glesv1_cm.pc
│   ├── glesv2.pc
│   └── gl.pc
└── vdpau
├── libvdpau_radeonsi.so -> libvdpau_radeonsi.so.1.0.0
├── libvdpau_radeonsi.so.1 -> libvdpau_radeonsi.so.1.0.0
├── libvdpau_radeonsi.so.1.0 -> libvdpau_radeonsi.so.1.0.0
└── libvdpau_radeonsi.so.1.0.0

  • lib/dri/radeonsi_dri.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=64d143397f4406ab86271ef63d7aca89f02e213c, with debug_info, not stripped
  • lib/libGL.so.1.2.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=5db292ff6b7603626d7edb2c003a004ae3ce6be0, with debug_info, not stripped
  • lib/libvulkan_radeon.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=2e93de24a06fdca0dd68d574466e7a22eba9d431, with debug_info, not stripped
System informations
  • Operating System: openSUSE Tumbleweed 20230821
  • KDE Plasma Version: 5.27.7
  • KDE Frameworks Version: 5.109.0
  • Qt Version: 5.15.10
  • Kernel Version: 6.4.11-1-default (64-bit)
  • Graphics Platform: X11
  • Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
  • Memory: 62.7 GiB of RAM
  • Graphics Processor: AMD Radeon RX 6600M
  • Base Graphics Driver: Mesa 23.1.5
Check linked library
  • /usr/bin/glxgears (64-bit)
$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib ldd /usr/bin/glxgears
        linux-vdso.so.1 (0x00007fff63714000)
        libGL.so.1 => /home/russell/.local/lib/mesa/lib64/libGL.so.1 (0x00007f70ee2c3000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007f70ee157000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f70ee070000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f70ede00000)
        libglapi.so.0 => /home/russell/.local/lib/mesa/lib64/libglapi.so.0 (0x00007f70edda3000)
        libdrm.so.2 => /lib64/libdrm.so.2 (0x00007f70edd8d000)
        libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007f70edd70000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f70edd45000)
        libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f70ee069000)
        libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007f70edd3e000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007f70edd29000)
        libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f70edd21000)
        libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007f70edd1a000)
        libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f70ee062000)
        libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f70edcee000)
        libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007f70edce7000)
        libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007f70edcd5000)
        libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007f70edcce000)
        libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007f70edcc9000)
        libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f70edcc0000)
        libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f70edcb6000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f70ee360000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007f70edcaf000)
  • /usr/lib/mesa-demos/xdemos/glxgears (32-bit)
$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib ldd /usr/lib/mesa-demos/xdemos/glxgears
        linux-gate.so.1 (0xf7f51000)
        libGL.so.1 => /home/russell/.local/lib/mesa/lib/libGL.so.1 (0xf7ec0000)
        libX11.so.6 => /lib/libX11.so.6 (0xf7d43000)
        libm.so.6 => /lib/libm.so.6 (0xf7c3a000)
        libc.so.6 => /lib/libc.so.6 (0xf7800000)
        libglapi.so.0 => /home/russell/.local/lib/mesa/lib/libglapi.so.0 (0xf7bea000)
        libdrm.so.2 => /lib/libdrm.so.2 (0xf7bd1000)
        libxcb-glx.so.0 => /lib/libxcb-glx.so.0 (0xf7bb3000)
        libxcb.so.1 => /lib/libxcb.so.1 (0xf7b85000)
        libX11-xcb.so.1 => /lib/libX11-xcb.so.1 (0xf7b80000)
        libxcb-dri2.so.0 => /lib/libxcb-dri2.so.0 (0xf7b77000)
        libXext.so.6 => /lib/libXext.so.6 (0xf7b61000)
        libXfixes.so.3 => /lib/libXfixes.so.3 (0xf7b58000)
        libXxf86vm.so.1 => /lib/libXxf86vm.so.1 (0xf7b51000)
        libxcb-shm.so.0 => /lib/libxcb-shm.so.0 (0xf7b4c000)
        libexpat.so.1 => /lib/libexpat.so.1 (0xf7b1f000)
        libxshmfence.so.1 => /lib/libxshmfence.so.1 (0xf7b1a000)
        libxcb-randr.so.0 => /lib/libxcb-randr.so.0 (0xf7b07000)
        libxcb-dri3.so.0 => /lib/libxcb-dri3.so.0 (0xf7b00000)
        libxcb-present.so.0 => /lib/libxcb-present.so.0 (0xf7afb000)
        libxcb-sync.so.1 => /lib/libxcb-sync.so.1 (0xf7af2000)
        libxcb-xfixes.so.0 => /lib/libxcb-xfixes.so.0 (0xf7ae5000)
        /lib/ld-linux.so.2 (0xf7f53000)
        libXau.so.6 => /lib/libXau.so.6 (0xf7ae0000)

my shell is fish-shell, if set LD_LIBRARY_PATH to $MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH, linked libraries still use in /lib, instead of $MESA.

$ ps
  PID TTY          TIME CMD
21789 pts/1    00:00:17 fish

$ echo $LD_LIBRARY_PATH

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH ldd /usr/bin/glxgears
        linux-vdso.so.1 (0x00007ffd3b9df000)
        libGL.so.1 => /lib64/libGL.so.1 (0x00007fab0ff12000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007fab0fdcc000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fab0fce5000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fab0fa00000)
        libGLX.so.0 => /lib64/libGLX.so.0 (0x00007fab0fcb1000)
        libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007fab0f949000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fab0fc86000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fab0ffcf000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007fab0fc81000)

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH /usr/bin/glxgears -info
GL_RENDERER   = AMD Radeon RX 6600M (navi23, LLVM 16.0.6, DRM 3.52, 6.4.11-1-default)
GL_VERSION    = 4.6 (Compatibility Profile) Mesa 23.1.5
GL_VENDOR     = AMD

in bash, no issue.

$ ps
  PID TTY          TIME CMD
26128 pts/1    00:00:00 bash

$ echo $LD_LIBRARY_PATH

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH ldd /usr/bin/glxgears
        linux-vdso.so.1 (0x00007fffb09e8000)
        libGL.so.1 => /home/russell/.local/lib/mesa/lib64/libGL.so.1 (0x00007f2e4c4dc000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007f2e4c370000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f2e4c289000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f2e4c000000)
        libglapi.so.0 => /home/russell/.local/lib/mesa/lib64/libglapi.so.0 (0x00007f2e4bfa3000)
        libdrm.so.2 => /lib64/libdrm.so.2 (0x00007f2e4c271000)
        libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007f2e4bf86000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f2e4bf5b000)
        libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f2e4c26c000)
        libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007f2e4c263000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007f2e4bf46000)
        libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f2e4bf3e000)
        libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007f2e4bf37000)
        libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f2e4bf32000)
        libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f2e4bf06000)
        libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007f2e4bf01000)
        libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007f2e4beef000)
        libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007f2e4bee8000)
        libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007f2e4bee3000)
        libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f2e4beda000)
        libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f2e4bed0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2e4c579000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007f2e4bec9000)

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH /usr/bin/glxgears -info
GL_RENDERER   = AMD Radeon RX 6600M (navi23, LLVM 16.0.6, DRM 3.52, 6.4.11-1-default)
GL_VERSION    = 4.6 (Compatibility Profile) Mesa 23.2.0-rc2 (git-71e6fe758c)
GL_VENDOR     = AMD

when only set LD_LIBRARY_PATH to $MESA path in fish, no issue. this issue looks like version of libgl is not MATCH with dri's.

$ ps
  PID TTY          TIME CMD
21789 pts/1    00:00:17 fish

$ echo $LD_LIBRARY_PATH

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib ldd /usr/bin/glxgears
        linux-vdso.so.1 (0x00007ffe17bfe000)
        libGL.so.1 => /home/russell/.local/lib/mesa/lib64/libGL.so.1 (0x00007fa26b181000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007fa26b015000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fa26af2e000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fa26ac00000)
        libglapi.so.0 => /home/russell/.local/lib/mesa/lib64/libglapi.so.0 (0x00007fa26aecf000)
        libdrm.so.2 => /lib64/libdrm.so.2 (0x00007fa26aeb9000)
        libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007fa26ae9c000)
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fa26ae71000)
        libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007fa26ae6c000)
        libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007fa26ae63000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007fa26abeb000)
        libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007fa26abe3000)
        libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007fa26abdc000)
        libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007fa26abd7000)
        libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fa26abab000)
        libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007fa26aba6000)
        libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007fa26ab94000)
        libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007fa26ab8d000)
        libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007fa26ab88000)
        libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007fa26ab7f000)
        libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007fa26ab75000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa26b21e000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007fa26ab6e000)

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib:$LD_LIBRARY_PATH LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri /usr/bin/glxgears -info
libGL error: DRI driver not from this Mesa build ('23.2.0-rc2 (git-71e6fe758c)' vs '23.1.5')
libGL error: failed to load driver: radeonsi
libGL error: DRI driver not from this Mesa build ('23.2.0-rc2 (git-71e6fe758c)' vs '23.1.5')
libGL error: failed to load driver: radeonsi
libGL error: DRI driver not from this Mesa build ('23.2.0-rc2 (git-71e6fe758c)' vs '23.1.5')
libGL error: failed to load driver: swrast
Error: glXCreateContext failed

$ MESA=$HOME/.local/lib/mesa LD_LIBRARY_PATH=$MESA/lib64:$MESA/lib LIBGL_DRIVERS_PATH=$MESA/lib64/dri:$MESA/lib/dri /usr/bin/glxgears -info
GL_RENDERER   = AMD Radeon RX 6600M (navi23, LLVM 16.0.6, DRM 3.52, 6.4.11-1-default)
GL_VERSION    = 4.6 (Compatibility Profile) Mesa 23.2.0-rc2 (git-71e6fe758c)
GL_VENDOR     = AMD

sry, this is my mistake.

@StatusCode404
Copy link

@Venemo - Could I kindly ask that you update the instructions to include adding video codecs somewhere? Perhaps for those that want GPU acceleration.
-Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec

Also a note on how to force ACO for OpenGL using
AMD_DEBUG=useaco environment variable

Many thanks for writing up the instructions in a real clear and straight to the point manner! This really helped me get started many months ago when I decided to build my own Mesa.

@Venemo
Copy link
Author

Venemo commented Oct 26, 2023

@StatusCode404 I'm not familiar with video codecs so I don't know how to build them or how to use them

@StatusCode404
Copy link

StatusCode404 commented Oct 27, 2023

The codecs are already in the Mesa source, just need to provide instructions to include them in Mesa so video players and encoders have the option to use gpu hardware acceleration for decoding (playback and transcoding source) and encoding (making mkv video files). Browsers will also use it like Firefox and Chromium and Chrome. If it isn't in Mesa when built, it will use the CPU to decode and encode which is heavy coming from browser. Imagine Netflix, Youtube, etc.

VLC (VideoLan) player for example has the default setting to use hardware acceleration if the Mesa driver has it available through VAAPI or VDPAU interface. Same with totem video player which is what comes with Ubuntu and many other distros.

(Side Note VLC apt and flatpak work with Mesa acceleration if codecs are built with it. However the snap version is broken and doesn't use hardware acceleration. Fails to hook up with VAAPI api.)

I build mesa for amdgpu and add the codecs by just adding that option I pasted above...
-Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec

Mesa doesn't add it automatically due to some disagreement between people in the project deciding whether it should be default or not due to licensing and patents. But you can optionally add it by adding that parameter.

This is my single one-liner build command with the codecs in it...

meson setup builddir/ -Dprefix="<ENTER YOUR PATH HERE>/Mesa/mesa" -Dgallium-drivers=radeonsi,swrast,zink -Dvulkan-drivers=amd -Dgallium-nine=true -Dosmesa=false -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec -Dbuildtype=release -Dc_args="-march=znver3 -pipe -O3 -fuse-ld=mold" -Dcpp_args="-march=znver3 -pipe -O3 -fuse-ld=mold"

For "video-codecs" official documentation go to the mesa-git/mesa root folder for the source code and:
cat ./meson_options.txt
search for "video-codecs"

@Venemo
Copy link
Author

Venemo commented Oct 27, 2023

@StatusCode404 I understand that. However, as I don't work on them in my daily work, I am not familiar with how to use them.

I build mesa for amdgpu and add the codecs by just adding that option I pasted above

Your comment is missing what environment variables do you need to use to have applications pick up the custom built VAAPI libs instead of the system ones. If you let me know that, I will add it above.

This is my single one-liner build command with the codecs in it...

Can you please edit that line and remove -flto? Do NOT use LTO with Mesa. We don't support it and it is very likely to cause inexplicable issues. Please do not recommend that to users.

@StatusCode404
Copy link

StatusCode404 commented Oct 28, 2023

I don't think there is a need for additional environment variables. It is part of mesa and not custom. These aren't custom built VAAPI libs. You choose to have VAAPI by adding this to Mesa or you don't and your applications revert to CPU software decode/encode if Mesa doesn't have it.

Have you never watched a video on a browser or used VLC or any other video player? It uses Mesa's VAAPI if it is available.

There's information here: https://wiki.archlinux.org/title/Hardware_video_acceleration

I've removed the flto from above but I've been using it for several months now and never had any problems.

@Venemo
Copy link
Author

Venemo commented Oct 28, 2023

I don't think there is a need for additional environment variables

How do you tell the application to pick up your custom built version and not the one from your system libraries?

I've removed the flto from above but I've been using it for several months now and never had any problems.

We've seen many many issues reported with LTO builds over the years. Various glitches, artifacting and inexplicable GPU hangs.

@StatusCode404
Copy link

How do you tell the application to pick up your custom built version and not the one from your system libraries?

Most of the existing common applications like ffmpeg, players, etc, "I believe, not 100% sure how" look for $MESA. If you look at that Arch linux page, there's a section on configuring applications and each one just needs Mesa there with the capability built-in. If Mesa doesn't have the codecs built-in then it doesn't work and reverts to cpu-software mode.

We've seen many many issues reported with LTO builds over the years. Various glitches, artifacting and inexplicable GPU hangs.

Fair enough, I have removed it from that line, but will continue using it as it seems to make my games run a little faster fps-wise. Haven't had issues yet since I've started building Mesa on my own. I'll try without if I get a hang or something similar.

@juampiursic
Copy link

Hello! I came across this guide, could build it, can run vkcube but I have my games on Steam flatpak and Bottles, so I suppose there is something wrong when trying flatpaks. When I do:

source ~/mesa.sh
vulkaninfo

I get the latest mesa version, 24.0.0-devel but when I try to run Steam flatpak I get this:

INFO:root:https://github.com/flathub/com.valvesoftware.Steam/wiki
INFO:root:Will set XDG dirs prefix to /home/jursic/.var/app/com.valvesoftware.Steam
DEBUG:root:Checking input devices permissions
WARNING:root:Missing permissions for input devices
INFO:root:Overriding TZ to America/Argentina/Buenos_Aires
DEBUG:root:Addding /usr/lib/extensions/vulkan/MangoHud/bin to PATH
DEBUG:root:Addding /usr/lib/extensions/vulkan/gamescope/bin to PATH
steam.sh[2]: Running Steam on org.freedesktop.platform 23.08 64-bit
steam.sh[2]: STEAM_RUNTIME is enabled automatically
setup.sh[74]: Steam runtime environment up-to-date!
steam.sh[2]: Steam client's requirements are satisfied
[2023-10-28 21:50:45] Startup - updater built Oct 25 2023 18:40:00
[2023-10-28 21:50:45] Startup - Steam Client launched with: '/home/jursic/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/steam' '-no-cef-sandbox'
10/28 21:50:45 Init: Installing breakpad exception handler for appid(steam)/version(1698260427)/tid(108)
libGL error: MESA-LOADER: failed to open radeonsi: /home/jursic/mesa/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi: /home/jursic/mesa/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast: /home/jursic/mesa/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
SteamUpdateUI: An X Error occurred
X Error of failed request:  BadValue (integer parameter out of range for operation)
Major opcode of failed request:  152 (GLX)
Minor opcode of failed request:  3 (X_GLXCreateContext)
Value in failed request:  0x0
Serial number of failed request:  49
xerror_handler: X failed, continuing
[2023-10-28 21:50:45] Loading cached metrics from disk (/home/jursic/.var/app/com.valvesoftware.Steam/.local/share/Steam/package/steam_client_metrics.bin)
[2023-10-28 21:50:45] Using the following download hosts for Public, Realm steamglobal
[2023-10-28 21:50:45] 1. https://client-update.akamai.steamstatic.com, /, Realm 'steamglobal', weight was 1000, source = 'update_hosts_cached.vdf'
[2023-10-28 21:50:45] 2. https://cdn.cloudflare.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'update_hosts_cached.vdf'
[2023-10-28 21:50:45] 3. https://cdn.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'baked in'
[2023-10-28 21:50:45] Verifying installation...
[2023-10-28 21:50:45] Verification complete

Steam logging initialized: directory: /home/jursic/.var/app/com.valvesoftware.Steam/.local/share/Steam/logs

XRRGetOutputInfo Workaround: initialized with override: 0 real: 0xf62c78f0
XRRGetCrtcInfo Workaround: initialized with override: 0 real: 0xf62c61c0
libGL error: MESA-LOADER: failed to open radeonsi: /home/jursic/mesa/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi: /home/jursic/mesa/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast: /home/jursic/mesa/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /home/jursic/mesa/lib64/dri:/home/jursic/mesa/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
crash_20231028215045_4.dmp[115]: Uploading dump (out-of-process)
/tmp/dumps/crash_20231028215045_4.dmp
/home/jursic/.var/app/com.valvesoftware.Steam/.local/share/Steam/steam.sh: línea 798:   108 Violación de segmento  (`core' generado) "$STEAMROOT/$STEAMEXEPATH" "$@"
crash_20231028215045_4.dmp[115]: Finished uploading minidump (out-of-process): success = yes
crash_20231028215045_4.dmp[115]: response: CrashID=bp-e6667828-714e-42c9-a445-0e79b2231028
crash_20231028215045_4.dmp[115]: file ''/tmp/dumps/crash_20231028215045_4.dmp'', upload yes: ''CrashID=bp-e6667828-714e-42c9-a445-0e79b2231028''

What can I do?

@Venemo
Copy link
Author

Venemo commented Oct 29, 2023

@StatusCode404

I believe, not 100% sure how

Let me know when you know how.

will continue using it as it seems to make my games run a little faster fps-wise

I am curious to see any benchmark results if you have them

@juampiursic

when I try to run Steam flatpak I get this

I'm not a flatpak expert, so I can't help you sorry. I recommend asking for support on a flatpak channel.

@StatusCode404
Copy link

StatusCode404 commented Oct 29, 2023

@Venemo

Let me know when you know how.

I believe each application approaches it differently but all manners lead towards mesa.
vainfo for example, an application that tells you what your Mesa driver is capable of accelerating for VAAPI appears to just check for
/usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so

Here's an example of the output from vainfo with a mesa from your colleague from Valve Kisak who adds the codecs like me...

$ vainfo
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Mesa Gallium driver 23.2.1 - kisak-mesa PPA for AMD Radeon RX 6900 XT (navi21, LLVM 15.0.7, DRM 3.54, 6.5.9-danglingpointer-znver3-clang)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileAV1Profile0            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

As I mentioned, all that is important is that it is compiled in the build of Mesa, it is part of Mesa but not enabled by default, just like Ray Tracing was disabled by default prior to 23.2.x You didn't have to add any special environment variables to enable it in 23.2.x

I'm not sure why you are hesitant to update your guide to add codecs for video acceleration? Your colleague Kisak builds his with it.

Anyways, its up to you mate. For those fortunate enough to read my entries here add the parameters
-Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec to your build and enjoy AMD GPU hardware acceleration for those codecs.

For those that don't well your CPU will work harder.

This of course only works if you install Mesa after building it.
More info here: https://wiki.archlinux.org/title/Hardware_video_acceleration

@Venemo
Copy link
Author

Venemo commented Oct 29, 2023

@StatusCode404 You are avoiding the question... I will ask once more, how do you tell the application to pick up your custom built version and not the one from your system libraries? Just building mesa with the codecs enabled will not mean that your apps will pick up the custom build rather than the one from your system.

@Venemo
Copy link
Author

Venemo commented Oct 29, 2023

@StatusCode404 Okay, after some digging I found the relevant environment variables:

  • LIBVA_DRIVERS_PATH must be set for VAAPI to work correctly with the custom build (this works similarly to LIBGL_DRIVERS_PATH and seems to be a list of directories separated by colons)
  • VDPAU_DRIVER_PATH must be set for VDPAU to work correctly, though apparently not all apps are able to pick it up, and you may also need VDPAU_DRIVER=radeonsi for it to recognize the RadeonSI as the correct driver.

With that, I now extended the above instructions to include the codecs and also how to use them.

@razholio
Copy link

I'm attempting to build for local install specifically to get VAAPI support for my intel ARC dg2 card. The i915 gallium driver is built, but even with gallium-driver set to 'auto' or 'all', I'm not getting the dri driver: i965_drv_video.so that vainfo is looking for. Are there any special options for i965 video support that you know of?

@razholio
Copy link

I'm not getting the dri driver: i965_drv_video.so that vainfo is looking for.
answered my own question. With intel, the 'patent encumberances' keep the VAAPI drivers out of mesa. They are here: https://github.com/intel/media-driver
and need to be compiled separately. Still open source, though.

@StatusCode404
Copy link

@StatusCode404 Okay, after some digging I found the relevant environment variables:

* `LIBVA_DRIVERS_PATH` must be set for VAAPI to work correctly with the custom build (this works similarly to `LIBGL_DRIVERS_PATH` and seems to be a list of directories separated by colons)

* `VDPAU_DRIVER_PATH` must be set for VDPAU to work correctly, though apparently not all apps are able to pick it up, and you may also need `VDPAU_DRIVER=radeonsi` for it to recognize the RadeonSI as the correct driver.

With that, I now extended the above instructions to include the codecs and also how to use them.

Well done for being persistent and figuring it out for a custom mesa script!
I think it works on my system with those extra two env variables..

@StatusCode404
Copy link

StatusCode404 commented Jan 23, 2024

To get it to work on ubuntu 22.04 this is the script that worked for me...

#!/bin/bash

MESA=/home/Mesa/mesa \
LD_LIBRARY_PATH=$MESA/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH \
LIBGL_DRIVERS_PATH=$MESA/lib/x86_64-linux-gnu/dri \
VK_ICD_FILENAMES=$MESA/share/vulkan/icd.d/radeon_icd.x86_64.json \
LIBVA_DRIVERS_PATH=$MESA/lib/x86_64-linux-gnu/dri \
VDPAU_DRIVER_PATH=$MESA/lib/x86_64-linux-gnu/dri \
D3D_MODULE_PATH=$MESA/lib/x86_64-linux-gnu/d3d/d3dadapter9.so.1 \
    exec "$@"

The above is used in my system purely for 64bit for AMD.

@ZephyrCheez
Copy link

Trying to build 32-bit build on Arch Linux and I'm getting a whole crap ton of errors from blake3 .S files about too many memory references.

@psyborg55
Copy link

which target on LLVM build should i choose, AMDGPU or x86 ? i need only VAAPI/VDPAU

@Venemo
Copy link
Author

Venemo commented Mar 11, 2024

@psyborg55 You don't need to build LLVM. As I say in the guide: skip this unless you know you specifically need it

@psyborg55
Copy link

live boot of 16.04 and installing all the required stuff shows libllvm6.0 as dependency. on the system i want to build this there is no llvm installed. so i thought i need it?
Screenshot from 2024-03-11 01-57-38

@Venemo
Copy link
Author

Venemo commented Mar 11, 2024

@psyborg55 I assume by "16.04" that you use an old Ubuntu, but I have no idea what you are doing in there with apt install smplayer. This article is about building mesa.

@psyborg55
Copy link

16.04 -> install player to check hw acceleration works (confirmed, works) and checked dependencies to see what i need to build on ubuntu older than 16.04

@Venemo
Copy link
Author

Venemo commented Mar 11, 2024

The dependencies of a video player do not have anything to do with what is required to build mesa. That being said, if you want to use LLVM, you can simply install it from Ubuntu's repos and you don't need to build it yourself.

All that being said, I highly recommend to upgrade to a newer operating system, 2016 was a long time ago.

@psyborg55
Copy link

2016 ? i run this on 2009 machine, ubuntu 10.04 (you can imagine the slugish performance on newer ubuntu versions probably, not to mention how each new release looks uglier than prevoius)
no ubuntu repos or anything similar alive
dependenices solved now, mesa created config file. and yes needed to build LLVM on this system, not sure what the difference i set AMDGPU

@Venemo
Copy link
Author

Venemo commented Mar 12, 2024

Obviously if you want to use LLVM and your operating system doesn't provide the minimum required version, you need to build it. That being said, these days mesa can be used without LLVM if configured properly; and also, I don't recommend running outdated operating systems.

@psyborg55
Copy link

after spending few days with this i got most of the stuff done, e.g. compiled ffmpeg, mpv, smplayer etc. but still have problems getting any of the players to output on vaapi or vdpau. looked at DRM driver, it shows version 2.49 while on working ubuntu there is 2.50 (is this change relevant https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon/radeon_drv.c?id=75cb00dc0c9dbe5e7a971ac729384d8d05f0deb1 ?)

some outputs

vainfo

libva info: VA-API version 1.10.0
libva info: Trying to open /usr/local/lib64/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva error: /usr/local/lib64/dri/r600_drv_video.so init failed
libva info: va_openDriver() returns 2
vaInitialize failed with error code 2 (resource allocation failed),exit

vdpauinfo

display: :0.0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1

vainfo --device /dev/dri/renderD128 --display drm

libva info: VA-API version 1.10.0
libva info: Trying to open /usr/local/lib64/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Mesa Gallium driver 19.0.4 for AMD RS780 (DRM 2.49.0 / 4.9.172, LLVM 7.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

glxinfo -B

name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: Mesa DRI R600 (RS780 9612) 20090101  TCL DRI2
OpenGL version string: 1.5 Mesa 7.7.1

last one appears to be wrong, indicating mesa 7.7.1, is that correct?

managed to convert a video via ffmpeg commands found in wiki with specifying hwaccel vaapi, but some of the display stuff must be wrong as all players fallback to xv output. any idea ?

@Venemo
Copy link
Author

Venemo commented Mar 16, 2024

Sorry, this is completely off-topic here. I wish I could help you but I have no clue, I recommend that you talk to the ffmpeg community on their IRC channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment