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 /** 122 * \brief Debugging options 123 */ 124 #define DRI_CONF_SECTION_DEBUG DRI_CONF_SECTION("Debugging") 125 126 #define DRI_CONF_ALWAYS_FLUSH_BATCH(def) \ 127 DRI_CONF_OPT_B(always_flush_batch, def, \ 128 "Enable flushing batchbuffer after each draw call") 129 130 #define DRI_CONF_ALWAYS_FLUSH_CACHE(def) \ 131 DRI_CONF_OPT_B(always_flush_cache, def, \ 132 "Enable flushing GPU caches with each draw call") 133 134 #define DRI_CONF_DISABLE_THROTTLING(def) \ 135 DRI_CONF_OPT_B(disable_throttling, def, \ 136 "Disable throttling on first batch after flush") 137 138 #define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ 139 DRI_CONF_OPT_B(force_glsl_extensions_warn, def, \ 140 "Force GLSL extension default behavior to 'warn'") 141 142 #define DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(def) \ 143 DRI_CONF_OPT_B(disable_blend_func_extended, def, \ 144 "Disable dual source blending") 145 146 #define DRI_CONF_DISABLE_ARB_GPU_SHADER5(def) \ 147 DRI_CONF_OPT_B(disable_arb_gpu_shader5, def, \ 148 "Disable GL_ARB_gpu_shader5") 149 150 #define DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(def) \ 151 DRI_CONF_OPT_B(dual_color_blend_by_location, def, \ 152 "Identify dual color blending sources by location rather than index") 153 154 #define DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(def) \ 155 DRI_CONF_OPT_B(disable_glsl_line_continuations, def, \ 156 "Disable backslash-based line continuations in GLSL source") 157 158 #define DRI_CONF_FORCE_GLSL_VERSION(def) \ 159 DRI_CONF_OPT_I(force_glsl_version, def, 0, 999, \ 160 "Force a default GLSL version for shaders that lack an explicit #version line") 161 162 #define DRI_CONF_ALLOW_EXTRA_PP_TOKENS(def) \ 163 DRI_CONF_OPT_B(allow_extra_pp_tokens, def, \ 164 "Allow extra tokens at end of preprocessor directives.") 165 166 #define DRI_CONF_ALLOW_GLSL_EXTENSION_DIRECTIVE_MIDSHADER(def) \ 167 DRI_CONF_OPT_B(allow_glsl_extension_directive_midshader, def, \ 168 "Allow GLSL #extension directives in the middle of shaders") 169 170 #define DRI_CONF_ALLOW_GLSL_120_SUBSET_IN_110(def) \ 171 DRI_CONF_OPT_B(allow_glsl_120_subset_in_110, def, \ 172 "Allow a subset of GLSL 1.20 in GLSL 1.10 as needed by SPECviewperf13") 173 174 #define DRI_CONF_ALLOW_GLSL_BUILTIN_CONST_EXPRESSION(def) \ 175 DRI_CONF_OPT_B(allow_glsl_builtin_const_expression, def, \ 176 "Allow builtins as part of constant expressions") 177 178 #define DRI_CONF_ALLOW_GLSL_RELAXED_ES(def) \ 179 DRI_CONF_OPT_B(allow_glsl_relaxed_es, def, \ 180 "Allow some relaxation of GLSL ES shader restrictions") 181 182 #define DRI_CONF_ALLOW_GLSL_BUILTIN_VARIABLE_REDECLARATION(def) \ 183 DRI_CONF_OPT_B(allow_glsl_builtin_variable_redeclaration, def, \ 184 "Allow GLSL built-in variables to be redeclared verbatim") 185 186 #define DRI_CONF_ALLOW_HIGHER_COMPAT_VERSION(def) \ 187 DRI_CONF_OPT_B(allow_higher_compat_version, def, \ 188 "Allow a higher compat profile (version 3.1+) for apps that request it") 189 190 #define DRI_CONF_FORCE_GLSL_ABS_SQRT(def) \ 191 DRI_CONF_OPT_B(force_glsl_abs_sqrt, def, \ 192 "Force computing the absolute value for sqrt() and inversesqrt()") 193 194 #define DRI_CONF_GLSL_CORRECT_DERIVATIVES_AFTER_DISCARD(def) \ 195 DRI_CONF_OPT_B(glsl_correct_derivatives_after_discard, def, \ 196 "Implicit and explicit derivatives after a discard behave as if the discard didn't happen") 197 198 #define DRI_CONF_ALLOW_GLSL_CROSS_STAGE_INTERPOLATION_MISMATCH(def) \ 199 DRI_CONF_OPT_B(allow_glsl_cross_stage_interpolation_mismatch, def, \ 200 "Allow interpolation qualifier mismatch across shader stages") 201 202 #define DRI_CONF_ALLOW_DRAW_OUT_OF_ORDER(def) \ 203 DRI_CONF_OPT_B(allow_draw_out_of_order, def, \ 204 "Allow out-of-order draw optimizations. Set when Z fighting doesn't have to be accurate.") 205 206 #define DRI_CONF_FORCE_GL_VENDOR(def) \ 207 DRI_CONF_OPT_S(force_gl_vendor, def, "Override GPU vendor string.") 208 209 #define DRI_CONF_FORCE_COMPAT_PROFILE(def) \ 210 DRI_CONF_OPT_B(force_compat_profile, def, \ 211 "Force an OpenGL compatibility context") 212 213 #define DRI_CONF_OVERRIDE_VRAM_SIZE() \ 214 DRI_CONF_OPT_I(override_vram_size, -1, -1, 2147483647, \ 215 "Override the VRAM size advertised to the application in MiB (-1 = default)") 216 217 #define DRI_CONF_FORCE_GL_NAMES_REUSE(def) \ 218 DRI_CONF_OPT_B(force_gl_names_reuse, def, "Force GL names reuse") 219 220 #define DRI_CONF_GLX_EXTENSION_OVERRIDE(def) \ 221 DRI_CONF_OPT_S(glx_extension_override, def, \ 222 "Allow enabling/disabling a list of GLX extensions") 223 224 #define DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE(def) \ 225 DRI_CONF_OPT_S(indirect_gl_extension_override, def, \ 226 "Allow enabling/disabling a list of indirect-GL extensions") 227 228 #define DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(def) \ 229 DRI_CONF_OPT_B(disable_protected_content_check, def, \ 230 "Don't reject image import if protected_content attribute doesn't match") 231 232 /** 233 * \brief Image quality-related options 234 */ 235 #define DRI_CONF_SECTION_QUALITY DRI_CONF_SECTION("Image Quality") 236 237 #define DRI_CONF_PRECISE_TRIG(def) \ 238 DRI_CONF_OPT_B(precise_trig, def, \ 239 "Prefer accuracy over performance in trig functions") 240 241 #define DRI_CONF_PP_CELSHADE(def) \ 242 DRI_CONF_OPT_E(pp_celshade, def, 0, 1, \ 243 "A post-processing filter to cel-shade the output", \ 244 ) 245 246 #define DRI_CONF_PP_NORED(def) \ 247 DRI_CONF_OPT_E(pp_nored, def, 0, 1, \ 248 "A post-processing filter to remove the red channel", \ 249 ) 250 251 #define DRI_CONF_PP_NOGREEN(def) \ 252 DRI_CONF_OPT_E(pp_nogreen, def, 0, 1, \ 253 "A post-processing filter to remove the green channel", \ 254 ) 255 256 #define DRI_CONF_PP_NOBLUE(def) \ 257 DRI_CONF_OPT_E(pp_noblue, def, 0, 1, \ 258 "A post-processing filter to remove the blue channel", \ 259 ) 260 261 #define DRI_CONF_PP_JIMENEZMLAA(def,min,max) \ 262 DRI_CONF_OPT_I(pp_jimenezmlaa, def, min, max, \ 263 "Morphological anti-aliasing based on Jimenez' MLAA. 0 to disable, 8 for default quality") 264 265 #define DRI_CONF_PP_JIMENEZMLAA_COLOR(def,min,max) \ 266 DRI_CONF_OPT_I(pp_jimenezmlaa_color, def, min, max, \ 267 "Morphological anti-aliasing based on Jimenez' MLAA. 0 to disable, 8 for default quality. Color version, usable with 2d GL apps") 268 269 /** 270 * \brief Performance-related options 271 */ 272 #define DRI_CONF_SECTION_PERFORMANCE DRI_CONF_SECTION("Performance") 273 274 #define DRI_CONF_VBLANK_NEVER 0 275 #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1 276 #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2 277 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3 278 #define DRI_CONF_VBLANK_MODE(def) \ 279 DRI_CONF_OPT_E(vblank_mode, def, 0, 3, \ 280 "Synchronization with vertical refresh (swap intervals)", \ 281 DRI_CONF_ENUM(0,"Never synchronize with vertical refresh, ignore application's choice") \ 282 DRI_CONF_ENUM(1,"Initial swap interval 0, obey application's choice") \ 283 DRI_CONF_ENUM(2,"Initial swap interval 1, obey application's choice") \ 284 DRI_CONF_ENUM(3,"Always synchronize with vertical refresh, application chooses the minimum swap interval")) 285 286 #define DRI_CONF_ADAPTIVE_SYNC(def) \ 287 DRI_CONF_OPT_B(adaptive_sync,def, \ 288 "Adapt the monitor sync to the application performance (when possible)") 289 290 #define DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(def) \ 291 DRI_CONF_OPT_B(vk_wsi_force_bgra8_unorm_first, def, \ 292 "Force vkGetPhysicalDeviceSurfaceFormatsKHR to return VK_FORMAT_B8G8R8A8_UNORM as the first format") 293 294 #define DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(def) \ 295 DRI_CONF_OPT_I(vk_x11_override_min_image_count, def, 0, 999, \ 296 "Override the VkSurfaceCapabilitiesKHR::minImageCount (0 = no override)") 297 298 #define DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(def) \ 299 DRI_CONF_OPT_B(vk_x11_strict_image_count, def, \ 300 "Force the X11 WSI to create exactly the number of image specified by the application in VkSwapchainCreateInfoKHR::minImageCount") 301 302 #define DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT(def) \ 303 DRI_CONF_OPT_B(vk_x11_ensure_min_image_count, def, \ 304 "Force the X11 WSI to create at least the number of image specified by the driver in VkSurfaceCapabilitiesKHR::minImageCount") 305 306 #define DRI_CONF_MESA_GLTHREAD(def) \ 307 DRI_CONF_OPT_B(mesa_glthread, def, \ 308 "Enable offloading GL driver work to a separate thread") 309 310 #define DRI_CONF_MESA_NO_ERROR(def) \ 311 DRI_CONF_OPT_B(mesa_no_error, def, \ 312 "Disable GL driver error checking") 313 314 #define DRI_CONF_DISABLE_EXT_BUFFER_AGE(def) \ 315 DRI_CONF_OPT_B(glx_disable_ext_buffer_age, def, \ 316 "Disable the GLX_EXT_buffer_age extension") 317 318 #define DRI_CONF_DISABLE_OML_SYNC_CONTROL(def) \ 319 DRI_CONF_OPT_B(glx_disable_oml_sync_control, def, \ 320 "Disable the GLX_OML_sync_control extension") 321 322 #define DRI_CONF_DISABLE_SGI_VIDEO_SYNC(def) \ 323 DRI_CONF_OPT_B(glx_disable_sgi_video_sync, def, \ 324 "Disable the GLX_SGI_video_sync extension") 325 326 327 328 /** 329 * \brief Miscellaneous configuration options 330 */ 331 #define DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_SECTION("Miscellaneous") 332 333 #define DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER(def) \ 334 DRI_CONF_OPT_B(always_have_depth_buffer, def, \ 335 "Create all visuals with a depth buffer") 336 337 #define DRI_CONF_GLSL_ZERO_INIT(def) \ 338 DRI_CONF_OPT_B(glsl_zero_init, def, \ 339 "Force uninitialized variables to default to zero") 340 341 #define DRI_CONF_VS_POSITION_ALWAYS_INVARIANT(def) \ 342 DRI_CONF_OPT_B(vs_position_always_invariant, def, \ 343 "Force the vertex shader's gl_Position output to be considered 'invariant'") 344 345 #define DRI_CONF_ALLOW_RGB10_CONFIGS(def) \ 346 DRI_CONF_OPT_B(allow_rgb10_configs, def, \ 347 "Allow exposure of visuals and fbconfigs with rgb10a2 formats") 348 349 #define DRI_CONF_ALLOW_RGB565_CONFIGS(def) \ 350 DRI_CONF_OPT_B(allow_rgb565_configs, def, \ 351 "Allow exposure of visuals and fbconfigs with rgb565 formats") 352 353 #define DRI_CONF_ALLOW_FP16_CONFIGS(def) \ 354 DRI_CONF_OPT_B(allow_fp16_configs, def, \ 355 "Allow exposure of visuals and fbconfigs with fp16 formats") 356 357 #define DRI_CONF_FORCE_INTEGER_TEX_NEAREST(def) \ 358 DRI_CONF_OPT_B(force_integer_tex_nearest, def, \ 359 "Force integer textures to use nearest filtering") 360 361 /** 362 * \brief Initialization configuration options 363 */ 364 #define DRI_CONF_SECTION_INITIALIZATION DRI_CONF_SECTION("Initialization") 365 366 #define DRI_CONF_DEVICE_ID_PATH_TAG(def) \ 367 DRI_CONF_OPT_S(device_id, def, "Define the graphic device to use if possible") 368 369 #define DRI_CONF_DRI_DRIVER(def) \ 370 DRI_CONF_OPT_S(dri_driver, def, "Override the DRI driver to load") 371 372 /** 373 * \brief Gallium-Nine specific configuration options 374 */ 375 376 #define DRI_CONF_SECTION_NINE DRI_CONF_SECTION("Gallium Nine") 377 378 #define DRI_CONF_NINE_THROTTLE(def) \ 379 DRI_CONF_OPT_I(throttle_value, def, 0, 0, \ 380 "Define the throttling value. -1 for no throttling, -2 for default (usually 2), 0 for glfinish behaviour") 381 382 #define DRI_CONF_NINE_THREADSUBMIT(def) \ 383 DRI_CONF_OPT_B(thread_submit, def, \ 384 "Use an additional thread to submit buffers.") 385 386 #define DRI_CONF_NINE_OVERRIDEVENDOR(def) \ 387 DRI_CONF_OPT_I(override_vendorid, def, 0, 0, \ 388 "Define the vendor_id to report. This allows faking another hardware vendor.") 389 390 #define DRI_CONF_NINE_ALLOWDISCARDDELAYEDRELEASE(def) \ 391 DRI_CONF_OPT_B(discard_delayed_release, def, \ 392 "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).") 393 394 #define DRI_CONF_NINE_TEARFREEDISCARD(def) \ 395 DRI_CONF_OPT_B(tearfree_discard, def, \ 396 "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. false by default.") 397 398 #define DRI_CONF_NINE_CSMT(def) \ 399 DRI_CONF_OPT_I(csmt_int, def, 0, 0, \ 400 "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.") 401 402 #define DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND(def) \ 403 DRI_CONF_OPT_B(dynamic_texture_workaround, def, \ 404 "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.") 405 406 #define DRI_CONF_NINE_SHADERINLINECONSTANTS(def) \ 407 DRI_CONF_OPT_B(shader_inline_constants, def, \ 408 "If set to true, recompile shaders with integer or boolean constants when the values are known. Can cause stutter, but can increase slightly performance.") 409 410 /** 411 * \brief radeonsi specific configuration options 412 */ 413 414 #define DRI_CONF_RADEONSI_ASSUME_NO_Z_FIGHTS(def) \ 415 DRI_CONF_OPT_B(radeonsi_assume_no_z_fights, def, \ 416 "Assume no Z fights (enables aggressive out-of-order rasterization to improve performance; may cause rendering errors)") 417 418 #define DRI_CONF_RADEONSI_COMMUTATIVE_BLEND_ADD(def) \ 419 DRI_CONF_OPT_B(radeonsi_commutative_blend_add, def, \ 420 "Commutative additive blending optimizations (may cause rendering errors)") 421 422 #define DRI_CONF_RADEONSI_ZERO_ALL_VRAM_ALLOCS(def) \ 423 DRI_CONF_OPT_B(radeonsi_zerovram, def, \ 424 "Zero all vram allocations") 425 426 #define DRI_CONF_V3D_NONMSAA_TEXTURE_SIZE_LIMIT(def) \ 427 DRI_CONF_OPT_B(v3d_nonmsaa_texture_size_limit, def, \ 428 "Report the non-MSAA-only texture size limit") 429 430 /** 431 * \brief virgl specific configuration options 432 */ 433 434 #define DRI_CONF_GLES_EMULATE_BGRA(def) \ 435 DRI_CONF_OPT_B(gles_emulate_bgra, def, \ 436 "On GLES emulate BGRA formats by using a swizzled RGBA format") 437 438 #define DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(def) \ 439 DRI_CONF_OPT_B(gles_apply_bgra_dest_swizzle, def, \ 440 "When the BGRA formats are emulated by using swizzled RGBA formats on GLES apply the swizzle when writing") 441 442 #define DRI_CONF_GLES_SAMPLES_PASSED_VALUE(def, minimum, maximum) \ 443 DRI_CONF_OPT_I(gles_samples_passed_value, def, minimum, maximum, \ 444 "GL_SAMPLES_PASSED value when emulated by GL_ANY_SAMPLES_PASSED") 445 446 /** 447 * \brief RADV specific configuration options 448 */ 449 450 #define DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING(def) \ 451 DRI_CONF_OPT_B(radv_report_llvm9_version_string, def, \ 452 "Report LLVM 9.0.1 for games that apply shader workarounds if missing (for ACO only)") 453 454 #define DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP(def) \ 455 DRI_CONF_OPT_B(radv_enable_mrt_output_nan_fixup, def, \ 456 "Replace NaN outputs from fragment shaders with zeroes for floating point render target") 457 458 #define DRI_CONF_RADV_NO_DYNAMIC_BOUNDS(def) \ 459 DRI_CONF_OPT_B(radv_no_dynamic_bounds, def, \ 460 "Disabling bounds checking for dynamic buffer descriptors") 461 462 #define DRI_CONF_RADV_OVERRIDE_UNIFORM_OFFSET_ALIGNMENT(def) \ 463 DRI_CONF_OPT_I(radv_override_uniform_offset_alignment, def, 0, 128, \ 464 "Override the minUniformBufferOffsetAlignment exposed to the application. (0 = default)") 465 466 #endif 467