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; 26 years ago (1995-02)
Stable release
20.2.0 / September 29, 2020; 15 months 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
Websitemesa3d.org
Glxgears big.jpg

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[edit]

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[edit]

OpenGL[edit]

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[edit]

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[edit]

Mesa has a single OpenCL driver for multiple platforms called Clover. Clover is only capable of OpenCL 1.1, and how well it works varies between Mesa versions. Mesa <=20.3 could not run the LuxMark benchmark. Mesa 21.0 could, but Mesa 21.1 can't.

Even the most basic OpenCL use-cases, 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.

The Mesa development team seems to have decided to ignore OpenCL 2.0 and go strait to OpenCL 3.0. Mesa 21.1 has near-complete OpenCL 3.0 support, though it's not enabled by default and how well it may or may not work when it is enabled is a good question if the OpenCL 1.1 support Clover has is anything to go by.

Technologies[edit]

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[edit]

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[edit]

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

ISL[edit]

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[edit]

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[edit]

"Standard Portable Intermediate Representation".

Zink[edit]

Zink is a neat technology primarily developed by Erik Faye-Lund from Collabora that makes it possible to run OpenGL applications on any system capable of rendering Vulkan graphics. Zink supports OpenGL 4.6 as of Mesa 21.1.

The idea is to make it possible to only create a Vulkan driver for future graphics cards and have basic OpenGL support for free.

See the Mesa Zink overview page for a more detailed description.

Links[edit]

Footnotes[edit]


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