Mesa-24.2.2

Introduction to Mesa

Mesa offers a wide variety of graphic software, offering the OpenGL library, OpenGL drivers, Vulkan drivers, and so forth.

[Note]

Note

Mesa is updated relatively often. You may want to use the latest available 24.2.x mesa version.

[Note]

Note

Development versions of GLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

Mesa Dependencies

Required

Xorg Libraries, libdrm-2.4.123, mako-1.3.5, and PyYAML-6.0.2

Recommended

Optional

libgcrypt, libunwind-1.6.2, lm_sensors , Nettle-3.10, valgrind, mesa-demos (provides more than 300 demos to test Mesa), Bellagio OpenMAX Integration Layer (for mobile platforms), and libtizonia

[Note]

Note

An Internet connection is needed for building the Nouveau Vulkan driver.

Installation of Mesa

[Note]

Note

If you are using NVIDIA-560.35.03 and wish to use Steam-1.0.0.81, this package is still a requirement as Steam depends on Mesa's GBM, or else the webhelper will repeatedly launch and crash before showing an error screen. You will need to have at least one gallium driver for this package to compile. Set the option -D gallium-drivers=nouveau to get this package over and done with as then you can move on. The 32-bit version of this package is not necessary if you are doing this.

Install Mesa by running the following commands:

mkdir build &&
cd    build &&

meson setup                    \
      --prefix=$XORG_PREFIX    \
      --buildtype=release      \
      -D osmesa=true           \
      -D platforms=x11,wayland \
      -D gallium-drivers=auto  \
      -D vulkan-drivers=auto   \
      -D valgrind=disabled     \
      -D libunwind=disabled    \
      -D glvnd=enabled         \
      ..    &&

ninja

To test the results, issue: meson configure -D build-tests=true && ninja test.

Now, as the root user:

ninja install

If desired, install the optional documentation by running the following commands as the root user:

cp -rv ../docs -T /usr/share/doc/mesa-24.2.2

32-bit Installation of Mesa

First clean the build directory:

rm -rf *

Install lib32-Mesa by running the following commands:

CC="gcc -m32" CXX="g++ -m32"                 \
PKG_CONFIG_PATH=$XORG_PREFIX/lib32/pkgconfig \
meson setup                                  \
      --prefix=$XORG_PREFIX                  \
      --libdir=$XORG_PREFIX/lib32            \
      --buildtype=release                    \
      -D osmesa=true                         \
      -D platforms=x11,wayland               \
      -D gallium-drivers=auto                \
      -D vulkan-drivers=auto                 \
      -D valgrind=disabled                   \
      -D libunwind=disabled                  \
      -D glvnd=enabled                       \
      .. &&
      sed -i 's/\/usr\/lib\//\/usr\/lib32\//g' ./build.ninja &&

ninja

Now, as the root user:

