User:Maffblaster/Drafts/Graphics

This meta article primer to explain the composition and configuration of the modern graphics stack on Linux systems.]] Historical aspects will be reviewed when necessary, including the X.org server, however the expectation of this primer is to use a Wayland supported desktop environment with a focus on graphic intensive applications, such as games.

Introduction
Historically running a modern graphics stack on POSIX systems was somewhat challenging. Either graphics drivers for the latest hardware was months or years behind the same level of support in Microsoft Windows, or the software compatibility layers were not well supported for the latest games. As of the March, 2021, 70% of the top 50 games available on Steam are support from launch on POSIX systems. This is largely the result of continued effort to develop emulation layers to make software written for non-POSIX systems run on them.

Corporate and enterprise
There are several parties interested in running software designed for Microsoft Windows - including games - on POSIX compliant systems. Game companies, such as Valve, have been hedging against Microsoft changing licensing terms of Windows. In other words, Valve has been investing in Linux and it's graphics stack in order to have an alternative platform to Microsoft Windows.

Companies that sell Linux commercial and enterprise support, such as Canonical and Red Hat, and open source consulting companies such as Collabora and CodeWeavers also hold interest in Windows software running on POSIX compliant systems. These companies run their businesses on helping software run on POSIX systems.

Game developers and players
Certain game development studios, such as Feral Interactive work to transition games to natively run on Linux.

The players themselves hold interest in running Windows software. Privacy conscious players have concerns surrounding data collection from Big Tech. This generally occurs at the operating system, but also other layers surrounding gaming such as programmable keyboard software such as Razer Synapse, which is "Cloud enabled" and requires a "valid e-mail, software download, license acceptance, and internet connection needed to activate full features and for software updates".

Hardware considerations
When considering hardware for a modern graphic experience on Linux, one should consider support from the hardware manufacturer. Some manufacturers seek to work with Linux kernel developers and open source standards groups to certify their hardware will be operational on Linux from release day. These companies include AMD and Intel.

NVIDIA, while being the largest retailer of full size personal computer graphics hardware in the world, has historically not taken a supportive position on helping their hardware be compatible with an open stack. They have, however, released proprietary software that integrates with the Linux kernel. For this reason, NVIDIA should be avoided.

Software considerations
Certain software will not work correctly due to anti-cheat. Easy Anti-Cheat (EAC) software, which is integrated into certain online games, currently does not work with the software compatibly modes necessary on Linux.

Kernel
With the exception of firmware, configuring the Linux kernel to support the graphics adapter is mostly straightforward.

PREEMPT
Better support for a low latency desktop can be enabled via PREEMPT.

AMD
As outlined in the AMD meta article, there are a view viable options when configuring AMD graphic cards. See the kernel section of the AMD article.

For card firmware, some precision is needed.

User space
Software that provides user space support is any software component that does not reside inside the Linux kernel itself. This is the largest portion of the graphics stack on Linux systems.

Wayland
https://wayland.freedesktop.org/xserver.html

Mesa
Mesa is a FreeDesktop.org project dedicated to open source drivers for graphics cards.

Current status of OpenGL and OpenCL implementations on a per-driver basis can be found on the MesaMatrix site (also available here).

Shader cache
Support for a shader cache is available in Mesa. The shader cache can be used to enhance the speed of operations. When in enabled, it will exist under the following directory:

Support for the cache can be controlled with the MESA_GLSL_CACHE_DISABLE environment variable. Set to  to disable the cache and   to enable caching.

The MESA_DISK_CACHE_SINGLE_FILE environment variable also exists for Mesa version 21.1 and higher. Set to  to eanble the single file cache and   to disable. A single file cache is avoids duplicated data that could occur when using a multiple file cache by up to three times the space savings.

Wine
Wine is a software library translation layer that enables Windows API calls on POSIX compliant operating systems such as Linux. It is an important piece of software for gaming on Linux since many game development studios do not put in effort to create games for operating systems other than Microsoft Windows. An application database called WineDB exists to track the operational status of software on Wine.

Valve software has created a fork of Wine called Proton that seeks to integrate changes that may be backported into Wine and additionally provides other components. Proton is primarily meant to accompany and assist the Steam client, however is itself open source software.

Testing
A few tools are available to help test graphics acceleration capabilities.



Acceleration
To verify the system is running accellerated graphics, try the following (requires which contains  and  commands):

If the output of the previous command is anything is a "no" then system graphics are not being accelerated.

System running Intel graphics chipsets may find the tools available in useful for diagnostic and testing.

External resources

 * https://unix.stackexchange.com/questions/17027/how-to-set-the-resolution-in-text-consoles-troubleshoot-when-any-vga-fail - Information for changing console resolution at boot time.