Environment Variables¶
Normally, no environment variables need to be set. Most of the environment variables used by Mesa/Gallium are for debugging purposes, but they can sometimes be useful for debugging end-user issues.
LibGL environment variables¶
LIBGL_DEBUGIf defined debug information will be printed to stderr. If set to
verboseadditional information will be printed.LIBGL_DRIVERS_PATHcolon-separated list of paths to search for DRI drivers
LIBGL_ALWAYS_INDIRECTif set to
true, forces an indirect rendering context/connection.LIBGL_ALWAYS_SOFTWAREif set to
true, always use software renderingLIBGL_NO_DRAWARRAYSif set to
true, do not use DrawArrays GLX protocol (for debugging)LIBGL_SHOW_FPSprint framerate to stdout based on the number of
glXSwapBufferscalls per second.LIBGL_DRI3_DISABLEdisable DRI3 if set to
true.
Core Mesa environment variables¶
MESA_NO_ASMif set, disables all assembly language optimizations
MESA_NO_MMXif set, disables Intel MMX optimizations
MESA_NO_3DNOWif set, disables AMD 3DNow! optimizations
MESA_NO_SSEif set, disables Intel SSE optimizations
MESA_NO_ERRORif set to 1, error checking is disabled as per
KHR_no_error. This will result in undefined behaviour for invalid use of the api, but can reduce CPU use for apps that are known to be error free.MESA_DEBUGif set, error messages are printed to stderr. For example, if the application generates a
GL_INVALID_ENUMerror, a corresponding error message indicating where the error occurred, and possibly why, will be printed to stderr. For release builds,MESA_DEBUGdefaults to off (no debug output).MESA_DEBUGaccepts the following comma-separated list of named flags, which adds extra behaviour to just setMESA_DEBUG=1:silentturn off debug messages. Only useful for debug builds.
flushflush after each drawing command
incomplete_texextra debug messages when a texture is incomplete
incomplete_fboextra debug messages when a fbo is incomplete
contextcreate a debug context (see
GLX_CONTEXT_DEBUG_BIT_ARB) and print error and performance messages to stderr (orMESA_LOG_FILE).
MESA_LOG_FILEspecifies a file name for logging all errors, warnings, etc., rather than stderr
MESA_TEX_PROGif set, implement conventional texture env modes with fragment programs (intended for developers only)
MESA_TNL_PROGif set, implement conventional vertex transformation operations with vertex programs (intended for developers only). Setting this variable automatically sets the
MESA_TEX_PROGvariable as well.MESA_EXTENSION_OVERRIDEcan be used to enable/disable extensions. A value such as
GL_EXT_foo -GL_EXT_barwill enable theGL_EXT_fooextension and disable theGL_EXT_barextension.MESA_EXTENSION_MAX_YEARThe
GL_EXTENSIONSstring returned by Mesa is sorted by extension year. If this variable is set to year X, only extensions defined on or before year X will be reported. This is to work-around a bug in some games where the extension string is copied into a fixed-size buffer without truncating. If the extension string is too long, the buffer overrun can cause the game to crash. This is a work-around for that.MESA_GL_VERSION_OVERRIDEchanges the value returned by
glGetString(GL_VERSION)and possibly the GL API type.The format should be
MAJOR.MINOR[FC|COMPAT]FCis an optional suffix that indicates a forward compatible context. This is only valid for versions >= 3.0.COMPATis an optional suffix that indicates a compatibility context orGL_ARB_compatibilitysupport. This is only valid for versions >= 3.1.GL versions <= 3.0 are set to a compatibility (non-Core) profile
GL versions = 3.1, depending on the driver, it may or may not have the
ARB_compatibilityextension enabled.GL versions >= 3.2 are set to a Core profile
Examples:
2.1select a compatibility (non-Core) profile with GL version 2.1.
3.0select a compatibility (non-Core) profile with GL version 3.0.
3.0FCselect a Core+Forward Compatible profile with GL version 3.0.
3.1select GL version 3.1 with
GL_ARB_compatibilityenabled per the driver default.3.1FCselect GL version 3.1 with forward compatibility and
GL_ARB_compatibilitydisabled.3.1COMPATselect GL version 3.1 with
GL_ARB_compatibilityenabled.X.Yoverride GL version to X.Y without changing the profile.
X.YFCselect a Core+Forward Compatible profile with GL version X.Y.
X.YCOMPATselect a Compatibility profile with GL version X.Y.
Mesa may not really implement all the features of the given version. (for developers only)
MESA_GLES_VERSION_OVERRIDEchanges the value returned by
glGetString(GL_VERSION)for OpenGL ES.The format should be
MAJOR.MINORExamples:
2.0,3.0,3.1Mesa may not really implement all the features of the given version. (for developers only)
MESA_GLSL_VERSION_OVERRIDEchanges the value returned by
glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as130. Mesa will not really implement all the features of the given language version if it’s higher than what’s normally reported. (for developers only)MESA_GLSL_CACHE_DISABLEif set to
true, disables the GLSL shader cacheMESA_GLSL_CACHE_MAX_SIZEif set, determines the maximum size of the on-disk cache of compiled GLSL programs. Should be set to a number optionally followed by
K,M, orGto specify a size in kilobytes, megabytes, or gigabytes. By default, gigabytes will be assumed. And if unset, a maximum size of 1GB will be used.Note
A separate cache might be created for each architecture that Mesa is installed for on your system. For example under the default settings you may end up with a 1GB cache for x86_64 and another 1GB cache for i386.
MESA_GLSL_CACHE_DIRif set, determines the directory to be used for the on-disk cache of compiled GLSL programs. If this variable is not set, then the cache will be stored in
$XDG_CACHE_HOME/mesa_shader_cache(if that variable is set), or else within.cache/mesa_shader_cachewithin the user’s home directory.MESA_GLSLMESA_NO_MINMAX_CACHEwhen set, the minmax index cache is globally disabled.
MESA_SHADER_CAPTURE_PATHMESA_SHADER_DUMP_PATHandMESA_SHADER_READ_PATHMESA_VK_VERSION_OVERRIDEchanges the Vulkan physical device version as returned in
VkPhysicalDeviceProperties::apiVersion.The format should be
MAJOR.MINOR[.PATCH]This will not let you force a version higher than the driver’s instance version as advertised by
vkEnumerateInstanceVersionThis can be very useful for debugging but some features may not be implemented correctly. (For developers only)
NIR passes enviroment variables¶
The following are only applicable for drivers that uses NIR, as they modify the behaviour for the common NIR_PASS and NIR_PASS_V macros, that wrap calls to NIR lowering/optimizations.
NIR_PRINTIf defined, the resulting NIR shader will be printed out at each succesful NIR lowering/optimization call.
NIR_TEST_CLONEIf defined, cloning a NIR shader would be tested at each succesful NIR lowering/optimization call.
NIR_TEST_SERIALIZEIf defined, serialize and deserialize a NIR shader would be tested at each succesful NIR lowering/optimization call.
Mesa Xlib driver environment variables¶
The following are only applicable to the Mesa Xlib software driver. See the Xlib software driver page for details.
MESA_RGB_VISUALspecifies the X visual and depth for RGB mode
MESA_CI_VISUALspecifies the X visual and depth for CI mode
MESA_BACK_BUFFERspecifies how to implement the back color buffer, either
pixmaporximageMESA_GAMMAgamma correction coefficients for red, green, blue channels
MESA_XSYNCenable synchronous X behavior (for debugging only)
MESA_GLX_FORCE_CIif set, force GLX to treat 8bpp visuals as CI visuals
MESA_GLX_FORCE_ALPHAif set, forces RGB windows to have an alpha channel.
MESA_GLX_DEPTH_BITSspecifies default number of bits for depth buffer.
MESA_GLX_ALPHA_BITSspecifies default number of bits for alpha channel.
i945/i965 driver environment variables (non-Gallium)¶
INTEL_NO_HWif set to 1, prevents batches from being submitted to the hardware. This is useful for debugging hangs, etc.
INTEL_DEBUGa comma-separated list of named flags, which do various things:
annannotate IR in assembly dumps
aubdump batches into an AUB trace for use with simulation tools
batemit batch information
blitemit messages about blit operations
blorpemit messages about the blorp operations (blits & clears)
bufemit messages about buffer objects
clipemit messages about the clip unit (for old gens, includes the CLIP program)
coloruse color in output
csdump shader assembly for compute shaders
do32generate compute shader SIMD32 programs even if workgroup size doesn’t exceed the SIMD16 limit
driemit messages about the DRI interface
fboemit messages about framebuffers
fsdump shader assembly for fragment shaders
gsdump shader assembly for geometry shaders
hexprint instruction hex dump with the disassembly
l3emit messages about the new L3 state during transitions
miptreeemit messages about miptrees
no8don’t generate SIMD8 fragment shader
no16suppress generation of 16-wide fragment shaders. useful for debugging broken shaders
nocompactdisable instruction compaction
nodualobjsuppress generation of dual-object geometry shader code
nofcdisable fast clears
norbcdisable single sampled render buffer compression
optimizerdump shader assembly to files at each optimization pass and iteration that make progress
perfemit messages about performance issues
perfmonemit messages about
AMD_performance_monitorpixemit messages about pixel operations
primemit messages about drawing primitives
reemitmark all state dirty on each draw call
sfemit messages about the strips & fans unit (for old gens, includes the SF program)
shader_timerecord how much GPU time is spent in each shader
spill_fsforce spilling of all registers in the scalar backend (useful to debug spilling code)
spill_vec4force spilling of all registers in the vec4 backend (useful to debug spilling code)
stateemit messages about state flag tracking
submitemit batchbuffer usage statistics
syncafter sending each batch, emit a message and wait for that batch to finish rendering
tcsdump shader assembly for tessellation control shaders
tesdump shader assembly for tessellation evaluation shaders
texemit messages about textures.
urbemit messages about URB setup
vertemit messages about vertex assembly
vsdump shader assembly for vertex shaders
INTEL_SCALAR_VS(orTCS,TES,GS)force scalar/vec4 mode for a shader stage (Gen8-9 only)
INTEL_PRECISE_TRIGif set to 1, true or yes, then the driver prefers accuracy over performance in trig functions.
Radeon driver environment variables (radeon, r200, and r300g)¶
RADEON_NO_TCLif set, disable hardware-accelerated Transform/Clip/Lighting.
EGL environment variables¶
Mesa EGL supports different sets of environment variables. See the Mesa EGL page for the details.
Gallium environment variables¶
GALLIUM_HUDdraws various information on the screen, like framerate, cpu load, driver statistics, performance counters, etc. Set
GALLIUM_HUD=helpand run e.g.glxgearsfor more info.GALLIUM_HUD_PERIODsets the hud update rate in seconds (float). Use zero to update every frame. The default period is 1/2 second.
GALLIUM_HUD_VISIBLEcontrol default visibility, defaults to true.
GALLIUM_HUD_TOGGLE_SIGNALtoggle visibility via user specified signal. Especially useful to toggle hud at specific points of application and disable for unencumbered viewing the rest of the time. For example, set
GALLIUM_HUD_VISIBLEtofalseandGALLIUM_HUD_TOGGLE_SIGNALto10(SIGUSR1). Usekill -10 <pid>to toggle the hud as desired.GALLIUM_HUD_SCALEScale hud by an integer factor, for high DPI displays. Default is 1.
GALLIUM_HUD_DUMP_DIRspecifies a directory for writing the displayed hud values into files.
GALLIUM_DRIVERuseful in combination with
LIBGL_ALWAYS_SOFTWARE=truefor choosing one of the software rendererssoftpipe,llvmpipeorswr.GALLIUM_LOG_FILEspecifies a file for logging all errors, warnings, etc. rather than stderr.
GALLIUM_PRINT_OPTIONSif non-zero, print all the Gallium environment variables which are used, and their current values.
GALLIUM_DUMP_CPUif non-zero, print information about the CPU on start-up
TGSI_PRINT_SANITYif set, do extra sanity checking on TGSI shaders and print any errors to stderr.
DRAW_FSE???
DRAW_NO_FSE???
DRAW_USE_LLVMif set to zero, the draw module will not use LLVM to execute shaders, vertex fetch, etc.
ST_DEBUGcontrols debug output from the Mesa/Gallium state tracker. Setting to
tgsi, for example, will print all the TGSI shaders. Seesrc/mesa/state_tracker/st_debug.cfor other options.
Clover environment variables¶
CLOVER_EXTRA_BUILD_OPTIONSallows specifying additional compiler and linker options. Specified options are appended after the options set by the OpenCL program in
clBuildProgram.CLOVER_EXTRA_COMPILE_OPTIONSallows specifying additional compiler options. Specified options are appended after the options set by the OpenCL program in
clCompileProgram.CLOVER_EXTRA_LINK_OPTIONSallows specifying additional linker options. Specified options are appended after the options set by the OpenCL program in
clLinkProgram.
Softpipe driver environment variables¶
SOFTPIPE_DUMP_FSif set, the softpipe driver will print fragment shaders to stderr
SOFTPIPE_DUMP_GSif set, the softpipe driver will print geometry shaders to stderr
SOFTPIPE_NO_RASTif set, rasterization is no-op’d. For profiling purposes.
SOFTPIPE_USE_LLVMif set, the softpipe driver will try to use LLVM JIT for vertex shading processing.
LLVMpipe driver environment variables¶
LP_NO_RASTif set LLVMpipe will no-op rasterization
LP_DEBUGa comma-separated list of debug options is accepted. See the source code for details.
LP_PERFa comma-separated list of options to selectively no-op various parts of the driver. See the source code for details.
LP_NUM_THREADSan integer indicating how many threads to use for rendering. Zero turns off threading completely. The default value is the number of CPU cores present.
VMware SVGA driver environment variables¶
SVGA_FORCE_SWTNLforce use of software vertex transformation
SVGA_NO_SWTNLdon’t allow software vertex transformation fallbacks (will often result in incorrect rendering).
SVGA_DEBUGfor dumping shaders, constant buffers, etc. See the code for details.
SVGA_EXTRA_LOGGINGif set, enables extra logging to the
vmware.logfile, such as the OpenGL program’s name and command line arguments.SVGA_NO_LOGGINGif set, disables logging to the
vmware.logfile. This is useful when using Valgrind because it otherwise crashes when initializing the host log feature.
See the driver code for other, lesser-used variables.
WGL environment variables¶
WGL_SWAP_INTERVALto set a swap interval, equivalent to calling
wglSwapIntervalEXT()in an application. If this environment variable is set, application calls towglSwapIntervalEXT()will have no effect.
VA-API environment variables¶
VAAPI_MPEG4_ENABLEDenable MPEG4 for VA-API, disabled by default.
VC4 driver environment variables¶
VC4_DEBUGa comma-separated list of named flags, which do various things:
cldump command list during creation
qpudump generated QPU instructions
qirdump QPU IR during program compile
nirdump NIR during program compile
tgsidump TGSI during program compile
shaderdbdump program compile information for shader-db analysis
perfprint during performance-related events
norastskip actual hardware execution of commands
always_flushflush after each draw call
always_syncwait for finish after each flush
dumpwrite a GPU command stream trace file (VC4 simulator only)
RADV driver environment variables¶
RADV_DEBUGa comma-separated list of named flags, which do various things:
llvmenable LLVM compiler backend
allbosforce all allocated buffers to be referenced in submissions
allentrypointsenable all device/instance entrypoints
checkirvalidate the LLVM IR before LLVM compiles the shader
errorsdisplay more info about errors
infoshow GPU-related information
metashadersdump internal meta shaders
nobinningdisable primitive binning
nocachedisable shaders cache
nocomputedisable compute queue
nodccdisable Delta Color Compression (DCC) on images
nodynamicboundsdo not check OOB access for dynamic descriptors
nofastclearsdisable fast color/depthstencil clears
nohizdisable HIZ for depthstencil images
noibsdisable directly recording command buffers in GPU-visible memory
noloadstoreoptdisable LLVM SILoadStoreOptimizer pass
nomemorycachedisable memory shaders cache
nonggdisable NGG for GFX10+
nooutoforderdisable out-of-order rasterization
noshaderballotdisable shader ballot
nothreadllvmdisable LLVM threaded compilation
preoptirdump LLVM IR before any optimizations
shadersdump shaders
shaderstatsdump shader statistics
spirvdump SPIR-V
startupdisplay info at startup
syncshaderssynchronize shaders after all draws/dispatches
vmfaultscheck for VM memory faults via dmesg
zerovraminitialize all memory allocated in VRAM as zero
RADV_FORCE_FAMILYcreate a null device to compile shaders without a AMD GPU (eg. gfx900)
RADV_PERFTESTa comma-separated list of named flags, which do various things:
bolistenable the global BO list
cswave32enable wave32 for compute shaders (GFX10+)
dccmsaaenable DCC for MSAA images
dfsmenable dfsm
gewave32enable wave32 for vertex/tess/geometry shaders (GFX10+)
localbosenable local BOs
pswave32enable wave32 for pixel shaders (GFX10+)
shader_ballotenable shader ballot
tccompatcmaskenable TC-compat cmask for MSAA images
RADV_SECURE_COMPILE_THREADSmaximum number of secure compile threads (up to 32)
RADV_TEX_ANISOforce anisotropy filter (up to 16)
RADV_TRACE_FILEgenerate cmdbuffer tracefiles when a GPU hang is detected
ACO_DEBUGa comma-separated list of named flags, which do various things:
validateirvalidate the ACO IR at various points of compilation (enabled by default for debug/debugoptimized builds)
validateravalidate register assignment of ACO IR and catches many RA bugs
perfwarnabort on some suboptimal code generation
radeonsi driver environment variables¶
AMD_DEBUGa comma-separated list of named flags, which do various things:
nodmaDisable SDMA
nodmaclearDisable SDMA clears
nodmacopyimageDisable SDMA image copies
zerovramClear VRAM allocations.
nodccDisable DCC.
nodccclearDisable DCC fast clear.
nodccfbDisable separate DCC on the main framebuffer
nodccmsaaDisable DCC for MSAA
nodpbbDisable DPBB.
nodfsmDisable DFSM.
notilingDisable tiling
nofmaskDisable MSAA compression
nohyperzDisable Hyper-Z
norbplusDisable RB+.
no2dDisable 2D tiling
infoPrint driver information
texPrint texture info
computePrint compute info
vmPrint virtual addresses when creating resources
vsPrint vertex shaders
psPrint pixel shaders
gsPrint geometry shaders
tcsPrint tessellation control shaders
tesPrint tessellation evaluation shaders
csPrint compute shaders
noirDon’t print the LLVM IR
nonirDon’t print NIR when printing shaders
noasmDon’t print disassembled shaders
preoptirPrint the LLVM IR before initial optimizations
giselEnable LLVM global instruction selector.
w32geUse Wave32 for vertex, tessellation, and geometry shaders.
w32psUse Wave32 for pixel shaders.
w32csUse Wave32 for computes shaders.
w64geUse Wave64 for vertex, tessellation, and geometry shaders.
w64psUse Wave64 for pixel shaders.
w64csUse Wave64 for computes shaders.
checkirEnable additional sanity checks on shader IR
monoUse old-style monolithic shaders compiled on demand
nooptvariantDisable compiling optimized shader variants.
forcedmaUse SDMA for all operations when possible.
nowcDisable GTT write combining
check_vmCheck VM faults and dump debug info.
reserve_vmidForce VMID reservation per context.
nogfxDisable graphics. Only multimedia compute paths can be used.
nonggDisable NGG and use the legacy pipeline.
nggcAlways use NGG culling even when it can hurt.
nonggcDisable NGG culling.
alwayspdAlways enable the primitive discard compute shader.
pdEnable the primitive discard compute shader for large draw calls.
nopdDisable the primitive discard compute shader.
switch_on_eopProgram WD/IA to switch on end-of-packet.
nooutoforderDisable out-of-order rasterization
dpbbEnable DPBB.
dfsmEnable DFSM.
Other Gallium drivers have their own environment variables. These may change frequently so the source code should be consulted for details.