DESTDIR=$PWD/DESTDIR ninja install
cp -vr DESTDIR/$XORG_PREFIX/lib32/* $XORG_PREFIX/lib32
cp -vr DESTDIR/$XORG_PREFIX/share/vulkan/* $XORG_PREFIX/share/vulkan
rm -rf DESTDIR
ldconfig

32-bit Installation of NVK and Vulkan Swrast

[Note]

Note

Feel free to skip this section if you don't want to install the Nouveau Vulkan driver (NVK) or Vulkan swrast.

NVK and Vulkan swrast have special requirements to be configured and compiled, requiring extra steps. You are going to need to modify a few paths in a personality file used by Pkgconf, as it searches in /usr rather than $XORG_PREFIX. If the expanded path is /usr, skip to the compilation instructions.

Change the paths in the Pkgconf personality file as the root user:

sed -i 's/\/usr/\$XORG_PREFIX/g' \
    /usr/share/pkgconfig/personality.d/i686-pc-linux-gnu.personality

Now clean the build directory:

rm -rf *

Install lib32-NVK and/or Vulkan swrast by following the commands:

meson setup                                     \
            --cross-file lib32                   \
            --prefix=$XORG_PREFIX                \
            --libdir=$XORG_PREFIX/lib32          \
            --buildtype=release                  \
            -D platforms=x11,wayland             \
            -D gallium-drivers=softpipe,llvmpipe \
            -D vulkan-drivers=nouveau,swrast     \
            -D glx=disabled                      \
            -D egl=disabled                      \
            -D opengl=false                      \
            -D gles1=disabled                    \
            -D gles2=disabled                    \
            -D valgrind=disabled                 \
            -D libunwind=disabled                \
            .. &&
            sed -i 's/\/usr\/lib\//\/usr\/lib32\//g' ./build.ninja &&

ninja

Now, as the root user:

DESTDIR=$PWD/DESTDIR ninja install
cp -vr DESTDIR/$XORG_PREFIX/lib32/* $XORG_PREFIX/lib32
cp -vr DESTDIR/$XORG_PREFIX/share/vulkan/* $XORG_PREFIX/share/vulkan
rm -rf DESTDIR
ldconfig

If you modified the Pkgconf personality, you can change it back by doing the following command as the root user:

sed -i 's/\$XORG_PREFIX/\/usr/g' \
    /usr/share/pkgconfig/personality.d/i686-pc-linux-gnu.personality

Command Explanations

--buildtype=release: This switch ensures a fully-optimized build, and disables debug assertions which will severely slow down the libraries in certain use-cases. Without this switch, build sizes can span into the 2GB range.

-D gallium-drivers=auto: This parameter controls which Gallium3D drivers should be built. Gallium drivers are essentially OpenGL drivers. If you wish to build specific drivers, valid options include:

  • auto selects all Gallium3D drivers available for x86

  • r300 (for ATI Radeon 9000 or Radeon X series)

  • r600 (for AMD/ATI Radeon HD 2000-6000 series)

  • radeonsi (for AMD Radeon HD 7000 or newer AMD GPU models)

  • nouveau (for Supported NVIDIA GPUs, they are listed as all 3D features either DONE or N/A in the Nouveau status page)

  • virgl (for QEMU virtual GPU with virglrender support)

  • svga (for VMWare virtual GPU)

  • softpipe (using CPU for 3D rasterization; needed for OSMesa which provides OpenGL bitmap support)

  • llvmpipe (softpipe but uses LLVM to increase performance)

  • zink (a driver converting Vulkan calls to OpenGL; it is maturing and becoming more useful and performant and can be used as a replacement for dri drivers like nouveau)

  • iris (for Intel GPUs shipped with Broadwell or newer CPUs)

  • crocus (for Intel GMA 3000, X3000 series, 4000 series, or X4000 series GPUs shipped with chipsets, or Intel HD GPUs shipped with pre-Broadwell CPUs)

  • i915 (for Intel GMA 900, 950, 3100, or 3150 GPUs shipped with chipsets or Atom D/N 4xx/5xx CPUs)

You may replace auto with a comma-separated list to build only a subset of these drivers if you precisely know which drivers you need, for example: -D gallium-drivers=radeonsi,iris,swrast.

-D osmesa=true: This switch enables building the libOSMesa library and provides Gallium3D support in it. It requires the swrast gallium driver.

-D platforms=...: This parameter controls which windowing systems will be supported. Available linux platforms are x11 and wayland.

-D vulkan-drivers=auto: This switch enables support for the Vulkan graphics API. It automatically builds all graphics drivers that are available for Vulkan. If you wish to build specific drivers, valid options include:

  • amd (for AMD Radeon HD 7730 or newer AMD GPUs)

  • intel (for Intel GPUs shipped with Skylake or newer CPUs, or as a dedicated PCIe card)

  • intel_hasvk (for Intel GPUs shipped with Ivy Bridge, Haswell, or Broadwell CPUs)

  • nouveau (for GTX 16XX, RTX 20XX, or newer NVIDIA GPUs; this driver is maturing so performance isn't the best but is fairly usable)

  • swrast (using CPU for 3D rasterization. Note that it's much slower than using a modern 3D-capable GPU)

You may replace auto with a comma-separated list to build only a subset of these drivers if you precisely know which drivers you need, for example: -D vulkan-drivers=amd,nouveau,swrast.

-D valgrind=disabled: This parameter disables the usage of Valgrind during the build process. Remove this parameter if you have Valgrind installed, and wish to check for memory leaks.

-D libunwind=disabled: This parameter disables the usage of libunwind.

-D glvnd=enabled: This parameter disables this package from building its own OpenGL library and uses the libraries provided by libglvnd-1.7.0. Omit parameter if you do not want to use Steam-1.0.0.81. Otherwise, keep the parameter and install libglvnd-1.7.0 before compiling this package.

meson configure -D build-tests=true: This command will reconfigure the build to set -D build-tests=true, but keep the other options specified in the meson setup command unchanged. It allows ninja test to build and run unit tests.

-D egl-native-platform="...": This parameter controls which Embedded Graphics Library support will be built. Available linux options are auto (default), x11, wayland, surfaceless, and drm.

sed -i 's/\/usr\/lib\//\/usr\/lib32\//g' ./build.ninja: This package is stubborn and likes to link against LLVM libraries in /lib, even on a multilib installation, so this command tells this package to link against libraries in the proper directory.

Contents

Installed Programs: None
Installed Libraries: libEGL.so, libGL.so, libGLESv1_CM.so, libGLESv2.so, libgallium-24.2.2.so, libgbm.so, libglapi.so, libOSMesa.so, and libxatracker.so
Installed DRI Driver Stubs: libdril_dri.so and symlinks to it: crocus_dri.so, i915_dri.so, iris_dri.so, kms_swrast_dri.so, nouveau_dri.so, r300_dri.so, r600_dri.so, r600_drv_video.so, radeonsi_dri.so, swrast_dri.so, virtio_gpu_dri.so, vmwgfx_dri.so, and zink_dri.so
Installed VA-API Drivers: nouveau_drv_video.so, radeonsi_drv_video.so, virtio_gpu_drv_video.so,
Installed VDPAU Drivers: libvdpau_nouveau.so, libvdpau_r300.so libvdpau_r600.so, and libvdpau_radeonsi.so libvdpau_virtio_gpu.so (Many of these drivers are hard-linked).
Installed Vulkan Drivers: libvulkan_intel_hasvk.so, libvulkan_intel.so, libvulkan_lvp.so, and libvulkan_nouveau.so, and libvulkan_radeon.so
Installed Directories: $XORG_PREFIX/{include/{EGL,GLES,GLES2,GLES3,KHR}, $XORG_PREFIX/lib/{dri,vdpau}}, $XORG_PREFIX/share/drirc.d (contains workarounds for various applications, particularly browsers and games), $XORG_PREFIX/share/vulkan, and /usr/share/doc/mesa-24.2.2

Short Descriptions

libEGL.so

provides a native platform graphics interface as defined by the EGL-1.4 specification

libgbm.so

is the Mesa Graphics Buffer Manager library

libGLESv1_CM.so

is the Mesa OpenGL ES 1.1 library

libGLES2.so

is the Mesa OpenGL ES 2.0 library

libGL.so

is the main Mesa OpenGL library