Mesa (computer graphics)

From Infogalactic: the planetary knowledge core
(Redirected from Mesa 3D)
Jump to: navigation, search
Mesa
Original author(s) Brian Paul
Developer(s) Currently: Intel, AMD, VMware
Formerly: Tungsten Graphics[1]
Initial release August 1993; 30 years ago (1993-08)[2]
Stable release 11.1.1 / January 13, 2016; 8 years ago (2016-01-13)[3]
Development status Active
Written in C, C++, Assembly[4]
Operating system Cross-platform (BSDs, Haiku, Linux, et al.)
Type Graphics library
License MIT License[5]
Website mesa3d.org

Mesa is a collection of free and open-source libraries that implement several rendering as well as video acceleration APIs related to hardware-accelerated 3D rendering, 3D computer graphics and GPGPU, the most prominent being OpenGL. Mesa is hosted at freedesktop.org and used on Linux, BSD and other operating systems. Additionally to the APIs, Mesa also harbors most of the available free and open-source graphics device drivers. The development of Mesa started in August 1993 by Brian Paul, who is still active in the project today, by now containing numerous contributions from various other people and companies worldwide, due to its broad adoption. Crowdfunding has been successfully used to partially drive development of Mesa.[6]

Overview

Video games outsource rendering calculations to the GPU over OpenGL in real-time. Shaders are written in OpenGL Shading Language and compiled. The compiled programs are executed on the GPU.
Illustration of the Linux graphics stack: DRM & libDRM, Mesa 3D. Display server belongs to the windowing system and is not necessary e.g. for gaming.

Implementations of rendering APIs

The free implementations of Wayland rely upon the Mesa implementation of EGL. The special library called libwayland-EGL, written to accommodate access to the framebuffer, should have been made obsolete by the EGL 1.5 release. On the GDC 2014, AMD was exploring a strategy change towards using DRM instead of their in-kernel blob.[7]

Mesa is known as housing implementation of graphic APIs. Historically the main API that Mesa has implemented is OpenGL, along with other Khronos Group related specifications (like OpenVG, OpenGL ES or recently EGL). But Mesa can implement other APIs and indeed it did with Glide.

The supported version of the different graphic APIs depends on the driver, because each hardware driver has its own implementation (and therefore status). This is specially true for DRI drivers, while the Gallium3D drivers share common code that tend to homogenize the supported extensions and versions.

Mesa 10.x complies with OpenGL 3.3, for Intel, AMD/ATI and Nvidia GPU hardware. Mesa 11.0 was announced with some drivers being OpenGL 4.1 compliant.[8] Mesa maintains a support matrix with the status of the current OpenGL 3 and 4 conformance.[9][10]

API OpenGL OpenGL ES OpenVG EGL GLX Direct3D
Version Date 4.5
2014-08-11
3.2
2015-08-10
1.1
2008-12-03
1.5
2014-03-19
1.4
2005-12-16
11.2
2013-10-17
Current stable version: 11.1 2015-12-15[11] 4.2 (Intel 3.3) 3.0 N/A 1.5 1.4 9.0c
Older version, yet still supported: 11.0 2015-09-12[12] 4.2 (Intel 3.3)[13] 3.0 N/A 1.5 1.4 9.0c
Old version, no longer supported: 10.6 2015-06-15[14] 3.3 3.0 N/A[15] 1.4 1.4 9.0c
Old version, no longer supported: 10.5 2015-03-06[16] 3.3 3.0 1.1 1.4 1.4 9.0c
Old version, no longer supported: 10.4 2014-12-14[17] 3.3 3.0 1.1 1.4 1.4 9.0c[18]
Old version, no longer supported: 10.3 2014-09-19[19] 3.3 3.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 10.2 2014-06-06[20] 3.3 3.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 10.1 2014-03-04[21] 3.3[22] 3.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 10.0 2013-11-30[23] 3.3[24] 3.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 9.0 2012-10-08 3.1[25] 2.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 8.0 2012-02-08 3.0 2.0 1.1 1.4 1.4 N/A
Old version, no longer supported: 7.0 2007-06-22 2.1 N/A N/A N/A 1.4 N/A
Old version, no longer supported: 6.0 2004-01-06 1.5 N/A N/A N/A 1.3 N/A
Old version, no longer supported: 5.0 2002-11-13 1.4 N/A N/A N/A 1.3 N/A
Old version, no longer supported: 4.0 2001-10-22 1.3 N/A N/A N/A 1.3 N/A
Legend:
Old version
Older version, still supported
Latest version
Latest preview version
Future release

