| 1 |
Performance Tips |
| 2 |
================ |
| 3 |
|
| 4 |
Intel GPUs |
| 5 |
---------- |
| 6 |
|
| 7 |
#. Keep the system updated with the latest kernel and Mesa versions. |
| 8 |
#. Ensure SoC firmware is up-to-date. These firmware updates currently |
| 9 |
require installing the Windows graphics driver; firmware updates |
| 10 |
via `fwupd` are in progress. |
| 11 |
#. Use Wayland where possible, as it supports additional modifiers for |
| 12 |
better performance. |
| 13 |
#. For MTL and newer integrated GPUs, disable VT-d if virtualization is |
| 14 |
not needed. |
| 15 |
#. For discrete GPUs: |
| 16 |
|
| 17 |
#. Enable `ReBAR`_ |
| 18 |
#. For workloads that keep the GPU busy (e.g. 3D videogames), |
| 19 |
minimize idle power consumption by enabling `ASPM`_ powersave mode. |
| 20 |
#. For "bursty", latency-sensitive workloads (e.g. AI inference), |
| 21 |
enable ASPM performance mode. |
| 22 |
#. Enable the 'performance' `cpufreq`_ governor. |
| 23 |
|
| 24 |
.. _ReBAR: https://www.intel.com/content/www/us/en/support/articles/000090831/graphics.html |
| 25 |
.. _ASPM: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/6/html/power_management_guide/aspm |
| 26 |
.. _cpufreq: https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/6/html/performance_tuning_guide/s-cpu-cpufreq |
| 27 |
|
| 28 |
Software rendering |
| 29 |
------------------ |
| 30 |
|
| 31 |
#. Turn off smooth shading when you don't need it (glShadeModel) |
| 32 |
#. Turn off depth buffering when you don't need it. |
| 33 |
#. Turn off dithering when not needed. |
| 34 |
#. Use double buffering as it's often faster than single buffering |
| 35 |
#. Compile in the X Shared Memory extension option if it's supported on |
| 36 |
your system by adding -DSHM to CFLAGS and -lXext to XLIBS for your |
| 37 |
system in the Make-config file. |
| 38 |
#. Recompile Mesa with more optimization if possible. |
| 39 |
#. Try to maximize the amount of drawing done between glBegin/glEnd |
| 40 |
pairs. |
| 41 |
#. Use the MESA_BACK_BUFFER variable to find best performance in double |
| 42 |
buffered mode. (X users only) |
| 43 |
#. Optimized polygon rasterizers are employed when: rendering into back |
| 44 |
buffer which is an XImage RGB mode, not grayscale, not monochrome |
| 45 |
depth buffering is GL_LESS, or disabled flat or smooth shading |
| 46 |
dithered or non-dithered no other rasterization operations enabled |
| 47 |
(blending, stencil, etc) |
| 48 |
#. Optimized line drawing is employed when: rendering into back buffer |
| 49 |
which is an XImage RGB mode, not grayscale, not monochrome depth |
| 50 |
buffering is GL_LESS or disabled flat shading dithered or |
| 51 |
non-dithered no other rasterization operations enabled (blending, |
| 52 |
stencil, etc) |
| 53 |
#. Textured polygons are fastest when: using a 3-component (RGB), 2-D |
| 54 |
texture minification and magnification filters are GL_NEAREST texture |
| 55 |
coordinate wrap modes for S and T are GL_REPEAT GL_DECAL environment |
| 56 |
mode glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ) depth |
| 57 |
buffering is GL_LESS or disabled |
| 58 |
#. Lighting is fastest when: Two-sided lighting is disabled |
| 59 |
GL_LIGHT_MODEL_LOCAL_VIEWER is false GL_COLOR_MATERIAL is disabled No |
| 60 |
spot lights are used (all GL_SPOT_CUTOFFs are 180.0) No local lights |
| 61 |
are used (all position W's are 0.0) All material and light |
| 62 |
coefficients are >= zero |
| 63 |
#. XFree86 users: if you want to use 24-bit color try starting your X |
| 64 |
server in 32-bit per pixel mode for better performance. That is, |
| 65 |
start your X server with startx -- -bpp 32 instead of startx -- -bpp |
| 66 |
24 |
| 67 |
#. Try disabling dithering with the MESA_NO_DITHER environment variable. |
| 68 |
If this environment variable is defined Mesa will disable dithering |
| 69 |
and the command glEnable(GL_DITHER) will be ignored. |