xref: /aosp_15_r20/external/mesa3d/src/util/driconf.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * XML DRI client-side driver configuration
3  * Copyright (C) 2003 Felix Kuehling
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
21  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 /**
25  * \file driconf.h
26  * \brief Pool of common options
27  * \author Felix Kuehling
28  *
29  * This file defines macros that can be used to construct
30  * driConfigOptions in the drivers.
31  */
32 
33 #ifndef __DRICONF_H
34 #define __DRICONF_H
35 
36 #include "xmlconfig.h"
37 
38 /*
39  * generic macros
40  */
41 
42 /** \brief Names a section of related options to follow */
43 #define DRI_CONF_SECTION(text) { .desc = text, .info = { .type = DRI_SECTION } },
44 #define DRI_CONF_SECTION_END
45 
46 /** \brief End an option description */
47 #define DRI_CONF_OPT_END },
48 
49 /** \brief A verbal description (empty version) */
50 #define DRI_CONF_DESC(text) .desc = text,
51 
52 /** \brief A verbal description of an enum value */
53 #define DRI_CONF_ENUM(_value,text) { .value = _value, .desc = text },
54 
55 #define DRI_CONF_RANGE_I(min, max)              \
56       .range = {                                \
57          .start = { ._int = min },              \
58          .end = { ._int = max },                \
59       }                                         \
60 
61 #define DRI_CONF_RANGE_F(min, max)              \
62       .range = {                                \
63          .start = { ._float = min },            \
64          .end = { ._float = max },              \
65       }                                         \
66 
67 /**
68  * \brief A boolean option definition, with the default value passed in as a
69  * string
70  */
71 
72 #define DRI_CONF_OPT_B(_name, def, _desc) {                     \
73       .desc = _desc,                                            \
74       .info = {                                                 \
75          .name = #_name,                                        \
76          .type = DRI_BOOL,                                      \
77       },                                                        \
78       .value = { ._bool = def },                                \
79    },
80 
81 #define DRI_CONF_OPT_I(_name, def, min, max, _desc) {           \
82       .desc = _desc,                                            \
83       .info = {                                                 \
84          .name = #_name,                                        \
85          .type = DRI_INT,                                       \
86          DRI_CONF_RANGE_I(min, max),                            \
87       },                                                        \
88       .value = { ._int = def },                                 \
89    },
90 
91 #define DRI_CONF_OPT_F(_name, def, min, max, _desc) {           \
92       .desc = _desc,                                            \
93       .info = {                                                 \
94          .name = #_name,                                        \
95          .type = DRI_FLOAT,                                     \
96          DRI_CONF_RANGE_F(min, max),                            \
97       },                                                        \
98       .value = { ._float = def },                               \
99    },
100 
101 #define DRI_CONF_OPT_E(_name, def, min, max, _desc, values) {   \
102       .desc = _desc,                                            \
103       .info = {                                                 \
104          .name = #_name,                                        \
105          .type = DRI_ENUM,                                      \
106          DRI_CONF_RANGE_I(min, max),                            \
107       },                                                        \
108       .value = { ._int = def },                                 \
109       .enums = { values },                                      \
110    },
111 
112 #define DRI_CONF_OPT_S(_name, def, _desc) {                     \
113       .desc = _desc,                                            \
114       .info = {                                                 \
115          .name = #_name,                                        \
116          .type = DRI_STRING,                                    \
117       },                                                        \
118       .value = { ._string = #def },                             \
119    },
120 
121 #define DRI_CONF_OPT_S_NODEF(_name, _desc) {                    \
122       .desc = _desc,                                            \
123       .info = {                                                 \
124          .name = #_name,                                        \
125          .type = DRI_STRING,                                    \
126       },                                                        \
127       .value = { ._string = "" },                               \
128    },
129 
130 /**
131  * \brief Debugging options
132  */
133 #define DRI_CONF_SECTION_DEBUG DRI_CONF_SECTION("Debugging")
134 
135 #define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \
136    DRI_CONF_OPT_B(always_flush_batch, def,                              \
137                   "Enable flushing batchbuffer after each draw call")
138 
139 #define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \
140    DRI_CONF_OPT_B(always_flush_cache, def, \
141                   "Enable flushing GPU caches with each draw call")
142 
143 #define DRI_CONF_DISABLE_THROTTLING(def) \
144    DRI_CONF_OPT_B(disable_throttling, def, \
145                   "Disable throttling on first batch after flush")
146 
147 #define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \
148    DRI_CONF_OPT_B(force_glsl_extensions_warn, def, \
149                   "Force GLSL extension default behavior to 'warn'")
150 
151 #define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \
152    DRI_CONF_OPT_B(disable_blend_func_extended, def, \
153                   "Disable dual source blending")
154 
155 #define DRI_CONF_DISABLE_ARB_GPU_SHADER5(def) \
156    DRI_CONF_OPT_B(disable_arb_gpu_shader5, def, \
157                   "Disable GL_ARB_gpu_shader5")
158 
159 #define DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(def) \
160    DRI_CONF_OPT_B(dual_color_blend_by_location, def, \
161                   "Identify dual color blending sources by location rather than index")
162 
163 #define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \
164    DRI_CONF_OPT_B(disable_glsl_line_continuations, def, \
165                   "Disable backslash-based line continuations in GLSL source")
166 
167 #define DRI_CONF_DISABLE_UNIFORM_ARRAY_RESIZE(def) \
168    DRI_CONF_OPT_B(disable_uniform_array_resize, def, \
169                   "Disable the glsl optimisation that resizes uniform arrays")
170 
171 #define DRI_CONF_ALIAS_SHADER_EXTENSION() \
172    DRI_CONF_OPT_S_NODEF(alias_shader_extension, "Allow  alias for shader extensions")
173 
174 #define DRI_CONF_ALLOW_VERTEX_TEXTURE_BIAS(def) \
175    DRI_CONF_OPT_B(allow_vertex_texture_bias, def, \
176                   "Allow GL2 vertex shaders to have access to texture2D/textureCube with bias variants")
177 
178 #define DRI_CONF_FORCE_GLSL_VERSION(def) \
179    DRI_CONF_OPT_I(force_glsl_version, def, 0, 999, \
180                   "Force a default GLSL version for shaders that lack an explicit #version line")
181 
182 #define DRI_CONF_ALLOW_EXTRA_PP_TOKENS(def) \
183    DRI_CONF_OPT_B(allow_extra_pp_tokens, def, \
184                   "Allow extra tokens at end of preprocessor directives.")
185 
186 #define DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(def) \
187    DRI_CONF_OPT_B(allow_glsl_extension_directive_midshader, def, \
188                   "Allow GLSL #extension directives in the middle of shaders")
189 
190 #define DRI_CONF_ALLOW_GLSL_120_SUBSET_IN_110(def) \
191    DRI_CONF_OPT_B(allow_glsl_120_subset_in_110, def, \
192                   "Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13")
193 
194 #define DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION(def) \
195    DRI_CONF_OPT_B(allow_glsl_builtin_const_expression, def, \
196                   "Allow builtins as part of constant expressions")
197 
198 #define DRI_CONF_ALLOW_GLSL_RELAXED_ES(def) \
199    DRI_CONF_OPT_B(allow_glsl_relaxed_es, def, \
200                   "Allow some relaxation of GLSL ES shader restrictions")
201 
202 #define DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION(def) \
203    DRI_CONF_OPT_B(allow_glsl_builtin_variable_redeclaration, def, \
204                   "Allow GLSL built-in variables to be redeclared verbatim")
205 
206 #define DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION(def) \
207    DRI_CONF_OPT_B(allow_higher_compat_version, def, \
208                   "Allow a higher compat profile (version 3.1+) for apps that request it")
209 
210 #define DRI_CONF_ALLOW_GLSL_COMPAT_SHADERS(def) \
211    DRI_CONF_OPT_B(allow_glsl_compat_shaders, def, \
212                   "Allow in GLSL: #version xxx compatibility")
213 
214 #define DRI_CONF_FORCE_GLSL_ABS_SQRT(def) \
215    DRI_CONF_OPT_B(force_glsl_abs_sqrt, def,                             \
216                   "Force computing the absolute value for sqrt() and inversesqrt()")
217 
218 #define DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(def) \
219    DRI_CONF_OPT_B(glsl_correct_derivatives_after_discard, def, \
220                   "Implicit and explicit derivatives after a discard behave as if the discard didn't happen")
221 
222 #define DRI_CONF_GLSL_IGNORE_WRITE_TO_READONLY_VAR(def) \
223    DRI_CONF_OPT_B(glsl_ignore_write_to_readonly_var, def, \
224                   "Forces the GLSL compiler to ignore writes to readonly vars rather than throwing an error")
225 
226 #define DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH(def) \
227    DRI_CONF_OPT_B(allow_glsl_cross_stage_interpolation_mismatch, def,   \
228                   "Allow interpolation qualifier mismatch across shader stages")
229 
230 #define DRI_CONF_DO_DCE_BEFORE_CLIP_CULL_ANALYSIS(def) \
231    DRI_CONF_OPT_B(do_dce_before_clip_cull_analysis, def,   \
232                   "Use dead code elimitation before checking for invalid Clip*/CullDistance variables usage.")
233 
234 #define DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(def) \
235    DRI_CONF_OPT_B(allow_draw_out_of_order, def, \
236                   "Allow out-of-order draw optimizations. Set when Z fighting doesn't have to be accurate.")
237 
238 #define DRI_CONF_GLTHREAD_NOP_CHECK_FRAMEBUFFER_STATUS(def) \
239    DRI_CONF_OPT_B(glthread_nop_check_framebuffer_status, def, \
240                   "glthread always returns GL_FRAMEBUFFER_COMPLETE to prevent synchronization.")
241 
242 #define DRI_CONF_FORCE_GL_VENDOR() \
243    DRI_CONF_OPT_S_NODEF(force_gl_vendor, "Override GPU vendor string.")
244 
245 #define DRI_CONF_FORCE_GL_RENDERER() \
246    DRI_CONF_OPT_S_NODEF(force_gl_renderer, "Override GPU renderer string.")
247 
248 #define DRI_CONF_FORCE_COMPAT_PROFILE(def) \
249    DRI_CONF_OPT_B(force_compat_profile, def, \
250                   "Force an OpenGL compatibility context")
251 
252 #define DRI_CONF_FORCE_COMPAT_SHADERS(def) \
253    DRI_CONF_OPT_B(force_compat_shaders, def, \
254                   "Force OpenGL compatibility shaders")
255 
256 #define DRI_CONF_FORCE_DIRECT_GLX_CONTEXT(def) \
257    DRI_CONF_OPT_B(force_direct_glx_context, def, \
258                   "Force direct GLX context (even if indirect is requested)")
259 
260 #define DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(def) \
261    DRI_CONF_OPT_B(allow_invalid_glx_destroy_window, def, \
262                   "Allow passing an invalid window into glXDestroyWindow")
263 
264 #define DRI_CONF_KEEP_NATIVE_WINDOW_GLX_DRAWABLE(def) \
265    DRI_CONF_OPT_B(keep_native_window_glx_drawable, def, \
266                   "Keep GLX drawable created from native window when switch context")
267 
268 #define DRI_CONF_OVERRIDE_VRAM_SIZE() \
269    DRI_CONF_OPT_I(override_vram_size, -1, -1, 2147483647, \
270                   "Override the VRAM size advertised to the application in MiB (-1 = default)")
271 
272 #define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \
273    DRI_CONF_OPT_B(force_gl_names_reuse, def, "Force GL names reuse")
274 
275 #define DRI_CONF_FORCE_GL_MAP_BUFFER_SYNCHRONIZED(def) \
276    DRI_CONF_OPT_B(force_gl_map_buffer_synchronized, def, "Override GL_MAP_UNSYNCHRONIZED_BIT.")
277 
278 #define DRI_CONF_TRANSCODE_ETC(def) \
279    DRI_CONF_OPT_B(transcode_etc, def, "Transcode ETC formats to DXTC if unsupported")
280 
281 #define DRI_CONF_TRANSCODE_ASTC(def) \
282    DRI_CONF_OPT_B(transcode_astc, def, "Transcode ASTC formats to DXTC if unsupported")
283 
284 #define DRI_CONF_MESA_EXTENSION_OVERRIDE() \
285    DRI_CONF_OPT_S_NODEF(mesa_extension_override, \
286                   "Allow enabling/disabling a list of extensions")
287 
288 #define DRI_CONF_GLX_EXTENSION_OVERRIDE() \
289    DRI_CONF_OPT_S_NODEF(glx_extension_override, \
290                   "Allow enabling/disabling a list of GLX extensions")
291 
292 #define DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE() \
293    DRI_CONF_OPT_S_NODEF(indirect_gl_extension_override, \
294                   "Allow enabling/disabling a list of indirect-GL extensions")
295 
296 #define DRI_CONF_FORCE_PROTECTED_CONTENT_CHECK(def) \
297    DRI_CONF_OPT_B(force_protected_content_check, def, \
298                   "Reject image import if protected_content attribute doesn't match")
299 
300 #define DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(def) \
301    DRI_CONF_OPT_B(ignore_map_unsynchronized, def, \
302                   "Ignore GL_MAP_UNSYNCHRONIZED_BIT, workaround for games that use it incorrectly")
303 
304 #define DRI_CONF_VK_DONT_CARE_AS_LOAD(def) \
305    DRI_CONF_OPT_B(vk_dont_care_as_load, def, \
306                   "Treat VK_ATTACHMENT_LOAD_OP_DONT_CARE as LOAD_OP_LOAD, workaround on tiler GPUs for games that confuse these two load ops")
307 
308 #define DRI_CONF_LIMIT_TRIG_INPUT_RANGE(def) \
309    DRI_CONF_OPT_B(limit_trig_input_range, def, \
310                   "Limit trig input range to [-2p : 2p] to improve sin/cos calculation precision on Intel")
311 
312 #define DRI_CONF_NO_16BIT(def) \
313    DRI_CONF_OPT_B(no_16bit, def, \
314                   "Disable 16-bit instructions")
315 
316 #define DRI_CONF_IGNORE_DISCARD_FRAMEBUFFER(def) \
317    DRI_CONF_OPT_B(ignore_discard_framebuffer, def, \
318                   "Ignore glDiscardFramebuffer/glInvalidateFramebuffer, workaround for games that use it incorrectly")
319 
320 #define DRI_CONF_FORCE_VK_VENDOR() \
321    DRI_CONF_OPT_I(force_vk_vendor, 0, -1, 2147483647, "Override GPU vendor id")
322 
323 #define DRI_CONF_FAKE_SPARSE(def) \
324    DRI_CONF_OPT_B(fake_sparse, def, \
325                   "Advertise support for sparse binding of textures regardless of real support")
326 
327 #define DRI_CONF_INTEL_ENABLE_WA_14018912822(def) \
328    DRI_CONF_OPT_B(intel_enable_wa_14018912822, def, \
329                   "Intel workaround for using zero blend constants")
330 
331 #define DRI_CONF_INTEL_SAMPLER_ROUTE_TO_LSC(def) \
332    DRI_CONF_OPT_B(intel_sampler_route_to_lsc, def, \
333                   "Intel specific toggle to enable sampler route to LSC")
334 
335 #define DRI_CONF_VK_REQUIRE_ETC2(def) \
336   DRI_CONF_OPT_B(vk_require_etc2, def, \
337                  "Implement emulated ETC2 on HW that does not support it")
338 
339 #define DRI_CONF_VK_REQUIRE_ASTC(def) \
340    DRI_CONF_OPT_B(vk_require_astc, def, \
341                   "Implement emulated ASTC on HW that does not support it")
342 
343 /**
344  * \brief Image quality-related options
345  */
346 #define DRI_CONF_SECTION_QUALITY DRI_CONF_SECTION("Image Quality")
347 
348 #define DRI_CONF_PRECISE_TRIG(def) \
349    DRI_CONF_OPT_B(precise_trig, def, \
350                   "Prefer accuracy over performance in trig functions")
351 
352 #define DRI_CONF_PP_CELSHADE(def) \
353    DRI_CONF_OPT_E(pp_celshade, def, 0, 1, \
354                   "A post-processing filter to cel-shade the output", \
355                   { 0 } )
356 
357 #define DRI_CONF_PP_NORED(def) \
358    DRI_CONF_OPT_E(pp_nored, def, 0, 1, \
359                   "A post-processing filter to remove the red channel", \
360                   { 0 } )
361 
362 #define DRI_CONF_PP_NOGREEN(def) \
363    DRI_CONF_OPT_E(pp_nogreen, def, 0, 1, \
364                   "A post-processing filter to remove the green channel", \
365                   { 0 } )
366 
367 #define DRI_CONF_PP_NOBLUE(def) \
368    DRI_CONF_OPT_E(pp_noblue, def, 0, 1, \
369                   "A post-processing filter to remove the blue channel", \
370                   { 0 } )
371 
372 #define DRI_CONF_PP_JIMENEZMLAA(def,min,max) \
373    DRI_CONF_OPT_I(pp_jimenezmlaa, def, min, max, \
374                   "Morphological anti-aliasing based on Jimenez' MLAA. 0 to disable, 8 for default quality")
375 
376 #define DRI_CONF_PP_JIMENEZMLAA_COLOR(def,min,max) \
377    DRI_CONF_OPT_I(pp_jimenezmlaa_color, def, min, max, \
378                   "Morphological anti-aliasing based on Jimenez' MLAA. 0 to disable, 8 for default quality. Color version, usable with 2d GL apps")
379 
380 #define DRI_CONF_PP_LOWER_DEPTH_RANGE_RATE() \
381    DRI_CONF_OPT_F(lower_depth_range_rate, 1.0, 0.0, 1.0, \
382                   "Lower depth range for fixing misrendering issues due to z coordinate float point interpolation accuracy")
383 
384 /**
385  * \brief Performance-related options
386  */
387 #define DRI_CONF_SECTION_PERFORMANCE DRI_CONF_SECTION("Performance")
388 
389 #define DRI_CONF_VBLANK_NEVER 0
390 #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
391 #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
392 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3
393 #define DRI_CONF_VBLANK_MODE(def) \
394    DRI_CONF_OPT_E(vblank_mode, def, 0, 3, \
395                   "Synchronization with vertical refresh (swap intervals)", \
396                   DRI_CONF_ENUM(0,"Never synchronize with vertical refresh, ignore application's choice") \
397                   DRI_CONF_ENUM(1,"Initial swap interval 0, obey application's choice") \
398                   DRI_CONF_ENUM(2,"Initial swap interval 1, obey application's choice") \
399                   DRI_CONF_ENUM(3,"Always synchronize with vertical refresh, application chooses the minimum swap interval"))
400 
401 #define DRI_CONF_ADAPTIVE_SYNC(def) \
402    DRI_CONF_OPT_B(adaptive_sync,def, \
403                   "Adapt the monitor sync to the application performance (when possible)")
404 
405 #define DRI_CONF_BLOCK_ON_DEPLETED_BUFFERS(def) \
406    DRI_CONF_OPT_B(block_on_depleted_buffers, def, \
407                   "Block clients using buffer backpressure until new buffer is available to reduce latency")
408 
409 #define DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(def) \
410    DRI_CONF_OPT_B(vk_wsi_force_bgra8_unorm_first, def, \
411                   "Force vkGetPhysicalDeviceSurfaceFormatsKHR to return VK_FORMAT_B8G8R8A8_UNORM as the first format")
412 
413 #define DRI_CONF_VK_WSI_FORCE_SWAPCHAIN_TO_CURRENT_EXTENT(def) \
414    DRI_CONF_OPT_B(vk_wsi_force_swapchain_to_current_extent, def, \
415                   "Force VkSwapchainCreateInfoKHR::imageExtent to be VkSurfaceCapabilities2KHR::currentExtent")
416 
417 #define DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(def) \
418    DRI_CONF_OPT_I(vk_x11_override_min_image_count, def, 0, 999, \
419                   "Override the VkSurfaceCapabilitiesKHR::minImageCount (0 = no override)")
420 
421 #define DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(def) \
422    DRI_CONF_OPT_B(vk_x11_strict_image_count, def, \
423                   "Force the X11 WSI to create exactly the number of image specified by the application in VkSwapchainCreateInfoKHR::minImageCount")
424 
425 #define DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT(def) \
426    DRI_CONF_OPT_B(vk_x11_ensure_min_image_count, def, \
427                   "Force the X11 WSI to create at least the number of image specified by the driver in VkSurfaceCapabilitiesKHR::minImageCount")
428 
429 #define DRI_CONF_VK_X11_IGNORE_SUBOPTIMAL(def) \
430    DRI_CONF_OPT_B(vk_x11_ignore_suboptimal, def, \
431                   "Force the X11 WSI to never report VK_SUBOPTIMAL_KHR")
432 
433 #define DRI_CONF_VK_KHR_PRESENT_WAIT(def) \
434    DRI_CONF_OPT_B(vk_khr_present_wait, def, \
435                   "Expose VK_KHR_present_wait and id extensions despite them not being implemented for all supported surface types")
436 
437 #define DRI_CONF_VK_XWAYLAND_WAIT_READY(def) \
438    DRI_CONF_OPT_B(vk_xwayland_wait_ready, def, \
439                   "Wait for fences before submitting buffers to Xwayland")
440 
441 #define DRI_CONF_MESA_GLTHREAD_DRIVER(def) \
442    DRI_CONF_OPT_B(mesa_glthread_driver, def, \
443                   "Enable offloading GL driver work to a separate thread")
444 
445 #define DRI_CONF_MESA_NO_ERROR(def) \
446    DRI_CONF_OPT_B(mesa_no_error, def, \
447                   "Disable GL driver error checking")
448 
449 #define DRI_CONF_SHADER_SPILLING_RATE(def) \
450    DRI_CONF_OPT_I(shader_spilling_rate, def, 0, 100, \
451                   "Speed up shader compilation by increasing number of spilled registers after ra_allocate failure")
452 /**
453  * \brief Miscellaneous configuration options
454  */
455 #define DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_SECTION("Miscellaneous")
456 
457 #define DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(def) \
458    DRI_CONF_OPT_B(always_have_depth_buffer, def, \
459                   "Create all visuals with a depth buffer")
460 
461 #define DRI_CONF_GLSL_ZERO_INIT(def) \
462    DRI_CONF_OPT_B(glsl_zero_init, def, \
463                   "Force uninitialized variables to default to zero")
464 
465 #define DRI_CONF_VS_POSITION_ALWAYS_INVARIANT(def) \
466    DRI_CONF_OPT_B(vs_position_always_invariant, def, \
467                   "Force the vertex shader's gl_Position output to be considered 'invariant'")
468 
469 #define DRI_CONF_VS_POSITION_ALWAYS_PRECISE(def) \
470    DRI_CONF_OPT_B(vs_position_always_precise, def, \
471                   "Force the vertex shader's gl_Position output to be considered 'precise'")
472 
473 #define DRI_CONF_ALLOW_RGB10_CONFIGS(def) \
474    DRI_CONF_OPT_B(allow_rgb10_configs, def, \
475                   "Allow exposure of visuals and fbconfigs with rgb10a2 formats")
476 
477 #define DRI_CONF_ALLOW_RGB565_CONFIGS(def) \
478    DRI_CONF_OPT_B(allow_rgb565_configs, def, \
479                   "Allow exposure of visuals and fbconfigs with rgb565 formats")
480 
481 #define DRI_CONF_FORCE_INTEGER_TEX_NEAREST(def) \
482    DRI_CONF_OPT_B(force_integer_tex_nearest, def, \
483                   "Force integer textures to use nearest filtering")
484 
485 /* The GL spec does not allow this but wine has translation bug:
486    https://bugs.winehq.org/show_bug.cgi?id=54787
487 */
488 #define DRI_CONF_ALLOW_MULTISAMPLED_COPYTEXIMAGE(def) \
489    DRI_CONF_OPT_B(allow_multisampled_copyteximage, def, \
490                   "Allow CopyTexSubImage and other to copy sampled framebuffer")
491 
492 #define DRI_CONF_NO_FP16(def) \
493    DRI_CONF_OPT_B(no_fp16, def, \
494                   "Disable 16-bit float support")
495 
496 /**
497  * \brief Initialization configuration options
498  */
499 #define DRI_CONF_SECTION_INITIALIZATION DRI_CONF_SECTION("Initialization")
500 
501 #define DRI_CONF_DEVICE_ID_PATH_TAG() \
502    DRI_CONF_OPT_S_NODEF(device_id, "Define the graphic device to use if possible")
503 
504 #define DRI_CONF_DRI_DRIVER() \
505    DRI_CONF_OPT_S_NODEF(dri_driver, "Override the DRI driver to load")
506 
507 /**
508  * \brief Gallium-Nine specific configuration options
509  */
510 
511 #define DRI_CONF_SECTION_NINE DRI_CONF_SECTION("Gallium Nine")
512 
513 #define DRI_CONF_NINE_THROTTLE(def) \
514    DRI_CONF_OPT_I(throttle_value, def, 0, 0, \
515                   "Define the throttling value. -1 for no throttling, -2 for default (usually 2), 0 for glfinish behaviour")
516 
517 #define DRI_CONF_NINE_THREADSUBMIT(def) \
518    DRI_CONF_OPT_B(thread_submit, def, \
519                   "Use an additional thread to submit buffers.")
520 
521 #define DRI_CONF_NINE_OVERRIDEVENDOR(def) \
522    DRI_CONF_OPT_I(override_vendorid, def, 0, 0, \
523                   "Define the vendor_id to report. This allows faking another hardware vendor.")
524 
525 #define DRI_CONF_NINE_ALLOWDISCARDDELAYEDRELEASE(def) \
526    DRI_CONF_OPT_B(discard_delayed_release, def, \
527                   "Whether to allow the display server to release buffers with a delay when using d3d's presentation mode DISCARD. Default to true. Set to false if suffering from lag (thread_submit=true can also help in this situation).")
528 
529 #define DRI_CONF_NINE_TEARFREEDISCARD(def) \
530    DRI_CONF_OPT_B(tearfree_discard, def, \
531                   "Whether to make d3d's presentation mode DISCARD (games usually use that mode) Tear Free. If rendering above screen refresh, some frames will get skipped. true by default.")
532 
533 #define DRI_CONF_NINE_CSMT(def) \
534    DRI_CONF_OPT_I(csmt_force, def, 0, 0, \
535                   "If set to 1, force gallium nine CSMT. If set to 0, disable it. By default (-1) CSMT is enabled on known thread-safe drivers.")
536 
537 #define DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND(def) \
538    DRI_CONF_OPT_B(dynamic_texture_workaround, def, \
539                   "If set to true, use a ram intermediate buffer for dynamic textures. Increases ram usage, which can cause out of memory issues, but can fix glitches for some games.")
540 
541 #define DRI_CONF_NINE_SHADERINLINECONSTANTS(def) \
542    DRI_CONF_OPT_B(shader_inline_constants, def, \
543                   "If set to true, recompile shaders with integer or boolean constants when the values are known. Can cause stutter, but can increase slightly performance.")
544 
545 #define DRI_CONF_NINE_SHMEM_LIMIT() \
546    DRI_CONF_OPT_I(texture_memory_limit, 128, 0, 0, \
547                   "In MB the limit of virtual memory used for textures until shmem files are unmapped (default 128MB, 32bits only). If negative disables shmem. Set to a low amount to reduce virtual memory usage, but can incur a small perf hit if too low.")
548 
549 #define DRI_CONF_NINE_FORCESWRENDERINGONCPU(def) \
550    DRI_CONF_OPT_B(force_sw_rendering_on_cpu, def, \
551                   "If set to false, emulates software rendering on the requested device, else uses a software renderer.")
552 
553 #define DRI_CONF_NINE_FORCEFEATURESEMULATION(def) \
554    DRI_CONF_OPT_B(force_features_emulation, def, \
555                   "If set to true, force emulation of d3d9 features when possible instead of using native hw support.")
556 
557 #define DRI_CONF_V3D_NONMSAA_TEXTURE_SIZE_LIMIT(def) \
558    DRI_CONF_OPT_B(v3d_nonmsaa_texture_size_limit, def, \
559                   "Report the non-MSAA-only texture size limit")
560 
561 /**
562  * \brief wgl specific configuration options
563  */
564 
565 #define DRI_CONF_WGL_FRAME_LATENCY(def) \
566    DRI_CONF_OPT_I(wgl_frame_latency, def, 1, 16, \
567                   "Override default maximum frame latency")
568 
569 #define DRI_CONF_WGL_SWAP_INTERVAL(def) \
570    DRI_CONF_OPT_I(wgl_swap_interval, def, 1, 4, \
571                   "Override default swap interval")
572 
573 /**
574  * \brief virgl specific configuration options
575  */
576 
577 #define DRI_CONF_GLES_EMULATE_BGRA(def) \
578    DRI_CONF_OPT_B(gles_emulate_bgra, def, \
579                   "On GLES emulate BGRA formats by using a swizzled RGBA format")
580 
581 #define DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(def) \
582    DRI_CONF_OPT_B(gles_apply_bgra_dest_swizzle, def, \
583                   "When the BGRA formats are emulated by using swizzled RGBA formats on GLES apply the swizzle when writing")
584 
585 #define DRI_CONF_GLES_SAMPLES_PASSED_VALUE(def, minimum, maximum) \
586    DRI_CONF_OPT_I(gles_samples_passed_value, def, minimum, maximum, \
587                   "GL_SAMPLES_PASSED value when emulated by GL_ANY_SAMPLES_PASSED")
588 
589 #define DRI_CONF_FORMAT_L8_SRGB_ENABLE_READBACK(def) \
590    DRI_CONF_OPT_B(format_l8_srgb_enable_readback, def, \
591                   "Force-enable reading back L8_SRGB textures")
592 
593 #define DRI_CONF_VIRGL_SHADER_SYNC(def) \
594    DRI_CONF_OPT_B(virgl_shader_sync, def, \
595                   "Make shader compilation synchronous")
596 
597 /**
598  * \brief freedreno specific configuration options
599  */
600 
601 #define DRI_CONF_DISABLE_CONSERVATIVE_LRZ(def) \
602    DRI_CONF_OPT_B(disable_conservative_lrz, def, \
603                   "Disable conservative LRZ")
604 
605 /**
606  * \brief Turnip specific configuration options
607  */
608 
609 #define DRI_CONF_TU_DONT_RESERVE_DESCRIPTOR_SET(def) \
610    DRI_CONF_OPT_B(tu_dont_reserve_descriptor_set, def, \
611                   "Don't internally reserve one of the HW descriptor sets for descriptor set dynamic offset support, this frees up an extra descriptor set at the cost of that feature")
612 
613 #define DRI_CONF_TU_ALLOW_OOB_INDIRECT_UBO_LOADS(def) \
614    DRI_CONF_OPT_B(tu_allow_oob_indirect_ubo_loads, def, \
615                   "Some D3D11 games rely on out-of-bounds indirect UBO loads to return real values from underlying bound descriptor, this prevents us from lowering indirectly accessed UBOs to consts")
616 
617 #define DRI_CONF_TU_DISABLE_D24S8_BORDER_COLOR_WORKAROUND(def) \
618    DRI_CONF_OPT_B(tu_disable_d24s8_border_color_workaround, def, \
619                   "Use UBWC for D24S8 images with VK_IMAGE_USAGE_SAMPLED_BIT when customBorderColorWithoutFormat is enabled")
620 
621 /**
622  * \brief venus specific configuration options
623  */
624 #define DRI_CONF_VENUS_IMPLICIT_FENCING(def) \
625    DRI_CONF_OPT_B(venus_implicit_fencing, def, \
626                   "Assume the virtio-gpu kernel driver supports implicit fencing")
627 
628 #define DRI_CONF_VENUS_WSI_MULTI_PLANE_MODIFIERS(def) \
629    DRI_CONF_OPT_B(venus_wsi_multi_plane_modifiers, def, \
630                   "Enable support of multi-plane format modifiers for wsi images")
631 
632 /**
633  * \brief RADV specific configuration options
634  */
635 
636 #define DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING(def) \
637    DRI_CONF_OPT_B(radv_report_llvm9_version_string, def, \
638                   "Report LLVM 9.0.1 for games that apply shader workarounds if missing (for ACO only)")
639 
640 #define DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP(def) \
641    DRI_CONF_OPT_B(radv_enable_mrt_output_nan_fixup, def, \
642                   "Replace NaN outputs from fragment shaders with zeroes for floating point render target")
643 
644 #define DRI_CONF_RADV_NO_DYNAMIC_BOUNDS(def) \
645    DRI_CONF_OPT_B(radv_no_dynamic_bounds, def, \
646                   "Disabling bounds checking for dynamic buffer descriptors")
647 
648 #define DRI_CONF_RADV_DISABLE_SHRINK_IMAGE_STORE(def) \
649    DRI_CONF_OPT_B(radv_disable_shrink_image_store, def, \
650                   "Disabling shrinking of image stores based on the format")
651 
652 #define DRI_CONF_RADV_OVERRIDE_UNIFORM_OFFSET_ALIGNMENT(def) \
653    DRI_CONF_OPT_I(radv_override_uniform_offset_alignment, def, 0, 128, \
654                   "Override the minUniformBufferOffsetAlignment exposed to the application. (0 = default)")
655 
656 #define DRI_CONF_RADV_ZERO_VRAM(def) \
657    DRI_CONF_OPT_B(radv_zero_vram, def, \
658                   "Initialize to zero all VRAM allocations")
659 
660 #define DRI_CONF_RADV_INVARIANT_GEOM(def) \
661    DRI_CONF_OPT_B(radv_invariant_geom, def, \
662                   "Mark geometry-affecting outputs as invariant")
663 
664 #define DRI_CONF_RADV_SPLIT_FMA(def) \
665    DRI_CONF_OPT_B(radv_split_fma, def, \
666                   "Split application-provided fused multiply-add in geometry stages")
667 
668 #define DRI_CONF_RADV_DISABLE_TC_COMPAT_HTILE_GENERAL(def) \
669    DRI_CONF_OPT_B(radv_disable_tc_compat_htile_general, def, \
670                   "Disable TC-compat HTILE in GENERAL layout")
671 
672 #define DRI_CONF_RADV_DISABLE_DCC(def) \
673    DRI_CONF_OPT_B(radv_disable_dcc, def, \
674                   "Disable DCC for color images")
675 
676 #define DRI_CONF_RADV_DISABLE_ANISO_SINGLE_LEVEL(def) \
677   DRI_CONF_OPT_B(radv_disable_aniso_single_level, def, \
678                  "Disable anisotropic filtering for single level images")
679 
680 #define DRI_CONF_RADV_DISABLE_TRUNC_COORD(def) \
681   DRI_CONF_OPT_B(radv_disable_trunc_coord, def, \
682                  "Disable TRUNC_COORD to use D3D10/11/12 point sampling behaviour. This has special behaviour for DXVK.")
683 
684 #define DRI_CONF_RADV_DISABLE_SINKING_LOAD_INPUT_FS(def) \
685    DRI_CONF_OPT_B(radv_disable_sinking_load_input_fs, def, \
686                   "Disable sinking load inputs for fragment shaders")
687 
688 #define DRI_CONF_RADV_DISABLE_DEPTH_STORAGE(def) \
689   DRI_CONF_OPT_B(radv_disable_depth_storage, def, \
690                  "Hides support for storage access to depth formats")
691 
692 #define DRI_CONF_RADV_DGC(def) \
693    DRI_CONF_OPT_B(radv_dgc, def, \
694                   "Expose an experimental implementation of VK_NV_device_generated_commands")
695 
696 #define DRI_CONF_RADV_FLUSH_BEFORE_QUERY_COPY(def) \
697   DRI_CONF_OPT_B( \
698       radv_flush_before_query_copy, def, \
699       "Wait for timestamps to be written before a query copy command")
700 
701 #define DRI_CONF_RADV_ENABLE_UNIFIED_HEAP_ON_APU(def) \
702    DRI_CONF_OPT_B(radv_enable_unified_heap_on_apu, def, \
703                   "Enable an unified heap with DEVICE_LOCAL on integrated GPUs")
704 
705 #define DRI_CONF_RADV_TEX_NON_UNIFORM(def) \
706    DRI_CONF_OPT_B(radv_tex_non_uniform, def, \
707                   "Always mark texture sample operations as non-uniform.")
708 
709 #define DRI_CONF_RADV_SSBO_NON_UNIFORM(def) \
710    DRI_CONF_OPT_B(radv_ssbo_non_uniform, def, \
711                   "Always mark SSBO operations as non-uniform.")
712 
713 #define DRI_CONF_RADV_FLUSH_BEFORE_TIMESTAMP_WRITE(def) \
714    DRI_CONF_OPT_B(radv_flush_before_timestamp_write, def, \
715                   "Wait for previous commands to finish before writing timestamps")
716 
717 #define DRI_CONF_RADV_RT_WAVE64(def) \
718    DRI_CONF_OPT_B(radv_rt_wave64, def, \
719                   "Force wave64 in RT shaders")
720 
721 #define DRI_CONF_RADV_LEGACY_SPARSE_BINDING(def) \
722    DRI_CONF_OPT_B(radv_legacy_sparse_binding, def, \
723                   "Enable legacy sparse binding (with implicit synchronization) on the graphics and compute queue")
724 
725 #define DRI_CONF_RADV_FORCE_PSTATE_PEAK_GFX11_DGPU(def) \
726    DRI_CONF_OPT_B(radv_force_pstate_peak_gfx11_dgpu, def, \
727                   "Force the performance level to profile_peak (all clocks to the highest levels) for RDNA3 dGPUs")
728 
729 /**
730  * Overrides for forcing re-compilation of pipelines when RADV_BUILD_ID_OVERRIDE is enabled.
731  * These need to be bumped every time a compiler bugfix is backported (up to 8 shader
732  * versions are supported).
733  */
734 #define DRI_CONF_RADV_OVERRIDE_GRAPHICS_SHADER_VERSION(def) \
735    DRI_CONF_OPT_I(radv_override_graphics_shader_version, def, 0, 7, \
736                   "Override the shader version of graphics pipelines to force re-compilation. (0 = default)")
737 
738 #define DRI_CONF_RADV_OVERRIDE_COMPUTE_SHADER_VERSION(def) \
739    DRI_CONF_OPT_I(radv_override_compute_shader_version, def, 0, 7, \
740                   "Override the shader version of compute pipelines to force re-compilation. (0 = default)")
741 
742 #define DRI_CONF_RADV_OVERRIDE_RAY_TRACING_SHADER_VERSION(def) \
743    DRI_CONF_OPT_I(radv_override_ray_tracing_shader_version, def, 0, 7, \
744                   "Override the shader version of ray tracing pipelines to force re-compilation. (0 = default)")
745 
746 #define DRI_CONF_RADV_APP_LAYER() DRI_CONF_OPT_S_NODEF(radv_app_layer, "Select an application layer.")
747 
748 #define DRI_CONF_RADV_CLEAR_LDS(def) \
749    DRI_CONF_OPT_B(radv_clear_lds, def, "Clear LDS at the end of shaders. Might decrease performance.")
750 
751 #define DRI_CONF_RADV_DISABLE_NGG_GS(def) \
752    DRI_CONF_OPT_B(radv_disable_ngg_gs, def, "Disable NGG GS on GFX10/GFX10.3.")
753 
754 /**
755  * \brief ANV specific configuration options
756  */
757 
758 #define DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS(def) \
759    DRI_CONF_OPT_I(anv_assume_full_subgroups, def, 0, 32, \
760                   "Allow assuming full subgroups requirement even when it's not specified explicitly and set the given size")
761 
762 #define DRI_CONF_ANV_ASSUME_FULL_SUBGROUPS_WITH_BARRIER(def) \
763    DRI_CONF_OPT_B(anv_assume_full_subgroups_with_barrier, def, \
764                   "Assume full subgroups requirement for compute shaders that use control barriers")
765 
766 #define DRI_CONF_ANV_SAMPLE_MASK_OUT_OPENGL_BEHAVIOUR(def) \
767    DRI_CONF_OPT_B(anv_sample_mask_out_opengl_behaviour, def, \
768                   "Ignore sample mask out when having single sampled target")
769 
770 #define DRI_CONF_ANV_FORCE_FILTER_ADDR_ROUNDING(def) \
771    DRI_CONF_OPT_B(anv_force_filter_addr_rounding, def, \
772                   "Force min/mag filter address rounding to be enabled even for NEAREST sampling")
773 
774 #define DRI_CONF_ANV_MESH_CONV_PRIM_ATTRS_TO_VERT_ATTRS(def) \
775    DRI_CONF_OPT_E(anv_mesh_conv_prim_attrs_to_vert_attrs, def, -2, 2, \
776                   "Apply workaround for gfx12.5 per-prim attribute corruption HW bug", \
777                   DRI_CONF_ENUM(-2, "enable attribute conversion and vertex duplication ONLY if needed") \
778                   DRI_CONF_ENUM(-1, "enable attribute conversion ONLY if needed") \
779                   DRI_CONF_ENUM(0,  "disable workaround") \
780                   DRI_CONF_ENUM(1,  "enable attribute conversion ALWAYS") \
781                   DRI_CONF_ENUM(2,  "enable attribute conversion and vertex duplication ALWAYS") )
782 
783 #define DRI_CONF_ANV_FP64_WORKAROUND_ENABLED(def) \
784    DRI_CONF_OPT_B(fp64_workaround_enabled, def, \
785                   "Use softpf64 when the shader uses float64, but the device doesn't support that type")
786 
787 #define DRI_CONF_ANV_GENERATED_INDIRECT_THRESHOLD(def) \
788    DRI_CONF_OPT_I(generated_indirect_threshold, def, 0, INT32_MAX, \
789                   "Indirect threshold count above which we start generating commands")
790 
791 #define DRI_CONF_ANV_GENERATED_INDIRECT_RING_THRESHOLD(def) \
792    DRI_CONF_OPT_I(generated_indirect_ring_threshold, def, 0, INT32_MAX, \
793                   "Indirect threshold count above which we start generating commands in a ring buffer")
794 
795 #define DRI_CONF_ANV_QUERY_CLEAR_WITH_BLORP_THRESHOLD(def) \
796    DRI_CONF_OPT_I(query_clear_with_blorp_threshold, def, 0, INT32_MAX, \
797                   "Query threshold count above which query buffers are cleared with blorp")
798 
799 #define DRI_CONF_ANV_QUERY_COPY_WITH_SHADER_THRESHOLD(def) \
800    DRI_CONF_OPT_I(query_copy_with_shader_threshold, def, 0, INT32_MAX, \
801                   "Query threshold count above which query copies are executed with a shader")
802 
803 #define DRI_CONF_ANV_FORCE_INDIRECT_DESCRIPTORS(def) \
804    DRI_CONF_OPT_B(force_indirect_descriptors, def, \
805                   "Use an indirection to access buffer/image/texture/sampler handles")
806 
807 #define DRI_CONF_ANV_DISABLE_FCV(def) \
808    DRI_CONF_OPT_B(anv_disable_fcv, def, \
809                   "Disable FCV optimization")
810 
811 #define DRI_CONF_ANV_DISABLE_XE2_CCS(def) \
812    DRI_CONF_OPT_B(anv_disable_xe2_ccs, def, \
813                   "Disable CCS optimization on Xe2")
814 
815 #define DRI_CONF_ANV_EXTERNAL_MEMORY_IMPLICIT_SYNC(def) \
816    DRI_CONF_OPT_B(anv_external_memory_implicit_sync, def, "Implicit sync on external BOs")
817 
818 #define DRI_CONF_ANV_COMPRESSION_CONTROL_ENABLED(def) \
819    DRI_CONF_OPT_B(compression_control_enabled, def, "Enable VK_EXT_image_compression_control support")
820 
821 #define DRI_CONF_ANV_FAKE_NONLOCAL_MEMORY(def) \
822    DRI_CONF_OPT_B(anv_fake_nonlocal_memory, def, \
823                   "Present host-visible device-local memory types as non device-local")
824 
825 /**
826  * \brief HASVK specific configuration options
827  */
828 
829 #define DRI_CONF_HASVK_OVERRIDE_API_VERSION(def) \
830    DRI_CONF_OPT_B(hasvk_report_vk_1_3_version, def, \
831                   "Override intel_hasvk API version")
832 
833 #define DRI_CONF_ANV_FORCE_GUC_LOW_LATENCY(def) \
834    DRI_CONF_OPT_B(force_guc_low_latency, def, \
835                   "Enable low latency GuC strategy. Only supported on i915.")
836 
837 /**
838  * \brief DZN specific configuration options
839  */
840 
841 #define DRI_CONF_DZN_CLAIM_WIDE_LINES(def) \
842    DRI_CONF_OPT_B(dzn_claim_wide_lines, def, "Claim wide line support")
843 
844 #define DRI_CONF_DZN_ENABLE_8BIT_LOADS_STORES(def) \
845    DRI_CONF_OPT_B(dzn_enable_8bit_loads_stores, def, "Enable VK_KHR_8bit_loads_stores")
846 
847 #define DRI_CONF_DZN_DISABLE(def) \
848    DRI_CONF_OPT_B(dzn_disable, def, "Fail instance creation")
849 
850 #endif
851