Linux: 3D hardware acceleration

DmFrPro
3 min readFeb 22, 2021

If you have hardware 3D acceleration, you use a graphics processor instead of a CPU to create 3D images. CPU is forced to render everything on its own without hardware 3D acceleration, using Mesa library.

Linux

What is Mesa

Mesa is an open source implementation of the OpenGL, Vulkan, OpenCL, and other graphics APIs, as well as a set of user-space video drivers for AMD, Intel, Nvidia, and Qualcomm GPUs. Written in C, C++ and Assembler. Project site.

Implemented APIs:

  1. OpenGL / OpenGL ES is a cross-platform, industry standard graphics programming API for 3D graphics.
  2. Vulkan is the next-generation graphics programming API from The Khronos Group.
  3. EGL is an interface between Khronos rendering APIs such as OpenGL or OpenVG and the base of the native platform window system.
  4. OpenMAX is a opensource cross-platform set of C-language programming interfaces, provides abstractions for processing of media stack.
  5. OpenCL is a framework for writing programs that execute across different platforms consisting of CPUs, GPUs, DSPs, FPGAs and other processors or hardware accelerators.
  6. VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs.
  7. VA API is an opensource library and API, which provides access to graphics hardware acceleration capabilities for video processing.
  8. XvMC is an extension for Xorg. The XvMC API allows video programs to offload portions of the video decoding process to the GPU hardware.

Mesa is focused on providing high performance during working with 3D graphics, including through the use of 3D hardware acceleration supported by GPUs. Mesa is at the heart of the graphics stack of Linux and BSD distributions, so that on these operating systems, without using Mesa, it’s impossible to achieve the work of the graphical interface, desktop environment, applications and graphical interface, 3D graphics, including games, performance in which largely depends on Mesa. Therefore, for all users of Linux and BSD distributions using the GUI.

DRI and DRM

DRI (Direct Rendering Infrastructure) is an interface that allows you to access the graphics card in a safe and efficient way through a layer of GPU and Mesa drivers. The most common usation of DRI is to create fast OpenGL addons. DRI includes patches for Xorg, some client libraries, and for the kernel.

DRM (Direct Rendering Manager) is an addon to Xorg that provides 3D acceleration by adding the core modules required for direct access to the graphics card. The project is developing by Freedesktop.

Linux graphics stack with 3D hardware acceleration

Nowadays DRM works good with all video drivers, including amdgpu, radeon, nouveau, and proprietary Nvidia drivers.

Advantages of DRM:

  1. DRM provides synchronized access to the video card.
  2. DRM provides secure access to the graphics hardware.
  3. DRM supports DMA (Direct Memory Access), which increases the throughput of Xorg buffer pools.

Sources

This article is based on my previously made article in VK Unix Power group.
Source

--

--

DmFrPro

throw new NoSuchElementException("Bio is not found");