There has also been a Direct3D 9 state tracker since July 2013.[26] Note that due to the modularized nature of OpenGL, Mesa actually supports extensions from newer versions of OpenGL without claiming full support for them. For example, as of September 2015, Mesa supports OpenGL 4.2 Core Profile but also 9 out of 12 extensions that form OpenGL 4.5, with two more extensions under development.

Vulkan

In March 2015, the Vulkan API was officially announced by Khronos. SPIR-V, a newer version of Standard Portable Intermediate Representation (SPIR), will be part of the core specification. It remains to be seen how Mesa's current LIR, HIR and TGSI will interoperate with SPIR-V.

Generic Buffer Management

Generic Buffer Management (GBM) is an API which provides a mechanism for allocating buffers for graphics rendering tied to Mesa. GBM is intended to be used as a native platform for EGL on drm or openwfd. The handle it creates can be used to initialize EGL and to create render target buffers.[27]

Mesa GBM is an abstraction of the graphics driver specific buffer management APIs (for instance the various libdrm_* libraries), implemented internally by calling into the Mesa GPU drivers.

For example, the Wayland compositor Weston does its rendering using OpenGL ES 2, which it initializes by calling EGL. Since the server runs on the "bare KMS driver", it uses the EGL DRM platform, which could really be called as the GBM platform, since it relies on the Mesa GBM interface.

At XDC2014, Nvidia employee Andy Ritger proposed to enhance EGL in order to replace GBM.[28]

Implementations of video acceleration APIs

There are three possible ways to do the calculations necessary for the encoding and decoding of video streams:

  1. use a codec and do calculations on the CPU
  2. use a codec and do calculations on the 3D rendering engine of the GPU
  3. use a SIP block designed specifically for this task, e.g. PureVideo, Unified Video Decoder, Video Coding Engine, Quick Sync Video, DaVinci, CedarX, Crystal HD, etc.

Utilizing the CPU doesn't require any special support to be present in Mesa, but methods two and three do require explicit support by the graphics device driver and additional special interfaces (APIs) to be used by end-user software to access this hardware, which are shared in Mesa 3D. Several APIs for the access of video decoding hardware have been designed, including:

One of these interfaces is then used by end-user software, like e.g. VLC media player, GStreamer or HandBrake, to access the video acceleration hardware and make use of it.

Please note, that V4L2 is a kernel-to-user-space interface for video bit streams delivered by webcams or TV tuners.

Nouveau supports PureVideo and provides access to it through VDPAU and partly through XvMC.[29]

The free radeon driver supports Unified Video Decoder and Video Coding Engine through VDPAU and OpenMAX.[30]

Device drivers

Lua error in package.lua at line 80: module 'strict' not found.

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Graphics device drivers are implemented using two components: a UMD (user-mode driver) and a KMD (kernel-mode driver). Starting with Linux kernel 3.x AMD Catalyst and Mesa will share the same Linux kernel driver: amdgpu. Amdgpu provides interfaces defined by DRM and KMS.

The available free and open-source device drivers for graphic chipsets are "stewarded" by Mesa (because the existing free and open-source implementation of APIs are developed inside of Mesa). Currently there are two frameworks to write graphics drivers: DRI and Gallium3D. An overview over some of the drivers available in Mesa is given at http://mesamatrix.net/ The driver vc4 is missing from this site, while the driver freedreno is not part of mesa.

There are device drivers for AMD/ATI R100 to R800, Intel, and Nvidia cards with 3D acceleration. Previously drivers existed for the IBM/Toshiba/Sony Cell APU of the PlayStation 3, S3 Virge & Savage chipsets, VIA chipsets, Matrox G200 & G400, and more.[31]

The free and open-source drivers compete with proprietary closed-source drivers. Depending on the availability of hardware documentation and man-power, the free and open-source driver lag behind more or less in supporting 3D acceleration of new hardware. Also, 3D rendering performance is usually significantly slower with some notable exceptions,[32][33][34][35] where the free and open-source driver performs better than proprietary drivers.

Direct Rendering Infrastructure (DRI)

Lua error in package.lua at line 80: module 'strict' not found.

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

