Introduction to Mesa
        
        
          Mesa is an OpenGL compatible 3D
          graphics library.
        
        
          
          
            Note
          
          
            Mesa is updated relatively
            often. You may want to use the latest available 20.1.x mesa
            version.
          
         
        
          This package is known to build and work properly using an LFS-10.0
          platform.
        
        
          Package Information
        
        
        
          Additional Downloads
        
        
        
          Mesa Dependencies
        
        
          Required
        
        
          Xorg
          Libraries, libdrm-2.4.102, and Mako-1.1.3
        
        
          Recommended
        
        
          libva-2.8.0 (to provide VA-API support for some
          gallium drivers, note that there is a circular dependency. You must
          build libva first without EGL and
          GLX support, install this package, and rebuild libva), libvdpau-1.4 (to
          build VDPAU drivers), LLVM-10.0.1 (required for Gallium3D,
          nouveau, r300, and radeonsi drivers and for swrast, the software
          rasterizer which is sometimes referred to as llvmpipe. See
          http://www.mesa3d.org/systems.html
          for more information), and wayland-protocols-1.20 (required for
          Plasma-5.19.4, GNOME, and recommended for
          GTK+-3.24.22)
        
        
          Optional
        
        
          libgcrypt-1.8.6, lm-sensors-3-6-0 , Nettle-3.6,
          Valgrind-3.16.1, 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), libunwind, and 
          libtizonia
        
        
          
          
            Note
          
          
            The instructions below assume that LLVM with the r600/amdgpu and host backends
            and run-time type information (RTTI - needed for nouveau) are
            installed. You will need to modify the instructions if you choose
            not to install all of these. For an explanation of Gallium3D see
            https://en.wikipedia.org/wiki/Gallium3D.
          
         
        
          User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/mesa
        
       
      
        
          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-20.1.5-add_xdemos-1.patch
        
          If Python-2.7.18 is not installed, adjust a script
          file in test suite to use Python 3:
        
        
sed '1s/python/&3/' -i bin/symbols-check.py
        
          
          
            Note
          
          
            The measurements above, and the Contents below, are for a full
            build. Many people will not wish to install drivers they cannot
            use, so the following paragraphs explain how to limit the
            drivers, and give an example which can be be reduced or amended
            as necessary.
          
         
        
          Now, select the drivers you wish to install. For the X86
          architecture, the available gallium drivers are auto, or alternatively a choice from i915,
          nouveau, r300, r600, radeonsi, svga, swrast, and virgl. The latter
          is recommended if you intend to run the system under qemu-5.1.0. If you wish to build all available
          gallium drivers, use 'auto'.
        
        
          The (non-gallium) DRI drivers available in X86 are auto,
          or alternatively a choice
          from i915, i965, nouveau, r100, r200, and swrast. Use
          'auto' to build all available DRI drivers, or use an empty string
          (DRI_DRIVERS="") if you wish to only build gallium drivers.
        
        
          The platforms ("window systems") available for X86 linux are x11,
          wayland, drm, and surfaceless. By not specifying anything, the
          meson build-system will build for all these platforms if you have
          the dependencies, identical to if you had specified
          '-Dplatforms=auto'.
        
        
          Modify the commands below for your desired drivers. The drivers
          listed below will cover most modern video cards and virtual
          machines. For help in selecting drivers see http://www.mesa3d.org/systems.html.
        
        
          
          
            Note
          
          
            Although the nouveau drivers can be built for both gallium and
            dri, the i915 driver can only be built for one or the other.
          
         
        
GALLIUM_DRV="i915,iris,nouveau,r600,radeonsi,svga,swrast,virgl"
DRI_DRIVERS="i965,nouveau"
        
          Install Mesa by running the
          following commands:
        
        
mkdir build &&
cd    build &&
meson --prefix=$XORG_PREFIX          \
      -Dbuildtype=release            \
      -Ddri-drivers=$DRI_DRIVERS     \
      -Dgallium-drivers=$GALLIUM_DRV \
      -Dgallium-nine=false           \
      -Dglx=dri                      \
      -Dosmesa=gallium               \
      -Dvalgrind=false               \
      -Dlibunwind=false              \
      ..                             &&
unset GALLIUM_DRV DRI_DRIVERS &&
ninja
        
          If you built the tests (see 'Command Explanations'), to run them
          issue: ninja test.
          Four tests in the glcpp test suite and two tests in the llvmpipe
          suite are known to fail.
        
        
          Now, as the root user:
        
        
ninja install
        
          If desired, install the optional documentation by running the
          following commands as the root
          user:
        
        
install -v -dm755 /usr/share/doc/mesa-20.1.5 &&
cp -rfv ../docs/* /usr/share/doc/mesa-20.1.5
       
      
        
          Command Explanations
        
        
          -Dbuildtype=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.
        
        
          -Ddri-drivers="...": This
          parameter controls which (non-gallium) dri drivers should be built.
        
        
          -Dgallium-drivers="...":
          This parameter controls which Gallium3D drivers should be built.
        
        
          -Dgallium-nine=true: Setting this
          option to true will provide support for (MS Windows) games designed
          for DX9.
        
        
          -Dosmesa=gallium: This
          switch enables building the libOSMesa
          library and provides Gallium3D support in it. It requires the
          swrast gallium driver.
        
        
          -Dvalgrind=false: 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.
        
        
          -Dbuild-tests=true: This option will
          cause the test code to be enabled.