Introduction to Mesa
Mesa contains several libraries and drivers
for multiple APIs like OpenGL and Vulkan.
This package is known to build and work properly
using an LFS 12.4 platform.
Package Information
Download (HTTP): https://mesa.freedesktop.org/archive/mesa-25.2.7.tar.xz
Download SHA256 Sum: b40232a642011820211aab5a9cdf754e106b0bce15044bc4496b0ac9615892ad
Download MD5 sum:
Download size: 283,604.1 KB
Estimated disk space required: 1,056,176.2 KB
Estimated build time: 10.78 SBU
Additional Downloads
Mesa Dependencies
Required
Xorg7 Libraries,
libdrm-2.4.129,
Mako-1.3.10, and
PyYAML-6.0.3
Recommended
Glslang-16.0.0 (required for Vulkan support)
libva-2.22.0 (to provide VA-API support for some
gallium drivers. Note that there is a circular dependency.
You must build libva first without
mesa's EGL and GLX support, install this package, and rebuild
libva)
libvdpau-1.5 (to build VDPAU drivers)
LLVM-21.1.2 (required for the llvmpipe, r300, r600,
and radeonsi drivers)
wayland-protocols-1.45 (required for "plasma-build"
,
GNOME, and recommended for "GTK3"
)
libclc-21.1.2 (required for the Intel iris
gallium driver)
Vulkan-Loader-1.4.328.1 (required for Vulkan support)
ply-3.11 (required for the Intel vulkan driver)
"cbindgen",
make-ca-1.16.1, and
"rust-bindgen"
(required for the Nouveau Vulkan driver)
![[Note]](../images/note.png)
Note
An Internet connection is needed for building the Nouveau Vulkan
driver. The system certificate store may need to be set up with
make-ca before building this
package.
![[Note]](../images/note.png)
Note
Choosing Mesa Drivers
In the instructions below, all the available drivers are built. That
will almost always work. However, it is not efficient. Depending on
your video hardware, you probably need only specific drivers.
The first thing you need to know is which type of video device you
have. In some cases it is built into the CPU. In others it is a
separate PCI card. In either case you can tell what video hardware you
have by installing pciutils-3.14.0 and running:
lspci | grep VGA
The video device is most likely one of three families: AMD, Intel, or
NVIDIA. See the Command Explanations for
-D gallium-drivers=auto below to
see what options are available for your specific video hardware (or
emulated video hardware). You should probably add the softpipe or
llvmpipe option as a backup driver.
For 'platforms' you can select x11 and/or wayland. Note that in BLFS
currently only Gnome and KDE can use wayland. If you are not going to
use one of those desktop environments then you probably only want x11.
For 'vulkan-drivers' you may want to limit the selection to your
current hardware. These drivers are used by some specific applications.
For example, ffmpeg (including ffplay) will use Vulkan instead of
OpenGL for rendering video on the GPU. If you do not want to do this
you may or may not want to install them.
See the Command Explanations for
-D vulkan-drivers=auto below to
see what options are available for your specific video hardware (or
emulated video hardware). You should probably add the swrast option
as a backup driver unless you don't need Vulkan at all.
Optional
lm-sensors-3-6-2,
Nettle-3.10.2,
mesa-demos
(provides more than 300 extra demos to test
Mesa; this includes the same programs added by
the patch above),
Bellagio OpenMAX Integration
Layer (for mobile platforms), and
libtizonia
Kernel Configuration
Enable the following options in the kernel configuration and
recompile the kernel if necessary:
Device Drivers --->
Graphics support --->
<*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
... [DRM]
# For r300 or r600:
< /*/M> ATI Radeon [DRM_RADEON]
# For radeonsi:
< /*/M> AMD GPU [DRM_AMDGPU]
[*] Enable amdgpu support for SI parts [DRM_AMDGPU_SI]
[*] Enable amdgpu support for CIK parts [DRM_AMDGPU_CIK]
Display Engine Configuration --->
[*] AMD DC - Enable new display engine [DRM_AMD_DC]
# For nouveau:
< /*/M> Nouveau (NVIDIA) cards [DRM_NOUVEAU]
[*] Use GSP firmware for Turing/Ampere (needs firmware installed)
... [DRM_NOUVEAU_GSP_DEFAULT]
# For i915, crocus, or iris:
< /*/M> Intel 8xx/9xx/G3x/G4x/HD Graphics [DRM_I915]
# For iris:
< /*/M> Intel Xe2 Graphics [DRM_XE]
[*] Enable display support [DRM_XE_DISPLAY]
(*) Force probe xe for selected Intel hardware IDs
... [DRM_XE_FORCE_PROBE]
# For llvmpipe or softpipe:
< /*> Virtual GEM provider [DRM_VGEM]
# For svga:
< /*/M> DRM driver for VMware Virtual GPU [DRM_VMWGFX]![[Note]](../images/note.png)
Note
The corresponding Mesa Gallium3D driver name is provided as the
comment for the configuration entries. If you don't know the name
of the Mesa Gallium3D driver for your GPU, see Mesa Gallium3D Drivers below.
For the GPUs supported by the Iris Gallium3D driver, with
CONFIG_DRM_I915 enabled and
CONFIG_DRM_XE_FORCE_PROBE set to
the string *, the i915 driver will be used
if it supports the GPU, and the Xe driver will be used if it
supports the GPU but the i915 driver does not. If you are sure
your GPU is supported by the i915 driver, you can disable the
Xe driver to save some build time. If your GPU is supported
by both drivers and you want to use the Xe driver, you can disable
the i915 driver, or make the i915 driver deny your GPU via the
CONFIG_DRM_I915_FORCE_PROBE option, for example
setting it to !7d55 would make i915 deny the
Meteor Lake integrated GPU (of which the PCI ID is
8086:7d55), leaving it for the Xe driver.
CONFIG_DRM_RADEON,
CONFIG_DRM_AMDGPU,
CONFIG_DRM_NOUVEAU,
CONFIG_DRM_I915,
and CONFIG_DRM_XE may require firmware.
See 'postlfs-firmware' for details.
Selecting CONFIG_DRM_RADEON,
CONFIG_DRM_AMDGPU, or
CONFIG_DRM_NOUVEAU as
“y” is not recommended. If it is, any
required firmware must be built as a part of the kernel image or the
initramfs for the driver to function correctly.
The sub-entries under CONFIG_DRM_AMDGPU are used
to ensure the AMDGPU kernel driver supports all GPUs using the
radeonsi driver. They are not needed if you
won't need CONFIG_DRM_AMDGPU itself. They
may be unneeded for some GPU models.
For llvmpipe or softpipe,
CONFIG_DRM_VGEM is required or X clients may fail
to start with a cryptic message Error: couldn't get
an RGB, Double-buffered visual. Strictly speaking,
it can be compiled as a module. But the module will not be loaded
automatically, so it's more convenient to build it as a part of the
kernel image.
Installation of Mesa
If you have downloaded the xdemos patch (needed if testing the Xorg
installation per BLFS instructions), apply it by running the following
command:
patch -Np1 -i ../mesa-add_xdemos-4.patch
Prepare Mesa by running the following
commands:
meson setup build \
--prefix=/usr \
--buildtype=release \
-D platforms=x11,wayland \
-D valgrind=disabled \
-D video-codecs=all \
-D libunwind=disabled \
-D vulkan-drivers=amd,intel,intel_hasvk \
-D gallium-drivers=r300,r600,radeonsi,iris,i915,crocusninja -C build
![[Warning]](../images/warning.png)
Warning
Please ask your lawyer or remove the
-D video-codecs=all option if you will
distribute the compiled Mesa libraries and drivers to others.
To test the results, issue:
cd build
meson configure -D build-tests=true
ninja test
Now Install, as the root user:
ninja -C build install
If desired, install the optional documentation by running
the following commands as the root user:
cp -rv docs -T /usr/share/doc/mesa-25.2.7
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 2 GB range.
-D gallium-drivers=auto: This parameter
controls which Gallium3D drivers should be built:
auto selects all Gallium3D drivers available
for x86. With a comma-separated list, only a subset of these
drivers will be built. If you precisely know which drivers you
need, you can select them explicitly. For example,
-D gallium-drivers=radeonsi,iris,llvmpipe.
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 a QEMU virtual GPU
with virglrender support; note that BLFS
'qemu' is not built with virglrender)
svga (for a VMWare virtual GPU)
llvmpipe (using CPU for 3D
rasterization. Note that it's much slower than using a modern
3D-capable GPU, so it should be only used if the GPU is not supported
by other drivers)
softpipe (also using CPU for 3D
rasterization, but slower than llvmpipe. There is not much reason
to use it unless LLVM is not available)
iris (for Intel GPUs shipped with Broadwell
or newer CPUs, or as a dedicated PCIe card)
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)
zink (uses Vulkan to implement OpenGL,
and while unstable at times, it can be a decent replacement for
non-performant gallium drivers like nouveau)
-D vulkan-drivers=auto: This parameter
controls which Vulkan drivers should be built:
auto selects all Vulkan drivers available
for x86. With a comma-separated list, only a subset of these
drivers will be built. If you precisely know which drivers you
need, you can select them explicitly. For example,
-D vulkan-drivers=amd,nouveau,swrast.
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)
swrast (for using the CPU for 3D rasterization)
Note that it's much slower than using a modern 3D-capable GPU,
so it should be only used if the GPU is not supported by other
drivers.
"" (empty list, use
-D vulkan-drivers="" if you've not installed and
you don't plan to install Vulkan-Loader-1.4.328.1)
-D platforms=...: This parameter
controls which windowing systems will be supported. Available
linux platforms are x11 and wayland.
-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 video-codecs=all: This parameter enables
building codecs for video formats covered by third-party patents.
-D libunwind=disabled: This parameter disables
the usage of libunwind.
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.
Contents
Installed Programs:
glxgears and
glxinfo
Installed Libraries:
libEGL.so,
libGL.so,
libGLESv1_CM.so,
libGLESv2.so,
libgbm.so, and
libgallium-25.2.7.so
Installed DRI Driver Stubs:
libdril_dri.so and symlinks to it:
crocus_dri.so,
i915_dri.so,
iris_dri.so,
r300_dri.so,
r600_dri.so,
radeonsi_dri.so
Installed VA-API Drivers:
r600_drv_video.so,
radeonsi_drv_video.so
Installed GBM Drivers:
dri_gbm.so
Installed VDPAU Drivers:
libvdpau_r600.so,
libvdpau_radeonsi.so
(many of these drivers are hard-linked)
Installed Vulkan Drivers:
libvulkan_intel_hasvk.so,
libvulkan_intel.so,
and
libvulkan_radeon.so
Installed Directories:
/usr/include/{EGL,GLES,GLES2,GLES3,KHR},
/usr/lib/{dri,gbm,vdpau},
/usr/share/drirc.d (contains workarounds for various applications,
particularly browsers and games),
/usr/share/vulkan,
and /usr/share/doc/mesa-25.2.7
Short Descriptions
glxgears |
is a GL demo useful for troubleshooting graphics
problems
|
glxinfo |
is a diagnostic program that displays information about the
graphics hardware and installed GL libraries
|
dri_gbm.so
|
is the GBM driver for Mesa
|
libdril_dri.so
|
is a stub allowing Xorg server to co-operate with the Gallium3D
drivers
|
libEGL.so
|
provides a native platform graphics interface as
defined by the EGL-1.4 specification
|
libgallium-25.2.7.so
|
contains all the Gallium3D drivers
|
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
|