At the time 3D graphics cards became more mainstream for PCs, individuals partly supported by some companies began working on adding more support for hardware-accelerated 3D rendering to Mesa.[when?] The Direct Rendering Infrastructure (DRI) was one of these approaches to interface Mesa, OpenGL and other 3D rendering API libraries with the device drivers and hardware. After reaching a basic level of usability, DRI support was officially added to Mesa. This significantly broadened the available range of hardware support achievable when using the Mesa library.[36]

With adapting to DRI, the Mesa library finally took over the role of the front end component of a full scale OpenGL framework with varying backend components that could offer different degrees of 3D hardware support while not dropping the full software rendering capability. The total system used many different software components.[36]

While the design requires all these components to interact carefully, the interfaces between them are relatively fixed. Nonetheless, as most components interacting with the Mesa stack are open source, experimental work is often done through altering several components at once as well as the interfaces between them. If such experiments prove successful, they can be incorporated into the next major or minor release. That applies e.g. to the update of the DRI specification developed in the 2007-2008 timeframe. The result of this experimentation, DRI2, operates without locks and with improved back buffer support. For this, a special git branch of Mesa was created.[37]

DRI3 should be supported by at least the intel driver.[38][39]

Software renderer

Software rendering is the misleading term, when shaders are executed on the CPU instead of the GPU. Mesa also contains an implementation of software rendering that allows shaders to run on the CPU as a fallback when no graphics hardware accelerators are present called swrast. The Gallium software rasterizer is known as softpipe or when built with support for LLVM llvmpipe which generates CPU code at runtime.[40][41]

Mega drivers

The idea of bundling multiple drivers into a single "mega" driver was proposed by Eric Anholt. It allows for a single copy of the shared Mesa code to be used among multiple drivers (instead of it existing in each driver separately) and offering better performance than a separate shared library due to the removal of the internal library interface.[42] The state trackers for VDPAU and XvMC have become separate libraries.[43]

Software architecture

Mesa's GLSL compiler

Mesa's GLSL compiler generates its own IR. Because each driver has very different requirements from a LIR, it differentiates between HIR (high-level IR) and LIR (low-level IR).

Gallium3D

Lua error in package.lua at line 80: module 'strict' not found.

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

Gallium3D introduced the intermediate language TGSI (Tungsten Graphics Shader Infrastructure). Any shaders written in GLSL (or other shading languages as well) are translated into TGSI, this translation is supported by the hardware driver. The driver translates these TGSI shaders into the instruction set of the GPU it is written for.

Gallium3D was developed by Tungsten Graphics as a means to simplify the writing of device drivers and also to achieve maximum portability of them, without having to rewrite the source code. Gallium3D specification were released in 2008 and as of 28 March 2024, the current version is still 0.4.

Most device drivers inside of Mesa have been rewritten conforming to the new internal APIs defined by Gallium3D, and new drivers written since the introduction of Gallium3D have been written as Gallium3D drivers from the beginning on. A notable exception is the Mesa driver for the Intel 965-family of GPUs.

The main disadvantage is, that by introducing additional interfaces, namely the Gallium3D WinSys Interface, the full capabilities of the underlying hardware can not be accessed by the device drivers.[citation needed]

Performance

History

Lua error in package.lua at line 80: module 'strict' not found. Project initiator Brian Paul was a graphics hobbyist. He thought it would be fun to implement a simple 3D graphics library using the OpenGL API, which he might then use instead of VOGL (very ordinary GL Like Library).[2] Beginning in 1993, he spent eighteen months of part-time development before he released the software on the Internet. The software was well received, and people began contributing to its development. Mesa started off by rendering all 3D computer graphics on the CPU. Despite this, the internal architecture of Mesa was designed to be open for attaching to graphics processor-accelerated 3D rendering. In this first phase, rendering was done indirectly in the display server, leaving some overhead and noticeable speed lagging behind the theoretical maximum. The Diamond Monster 3D, using the Voodoo Graphics chipset, was one of the first 3D hardware devices supported by Mesa.

The first true graphics hardware support was added to Mesa in 1997, based upon the Glide API for the then new 3dfx Voodoo I/II graphics cards and their successors.[36] A major problem of using Glide as the acceleration layer was the habit of Glide to run full screen, which was only suitable for computer games. Further, Glide took the lock of the screen memory, and thus the display server was blocked from doing any other GUI tasks.[44]

