summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIllia Abernikhin <illia.abernikhin@globallogic.com>2022-09-13 12:49:56 +0300
committerMarge Bot <emma+marge@anholt.net>2022-11-02 07:25:39 +0000
commitaa4ac5ff8bb8932c451c515fb9359bdecc9047f7 (patch)
tree9f81da013602131ac4682410bd65f43a5d324472 /src
parent0e47171abea1afe89c0e368a0a6c8867de69fa68 (diff)
utils: Merge util/debug.* into util/u_debug.* and remove util/debug.*
Rename env_var_as_unsigned() -> debug_get_num_option(), because duplicate Rename env_var_as_bool() -> debug_get_bool_option(), because duplicate Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7177 Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19336>
Diffstat (limited to 'src')
-rw-r--r--src/amd/compiler/aco_ir.cpp2
-rw-r--r--src/amd/vulkan/radv_device.c3
-rw-r--r--src/amd/vulkan/radv_image.c2
-rw-r--r--src/amd/vulkan/radv_pipeline.c2
-rw-r--r--src/amd/vulkan/radv_pipeline_cache.c2
-rw-r--r--src/amd/vulkan/radv_shader.c2
-rw-r--r--src/broadcom/vulkan/v3dv_device.c2
-rw-r--r--src/compiler/glsl/ir_validate.cpp4
-rw-r--r--src/compiler/nir/nir.h2
-rw-r--r--src/compiler/spirv/vtn_cfg.c4
-rw-r--r--src/egl/drivers/dri2/platform_device.c4
-rw-r--r--src/egl/drivers/dri2/platform_x11.c6
-rw-r--r--src/egl/main/eglapi.c6
-rw-r--r--src/freedreno/ir3/ir3_nir.c4
-rw-r--r--src/freedreno/vulkan/tu_device.c2
-rw-r--r--src/freedreno/vulkan/tu_drm.c4
-rw-r--r--src/freedreno/vulkan/tu_image.c2
-rw-r--r--src/freedreno/vulkan/tu_kgsl.c4
-rw-r--r--src/freedreno/vulkan/tu_pipeline.c2
-rw-r--r--src/gallium/auxiliary/nir/nir_to_tgsi.c2
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c2
-rw-r--r--src/gallium/auxiliary/target-helpers/inline_sw_helper.h3
-rw-r--r--src/gallium/auxiliary/target-helpers/sw_helper.h3
-rw-r--r--src/gallium/drivers/crocus/crocus_bufmgr.c2
-rw-r--r--src/gallium/drivers/crocus/crocus_program.c4
-rw-r--r--src/gallium/drivers/crocus/crocus_screen.c4
-rw-r--r--src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp2
-rw-r--r--src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp4
-rw-r--r--src/gallium/drivers/d3d12/d3d12_screen.cpp2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c6
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.h2
-rw-r--r--src/gallium/drivers/iris/iris_batch.c4
-rw-r--r--src/gallium/drivers/iris/iris_bufmgr.c2
-rw-r--r--src/gallium/drivers/iris/iris_context.c2
-rw-r--r--src/gallium/drivers/iris/iris_measure.c2
-rw-r--r--src/gallium/drivers/iris/iris_program.c4
-rw-r--r--src/gallium/drivers/iris/iris_screen.c6
-rw-r--r--src/gallium/frontends/dri/dri_context.c4
-rw-r--r--src/gallium/frontends/wgl/stw_device.c3
-rw-r--r--src/gallium/targets/wgl/wgl.c3
-rw-r--r--src/gbm/backends/dri/gbm_dri.c4
-rw-r--r--src/glx/apple/apple_glx_context.c2
-rw-r--r--src/glx/apple/apple_glx_log.c2
-rw-r--r--src/glx/apple/apple_glx_pbuffer.c2
-rw-r--r--src/glx/apple/apple_visual.c6
-rw-r--r--src/glx/drisw_glx.c2
-rw-r--r--src/glx/glxcmds.c4
-rw-r--r--src/glx/glxext.c12
-rw-r--r--src/glx/indirect_glx.c4
-rw-r--r--src/intel/common/intel_measure.c3
-rw-r--r--src/intel/common/intel_urb_config.c4
-rw-r--r--src/intel/compiler/brw_compiler.c4
-rw-r--r--src/intel/dev/intel_debug.c2
-rw-r--r--src/intel/dev/intel_device_info.c4
-rw-r--r--src/intel/nullhw-layer/intel_nullhw.c2
-rw-r--r--src/intel/vulkan/anv_batch_chain.c2
-rw-r--r--src/intel/vulkan/anv_device.c12
-rw-r--r--src/intel/vulkan/anv_image.c2
-rw-r--r--src/intel/vulkan/anv_measure.c2
-rw-r--r--src/intel/vulkan/anv_nir_lower_multiview.c4
-rw-r--r--src/intel/vulkan/anv_pipeline_cache.c2
-rw-r--r--src/intel/vulkan/genX_acceleration_structure.c2
-rw-r--r--src/intel/vulkan_hasvk/anv_batch_chain.c4
-rw-r--r--src/intel/vulkan_hasvk/anv_device.c8
-rw-r--r--src/intel/vulkan_hasvk/anv_image.c2
-rw-r--r--src/intel/vulkan_hasvk/anv_measure.c2
-rw-r--r--src/intel/vulkan_hasvk/anv_nir_lower_multiview.c4
-rw-r--r--src/intel/vulkan_hasvk/anv_pipeline_cache.c2
-rw-r--r--src/mesa/main/bufferobj.c4
-rw-r--r--src/mesa/main/context.c4
-rw-r--r--src/microsoft/vulkan/dzn_device.c2
-rw-r--r--src/panfrost/vulkan/panvk_device.c4
-rw-r--r--src/panfrost/vulkan/panvk_image.c2
-rw-r--r--src/panfrost/vulkan/panvk_pipeline.c2
-rw-r--r--src/panfrost/vulkan/panvk_vX_image.c2
-rw-r--r--src/panfrost/vulkan/panvk_vX_pipeline.c2
-rw-r--r--src/util/debug.c46
-rw-r--r--src/util/debug.h45
-rw-r--r--src/util/disk_cache.c12
-rw-r--r--src/util/disk_cache_os.c10
-rw-r--r--src/util/meson.build2
-rw-r--r--src/util/perf/u_trace.py2
-rw-r--r--src/virtio/vulkan/vn_common.c3
-rw-r--r--src/vulkan/overlay-layer/overlay.cpp2
-rw-r--r--src/vulkan/runtime/vk_device.c6
-rw-r--r--src/vulkan/runtime/vk_pipeline_cache.c4
-rw-r--r--src/vulkan/runtime/vk_queue.c4
-rw-r--r--src/vulkan/runtime/vk_sync.c4
-rw-r--r--src/vulkan/util/vk_util.c4
-rw-r--r--src/vulkan/wsi/wsi_common.c2
91 files changed, 150 insertions, 250 deletions
diff --git a/src/amd/compiler/aco_ir.cpp b/src/amd/compiler/aco_ir.cpp
index 583250f56ed..14de439dfa9 100644
--- a/src/amd/compiler/aco_ir.cpp
+++ b/src/amd/compiler/aco_ir.cpp
@@ -26,7 +26,7 @@
#include "aco_builder.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "c11/threads.h"
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 7d044b88f9d..1a3bb842d93 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -43,7 +43,7 @@
#include <sys/inotify.h>
#endif
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "radv_cs.h"
#include "radv_debug.h"
@@ -60,7 +60,6 @@ typedef void *drmDevicePtr;
#include "winsys/amdgpu/radv_amdgpu_winsys_public.h"
#endif
#include "util/build_id.h"
-#include "util/debug.h"
#include "util/driconf.h"
#include "util/mesa-sha1.h"
#include "util/os_time.h"
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 9f2dede4362..5144dd003c9 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -26,7 +26,7 @@
*/
#include "ac_drm_fourcc.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_atomic.h"
#include "vulkan/util/vk_format.h"
#include "radv_debug.h"
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index e343403bc5e..8fe7b52465f 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -41,7 +41,7 @@
#include "vk_pipeline.h"
#include "vk_util.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "ac_binary.h"
#include "ac_nir.h"
#include "ac_shader_util.h"
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index bb8b5ed6b9f..081ce4d1a82 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -21,7 +21,7 @@
* IN THE SOFTWARE.
*/
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/macros.h"
#include "util/mesa-sha1.h"
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index ee697fcff97..0c328e45c99 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -38,7 +38,7 @@
#include "radv_private.h"
#include "radv_shader_args.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "ac_binary.h"
#include "ac_nir.h"
#if defined(USE_LIBELF)
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index c165c1baf9d..7be8b137107 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -50,7 +50,7 @@
#include "git_sha1.h"
#include "util/build_id.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 89feaa7fcb5..2e120db4ea8 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -35,7 +35,7 @@
#include "ir.h"
#include "ir_hierarchical_visitor.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/hash_table.h"
#include "util/macros.h"
#include "util/set.h"
@@ -1214,7 +1214,7 @@ validate_ir_tree(exec_list *instructions)
* anything.
*/
#ifndef DEBUG
- if (!env_var_as_boolean("GLSL_VALIDATE", false))
+ if (!debug_get_bool_option("GLSL_VALIDATE", false))
return;
#endif
ir_validate v;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 97fb482c83a..afc53ac0557 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -49,7 +49,7 @@
#include <stdio.h>
#ifndef NDEBUG
-#include "util/debug.h"
+#include "util/u_debug.h"
#endif /* NDEBUG */
#include "nir_opcodes.h"
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index f8e63f3e23f..cdf3587ed95 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -24,7 +24,7 @@
#include "vtn_private.h"
#include "spirv_info.h"
#include "nir/nir_vla.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
static struct vtn_block *
vtn_block(struct vtn_builder *b, uint32_t value_id)
@@ -1452,7 +1452,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func,
static int force_unstructured = -1;
if (force_unstructured < 0) {
force_unstructured =
- env_var_as_boolean("MESA_SPIRV_FORCE_UNSTRUCTURED", false);
+ debug_get_bool_option("MESA_SPIRV_FORCE_UNSTRUCTURED", false);
}
nir_function_impl *impl = func->nir_func->impl;
diff --git a/src/egl/drivers/dri2/platform_device.c b/src/egl/drivers/dri2/platform_device.c
index 66b2eee08ee..bd16f3fdd7e 100644
--- a/src/egl/drivers/dri2/platform_device.c
+++ b/src/egl/drivers/dri2/platform_device.c
@@ -42,7 +42,7 @@
#include "egl_dri2.h"
#include "loader.h"
#include "kopper_interface.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
static __DRIimage*
device_alloc_image(struct dri2_egl_display *dri2_dpy,
@@ -274,7 +274,7 @@ static bool
device_probe_device(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- bool request_software = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ bool request_software = debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
if (request_software)
_eglLog(_EGL_WARNING, "Not allowed to force software rendering when "
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index eac1661b3fa..77c414823ac 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -40,7 +40,7 @@
#endif
#include <sys/types.h>
#include <sys/stat.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/bitscan.h"
@@ -1714,12 +1714,12 @@ dri2_initialize_x11(_EGLDisplay *disp)
return dri2_initialize_x11_swrast(disp);
#ifdef HAVE_DRI3
- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
+ if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false))
if (dri2_initialize_x11_dri3(disp))
return EGL_TRUE;
#endif
- if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false))
+ if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
if (dri2_initialize_x11_dri2(disp))
return EGL_TRUE;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 97aab222de2..93eca3d9d3b 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -94,7 +94,7 @@
#include <stdlib.h>
#include <string.h>
#include "c11/threads.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/perf/cpu_trace.h"
@@ -688,7 +688,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (!disp->Initialized) {
/* set options */
disp->Options.ForceSoftware =
- env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
if (disp->Options.ForceSoftware)
_eglLog(_EGL_DEBUG, "Found 'LIBGL_ALWAYS_SOFTWARE' set, will use a CPU renderer");
@@ -703,7 +703,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (!_eglDriver.Initialize(disp)) {
bool fail = true;
if (!disp->Options.ForceSoftware && !disp->Options.Zink &&
- !env_var_as_boolean("LIBGL_KOPPER_DISABLE", false) && !getenv("GALLIUM_DRIVER")) {
+ !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) && !getenv("GALLIUM_DRIVER")) {
/* zink fallback */
disp->Options.Zink = EGL_TRUE;
disp->Options.ForceSoftware = EGL_TRUE;
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index c2c1acf5d5f..bb53de3f493 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -24,7 +24,7 @@
* Rob Clark <robclark@freedesktop.org>
*/
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_math.h"
#include "ir3_compiler.h"
@@ -102,7 +102,7 @@ ir3_optimize_loop(struct ir3_compiler *compiler, nir_shader *s)
static int gcm = -1;
if (gcm == -1)
- gcm = env_var_as_unsigned("GCM", 0);
+ gcm = debug_get_num_option("GCM", 0);
if (gcm == 1)
progress |= OPT(s, nir_opt_gcm, true);
else if (gcm == 2)
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 3f2e6dc2d20..83f782635b4 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -14,7 +14,7 @@
#include <sys/sysinfo.h>
#include "git_sha1.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/driconf.h"
#include "util/os_misc.h"
diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c
index ac6b563afc6..9a57c664492 100644
--- a/src/freedreno/vulkan/tu_drm.c
+++ b/src/freedreno/vulkan/tu_drm.c
@@ -22,7 +22,7 @@
#include "vk_util.h"
#include "drm-uapi/msm_drm.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/hash_table.h"
#include "util/timespec.h"
#include "util/os_time.h"
@@ -883,7 +883,7 @@ tu_physical_device_try_create(struct vk_instance *vk_instance,
"could not get GMEM size");
goto fail;
}
- device->gmem_size = env_var_as_unsigned("TU_GMEM", device->gmem_size);
+ device->gmem_size = debug_get_num_option("TU_GMEM", device->gmem_size);
if (tu_drm_get_gmem_base(device, &device->gmem_base)) {
result = vk_startup_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 8bb83f4087e..15a0649a2dc 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -11,7 +11,7 @@
#include "fdl/fd6_format_table.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/format/u_format.h"
#include "vk_util.h"
#include "drm-uapi/drm_fourcc.h"
diff --git a/src/freedreno/vulkan/tu_kgsl.c b/src/freedreno/vulkan/tu_kgsl.c
index 95f0b859a87..ec1ae05b6b4 100644
--- a/src/freedreno/vulkan/tu_kgsl.c
+++ b/src/freedreno/vulkan/tu_kgsl.c
@@ -13,7 +13,7 @@
#include "msm_kgsl.h"
#include "vk_util.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "tu_cmd_buffer.h"
#include "tu_cs.h"
@@ -270,7 +270,7 @@ tu_enumerate_devices(struct vk_instance *vk_instance)
((info.chip_id >> 16) & 0xff) * 10 +
((info.chip_id >> 8) & 0xff);
device->dev_id.chip_id = info.chip_id;
- device->gmem_size = env_var_as_unsigned("TU_GMEM", info.gmem_sizebytes);
+ device->gmem_size = debug_get_num_option("TU_GMEM", info.gmem_sizebytes);
device->gmem_base = gmem_iova;
device->submitqueue_priority_count = 1;
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index 1647a5b79fb..eb770424410 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -17,7 +17,7 @@
#include "nir/nir_builder.h"
#include "nir/nir_serialize.h"
#include "spirv/nir_spirv.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/mesa-sha1.h"
#include "vk_pipeline.h"
#include "vk_render_pass.h"
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 48a05f0d42f..479bdf891c9 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -33,7 +33,7 @@
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_ureg.h"
#include "tgsi/tgsi_util.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_dynarray.h"
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 706c4d2d6d6..ad9ed85ecac 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -23,7 +23,7 @@
*/
#include "util/blob.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/u_memory.h"
#include "util/ralloc.h"
diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
index 91321a81ef4..d821008b534 100644
--- a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h
@@ -5,7 +5,6 @@
#include "pipe/p_compiler.h"
#include "pipe/p_screen.h"
#include "util/u_debug.h"
-#include "util/debug.h"
#include "frontend/sw_winsys.h"
#include "target-helpers/inline_debug_helper.h"
@@ -79,7 +78,7 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
static inline struct pipe_screen *
sw_screen_create_vk(struct sw_winsys *winsys, bool sw_vk)
{
- UNUSED bool only_sw = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ UNUSED bool only_sw = debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
const char *drivers[] = {
(sw_vk ? "" : debug_get_option("GALLIUM_DRIVER", "")),
#if defined(GALLIUM_D3D12)
diff --git a/src/gallium/auxiliary/target-helpers/sw_helper.h b/src/gallium/auxiliary/target-helpers/sw_helper.h
index 3695a06dec8..12c096403d8 100644
--- a/src/gallium/auxiliary/target-helpers/sw_helper.h
+++ b/src/gallium/auxiliary/target-helpers/sw_helper.h
@@ -4,7 +4,6 @@
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
-#include "util/debug.h"
#include "target-helpers/sw_helper_public.h"
#include "frontend/sw_winsys.h"
@@ -82,7 +81,7 @@ sw_screen_create_named(struct sw_winsys *winsys, const struct pipe_screen_config
struct pipe_screen *
sw_screen_create_vk(struct sw_winsys *winsys, const struct pipe_screen_config *config, bool sw_vk)
{
- UNUSED bool only_sw = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ UNUSED bool only_sw = debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
const char *drivers[] = {
(sw_vk ? "" : debug_get_option("GALLIUM_DRIVER", "")),
#if defined(GALLIUM_D3D12)
diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.c b/src/gallium/drivers/crocus/crocus_bufmgr.c
index eddcadbcaba..f3268de832c 100644
--- a/src/gallium/drivers/crocus/crocus_bufmgr.c
+++ b/src/gallium/drivers/crocus/crocus_bufmgr.c
@@ -55,7 +55,7 @@
#include "dev/intel_debug.h"
#include "common/intel_gem.h"
#include "dev/intel_device_info.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/hash_table.h"
#include "util/list.h"
diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c
index feaaf7a0bcc..ea0e34f5ca4 100644
--- a/src/gallium/drivers/crocus/crocus_program.c
+++ b/src/gallium/drivers/crocus/crocus_program.c
@@ -37,7 +37,7 @@
#include "pipe/p_screen.h"
#include "util/u_atomic.h"
#include "util/u_upload_mgr.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_prim.h"
#include "compiler/nir/nir.h"
#include "compiler/nir/nir_builder.h"
@@ -790,7 +790,7 @@ skip_compacting_binding_tables(void)
{
static int skip = -1;
if (skip < 0)
- skip = env_var_as_boolean("INTEL_DISABLE_COMPACT_BINDING_TABLE", false);
+ skip = debug_get_bool_option("INTEL_DISABLE_COMPACT_BINDING_TABLE", false);
return skip;
}
diff --git a/src/gallium/drivers/crocus/crocus_screen.c b/src/gallium/drivers/crocus/crocus_screen.c
index 32fe0e93369..81cc6b8a68f 100644
--- a/src/gallium/drivers/crocus/crocus_screen.c
+++ b/src/gallium/drivers/crocus/crocus_screen.c
@@ -37,7 +37,7 @@
#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_inlines.h"
#include "util/format/u_format.h"
#include "util/u_transfer_helper.h"
@@ -767,7 +767,7 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
screen->driconf.lower_depth_range_rate =
driQueryOptionf(config->options, "lower_depth_range_rate");
- screen->precompile = env_var_as_boolean("shader_precompile", true);
+ screen->precompile = debug_get_bool_option("shader_precompile", true);
isl_device_init(&screen->isl_dev, &screen->devinfo);
diff --git a/src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp b/src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp
index 1867ceded2b..112fda49951 100644
--- a/src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp
@@ -24,7 +24,7 @@
#include "d3d12_screen.h"
#include "d3d12_public.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_dl.h"
diff --git a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp
index da25eb017c6..ee4661d7240 100644
--- a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp
@@ -25,7 +25,7 @@
#include "d3d12_public.h"
#include "d3d12_debug.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_dl.h"
@@ -81,7 +81,7 @@ choose_dxgi_adapter(IDXGIFactory4 *factory, LUID *adapter)
debug_printf("D3D12: requested adapter missing, falling back to auto-detection...\n");
}
- bool want_warp = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ bool want_warp = debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
if (want_warp) {
if (SUCCEEDED(factory->EnumWarpAdapter(IID_PPV_ARGS(&ret))))
return ret;
diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp
index 5446d5b5d2a..d96a216010f 100644
--- a/src/gallium/drivers/d3d12/d3d12_screen.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp
@@ -37,7 +37,7 @@
#include "d3d12_nir_passes.h"
#include "pipebuffer/pb_bufmgr.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_screen.h"
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index af978b89665..70747d9549d 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -25,7 +25,7 @@
*/
#include "pipe/p_state.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/format/u_format.h"
#include "util/hash_table.h"
#include "util/u_dump.h"
@@ -334,8 +334,8 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key)
}
#ifdef DEBUG
- tpp_x = env_var_as_unsigned("TPP_X", tpp_x);
- tpp_y = env_var_as_unsigned("TPP_Y", tpp_x);
+ tpp_x = debug_get_num_option("TPP_X", tpp_x);
+ tpp_y = debug_get_num_option("TPP_Y", tpp_x);
#endif
gmem->maxpw = tpp_x;
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 58e9e5a694d..c0e4b403c0c 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -1006,7 +1006,7 @@ fd_screen_create(struct fd_device *dev, struct renderonly *ro,
DBG("could not get GMEM size");
goto fail;
}
- screen->gmemsize_bytes = env_var_as_unsigned("FD_MESA_GMEM", val);
+ screen->gmemsize_bytes = debug_get_num_option("FD_MESA_GMEM", val);
if (fd_device_version(dev) >= FD_VERSION_GMEM_BASE) {
fd_pipe_get_param(screen->pipe, FD_GMEM_BASE, &screen->gmem_base);
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
index b3891128aec..0aa0e2357c4 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.h
+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
@@ -34,7 +34,7 @@
#include "pipe/p_screen.h"
#include "renderonly/renderonly.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/simple_mtx.h"
#include "util/slab.h"
#include "util/u_idalloc.h"
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index e8f67a3486b..6e41896367b 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -49,7 +49,7 @@
#include "intel/common/intel_gem.h"
#include "intel/ds/intel_tracepoints.h"
#include "util/hash_table.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/set.h"
#include "util/u_upload_mgr.h"
@@ -292,7 +292,7 @@ iris_create_engines_context(struct iris_context *ice, int priority)
/* Blitter is only supported on Gfx12+ */
unsigned num_batches = IRIS_BATCH_COUNT - (devinfo->ver >= 12 ? 0 : 1);
- if (env_var_as_boolean("INTEL_COMPUTE_CLASS", false) &&
+ if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false) &&
intel_engines_count(engines_info, INTEL_ENGINE_CLASS_COMPUTE) > 0)
engine_classes[IRIS_BATCH_COMPUTE] = INTEL_ENGINE_CLASS_COMPUTE;
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 2198a175fb7..5e65a6def61 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -55,7 +55,7 @@
#include "dev/intel_device_info.h"
#include "isl/isl.h"
#include "os/os_mman.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/hash_table.h"
#include "util/list.h"
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c
index 8cbc4c702ec..ab39a077881 100644
--- a/src/gallium/drivers/iris/iris_context.c
+++ b/src/gallium/drivers/iris/iris_context.c
@@ -24,7 +24,7 @@
#include <time.h>
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/ralloc.h"
#include "util/u_inlines.h"
#include "util/format/u_format.h"
diff --git a/src/gallium/drivers/iris/iris_measure.c b/src/gallium/drivers/iris/iris_measure.c
index aa0b6411521..ec05be8882f 100644
--- a/src/gallium/drivers/iris/iris_measure.c
+++ b/src/gallium/drivers/iris/iris_measure.c
@@ -25,7 +25,7 @@
*/
#include <stdio.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/list.h"
#include "util/crc32.h"
#include "iris_context.h"
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 69d9ddc1e41..d7ced54483d 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -37,7 +37,7 @@
#include "pipe/p_screen.h"
#include "util/u_atomic.h"
#include "util/u_upload_mgr.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_async_debug.h"
#include "compiler/nir/nir.h"
#include "compiler/nir/nir_builder.h"
@@ -873,7 +873,7 @@ skip_compacting_binding_tables(void)
{
static int skip = -1;
if (skip < 0)
- skip = env_var_as_boolean("INTEL_DISABLE_COMPACT_BINDING_TABLE", false);
+ skip = debug_get_bool_option("INTEL_DISABLE_COMPACT_BINDING_TABLE", false);
return skip;
}
diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c
index 5b66eb84f23..90a598df7cb 100644
--- a/src/gallium/drivers/iris/iris_screen.c
+++ b/src/gallium/drivers/iris/iris_screen.c
@@ -37,7 +37,7 @@
#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/os_file.h"
#include "util/u_cpu_detect.h"
#include "util/u_inlines.h"
@@ -115,7 +115,7 @@ iris_enable_clover()
{
static int enable = -1;
if (enable < 0)
- enable = env_var_as_boolean("IRIS_ENABLE_CLOVER", false);
+ enable = debug_get_bool_option("IRIS_ENABLE_CLOVER", false);
return enable;
}
@@ -858,7 +858,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
screen->driconf.lower_depth_range_rate =
driQueryOptionf(config->options, "lower_depth_range_rate");
- screen->precompile = env_var_as_boolean("shader_precompile", true);
+ screen->precompile = debug_get_bool_option("shader_precompile", true);
isl_device_init(&screen->isl_dev, &screen->devinfo);
diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c
index 579d820a6dd..34127040ae4 100644
--- a/src/gallium/frontends/dri/dri_context.c
+++ b/src/gallium/frontends/dri/dri_context.c
@@ -39,7 +39,7 @@
#include "state_tracker/st_context.h"
#include "util/u_memory.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
GLboolean
dri_create_context(gl_api api, const struct gl_config * visual,
@@ -162,7 +162,7 @@ dri_create_context(gl_api api, const struct gl_config * visual,
/* KHR_no_error is likely to crash, overflow memory, etc if an application
* has errors so don't enable it for setuid processes.
*/
- if (env_var_as_boolean("MESA_NO_ERROR", false) ||
+ if (debug_get_bool_option("MESA_NO_ERROR", false) ||
driQueryOptionb(&screen->dev->option_cache, "mesa_no_error"))
#if !defined(_WIN32)
if (geteuid() == getuid())
diff --git a/src/gallium/frontends/wgl/stw_device.c b/src/gallium/frontends/wgl/stw_device.c
index bd37d72b469..aada384ae9e 100644
--- a/src/gallium/frontends/wgl/stw_device.c
+++ b/src/gallium/frontends/wgl/stw_device.c
@@ -28,7 +28,6 @@
#include <windows.h>
#include "glapi/glapi.h"
-#include "util/debug.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -128,7 +127,7 @@ stw_init(const struct stw_winsys *stw_winsys)
{
static struct stw_device stw_dev_storage;
- if (env_var_as_boolean("WGL_DISABLE_ERROR_DIALOGS", false))
+ if (debug_get_bool_option("WGL_DISABLE_ERROR_DIALOGS", false))
debug_disable_win32_error_dialogs();
assert(!stw_dev);
diff --git a/src/gallium/targets/wgl/wgl.c b/src/gallium/targets/wgl/wgl.c
index baa6f28514c..89e49a1d87b 100644
--- a/src/gallium/targets/wgl/wgl.c
+++ b/src/gallium/targets/wgl/wgl.c
@@ -37,7 +37,6 @@
#include <windows.h>
#include "util/u_debug.h"
-#include "util/debug.h"
#include "stw_winsys.h"
#include "stw_device.h"
#include "gdi/gdi_sw_winsys.h"
@@ -115,7 +114,7 @@ static struct pipe_screen *
wgl_screen_create(HDC hDC)
{
struct sw_winsys *winsys;
- UNUSED bool sw_only = env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ UNUSED bool sw_only = debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
winsys = gdi_create_sw_winsys();
if (!winsys)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index f410da0d4b6..36cee87a2fd 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -50,7 +50,7 @@
#include "loader_dri_helper.h"
#include "kopper_interface.h"
#include "loader.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
/* For importing wl_buffer */
@@ -1478,7 +1478,7 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
mtx_init(&dri->mutex, mtx_plain);
- force_sw = env_var_as_boolean("GBM_ALWAYS_SOFTWARE", false);
+ force_sw = debug_get_bool_option("GBM_ALWAYS_SOFTWARE", false);
if (!force_sw) {
ret = dri_screen_create(dri);
if (ret)
diff --git a/src/glx/apple/apple_glx_context.c b/src/glx/apple/apple_glx_context.c
index d80385b2aaf..d125ae31de1 100644
--- a/src/glx/apple/apple_glx_context.c
+++ b/src/glx/apple/apple_glx_context.c
@@ -55,7 +55,7 @@
#include "apple_cgl.h"
#include "apple_glx_drawable.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
static pthread_mutex_t context_lock = PTHREAD_MUTEX_INITIALIZER;
diff --git a/src/glx/apple/apple_glx_log.c b/src/glx/apple/apple_glx_log.c
index d95d18dd940..e50ec966484 100644
--- a/src/glx/apple/apple_glx_log.c
+++ b/src/glx/apple/apple_glx_log.c
@@ -37,7 +37,7 @@
#include <pthread.h>
#include "glxclient.h"
#include "apple_glx_log.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
static aslclient aslc;
diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c
index e97e29323a7..9c824f4a9ec 100644
--- a/src/glx/apple/apple_glx_pbuffer.c
+++ b/src/glx/apple/apple_glx_pbuffer.c
@@ -48,7 +48,7 @@
#include "apple_glx.h"
#include "glxconfig.h"
#include "apple_cgl.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
/* mesa defines in glew.h, Apple in glext.h.
* Due to namespace nightmares, just do it here.
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
index 4a90d77c3a5..8c1064f04ad 100644
--- a/src/glx/apple/apple_visual.c
+++ b/src/glx/apple/apple_visual.c
@@ -83,7 +83,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
int numattr = 0;
GLint vsref = 0;
CGLError error = 0;
- bool use_core_profile = env_var_as_boolean("LIBGL_PROFILE_CORE", false);
+ bool use_core_profile = debug_get_bool_option("LIBGL_PROFILE_CORE", false);
if (offscreen) {
apple_glx_diagnostic
@@ -91,13 +91,13 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
attr[numattr++] = kCGLPFAOffScreen;
}
- else if (env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false)) {
+ else if (debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false)) {
apple_glx_diagnostic
("Software rendering requested. Using kCGLRendererGenericFloatID.\n");
attr[numattr++] = kCGLPFARendererID;
attr[numattr++] = kCGLRendererGenericFloatID;
}
- else if (env_var_as_boolean("LIBGL_ALLOW_SOFTWARE", false)) {
+ else if (debug_get_bool_option("LIBGL_ALLOW_SOFTWARE", false)) {
apple_glx_diagnostic
("Software rendering is not being excluded. Not using kCGLPFAAccelerated.\n");
}
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index b5bdc87ee7b..c124c62c31e 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -33,7 +33,7 @@
#include "drisw_priv.h"
#include <X11/extensions/shmproto.h>
#include <assert.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "kopper_interface.h"
#include "loader_dri_helper.h"
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 4ec6b9d765c..f03a50834f4 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -43,7 +43,7 @@
#ifdef GLX_USE_APPLEGL
#include "apple/apple_glx_context.h"
#include "apple/apple_glx.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#else
#ifndef GLX_USE_WINDOWSGL
#include <X11/extensions/xf86vmode.h>
@@ -1304,7 +1304,7 @@ glXChooseVisual(Display * dpy, int screen, int *attribList)
}
#ifdef GLX_USE_APPLEGL
- if(visualList && env_var_as_boolean("LIBGL_DUMP_VISUALID", false)) {
+ if(visualList && debug_get_bool_option("LIBGL_DUMP_VISUALID", false)) {
printf("visualid 0x%lx\n", visualList[0].visualid);
}
#endif
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 6e5dbc29459..7f2fc2a0691 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -50,7 +50,7 @@
#endif
#include "glxextensions.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#ifndef GLX_USE_APPLEGL
#include "dri_common.h"
#endif
@@ -921,8 +921,8 @@ __glXInitialize(Display * dpy)
dpyPriv->glXDrawHash = __glxHashCreate();
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
- Bool glx_direct = !env_var_as_boolean("LIBGL_ALWAYS_INDIRECT", false);
- Bool glx_accel = !env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
+ Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
+ Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
Bool explicit_zink = env && !strcmp(env, "zink");
Bool infer_zink = false;
@@ -942,14 +942,14 @@ __glXInitialize(Display * dpy)
#if defined(GLX_USE_DRM)
if (glx_direct && glx_accel && !explicit_zink) {
#if defined(HAVE_DRI3)
- if (!env_var_as_boolean("LIBGL_DRI3_DISABLE", false))
+ if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false))
dpyPriv->dri3Display = dri3_create_display(dpy);
#endif /* HAVE_DRI3 */
- if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false))
+ if (!debug_get_bool_option("LIBGL_DRI2_DISABLE", false))
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
/* zink fallback */
if (!dpyPriv->dri3Display && !dpyPriv->dri2Display)
- infer_zink = !env_var_as_boolean("LIBGL_KOPPER_DISABLE", false) && !getenv("GALLIUM_DRIVER");
+ infer_zink = !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false) && !getenv("GALLIUM_DRIVER");
}
#endif /* GLX_USE_DRM */
if (glx_direct)
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index 7b0cf3b7164..3e39a801f0e 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -35,7 +35,7 @@
#include "glapi.h"
#include "glxclient.h"
#include "indirect.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#ifndef GLX_USE_APPLEGL
@@ -338,7 +338,7 @@ indirect_create_context_attribs(struct glx_screen *psc,
return NULL;
}
gc->client_state_private = state;
- state->NoDrawArraysProtocol = env_var_as_boolean("LIBGL_NO_DRAWARRAYS", false);
+ state->NoDrawArraysProtocol = debug_get_bool_option("LIBGL_NO_DRAWARRAYS", false);
/*
** Create a temporary buffer to hold GLX rendering commands. The size
diff --git a/src/intel/common/intel_measure.c b/src/intel/common/intel_measure.c
index aa3ef24f155..4a58945bc31 100644
--- a/src/intel/common/intel_measure.c
+++ b/src/intel/common/intel_measure.c
@@ -38,9 +38,8 @@
#include <inttypes.h>
#include "dev/intel_device_info.h"
-#include "util/debug.h"
-#include "util/macros.h"
#include "util/u_debug.h"
+#include "util/macros.h"
static const struct debug_control debug_control[] = {
diff --git a/src/intel/common/intel_urb_config.c b/src/intel/common/intel_urb_config.c
index 98d5686e101..8136ffb782c 100644
--- a/src/intel/common/intel_urb_config.c
+++ b/src/intel/common/intel_urb_config.c
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <math.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/u_math.h"
#include "compiler/shader_enums.h"
@@ -333,7 +333,7 @@ intel_get_mesh_urb_config(const struct intel_device_info *devinfo,
static int task_urb_share_percentage = -1;
if (task_urb_share_percentage < 0) {
task_urb_share_percentage =
- MIN2(env_var_as_unsigned("INTEL_MESH_TASK_URB_SHARE", 10), 100);
+ MIN2(debug_get_num_option("INTEL_MESH_TASK_URB_SHARE", 10), 100);
}
task_urb_share = task_urb_share_percentage / 100.0f;
}
diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c
index 89cc2dcec4b..8b66716180a 100644
--- a/src/intel/compiler/brw_compiler.c
+++ b/src/intel/compiler/brw_compiler.c
@@ -27,7 +27,7 @@
#include "dev/intel_debug.h"
#include "compiler/nir/nir.h"
#include "main/errors.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#define COMMON_OPTIONS \
.lower_fdiv = true, \
@@ -115,7 +115,7 @@ brw_compiler_create(void *mem_ctx, const struct intel_device_info *devinfo)
if (devinfo->ver < 8)
brw_vec4_alloc_reg_set(compiler);
- compiler->precise_trig = env_var_as_boolean("INTEL_PRECISE_TRIG", false);
+ compiler->precise_trig = debug_get_bool_option("INTEL_PRECISE_TRIG", false);
compiler->use_tcs_multi_patch = devinfo->ver >= 12;
diff --git a/src/intel/dev/intel_debug.c b/src/intel/dev/intel_debug.c
index a374ee5d97d..1fafaaecaa4 100644
--- a/src/intel/dev/intel_debug.c
+++ b/src/intel/dev/intel_debug.c
@@ -36,7 +36,7 @@
#include "dev/intel_debug.h"
#include "git_sha1.h"
#include "util/macros.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "c11/threads.h"
uint64_t intel_debug = 0;
diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c
index 344d231b88e..d2120976fe9 100644
--- a/src/intel/dev/intel_device_info.c
+++ b/src/intel/dev/intel_device_info.c
@@ -34,7 +34,7 @@
#include "intel_hwconfig.h"
#include "intel/common/intel_gem.h"
#include "util/bitscan.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/log.h"
#include "util/macros.h"
#include "util/os_misc.h"
@@ -2037,7 +2037,7 @@ intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo)
devinfo->pci_device_id = drmdev->deviceinfo.pci->device_id;
devinfo->pci_revision_id = drmdev->deviceinfo.pci->revision_id;
drmFreeDevice(&drmdev);
- devinfo->no_hw = env_var_as_boolean("INTEL_NO_HW", false);
+ devinfo->no_hw = debug_get_bool_option("INTEL_NO_HW", false);
if (devinfo->ver == 10) {
mesa_loge("Gfx10 support is redacted.");
diff --git a/src/intel/nullhw-layer/intel_nullhw.c b/src/intel/nullhw-layer/intel_nullhw.c
index 9320d0bddcc..aa5fd8bc4e3 100644
--- a/src/intel/nullhw-layer/intel_nullhw.c
+++ b/src/intel/nullhw-layer/intel_nullhw.c
@@ -29,7 +29,7 @@
#include <vulkan/vulkan.h>
#include <vulkan/vk_layer.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/hash_table.h"
#include "util/macros.h"
#include "util/simple_mtx.h"
diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index 15de9a8678f..fcdce4dff43 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -36,7 +36,7 @@
#include "genxml/genX_bits.h"
#include "perf/intel_perf.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/perf/u_trace.h"
/** \file anv_batch_chain.c
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index a20d3998d9e..ee28426c297 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -41,7 +41,7 @@
#include "anv_private.h"
#include "anv_measure.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/build_id.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
@@ -184,7 +184,7 @@ get_device_extensions(const struct anv_physical_device *device,
(device->sync_syncobj_type.features & VK_SYNC_FEATURE_CPU_WAIT) != 0;
const bool nv_mesh_shading_enabled =
- env_var_as_boolean("ANV_EXPERIMENTAL_NV_MESH_SHADER", false);
+ debug_get_bool_option("ANV_EXPERIMENTAL_NV_MESH_SHADER", false);
*ext = (struct vk_device_extension_table) {
.KHR_8bit_storage = true,
@@ -685,7 +685,7 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
INTEL_ENGINE_CLASS_RENDER);
int g_count = 0;
int c_count = 0;
- if (env_var_as_boolean("INTEL_COMPUTE_CLASS", false))
+ if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false))
c_count = intel_engines_count(pdevice->engine_info,
INTEL_ENGINE_CLASS_COMPUTE);
enum intel_engine_class compute_class =
@@ -912,7 +912,7 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
if (result != VK_SUCCESS)
goto fail_base;
- if (env_var_as_boolean("ANV_QUEUE_THREAD_DISABLE", false))
+ if (debug_get_bool_option("ANV_QUEUE_THREAD_DISABLE", false))
device->has_exec_timeline = false;
unsigned st_idx = 0;
@@ -937,10 +937,10 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->vk.pipeline_cache_import_ops = anv_cache_import_ops;
device->always_use_bindless =
- env_var_as_boolean("ANV_ALWAYS_BINDLESS", false);
+ debug_get_bool_option("ANV_ALWAYS_BINDLESS", false);
device->use_call_secondary =
- !env_var_as_boolean("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false);
+ !debug_get_bool_option("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false);
device->has_implicit_ccs = device->info.has_aux_map ||
device->info.verx10 >= 125;
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index a34f1376f6b..b6181e33669 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -30,7 +30,7 @@
#include "drm-uapi/drm_fourcc.h"
#include "anv_private.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "vk_util.h"
#include "util/u_math.h"
diff --git a/src/intel/vulkan/anv_measure.c b/src/intel/vulkan/anv_measure.c
index ece1a499d81..41957cf56e9 100644
--- a/src/intel/vulkan/anv_measure.c
+++ b/src/intel/vulkan/anv_measure.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include "common/intel_measure.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
struct anv_measure_batch {
struct anv_bo *bo;
diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c
index dd591976ac4..4fb66cf48f6 100644
--- a/src/intel/vulkan/anv_nir_lower_multiview.c
+++ b/src/intel/vulkan/anv_nir_lower_multiview.c
@@ -23,7 +23,7 @@
#include "anv_nir.h"
#include "nir/nir_builder.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
/**
* This file implements the lowering required for VK_KHR_multiview.
@@ -305,7 +305,7 @@ anv_check_for_primitive_replication(struct anv_device *device,
primitive_replication_max_views =
MIN2(MAX_VIEWS_FOR_PRIMITIVE_REPLICATION,
- env_var_as_unsigned("ANV_PRIMITIVE_REPLICATION_MAX_VIEWS",
+ debug_get_num_option("ANV_PRIMITIVE_REPLICATION_MAX_VIEWS",
default_max_views));
}
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index b94eea76f3d..0c162a41065 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -23,7 +23,7 @@
#include "util/blob.h"
#include "util/hash_table.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
#include "nir/nir_serialize.h"
diff --git a/src/intel/vulkan/genX_acceleration_structure.c b/src/intel/vulkan/genX_acceleration_structure.c
index d0382ccd88a..15f4fdbcefa 100644
--- a/src/intel/vulkan/genX_acceleration_structure.c
+++ b/src/intel/vulkan/genX_acceleration_structure.c
@@ -25,7 +25,7 @@
#include <math.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/half_float.h"
#include "util/u_atomic.h"
diff --git a/src/intel/vulkan_hasvk/anv_batch_chain.c b/src/intel/vulkan_hasvk/anv_batch_chain.c
index ba87b2461a5..994725fd056 100644
--- a/src/intel/vulkan_hasvk/anv_batch_chain.c
+++ b/src/intel/vulkan_hasvk/anv_batch_chain.c
@@ -36,7 +36,7 @@
#include "genxml/genX_bits.h"
#include "perf/intel_perf.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/perf/u_trace.h"
/** \file anv_batch_chain.c
@@ -1510,7 +1510,7 @@ execbuf_can_skip_relocations(struct anv_execbuf *exec)
static int userspace_relocs = -1;
if (userspace_relocs < 0)
- userspace_relocs = env_var_as_boolean("ANV_USERSPACE_RELOCS", true);
+ userspace_relocs = debug_get_bool_option("ANV_USERSPACE_RELOCS", true);
if (!userspace_relocs)
return false;
diff --git a/src/intel/vulkan_hasvk/anv_device.c b/src/intel/vulkan_hasvk/anv_device.c
index 1b195e83308..c514c020445 100644
--- a/src/intel/vulkan_hasvk/anv_device.c
+++ b/src/intel/vulkan_hasvk/anv_device.c
@@ -41,7 +41,7 @@
#include "anv_private.h"
#include "anv_measure.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/build_id.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
@@ -818,7 +818,7 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->has_exec_timeline =
anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_TIMELINE_FENCES);
- if (env_var_as_boolean("ANV_QUEUE_THREAD_DISABLE", false))
+ if (debug_get_bool_option("ANV_QUEUE_THREAD_DISABLE", false))
device->has_exec_timeline = false;
unsigned st_idx = 0;
@@ -843,11 +843,11 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->vk.pipeline_cache_import_ops = anv_cache_import_ops;
device->always_use_bindless =
- env_var_as_boolean("ANV_ALWAYS_BINDLESS", false);
+ debug_get_bool_option("ANV_ALWAYS_BINDLESS", false);
device->use_call_secondary =
device->use_softpin &&
- !env_var_as_boolean("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false);
+ !debug_get_bool_option("ANV_DISABLE_SECONDARY_CMD_BUFFER_CALLS", false);
/* We first got the A64 messages on broadwell and we can only use them if
* we can pass addresses directly into the shader which requires softpin.
diff --git a/src/intel/vulkan_hasvk/anv_image.c b/src/intel/vulkan_hasvk/anv_image.c
index 6fb8b43c6de..f10f46454d7 100644
--- a/src/intel/vulkan_hasvk/anv_image.c
+++ b/src/intel/vulkan_hasvk/anv_image.c
@@ -30,7 +30,7 @@
#include "drm-uapi/drm_fourcc.h"
#include "anv_private.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "vk_util.h"
#include "util/u_math.h"
diff --git a/src/intel/vulkan_hasvk/anv_measure.c b/src/intel/vulkan_hasvk/anv_measure.c
index 67644a0ff4c..ebeeb3b403f 100644
--- a/src/intel/vulkan_hasvk/anv_measure.c
+++ b/src/intel/vulkan_hasvk/anv_measure.c
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include "common/intel_measure.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
struct anv_measure_batch {
struct anv_bo *bo;
diff --git a/src/intel/vulkan_hasvk/anv_nir_lower_multiview.c b/src/intel/vulkan_hasvk/anv_nir_lower_multiview.c
index dd591976ac4..4fb66cf48f6 100644
--- a/src/intel/vulkan_hasvk/anv_nir_lower_multiview.c
+++ b/src/intel/vulkan_hasvk/anv_nir_lower_multiview.c
@@ -23,7 +23,7 @@
#include "anv_nir.h"
#include "nir/nir_builder.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
/**
* This file implements the lowering required for VK_KHR_multiview.
@@ -305,7 +305,7 @@ anv_check_for_primitive_replication(struct anv_device *device,
primitive_replication_max_views =
MIN2(MAX_VIEWS_FOR_PRIMITIVE_REPLICATION,
- env_var_as_unsigned("ANV_PRIMITIVE_REPLICATION_MAX_VIEWS",
+ debug_get_num_option("ANV_PRIMITIVE_REPLICATION_MAX_VIEWS",
default_max_views));
}
diff --git a/src/intel/vulkan_hasvk/anv_pipeline_cache.c b/src/intel/vulkan_hasvk/anv_pipeline_cache.c
index e85a362f7f4..83dad6e6fa5 100644
--- a/src/intel/vulkan_hasvk/anv_pipeline_cache.c
+++ b/src/intel/vulkan_hasvk/anv_pipeline_cache.c
@@ -23,7 +23,7 @@
#include "util/blob.h"
#include "util/hash_table.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
#include "nir/nir_serialize.h"
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 38129d46230..5ff1ad21bd1 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -32,7 +32,7 @@
#include <stdbool.h>
#include <inttypes.h> /* for PRId64 macro */
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "glheader.h"
#include "enums.h"
#include "hash.h"
@@ -1062,7 +1062,7 @@ get_no_minmax_cache()
static bool disable = false;
if (!read) {
- disable = env_var_as_boolean("MESA_NO_MINMAX_CACHE", false);
+ disable = debug_get_bool_option("MESA_NO_MINMAX_CACHE", false);
read = true;
}
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b3a32b57380..33fcf8877bf 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -124,7 +124,7 @@
#include "shaderobj.h"
#include "shaderimage.h"
#include "state.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/strtod.h"
#include "util/u_call_once.h"
@@ -714,7 +714,7 @@ init_attrib_groups(struct gl_context *ctx)
ctx->ErrorValue = GL_NO_ERROR;
ctx->ShareGroupReset = false;
ctx->VertexProgram._VaryingInputs = VERT_BIT_ALL;
- ctx->IntelBlackholeRender = env_var_as_boolean("INTEL_BLACKHOLE_DEFAULT", false);
+ ctx->IntelBlackholeRender = debug_get_bool_option("INTEL_BLACKHOLE_DEFAULT", false);
return GL_TRUE;
}
diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c
index b89e0e3c76c..8428f103fe9 100644
--- a/src/microsoft/vulkan/dzn_device.c
+++ b/src/microsoft/vulkan/dzn_device.c
@@ -33,7 +33,7 @@
#include "git_sha1.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/macros.h"
#include "util/mesa-sha1.h"
diff --git a/src/panfrost/vulkan/panvk_device.c b/src/panfrost/vulkan/panvk_device.c
index 9cf21f43b23..2ff615bf430 100644
--- a/src/panfrost/vulkan/panvk_device.c
+++ b/src/panfrost/vulkan/panvk_device.c
@@ -45,7 +45,7 @@
#include "drm-uapi/panfrost_drm.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/strtod.h"
#include "vk_format.h"
@@ -76,7 +76,7 @@ _panvk_device_set_lost(struct panvk_device *device,
vfprintf(stderr, msg, ap);
va_end(ap);
- if (env_var_as_boolean("PANVK_ABORT_ON_DEVICE_LOSS", false))
+ if (debug_get_bool_option("PANVK_ABORT_ON_DEVICE_LOSS", false))
abort();
return VK_ERROR_DEVICE_LOST;
diff --git a/src/panfrost/vulkan/panvk_image.c b/src/panfrost/vulkan/panvk_image.c
index 7c97b9d3efb..fa635abbc86 100644
--- a/src/panfrost/vulkan/panvk_image.c
+++ b/src/panfrost/vulkan/panvk_image.c
@@ -28,7 +28,7 @@
#include "panvk_private.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_atomic.h"
#include "vk_format.h"
#include "vk_object.h"
diff --git a/src/panfrost/vulkan/panvk_pipeline.c b/src/panfrost/vulkan/panvk_pipeline.c
index 369dd6b2e44..0d2a49cc4a8 100644
--- a/src/panfrost/vulkan/panvk_pipeline.c
+++ b/src/panfrost/vulkan/panvk_pipeline.c
@@ -34,7 +34,7 @@
#include "nir/nir.h"
#include "nir/nir_builder.h"
#include "spirv/nir_spirv.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/mesa-sha1.h"
#include "util/u_atomic.h"
#include "vk_format.h"
diff --git a/src/panfrost/vulkan/panvk_vX_image.c b/src/panfrost/vulkan/panvk_vX_image.c
index 2865dd17267..679aed3eb83 100644
--- a/src/panfrost/vulkan/panvk_vX_image.c
+++ b/src/panfrost/vulkan/panvk_vX_image.c
@@ -29,7 +29,7 @@
#include "genxml/gen_macros.h"
#include "panvk_private.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/u_atomic.h"
#include "vk_format.h"
#include "vk_object.h"
diff --git a/src/panfrost/vulkan/panvk_vX_pipeline.c b/src/panfrost/vulkan/panvk_vX_pipeline.c
index 7333747a7c1..a1bdcfe253a 100644
--- a/src/panfrost/vulkan/panvk_vX_pipeline.c
+++ b/src/panfrost/vulkan/panvk_vX_pipeline.c
@@ -34,7 +34,7 @@
#include "nir/nir.h"
#include "nir/nir_builder.h"
#include "spirv/nir_spirv.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/mesa-sha1.h"
#include "util/u_atomic.h"
#include "vk_format.h"
diff --git a/src/util/debug.c b/src/util/debug.c
deleted file mode 100644
index 97ed5cae527..00000000000
--- a/src/util/debug.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2015 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <errno.h>
-#include <string.h>
-#include "debug.h"
-
-/**
- * Reads an environment variable and interprets its value as a boolean.
- *
- * Recognizes 0/false/no and 1/true/yes. Other values result in the default value.
- */
-bool
-env_var_as_boolean(const char *var_name, bool default_value)
-{
- return debug_get_bool_option(var_name, default_value);
-}
-
-/**
- * Reads an environment variable and interprets its value as a unsigned.
- */
-unsigned
-env_var_as_unsigned(const char *var_name, unsigned default_value)
-{
- return debug_get_num_option(var_name, default_value);
-}
diff --git a/src/util/debug.h b/src/util/debug.h
deleted file mode 100644
index 6c3df5739f5..00000000000
--- a/src/util/debug.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright © 2015 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef _UTIL_DEBUG_H
-#define _UTIL_DEBUG_H
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "u_debug.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-bool
-env_var_as_boolean(const char *var_name, bool default_value);
-unsigned
-env_var_as_unsigned(const char *var_name, unsigned default_value);
-
-#ifdef __cplusplus
-} /* extern C */
-#endif
-
-#endif /* _UTIL_DEBUG_H */
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 274508ecfd6..f20a6650642 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -38,7 +38,7 @@
#include <inttypes.h>
#include "util/crc32.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/rand_xor.h"
#include "util/u_atomic.h"
#include "util/mesa-sha1.h"
@@ -118,10 +118,10 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
if (strcmp(driver_id, "make_check_uncompressed") == 0)
cache->compression_disabled = true;
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false)) {
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false)) {
if (!disk_cache_load_cache_index_foz(local, cache))
goto path_fail;
- } else if (env_var_as_boolean("MESA_DISK_CACHE_DATABASE", false)) {
+ } else if (debug_get_bool_option("MESA_DISK_CACHE_DATABASE", false)) {
if (!disk_cache_db_load_cache_index(local, cache))
goto path_fail;
@@ -257,7 +257,7 @@ disk_cache_destroy(struct disk_cache *cache)
util_queue_finish(&cache->cache_queue);
util_queue_destroy(&cache->cache_queue);
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false))
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false))
foz_destroy(&cache->foz_db);
if (cache->use_cache_db)
@@ -363,7 +363,7 @@ cache_put(void *job, void *gdata, int thread_index)
char *filename = NULL;
struct disk_cache_put_job *dc_job = (struct disk_cache_put_job *) job;
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false)) {
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false)) {
disk_cache_write_item_to_disk_foz(dc_job);
} else if (dc_job->cache->use_cache_db) {
disk_cache_db_write_item_to_disk(dc_job);
@@ -463,7 +463,7 @@ disk_cache_get(struct disk_cache *cache, const cache_key key, size_t *size)
return blob;
}
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false)) {
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false)) {
return disk_cache_load_item_foz(cache, key, size);
} else if (cache->use_cache_db) {
return disk_cache_db_load_item(cache, key, size);
diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c
index 7423c4ac7c7..6ef0e0dd463 100644
--- a/src/util/disk_cache_os.c
+++ b/src/util/disk_cache_os.c
@@ -97,7 +97,7 @@ disk_cache_get_function_identifier(void *ptr, struct mesa_sha1 *ctx)
#include "util/blob.h"
#include "util/crc32.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/ralloc.h"
#include "util/rand_xor.h"
@@ -832,9 +832,9 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name,
const char *driver_id)
{
char *cache_dir_name = CACHE_DIR_NAME;
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false))
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false))
cache_dir_name = CACHE_DIR_NAME_SF;
- else if (env_var_as_boolean("MESA_DISK_CACHE_DATABASE", false))
+ else if (debug_get_bool_option("MESA_DISK_CACHE_DATABASE", false))
cache_dir_name = CACHE_DIR_NAME_DB;
char *path = getenv("MESA_SHADER_CACHE_DIR");
@@ -904,7 +904,7 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name,
return NULL;
}
- if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false)) {
+ if (debug_get_bool_option("MESA_DISK_CACHE_SINGLE_FILE", false)) {
path = concatenate_and_mkdir(mem_ctx, path, driver_id);
if (!path)
return NULL;
@@ -939,7 +939,7 @@ disk_cache_enabled()
"use MESA_SHADER_CACHE_DISABLE instead ***\n");
}
- if (env_var_as_boolean(envvar_name, disable_by_default))
+ if (debug_get_bool_option(envvar_name, disable_by_default))
return false;
return true;
diff --git a/src/util/meson.build b/src/util/meson.build
index 3102b41acb2..a6e12737b9b 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -40,8 +40,6 @@ files_mesa_util = files(
'crc32.c',
'crc32.h',
'dag.c',
- 'debug.c',
- 'debug.h',
'disk_cache.c',
'disk_cache.h',
'disk_cache_os.c',
diff --git a/src/util/perf/u_trace.py b/src/util/perf/u_trace.py
index a6a7619cb6b..bcdfcc7654c 100644
--- a/src/util/perf/u_trace.py
+++ b/src/util/perf/u_trace.py
@@ -304,7 +304,7 @@ src_template = """\
% endfor
#define __NEEDS_TRACE_PRIV
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/perf/u_trace_priv.h"
% if trace_toggle_name is not None:
diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c
index a7eff31ac0f..30a4a480c8b 100644
--- a/src/virtio/vulkan/vn_common.c
+++ b/src/virtio/vulkan/vn_common.c
@@ -12,10 +12,9 @@
#include <stdarg.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/log.h"
#include "util/os_misc.h"
-#include "util/u_debug.h"
#include "venus-protocol/vn_protocol_driver_info.h"
#include "vk_enum_to_str.h"
diff --git a/src/vulkan/overlay-layer/overlay.cpp b/src/vulkan/overlay-layer/overlay.cpp
index 8171fe0c177..d38e05e5c3f 100644
--- a/src/vulkan/overlay-layer/overlay.cpp
+++ b/src/vulkan/overlay-layer/overlay.cpp
@@ -34,7 +34,7 @@
#include "overlay_params.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/hash_table.h"
#include "util/list.h"
#include "util/ralloc.h"
diff --git a/src/vulkan/runtime/vk_device.c b/src/vulkan/runtime/vk_device.c
index edb8cc34277..21144fbeb59 100644
--- a/src/vulkan/runtime/vk_device.c
+++ b/src/vulkan/runtime/vk_device.c
@@ -31,7 +31,7 @@
#include "vk_sync.h"
#include "vk_sync_timeline.h"
#include "vk_util.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/hash_table.h"
#include "util/ralloc.h"
@@ -200,7 +200,7 @@ vk_device_init(struct vk_device *device,
break;
case VK_DEVICE_TIMELINE_MODE_ASSISTED:
- if (env_var_as_boolean("MESA_VK_ENABLE_SUBMIT_THREAD", false)) {
+ if (debug_get_bool_option("MESA_VK_ENABLE_SUBMIT_THREAD", false)) {
device->submit_mode = VK_QUEUE_SUBMIT_MODE_THREADED;
} else {
device->submit_mode = VK_QUEUE_SUBMIT_MODE_THREADED_ON_DEMAND;
@@ -338,7 +338,7 @@ _vk_device_set_lost(struct vk_device *device,
vk_logd(VK_LOG_OBJS(device), "Timeline mode is %s.",
timeline_mode_str(device));
- if (env_var_as_boolean("MESA_VK_ABORT_ON_DEVICE_LOSS", false))
+ if (debug_get_bool_option("MESA_VK_ABORT_ON_DEVICE_LOSS", false))
abort();
return VK_ERROR_DEVICE_LOST;
diff --git a/src/vulkan/runtime/vk_pipeline_cache.c b/src/vulkan/runtime/vk_pipeline_cache.c
index f837ed3d482..7862eeccf0c 100644
--- a/src/vulkan/runtime/vk_pipeline_cache.c
+++ b/src/vulkan/runtime/vk_pipeline_cache.c
@@ -32,7 +32,7 @@
#include "compiler/nir/nir_serialize.h"
#include "util/blob.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/disk_cache.h"
#include "util/hash_table.h"
#include "util/set.h"
@@ -606,7 +606,7 @@ vk_pipeline_cache_create(struct vk_device *device,
simple_mtx_init(&cache->lock, mtx_plain);
if (info->force_enable ||
- env_var_as_boolean("VK_ENABLE_PIPELINE_CACHE", true)) {
+ debug_get_bool_option("VK_ENABLE_PIPELINE_CACHE", true)) {
cache->object_cache = _mesa_set_create(NULL, object_key_hash,
object_keys_equal);
}
diff --git a/src/vulkan/runtime/vk_queue.c b/src/vulkan/runtime/vk_queue.c
index edc57cb234d..b79553fc374 100644
--- a/src/vulkan/runtime/vk_queue.c
+++ b/src/vulkan/runtime/vk_queue.c
@@ -23,7 +23,7 @@
#include "vk_queue.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include <inttypes.h>
#include "vk_alloc.h"
@@ -129,7 +129,7 @@ _vk_queue_set_lost(struct vk_queue *queue,
p_atomic_inc(&queue->base.device->_lost.lost);
- if (env_var_as_boolean("MESA_VK_ABORT_ON_DEVICE_LOSS", false)) {
+ if (debug_get_bool_option("MESA_VK_ABORT_ON_DEVICE_LOSS", false)) {
_vk_device_report_lost(queue->base.device);
abort();
}
diff --git a/src/vulkan/runtime/vk_sync.c b/src/vulkan/runtime/vk_sync.c
index 83322ac5d6d..26a617804d8 100644
--- a/src/vulkan/runtime/vk_sync.c
+++ b/src/vulkan/runtime/vk_sync.c
@@ -26,7 +26,7 @@
#include <assert.h>
#include <string.h>
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/os_time.h"
@@ -202,7 +202,7 @@ get_max_abs_timeout_ns(void)
{
static int max_timeout_ms = -1;
if (max_timeout_ms < 0)
- max_timeout_ms = env_var_as_unsigned("MESA_VK_MAX_TIMEOUT", 0);
+ max_timeout_ms = debug_get_num_option("MESA_VK_MAX_TIMEOUT", 0);
if (max_timeout_ms == 0)
return UINT64_MAX;
diff --git a/src/vulkan/util/vk_util.c b/src/vulkan/util/vk_util.c
index 68d444e1607..dbcf2c0edd4 100644
--- a/src/vulkan/util/vk_util.c
+++ b/src/vulkan/util/vk_util.c
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include "vk_util.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "compiler/spirv/nir_spirv.h"
@@ -75,7 +75,7 @@ uint32_t vk_get_version_override(void)
void
vk_warn_non_conformant_implementation(const char *driver_name)
{
- if (env_var_as_boolean("MESA_VK_IGNORE_CONFORMANCE_WARNING", false))
+ if (debug_get_bool_option("MESA_VK_IGNORE_CONFORMANCE_WARNING", false))
return;
fprintf(stderr, "WARNING: %s is not a conformant Vulkan implementation, "
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index c48977606c3..5532c44d7b0 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -23,7 +23,7 @@
#include "wsi_common_private.h"
#include "wsi_common_entrypoints.h"
-#include "util/debug.h"
+#include "util/u_debug.h"
#include "util/macros.h"
#include "util/os_file.h"
#include "util/xmlconfig.h"