Mesa

From LinuxReviews
Jump to navigationJump to search
Mesa
Glxgears big.jpg
Original author(s)Brian Paul
Developer(s)Currently: Intel, AMD, VMware
Former: Tungsten Graphics
Key players:
Initial releaseFebruary 1995; 25 years ago (1995-02)
Stable release
20.2.0 / September 29, 2020; 31 days ago (2020-09-29)
Repositorygitlab.freedesktop.org /mesa/mesa
Bugtrackergitlab.freedesktop.org /groups/mesa/-/issues
Written inC, C++, Assembly
Operating systemLinux, BSD, Haiku
TypeGraphics drivers / Graphics library
LicenseMIT

Mesa (the project itself calls it "Mesa 3D") is a free software graphics library which provides excellent driver support for Intel and AMD GPUs. Mesa has implementations for Vulkan, OpenGL and some other graphics APIs done in a way which allows most of the code to be shared and used by multiple graphics drivers. Mesa has some limited support for NVidia GPUs using its Nouveau driver; it works but it is severely limited due to NVidia's hostility towards free software and open standards in general. Mesa is written in C, C++ and there's also some assembler code for key functions.

It's everywhere

Modern display servers like X.org and Wayland use OpenGL or EGL for all display rendering. Mesa is not only used for games like SuperTuxKart and 3D applications; all modern desktop environments and window managers use it's libraries. It is a key-stone part of GNU/Linux desktop systems, Android devices and ChromeOS machines.

Drivers

OpenGL drivers
Driver Graphics Brand / Gen Note
i965 Intel All Default Intel OpenGL driver for Mesa versions < 20, defaults for Intel iGPUs up to and including Haswell on Mesa 20+.
Iris Intel Gen 8-12+ Default for Broadwell and newer starting with Mesa 20.
llvmpipe Gallium OpenGL software renderer using LLVM. Supports GLES 3.2 and OpenGL 4.5 support as of Mesa 20.2.
NVC0 Nvidia NVC0 is a Gallium3D OpenGL driver for the free Nouveau driver for Nvidia GPUs.
Panfrost Nvidia (ARM) Mali Midgard and Bifrost GPUs source code at freedesktop gitlab
RadeonSI AMD GCN and Navi

Intel users can choose what OpenGL driver is used by setting MESA_LOADER_DRIVER_OVERRIDE to either iris or i965. Intel Iris is the default for Intel gen8-11 hardware as of Mesa 20.

Vulkan drivers
Driver Graphics Brand / Gen Note
ANV Intel 7th-12 Vulkan 1.0 on Ivy Bridge to Haswell, Vulkan 1.2 on Broadwell and newer.
RADV AMD GCN and Navi Only works with the amdgpu kernel module (supported by all GCN-based AMD cards as of Linux 5.9).

The RADV ACO shader compiler is the default shader compiler for RADV as of Mesa 20.2. It can be enabled on earlier Mesa versions by setting export RADV_PERFTEST=aco

OpenCL

Mesa has a OpenCL driver called Clover. It is capable of OpenCL 1.1 as of Mesa 20.2 rc1. It works fine on all Intel and AMD graphics cards. The practical use-cases for it are severely limited. The most basic OpenCL applications, like enabling OpenCL support in LibreOffice, requires OpenCL 2.0. AMD graphics users should see if Radeon Open Compute is supported by their card. Intel users with Broadwell/Braswell and newer should look into installing Intel's Neo OpenCL library. Mesa Clover is the only real, and therefor the best, option Intel users with Haswell and older hardware.

Technologies

It may be somewhat hard to follow what Mesa developers are talking about without having a brief introduction to the terms used to describe the various moving parts behind the fancy graphics displayed by the Mesa graphics library..

ACO

ACO (AMD Compiler) is a Vulkan shader compiler for AMD graphics cards. It has been a part of Mesa since 19.3. It became the default shader compiler for AMD graphics cards in Mesa 20.2. ACO can be enabled in Mesa versions prior to 20.2 with:

export RADV_PERFTEST=aco

See How the ACO Mesa Vulkan Shader Compiler For AMD GPUs Came To Be: From Prototype To Default for a really good and in-depth video introduction to the AMD COmpiler by developer Timor Kristóf at the X.Org Developers Conference 2020.

GLSL

GLSL isn't really a technology. It stands for "GL Shader Langauge" (in case you were wondering).

= ISL

ISL is short for "Intel Surface Layout". It's a small library that "calculates the layout of Intel GPU surfaces, queries those layouts, and queries the properties of surface formats"[1]. The ISL library is used by the Intel ANV Vulkan driver and the Intel Iris OpenGL driver.

NIR

NIR is short for New IR.[2]. IR stands for "Intermediate Representation". It is used by most of the Mesa OpenGL graphics drivres in cluding Freedreno, Intel Iris, LLVMpipe, Panfrost, RadeonSI and Nouveau.

Applications create OpenGL shaders when they want to create fancy graphics. These shaders are created in a very high-level language. These high-level shaders need to be turned into highly optimized low-level assembly code. That's where NIR comes in.

"OpenGL shaders are written in a high level language. NIR is the optimizing middle part of the compiler. The back-end [driver] produces assembly code that can run on your GPU."

Kenneth Graunke, Intel software engineer
in a secret developers club called "#dri-devel" on September 28th, 2020

SPIR-V

"Standard Portable Intermediate Representation".

Footnotes

Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.