In 2014, LunarG, a United States based private computer software company founded in 2009 that specializes in 3D driver development, enhancements and tuning,[45] received funding from Valve to explore the possibility of game performance improvements using LunarGLASS technology in the Mesa driver.[46]

See also

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. 2.0 2.1 Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. Lua error in package.lua at line 80: module 'strict' not found.
  11. Lua error in package.lua at line 80: module 'strict' not found.
  12. Lua error in package.lua at line 80: module 'strict' not found.
  13. Lua error in package.lua at line 80: module 'strict' not found.
  14. Lua error in package.lua at line 80: module 'strict' not found.
  15. Lua error in package.lua at line 80: module 'strict' not found.
  16. Lua error in package.lua at line 80: module 'strict' not found.
  17. Lua error in package.lua at line 80: module 'strict' not found.
  18. Lua error in package.lua at line 80: module 'strict' not found.
  19. Lua error in package.lua at line 80: module 'strict' not found.
  20. Lua error in package.lua at line 80: module 'strict' not found.
  21. Lua error in package.lua at line 80: module 'strict' not found.
  22. Lua error in package.lua at line 80: module 'strict' not found.
  23. Lua error in package.lua at line 80: module 'strict' not found.
  24. Lua error in package.lua at line 80: module 'strict' not found.
  25. Lua error in package.lua at line 80: module 'strict' not found.
  26. http://www.phoronix.com/scan.php?page=news_item&px=MTQxMjk
  27. Lua error in package.lua at line 80: module 'strict' not found.
  28. Lua error in package.lua at line 80: module 'strict' not found.
  29. Lua error in package.lua at line 80: module 'strict' not found.
  30. Lua error in package.lua at line 80: module 'strict' not found.
  31. Direct Rendering Infrastructure Status Page on freedesktop.org
  32. http://apcmag.com/how-to-improve-gaming-performance-on-your-linux-machine.htm
  33. http://www.geeks3d.com/20120110/linux-mesa-gallium3d-nouveau-and-nvidia-drivers-opengl-test-gtx-280-gtx-480-gtx-580/
  34. http://www.phoronix.com/vr.php?view=18344
  35. http://www.phoronix.com/scan.php?page=article&item=july_2013_gpus&num=8
  36. 36.0 36.1 36.2 Lua error in package.lua at line 80: module 'strict' not found.
  37. Lua error in package.lua at line 80: module 'strict' not found.
  38. http://lwn.net/Articles/570082/
  39. http://lists.freedesktop.org/archives/dri-devel/2013-November/048258.html
  40. Lua error in package.lua at line 80: module 'strict' not found.
  41. Lua error in package.lua at line 80: module 'strict' not found.
  42. Lua error in package.lua at line 80: module 'strict' not found.
  43. Lua error in package.lua at line 80: module 'strict' not found.
  44. Lua error in package.lua at line 80: module 'strict' not found.
  45. Lua error in package.lua at line 80: module 'strict' not found.
  46. Lua error in package.lua at line 80: module 'strict' not found.

External links

  • No URL found. Please specify a URL here or add one to Wikidata.
  • The history of Mesa, by Jake Edge, October 2013
Various layers within Linux, also showing separation between the userland and kernel space
User mode User applications For example, bash, LibreOffice, Apache OpenOffice, Blender, 0 A.D., Mozilla Firefox, etc.
Low-level system components: System daemons:
systemd, runit, logind, networkd, soundd, ...
Windowing system:
X11, Wayland, Mir, SurfaceFlinger (Android)
Other libraries:
GTK+, Qt, EFL, SDL, SFML, FLTK, GNUstep, etc.
Graphics:
Mesa, AMD Catalyst, ...
C standard library open(), exec(), sbrk(), socket(), fopen(), calloc(), ... (up to 2000 subroutines)
glibc aims to be POSIX/SUS-compatible, uClibc targets embedded systems, bionic written for Android, etc.
Kernel mode Linux kernel stat, splice, dup, read, open, ioctl, write, mmap, close, exit, etc. (about 380 system calls)
The Linux kernel System Call Interface (SCI, aims to be POSIX/SUS-compatible)
Process scheduling
subsystem
IPC
subsystem
Memory management
subsystem
Virtual files
subsystem
Network
subsystem
Other components: ALSA, DRI, evdev, LVM, device mapper, Linux Network Scheduler, Netfilter
Linux Security Modules: SELinux, TOMOYO, AppArmor, Smack
Hardware (CPU, main memory, data storage devices, etc.)