c6e23731065d17cd06c20467c7ad1107e077f4de
[mesa.git] / docs / envvars.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html lang="en">
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=utf-8">
5 <title>Environment Variables</title>
6 <link rel="stylesheet" type="text/css" href="mesa.css">
7 </head>
8 <body>
9
10 <div class="header">
11 The Mesa 3D Graphics Library
12 </div>
13
14 <iframe src="contents.html"></iframe>
15 <div class="content">
16
17 <h1>Environment Variables</h1>
18
19 <p>
20 Normally, no environment variables need to be set. Most of the environment
21 variables used by Mesa/Gallium are for debugging purposes, but they can
22 sometimes be useful for debugging end-user issues.
23 </p>
24
25
26 <h2>LibGL environment variables</h2>
27
28 <dl>
29 <dt>LIBGL_DEBUG</dt>
30 <dd>If defined debug information will be printed to stderr.
31 If set to 'verbose' additional information will be printed.</dd>
32 <dt>LIBGL_DRIVERS_PATH</dt>
33 <dd>colon-separated list of paths to search for DRI drivers</dd>
34 <dt>LIBGL_ALWAYS_INDIRECT</dt>
35 <dd>if set to `true`, forces an indirect rendering context/connection.</dd>
36 <dt>LIBGL_ALWAYS_SOFTWARE</dt>
37 <dd>if set to `true`, always use software rendering</dd>
38 <dt>LIBGL_NO_DRAWARRAYS</dt>
39 <dd>if set to `true`, do not use DrawArrays GLX protocol (for debugging)</dd>
40 <dt>LIBGL_SHOW_FPS</dt>
41 <dd>print framerate to stdout based on the number of glXSwapBuffers
42 calls per second.</dd>
43 <dt>LIBGL_DRI3_DISABLE</dt>
44 <dd>disable DRI3 if set to `true`.</dd>
45 </dl>
46
47 <h2>Core Mesa environment variables</h2>
48
49 <dl>
50 <dt>MESA_NO_ASM</dt>
51 <dd>if set, disables all assembly language optimizations</dd>
52 <dt>MESA_NO_MMX</dt>
53 <dd>if set, disables Intel MMX optimizations</dd>
54 <dt>MESA_NO_3DNOW</dt>
55 <dd>if set, disables AMD 3DNow! optimizations</dd>
56 <dt>MESA_NO_SSE</dt>
57 <dd>if set, disables Intel SSE optimizations</dd>
58 <dt>MESA_NO_ERROR</dt>
59 <dd>if set to 1, error checking is disabled as per KHR_no_error.
60 This will result in undefined behaviour for invalid use of the api, but
61 can reduce CPU use for apps that are known to be error free.</dd>
62 <dt>MESA_DEBUG</dt>
63 <dd>if set, error messages are printed to stderr. For example,
64 if the application generates a GL_INVALID_ENUM error, a corresponding error
65 message indicating where the error occurred, and possibly why, will be
66 printed to stderr. For release builds, MESA_DEBUG defaults to off (no debug
67 output). MESA_DEBUG accepts the following comma-separated list of named
68 flags, which adds extra behaviour to just set MESA_DEBUG=1:
69 <dl>
70 <dt>silent</dt>
71 <dd>turn off debug messages. Only useful for debug builds.</dd>
72 <dt>flush</dt>
73 <dd>flush after each drawing command</dd>
74 <dt>incomplete_tex</dt>
75 <dd>extra debug messages when a texture is incomplete</dd>
76 <dt>incomplete_fbo</dt>
77 <dd>extra debug messages when a fbo is incomplete</dd>
78 <dt>context</dt>
79 <dd>create a debug context (see GLX_CONTEXT_DEBUG_BIT_ARB) and print
80 error and performance messages to stderr (or MESA_LOG_FILE).</dd>
81 </dl>
82 </dd>
83 <dt>MESA_LOG_FILE</dt>
84 <dd>specifies a file name for logging all errors, warnings,
85 etc., rather than stderr</dd>
86 <dt>MESA_TEX_PROG</dt>
87 <dd>if set, implement conventional texture env modes with
88 fragment programs (intended for developers only)</dd>
89 <dt>MESA_TNL_PROG</dt>
90 <dd>if set, implement conventional vertex transformation operations with
91 vertex programs (intended for developers only). Setting this variable
92 automatically sets the MESA_TEX_PROG variable as well.</dd>
93 <dt>MESA_EXTENSION_OVERRIDE</dt>
94 <dd>can be used to enable/disable extensions. A value such as
95 "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension and disable
96 the GL_EXT_bar extension.</dd>
97 <dt>MESA_EXTENSION_MAX_YEAR</dt>
98 <dd>The GL_EXTENSIONS string returned by Mesa is sorted by extension year.
99 If this variable is set to year X, only extensions defined on or before
100 year X will be reported. This is to work-around a bug in some games where
101 the extension string is copied into a fixed-size buffer without
102 truncating. If the extension string is too long, the buffer overrun can
103 cause the game to crash. This is a work-around for that.
104 </dd>
105 <dt>MESA_GL_VERSION_OVERRIDE</dt>
106 <dd>changes the value returned by
107 glGetString(GL_VERSION) and possibly the GL API type.
108 <ul>
109 <li>The format should be MAJOR.MINOR[FC|COMPAT]
110 <li>FC is an optional suffix that indicates a forward compatible
111 context. This is only valid for versions &gt;= 3.0.
112 <li>COMPAT is an optional suffix that indicates a compatibility
113 context or GL_ARB_compatibility support. This is only valid for
114 versions &gt;= 3.1.
115 <li>GL versions &lt;= 3.0 are set to a compatibility (non-Core)
116 profile
117 <li>GL versions = 3.1, depending on the driver, it may or may not
118 have the ARB_compatibility extension enabled.
119 <li>GL versions &gt;= 3.2 are set to a Core profile
120 <li>Examples:
121 <dl>
122 <dt>2.1</dt>
123 <dd>select a compatibility (non-Core) profile with GL version 2.1.</dd>
124 <dt>3.0</dt>
125 <dd>select a compatibility (non-Core) profile with GL version 3.0.</dd>
126 <dt>3.0FC</dt>
127 <dd>select a Core+Forward Compatible profile with GL version 3.0.</dd>
128 <dt>3.1</dt>
129 <dd>select GL version 3.1 with GL_ARB_compatibility enabled per the
130 driver default.</dd>
131 <dt>3.1FC</dt>
132 <dd>select GL version 3.1 with forward compatibility and
133 GL_ARB_compatibility disabled.</dd>
134 <dt>3.1COMPAT</dt>
135 <dd>select GL version 3.1 with GL_ARB_compatibility enabled.</dd>
136 <dt>X.Y</dt>
137 <dd>override GL version to X.Y without changing the profile.</dd>
138 <dt>X.YFC</dt>
139 <dd>select a Core+Forward Compatible profile with GL version X.Y.</dd>
140 <dt>X.YCOMPAT</dt>
141 <dd>select a Compatibility profile with GL version X.Y.</dd>
142 </dl>
143 <li>Mesa may not really implement all the features of the given
144 version. (for developers only)
145 </ul>
146 </dd>
147 <dt>MESA_GLES_VERSION_OVERRIDE</dt>
148 <dd>changes the value returned by glGetString(GL_VERSION) for OpenGL ES.
149 <ul>
150 <li> The format should be MAJOR.MINOR
151 <li> Examples: 2.0, 3.0, 3.1
152 <li> Mesa may not really implement all the features of the given version.
153 (for developers only)
154 </ul>
155 </dd>
156 <dt>MESA_GLSL_VERSION_OVERRIDE</dt>
157 <dd>changes the value returned by glGetString(GL_SHADING_LANGUAGE_VERSION).
158 Valid values are integers, such as "130". Mesa will not really implement
159 all the features of the given language version if it's higher than what's
160 normally reported. (for developers only)
161 </dd>
162 <dt>MESA_GLSL_CACHE_DISABLE</dt>
163 <dd>if set to `true`, disables the GLSL shader cache</dd>
164 <dt>MESA_GLSL_CACHE_MAX_SIZE</dt>
165 <dd>if set, determines the maximum size of the on-disk cache of compiled GLSL
166 programs. Should be set to a number optionally followed by 'K', 'M', or
167 'G' to specify a size in kilobytes, megabytes, or gigabytes. By default,
168 gigabytes will be assumed. And if unset, a maximum size of 1GB will be
169 used. Note: A separate cache might be created for each architecture that
170 Mesa is installed for on your system. For example under the default
171 settings you may end up with a 1GB cache for x86_64 and another 1GB cache
172 for i386.</dd>
173 <dt>MESA_GLSL_CACHE_DIR</dt>
174 <dd>if set, determines the directory to be used for the on-disk cache of
175 compiled GLSL programs. If this variable is not set, then the cache will
176 be stored in $XDG_CACHE_HOME/mesa_shader_cache (if that variable is set),
177 or else within .cache/mesa_shader_cache within the user's home directory.
178 </dd>
179 <dt>MESA_GLSL</dt>
180 <dd><a href="shading.html#envvars">shading language compiler options</a></dd>
181 <dt>MESA_NO_MINMAX_CACHE</dt>
182 <dd>when set, the minmax index cache is globally disabled.</dd>
183 <dt>MESA_SHADER_CAPTURE_PATH</dt>
184 <dd>see <a href="shading.html#capture">Capturing Shaders</a></dd>
185 <dt>MESA_SHADER_DUMP_PATH and MESA_SHADER_READ_PATH</dt>
186 <dd>see <a href="shading.html#replacement">Experimenting with Shader Replacements</a></dd>
187 <dt>MESA_VK_VERSION_OVERRIDE</dt>
188 <dd>changes the Vulkan physical device version
189 as returned in VkPhysicalDeviceProperties::apiVersion.
190 <ul>
191 <li>The format should be MAJOR.MINOR[.PATCH]</li>
192 <li>This will not let you force a version higher than the driver's
193 instance versionas advertised by vkEnumerateInstanceVersion</li>
194 <li>This can be very useful for debugging but some features may not be
195 implemented correctly. (For developers only)</li>
196 </ul>
197 </dd>
198 </dl>
199
200
201 <h2>Mesa Xlib driver environment variables</h2>
202
203 <p>
204 The following are only applicable to the Mesa Xlib software driver.
205 See the <a href="xlibdriver.html">Xlib software driver page</a> for details.
206 </p>
207 <dl>
208 <dt>MESA_RGB_VISUAL</dt>
209 <dd>specifies the X visual and depth for RGB mode</dd>
210 <dt>MESA_CI_VISUAL</dt>
211 <dd>specifies the X visual and depth for CI mode</dd>
212 <dt>MESA_BACK_BUFFER</dt>
213 <dd>specifies how to implement the back color buffer, either "pixmap" or
214 "ximage"</dd>
215 <dt>MESA_GAMMA</dt>
216 <dd>gamma correction coefficients for red, green, blue channels</dd>
217 <dt>MESA_XSYNC</dt>
218 <dd>enable synchronous X behavior (for debugging only)</dd>
219 <dt>MESA_GLX_FORCE_CI</dt>
220 <dd>if set, force GLX to treat 8bpp visuals as CI visuals</dd>
221 <dt>MESA_GLX_FORCE_ALPHA</dt>
222 <dd>if set, forces RGB windows to have an alpha channel.</dd>
223 <dt>MESA_GLX_DEPTH_BITS</dt>
224 <dd>specifies default number of bits for depth buffer.</dd>
225 <dt>MESA_GLX_ALPHA_BITS</dt>
226 <dd>specifies default number of bits for alpha channel.</dd>
227 </dl>
228
229
230 <h2>i945/i965 driver environment variables (non-Gallium)</h2>
231
232 <dl>
233 <dt>INTEL_NO_HW</dt>
234 <dd>if set to 1, prevents batches from being submitted to the hardware.
235 This is useful for debugging hangs, etc.</dd>
236 <dt>INTEL_DEBUG</dt>
237 <dd>a comma-separated list of named flags, which do various things:
238 <dl>
239 <dt>ann</dt>
240 <dd>annotate IR in assembly dumps</dd>
241 <dt>aub</dt>
242 <dd>dump batches into an AUB trace for use with simulation tools</dd>
243 <dt>bat</dt>
244 <dd>emit batch information</dd>
245 <dt>blit</dt>
246 <dd>emit messages about blit operations</dd>
247 <dt>blorp</dt>
248 <dd>emit messages about the blorp operations (blits &amp; clears)</dd>
249 <dt>buf</dt>
250 <dd>emit messages about buffer objects</dd>
251 <dt>clip</dt>
252 <dd>emit messages about the clip unit (for old gens, includes the CLIP program)</dd>
253 <dt>color</dt>
254 <dd>use color in output</dd>
255 <dt>cs</dt>
256 <dd>dump shader assembly for compute shaders</dd>
257 <dt>do32</dt>
258 <dd>generate compute shader SIMD32 programs even if workgroup size doesn't exceed the SIMD16 limit</dd>
259 <dt>dri</dt>
260 <dd>emit messages about the DRI interface</dd>
261 <dt>fbo</dt>
262 <dd>emit messages about framebuffers</dd>
263 <dt>fs</dt>
264 <dd>dump shader assembly for fragment shaders</dd>
265 <dt>gs</dt>
266 <dd>dump shader assembly for geometry shaders</dd>
267 <dt>hex</dt>
268 <dd>print instruction hex dump with the disassembly</dd>
269 <dt>l3</dt>
270 <dd>emit messages about the new L3 state during transitions</dd>
271 <dt>miptree</dt>
272 <dd>emit messages about miptrees</dd>
273 <dt>no8</dt>
274 <dd>don't generate SIMD8 fragment shader</dd>
275 <dt>no16</dt>
276 <dd>suppress generation of 16-wide fragment shaders. useful for debugging broken shaders</dd>
277 <dt>nocompact</dt>
278 <dd>disable instruction compaction</dd>
279 <dt>nodualobj</dt>
280 <dd>suppress generation of dual-object geometry shader code</dd>
281 <dt>norbc</dt>
282 <dd>disable single sampled render buffer compression</dd>
283 <dt>optimizer</dt>
284 <dd>dump shader assembly to files at each optimization pass and iteration that make progress</dd>
285 <dt>perf</dt>
286 <dd>emit messages about performance issues</dd>
287 <dt>perfmon</dt>
288 <dd>emit messages about AMD_performance_monitor</dd>
289 <dt>pix</dt>
290 <dd>emit messages about pixel operations</dd>
291 <dt>prim</dt>
292 <dd>emit messages about drawing primitives</dd>
293 <dt>reemit</dt>
294 <dd>mark all state dirty on each draw call</dd>
295 <dt>sf</dt>
296 <dd>emit messages about the strips &amp; fans unit (for old gens, includes the SF program)</dd>
297 <dt>shader_time</dt>
298 <dd>record how much GPU time is spent in each shader</dd>
299 <dt>spill_fs</dt>
300 <dd>force spilling of all registers in the scalar backend (useful to debug spilling code)</dd>
301 <dt>spill_vec4</dt>
302 <dd>force spilling of all registers in the vec4 backend (useful to debug spilling code)</dd>
303 <dt>state</dt>
304 <dd>emit messages about state flag tracking</dd>
305 <dt>submit</dt>
306 <dd>emit batchbuffer usage statistics</dd>
307 <dt>sync</dt>
308 <dd>after sending each batch, emit a message and wait for that batch to finish rendering</dd>
309 <dt>tcs</dt>
310 <dd>dump shader assembly for tessellation control shaders</dd>
311 <dt>tes</dt>
312 <dd>dump shader assembly for tessellation evaluation shaders</dd>
313 <dt>tex</dt>
314 <dd>emit messages about textures.</dd>
315 <dt>urb</dt>
316 <dd>emit messages about URB setup</dd>
317 <dt>vert</dt>
318 <dd>emit messages about vertex assembly</dd>
319 <dt>vs</dt>
320 <dd>dump shader assembly for vertex shaders</dd>
321 </dl>
322 </dd>
323 <dt>INTEL_SCALAR_VS (or TCS, TES, GS)</dt>
324 <dd>force scalar/vec4 mode for a shader stage (Gen8-9 only)</dd>
325 <dt>INTEL_PRECISE_TRIG</dt>
326 <dd>if set to 1, true or yes, then the driver prefers accuracy over
327 performance in trig functions.</dd>
328 </dl>
329
330
331 <h2>Radeon driver environment variables (radeon, r200, and r300g)</h2>
332
333 <dl>
334 <dt>RADEON_NO_TCL</dt>
335 <dd>if set, disable hardware-accelerated Transform/Clip/Lighting.</dd>
336 </dl>
337
338
339 <h2>EGL environment variables</h2>
340
341 <p>
342 Mesa EGL supports different sets of environment variables. See the
343 <a href="egl.html">Mesa EGL</a> page for the details.
344 </p>
345
346
347 <h2>Gallium environment variables</h2>
348
349 <dl>
350 <dt>GALLIUM_HUD</dt>
351 <dd>draws various information on the screen, like framerate,
352 cpu load, driver statistics, performance counters, etc.
353 Set GALLIUM_HUD=help and run e.g. glxgears for more info.</dd>
354 <dt>GALLIUM_HUD_PERIOD</dt>
355 <dd>sets the hud update rate in seconds (float). Use zero
356 to update every frame. The default period is 1/2 second.</dd>
357 <dt>GALLIUM_HUD_VISIBLE</dt>
358 <dd>control default visibility, defaults to true.</dd>
359 <dt>GALLIUM_HUD_TOGGLE_SIGNAL</dt>
360 <dd>toggle visibility via user specified signal.
361 Especially useful to toggle hud at specific points of application and
362 disable for unencumbered viewing the rest of the time. For example, set
363 GALLIUM_HUD_VISIBLE to false and GALLIUM_HUD_TOGGLE_SIGNAL to 10 (SIGUSR1).
364 Use kill -10 &lt;pid&gt; to toggle the hud as desired.</dd>
365 <dt>GALLIUM_HUD_DUMP_DIR</dt>
366 <dd>specifies a directory for writing the displayed hud values into files.</dd>
367 <dt>GALLIUM_DRIVER</dt>
368 <dd>useful in combination with LIBGL_ALWAYS_SOFTWARE=true for choosing one
369 of the software renderers "softpipe", "llvmpipe" or "swr".</dd>
370 <dt>GALLIUM_LOG_FILE</dt>
371 <dd>specifies a file for logging all errors, warnings, etc.
372 rather than stderr.</dd>
373 <dt>GALLIUM_PRINT_OPTIONS</dt>
374 <dd>if non-zero, print all the Gallium environment variables which are
375 used, and their current values.</dd>
376 <dt>GALLIUM_DUMP_CPU</dt>
377 <dd>if non-zero, print information about the CPU on start-up</dd>
378 <dt>TGSI_PRINT_SANITY</dt>
379 <dd>if set, do extra sanity checking on TGSI shaders and
380 print any errors to stderr.</dd>
381 <dt>DRAW_FSE</dt>
382 <dd>???</dd>
383 <dt>DRAW_NO_FSE</dt>
384 <dd>???</dd>
385 <dt>DRAW_USE_LLVM</dt>
386 <dd>if set to zero, the draw module will not use LLVM to execute
387 shaders, vertex fetch, etc.</dd>
388 <dt>ST_DEBUG</dt>
389 <dd>controls debug output from the Mesa/Gallium state tracker.
390 Setting to "tgsi", for example, will print all the TGSI shaders.
391 See src/mesa/state_tracker/st_debug.c for other options.</dd>
392 </dl>
393
394 <h3>Clover state tracker environment variables</h3>
395
396 <dl>
397 <dt>CLOVER_EXTRA_BUILD_OPTIONS</dt>
398 <dd>allows specifying additional compiler and linker
399 options. Specified options are appended after the options set by the OpenCL
400 program in clBuildProgram.</dd>
401 <dt>CLOVER_EXTRA_COMPILE_OPTIONS</dt>
402 <dd>allows specifying additional compiler
403 options. Specified options are appended after the options set by the OpenCL
404 program in clCompileProgram.</dd>
405 <dt>CLOVER_EXTRA_LINK_OPTIONS</dt>
406 <dd>allows specifying additional linker
407 options. Specified options are appended after the options set by the OpenCL
408 program in clLinkProgram.</dd>
409 </dl>
410
411
412 <h3>Softpipe driver environment variables</h3>
413 <dl>
414 <dt>SOFTPIPE_DUMP_FS</dt>
415 <dd>if set, the softpipe driver will print fragment shaders to stderr</dd>
416 <dt>SOFTPIPE_DUMP_GS</dt>
417 <dd>if set, the softpipe driver will print geometry shaders to stderr</dd>
418 <dt>SOFTPIPE_NO_RAST</dt>
419 <dd>if set, rasterization is no-op'd. For profiling purposes.</dd>
420 <dt>SOFTPIPE_USE_LLVM</dt>
421 <dd>if set, the softpipe driver will try to use LLVM JIT for
422 vertex shading processing.</dd>
423 </dl>
424
425
426 <h3>LLVMpipe driver environment variables</h3>
427 <dl>
428 <dt>LP_NO_RAST</dt>
429 <dd>if set LLVMpipe will no-op rasterization</dd>
430 <dt>LP_DEBUG</dt>
431 <dd>a comma-separated list of debug options is accepted. See the
432 source code for details.</dd>
433 <dt>LP_PERF</dt>
434 <dd>a comma-separated list of options to selectively no-op various
435 parts of the driver. See the source code for details.</dd>
436 <dt>LP_NUM_THREADS</dt>
437 <dd>an integer indicating how many threads to use for rendering.
438 Zero turns off threading completely. The default value is the number of CPU
439 cores present.</dd>
440 </dl>
441
442 <h3>VMware SVGA driver environment variables</h3>
443 <dl>
444 <dt>SVGA_FORCE_SWTNL</dt>
445 <dd>force use of software vertex transformation</dd>
446 <dt>SVGA_NO_SWTNL</dt>
447 <dd>don't allow software vertex transformation fallbacks (will often result
448 in incorrect rendering).</dd>
449 <dt>SVGA_DEBUG</dt>
450 <dd>for dumping shaders, constant buffers, etc. See the code for
451 details.</dd>
452 <dt>SVGA_EXTRA_LOGGING</dt>
453 <dd>if set, enables extra logging to the vmware.log file, such as the
454 OpenGL program's name and command line arguments.</dd>
455 <dt>SVGA_NO_LOGGING</dt>
456 <dd>if set, disables logging to the vmware.log file. This is useful when
457 using Valgrind because it otherwise crashes when initializing the host
458 log feature.</dd>
459 </dl>
460 <p>See the driver code for other, lesser-used variables.</p>
461
462 <h3>WGL environment variables</h3>
463 <dl>
464 <dt>WGL_SWAP_INTERVAL</dt>
465 <dd>to set a swap interval, equivalent to calling wglSwapIntervalEXT()
466 in an application. If this environment variable is set, application
467 calls to wglSwapIntervalEXT() will have no effect.</dd>
468 </dl>
469
470 <h3>VA-API state tracker environment variables</h3>
471 <dl>
472 <dt>VAAPI_MPEG4_ENABLED</dt>
473 <dd>enable MPEG4 for VA-API, disabled by default.</dd>
474 </dl>
475
476
477 <h3>VC4 driver environment variables</h3>
478 <dl>
479 <dt>VC4_DEBUG</dt>
480 <dd>a comma-separated list of named flags, which do various things:
481 <dl>
482 <dt>cl</dt>
483 <dd>dump command list during creation</dd>
484 <dt>qpu</dt>
485 <dd>dump generated QPU instructions</dd>
486 <dt>qir</dt>
487 <dd>dump QPU IR during program compile</dd>
488 <dt>nir</dt>
489 <dd>dump NIR during program compile</dd>
490 <dt>tgsi</dt>
491 <dd>dump TGSI during program compile</dd>
492 <dt>shaderdb</dt>
493 <dd>dump program compile information for shader-db analysis</dd>
494 <dt>perf</dt>
495 <dd>print during performance-related events</dd>
496 <dt>norast</dt>
497 <dd>skip actual hardware execution of commands</dd>
498 <dt>always_flush</dt>
499 <dd>flush after each draw call</dd>
500 <dt>always_sync</dt>
501 <dd>wait for finish after each flush</dd>
502 <dt>dump</dt>
503 <dd>write a GPU command stream trace file (VC4 simulator only)</dd>
504 </dl>
505 </dd>
506 </dl>
507
508
509 <p>
510 Other Gallium drivers have their own environment variables. These may change
511 frequently so the source code should be consulted for details.
512 </p>
513
514 </div>
515 </body>
516 </html>