From 1ac1c0843f5be6e51ad3a10cd96eeec53df0d9d0 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 9 Mar 2024 04:00:44 +0800 Subject: [PATCH] treewide: Replace usage of macro DEBUG with MESA_DEBUG when possible This is achieved by the following steps: #ifndef DEBUG => #if !MESA_DEBUG defined(DEBUG) => MESA_DEBUG #ifdef DEBUG => #if MESA_DEBUG This is done by replace in vscode excludes docs,*.rs,addrlib,src/imgui,*.sh,src/intel/vulkan/grl/gpu These are safe because those files should keep DEBUG macro is already excluded; and not directly replace DEBUG, as we have some symbols around it. Use debug or NDEBUG instead of DEBUG in comments when proper This for reduce the usage of DEBUG, so it's easier migrating to MESA_DEBUG These are found when migrating DEBUG to MESA_DEBUG, these are all comment update, so it's safe Replace comment /* DEBUG */ and /* !DEBUG */ with proper /* MESA_DEBUG */ or /* !MESA_DEBUG */ manually DEBUG || !NDEBUG -> MESA_DEBUG || !NDEBUG !DEBUG && NDEBUG -> !(MESA_DEBUG || !NDEBUG) Replace the DEBUG present in comment with proper new MESA_DEBUG manually Signed-off-by: Yonggang Luo Acked-by: David Heidelberg Reviewed-by: Eric Engestrom Part-of: --- src/broadcom/compiler/qpu_validate.c | 2 +- src/broadcom/compiler/vir.c | 2 +- src/broadcom/vulkan/v3dv_device.c | 2 +- src/broadcom/vulkan/v3dv_private.h | 2 +- src/broadcom/vulkan/v3dv_uniforms.c | 2 +- src/broadcom/vulkan/v3dvx_device.c | 2 +- src/broadcom/vulkan/v3dvx_private.h | 2 +- src/compiler/glsl/ir.h | 2 +- src/compiler/glsl/ir_validate.cpp | 2 +- src/compiler/nir/nir_lower_clip.c | 2 +- src/egl/drivers/haiku/egl_haiku.cpp | 2 +- src/egl/main/eglconfig.c | 4 ++-- src/freedreno/ir3/ir3.c | 8 ++++---- src/freedreno/ir3/ir3.h | 8 ++++---- src/freedreno/ir3/ir3_compiler.c | 4 ++-- src/freedreno/ir3/ir3_compiler.h | 2 +- src/freedreno/ir3/ir3_postsched.c | 2 +- src/freedreno/ir3/ir3_print.c | 2 +- src/freedreno/ir3/ir3_ra.h | 2 +- src/freedreno/ir3/ir3_sched.c | 2 +- src/freedreno/vulkan/tu_knl_drm_msm.cc | 2 +- src/freedreno/vulkan/tu_knl_drm_virtio.cc | 2 +- .../auxiliary/draw/draw_cliptest_tmp.h | 2 +- src/gallium/auxiliary/draw/draw_pipe.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 2 +- .../auxiliary/draw/draw_pipe_aapoint.c | 2 +- .../auxiliary/driver_trace/tr_context.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_debug.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_init.c | 6 +++--- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +- src/gallium/auxiliary/gallivm/lp_bld_struct.c | 6 +++--- .../auxiliary/pipebuffer/pb_buffer_fenced.c | 4 ++-- .../auxiliary/pipebuffer/pb_bufmgr_debug.c | 6 +++--- src/gallium/auxiliary/tgsi/tgsi_exec.c | 10 +++++----- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +- src/gallium/auxiliary/util/u_cache.c | 8 ++++---- src/gallium/auxiliary/util/u_debug_flush.c | 2 +- src/gallium/auxiliary/util/u_debug_flush.h | 2 +- src/gallium/auxiliary/util/u_debug_image.c | 2 +- src/gallium/auxiliary/util/u_debug_image.h | 2 +- src/gallium/auxiliary/util/u_debug_refcnt.c | 4 ++-- src/gallium/auxiliary/util/u_debug_refcnt.h | 2 +- src/gallium/auxiliary/util/u_pstipple.c | 2 +- src/gallium/drivers/crocus/crocus_batch.c | 2 +- .../drivers/d3d12/d3d12_dxgi_screen.cpp | 2 +- src/gallium/drivers/d3d12/d3d12_resource.cpp | 2 +- src/gallium/drivers/d3d12/d3d12_screen.cpp | 2 +- src/gallium/drivers/d3d12/d3d12_video_enc.cpp | 2 +- ...2_video_encoder_references_manager_av1.cpp | 4 ++-- src/gallium/drivers/etnaviv/etnaviv_shader.c | 2 +- src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 2 +- .../drivers/freedreno/a6xx/fd6_program.cc | 4 ++-- .../drivers/freedreno/freedreno_batch_cache.c | 2 +- .../drivers/freedreno/freedreno_context.h | 2 +- .../drivers/freedreno/freedreno_gmem.c | 2 +- .../drivers/freedreno/freedreno_util.h | 2 +- src/gallium/drivers/iris/iris_batch.c | 2 +- src/gallium/drivers/llvmpipe/lp_perf.h | 2 +- src/gallium/drivers/llvmpipe/lp_rast.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_rast.h | 4 ++-- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 2 +- src/gallium/drivers/llvmpipe/lp_scene.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_line.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_point.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_setup_rect.c | 2 +- src/gallium/drivers/llvmpipe/lp_setup_tri.c | 2 +- .../drivers/llvmpipe/lp_state_sampler.c | 2 +- src/gallium/drivers/llvmpipe/lp_test_main.c | 2 +- src/gallium/drivers/llvmpipe/lp_texture.c | 16 +++++++-------- src/gallium/drivers/llvmpipe/lp_texture.h | 4 ++-- src/gallium/drivers/panfrost/pan_resource.c | 2 +- src/gallium/drivers/r300/r300_cb.h | 2 +- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_cs.h | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 2 +- src/gallium/drivers/svga/svga_context.h | 2 +- src/gallium/drivers/svga/svga_debug.h | 4 ++-- src/gallium/drivers/svga/svga_draw.c | 2 +- src/gallium/drivers/svga/svga_format.c | 4 ++-- src/gallium/drivers/svga/svga_image_view.c | 2 +- .../drivers/svga/svga_resource_texture.c | 2 +- src/gallium/drivers/svga/svga_screen.c | 10 +++++----- src/gallium/drivers/svga/svga_screen.h | 2 +- src/gallium/drivers/svga/svga_shader_buffer.c | 8 ++++---- src/gallium/drivers/svga/svga_state.c | 2 +- .../drivers/svga/svga_state_constants.c | 2 +- src/gallium/drivers/svga/svga_state_fs.c | 4 ++-- .../drivers/svga/svga_state_need_swtnl.c | 2 +- src/gallium/drivers/svga/svga_state_uav.c | 4 ++-- src/gallium/drivers/vc4/vc4_bufmgr.c | 2 +- src/gallium/drivers/vc4/vc4_qir_validate.c | 2 +- src/gallium/drivers/vc4/vc4_qpu_validate.c | 2 +- src/gallium/frontends/d3d10umd/Debug.cpp | 2 +- src/gallium/frontends/d3d10umd/Debug.h | 4 ++-- .../frontends/d3d10umd/OutputMerger.cpp | 2 +- src/gallium/frontends/glx/xlib/glx_usefont.c | 10 +++++----- src/gallium/frontends/hgl/hgl.c | 2 +- src/gallium/frontends/nine/basetexture9.c | 6 +++--- src/gallium/frontends/nine/basetexture9.h | 2 +- src/gallium/frontends/nine/nine_debug.h | 10 +++++----- src/gallium/frontends/nine/nine_dump.c | 4 ++-- src/gallium/frontends/nine/nine_dump.h | 6 +++--- src/gallium/frontends/nine/nine_ff.c | 2 +- .../frontends/nine/nine_memory_helper.c | 2 +- src/gallium/frontends/nine/nine_state.c | 2 +- src/gallium/frontends/nine/surface9.c | 4 ++-- src/gallium/frontends/nine/surface9.h | 2 +- src/gallium/frontends/nine/volume9.c | 2 +- src/gallium/frontends/omx/bellagio/vid_dec.c | 2 +- src/gallium/frontends/omx/bellagio/vid_enc.c | 2 +- src/gallium/frontends/wgl/stw_device.h | 2 +- src/gallium/frontends/wgl/stw_ext_pbuffer.c | 2 +- src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 18 ++++++++--------- src/gallium/winsys/amdgpu/drm/amdgpu_bo.h | 2 +- src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp | 2 +- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 14 ++++++------- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 2 +- src/gallium/winsys/i915/drm/i915_drm_buffer.c | 2 +- .../winsys/svga/drm/pb_buffer_simple_fenced.c | 4 ++-- src/gallium/winsys/svga/drm/vmw_buffer.c | 8 ++++---- src/gallium/winsys/svga/drm/vmw_buffer.h | 2 +- src/gallium/winsys/svga/drm/vmw_context.c | 16 +++++++-------- .../winsys/svga/drm/vmw_screen_ioctl.c | 2 +- src/gallium/winsys/svga/drm/vmw_shader.c | 2 +- src/gallium/winsys/svga/drm/vmw_surface.c | 2 +- src/gallium/winsys/sw/hgl/hgl_sw_winsys.cpp | 2 +- .../winsys/sw/kms-dri/kms_dri_sw_winsys.c | 2 +- src/glx/xfont.c | 2 +- src/imagination/vulkan/pds/pvr_pds.c | 4 ++-- src/imagination/vulkan/pds/pvr_pipeline_pds.c | 2 +- src/imagination/vulkan/pvr_border.c | 2 +- src/imagination/vulkan/pvr_cmd_buffer.c | 8 ++++---- src/imagination/vulkan/pvr_csb.c | 8 ++++---- src/imagination/vulkan/pvr_csb.h | 6 +++--- src/imagination/vulkan/pvr_device.c | 2 +- src/imagination/vulkan/pvr_private.h | 2 +- src/imagination/vulkan/pvr_spm.c | 4 ++-- .../vulkan/pvr_transfer_frag_store.c | 2 +- .../winsys/pvrsrvkm/pvr_srv_job_render.c | 2 +- src/intel/compiler/brw_disasm.c | 2 +- .../compiler/brw_fs_combine_constants.cpp | 2 +- src/intel/compiler/elk/elk_disasm.c | 2 +- .../compiler/elk/elk_fs_combine_constants.cpp | 2 +- src/intel/perf/intel_perf_query.c | 2 +- src/intel/vulkan/anv_image.c | 2 +- src/intel/vulkan/anv_private.h | 2 +- src/intel/vulkan_hasvk/anv_image.c | 2 +- src/intel/vulkan_hasvk/anv_private.h | 2 +- src/mapi/glapi/glapi_dispatch.c | 2 +- src/mapi/mapi_abi.py | 6 +++--- src/mapi/new/gen_gldispatch_mapi.py | 6 +++--- src/mesa/main/context.c | 4 ++-- src/mesa/main/draw.c | 2 +- src/mesa/main/draw_validate.c | 2 +- src/mesa/main/errors.c | 10 +++++----- src/mesa/main/macros.h | 2 +- src/mesa/main/teximage.c | 2 +- src/util/fast_urem_by_const.h | 2 +- src/util/libsync.h | 2 +- src/util/log.h | 6 +++--- src/util/os_misc.c | 2 +- src/util/os_misc.h | 2 +- src/util/u_cpu_detect.c | 4 ++-- src/util/u_debug.h | 20 +++++++++---------- src/vulkan/runtime/vk_log.c | 4 ++-- 165 files changed, 284 insertions(+), 284 deletions(-) diff --git a/src/broadcom/compiler/qpu_validate.c b/src/broadcom/compiler/qpu_validate.c index 6c15153b9cb..538b247e3e0 100644 --- a/src/broadcom/compiler/qpu_validate.c +++ b/src/broadcom/compiler/qpu_validate.c @@ -397,7 +397,7 @@ qpu_validate(struct v3d_compile *c) * keep compiling the validation code to make sure it doesn't get * broken. */ -#ifndef DEBUG +#if !MESA_DEBUG return; #endif diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index af0ec0c11a4..0fcf074c174 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -2170,7 +2170,7 @@ try_opt_ldunif(struct v3d_compile *c, uint32_t index, struct qreg *unif) struct qinst *prev_inst = NULL; assert(c->cur_block); -#ifdef DEBUG +#if MESA_DEBUG /* We can only reuse a uniform if it was emitted in the same block, * so callers must make sure the current instruction is being emitted * in the current block. diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 75fad5c5483..31f541e5180 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -1808,7 +1808,7 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice, perf_debug("Device created with Robust Image Access enabled.\n"); -#ifdef DEBUG +#if MESA_DEBUG v3dv_X(device, device_check_prepacked_sizes)(); #endif init_device_meta(device); diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index e9911524f76..af87f3a1d7c 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -104,7 +104,7 @@ #include "wsi_common.h" /* A non-fatal assert. Useful for debugging. */ -#ifdef DEBUG +#if MESA_DEBUG #define v3dv_assert(x) ({ \ if (unlikely(!(x))) \ fprintf(stderr, "%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \ diff --git a/src/broadcom/vulkan/v3dv_uniforms.c b/src/broadcom/vulkan/v3dv_uniforms.c index 018c471fe30..7350681801f 100644 --- a/src/broadcom/vulkan/v3dv_uniforms.c +++ b/src/broadcom/vulkan/v3dv_uniforms.c @@ -615,7 +615,7 @@ v3dv_write_uniforms_wg_offsets(struct v3dv_cmd_buffer *cmd_buffer, } else { assert(cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY); num_layers = 2048; -#ifdef DEBUG +#if MESA_DEBUG fprintf(stderr, "Skipping gl_LayerID shader sanity check for " "secondary command buffer\n"); #endif diff --git a/src/broadcom/vulkan/v3dvx_device.c b/src/broadcom/vulkan/v3dvx_device.c index 1b50d51e19f..a27d65cfd23 100644 --- a/src/broadcom/vulkan/v3dvx_device.c +++ b/src/broadcom/vulkan/v3dvx_device.c @@ -387,7 +387,7 @@ v3dX(get_hw_clear_color)(const VkClearColorValue *color, } } -#ifdef DEBUG +#if MESA_DEBUG void v3dX(device_check_prepacked_sizes)(void) { diff --git a/src/broadcom/vulkan/v3dvx_private.h b/src/broadcom/vulkan/v3dvx_private.h index 6c54c0568c7..adaa2b6dcf7 100644 --- a/src/broadcom/vulkan/v3dvx_private.h +++ b/src/broadcom/vulkan/v3dvx_private.h @@ -152,7 +152,7 @@ v3dX(framebuffer_compute_internal_bpp_msaa)(const struct v3dv_framebuffer *frame uint8_t *total_color_bpp, bool *msaa); -#ifdef DEBUG +#if MESA_DEBUG void v3dX(device_check_prepacked_sizes)(void); #endif diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h index 332b662a8f6..f2751d82b2d 100644 --- a/src/compiler/glsl/ir.h +++ b/src/compiler/glsl/ir.h @@ -643,7 +643,7 @@ private: * If the name length fits into name_storage, it's used, otherwise * the name is ralloc'd. shader-db mining showed that 70% of variables * fit here. This is a win over ralloc where only ralloc_header has - * 20 bytes on 64-bit (28 bytes with DEBUG), and we can also skip malloc. + * 20 bytes on 64-bit (28 bytes with debug), and we can also skip malloc. */ char name_storage[16]; diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp index 5a1c941eca3..35826b24057 100644 --- a/src/compiler/glsl/ir_validate.cpp +++ b/src/compiler/glsl/ir_validate.cpp @@ -1247,7 +1247,7 @@ validate_ir_tree(exec_list *instructions) * and it's half composed of assert()s anyway which wouldn't do * anything. */ -#ifndef DEBUG +#if !MESA_DEBUG if (!debug_get_bool_option("GLSL_VALIDATE", false)) return; #endif diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index c8362d4ebb1..f6b8d266dba 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -172,7 +172,7 @@ find_output(nir_shader *shader, unsigned drvloc) nir_def *new_def = find_output_in_block(block, drvloc); assert(!(new_def && def)); def = new_def; -#if !defined(DEBUG) +#if !MESA_DEBUG /* for debug builds, scan entire shader to assert * if output is written multiple times. For release * builds just assume all is well and bail when we diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp index e83656b53da..15417767406 100644 --- a/src/egl/drivers/haiku/egl_haiku.cpp +++ b/src/egl/drivers/haiku/egl_haiku.cpp @@ -53,7 +53,7 @@ extern "C" { #include "target-helpers/inline_sw_helper.h" } -#ifdef DEBUG +#if MESA_DEBUG #define TRACE(x...) printf("egl_haiku: " x) #define CALLED() TRACE("CALLED: %s\n", __PRETTY_FUNCTION__) #else diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index e962c6f32e3..add805bfd8f 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -466,8 +466,8 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) } if (!matched) { -#ifndef DEBUG - /* only print the common errors when DEBUG is not defined */ +#if !MESA_DEBUG + /* only print the common errors when MESA_DEBUG is defined to 0 */ if (attr != EGL_RENDERABLE_TYPE) break; #endif diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index a6a5defa10e..415c6abbc0e 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -504,7 +504,7 @@ struct ir3_block * ir3_block_create(struct ir3 *shader) { struct ir3_block *block = ir3_alloc(shader, sizeof(*block)); -#ifdef DEBUG +#if MESA_DEBUG block->serialno = ++shader->block_count; #endif block->shader = shader; @@ -633,7 +633,7 @@ instr_create(struct ir3_block *block, opc_t opc, int ndst, int nsrc) instr->dsts = (struct ir3_register **)ptr; instr->srcs = instr->dsts + ndst; -#ifdef DEBUG +#if MESA_DEBUG instr->dsts_max = ndst; instr->srcs_max = nsrc; #endif @@ -737,7 +737,7 @@ struct ir3_register * ir3_src_create(struct ir3_instruction *instr, int num, int flags) { struct ir3 *shader = instr->block->shader; -#ifdef DEBUG +#if MESA_DEBUG assert(instr->srcs_count < instr->srcs_max); #endif struct ir3_register *reg = reg_create(shader, num, flags); @@ -749,7 +749,7 @@ struct ir3_register * ir3_dst_create(struct ir3_instruction *instr, int num, int flags) { struct ir3 *shader = instr->block->shader; -#ifdef DEBUG +#if MESA_DEBUG assert(instr->dsts_count < instr->dsts_max); #endif struct ir3_register *reg = reg_create(shader, num, flags); diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 9458b1e196e..7da13e61eca 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -354,7 +354,7 @@ struct ir3_instruction { BITMASK_ENUM(ir3_instruction_flags) flags; uint8_t repeat; uint8_t nop; -#ifdef DEBUG +#if MESA_DEBUG unsigned srcs_max, dsts_max; #endif unsigned srcs_count, dsts_count; @@ -582,7 +582,7 @@ struct ir3 { /* List of ir3_array's: */ struct list_head array_list; -#ifdef DEBUG +#if MESA_DEBUG unsigned block_count; #endif unsigned instr_count; @@ -669,7 +669,7 @@ struct ir3_block { uint32_t loop_id; uint32_t loop_depth; -#ifdef DEBUG +#if MESA_DEBUG uint32_t serialno; #endif }; @@ -677,7 +677,7 @@ struct ir3_block { static inline uint32_t block_id(struct ir3_block *block) { -#ifdef DEBUG +#if MESA_DEBUG return block->serialno; #else return (uint32_t)(unsigned long)block; diff --git a/src/freedreno/ir3/ir3_compiler.c b/src/freedreno/ir3/ir3_compiler.c index 7e03a0a64cd..0cf419e090d 100644 --- a/src/freedreno/ir3/ir3_compiler.c +++ b/src/freedreno/ir3/ir3_compiler.c @@ -49,8 +49,8 @@ static const struct debug_named_value shader_debug_options[] = { {"nopreamble", IR3_DBG_NOPREAMBLE, "Disable the preamble pass"}, {"fullsync", IR3_DBG_FULLSYNC, "Add (sy) + (ss) after each cat5/cat6"}, {"fullnop", IR3_DBG_FULLNOP, "Add nops before each instruction"}, -#ifdef DEBUG - /* DEBUG-only options: */ +#if MESA_DEBUG + /* MESA_DEBUG-only options: */ {"schedmsgs", IR3_DBG_SCHEDMSGS, "Enable scheduler debug messages"}, {"ramsgs", IR3_DBG_RAMSGS, "Enable register-allocation debug messages"}, #endif diff --git a/src/freedreno/ir3/ir3_compiler.h b/src/freedreno/ir3/ir3_compiler.h index bcaaae8ef25..23f3aedc2c0 100644 --- a/src/freedreno/ir3/ir3_compiler.h +++ b/src/freedreno/ir3/ir3_compiler.h @@ -317,7 +317,7 @@ enum ir3_shader_debug { IR3_DBG_FULLSYNC = BITFIELD_BIT(15), IR3_DBG_FULLNOP = BITFIELD_BIT(16), - /* DEBUG-only options: */ + /* MESA_DEBUG-only options: */ IR3_DBG_SCHEDMSGS = BITFIELD_BIT(20), IR3_DBG_RAMSGS = BITFIELD_BIT(21), diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c index d642d559f4b..a80d17a20fd 100644 --- a/src/freedreno/ir3/ir3_postsched.c +++ b/src/freedreno/ir3/ir3_postsched.c @@ -31,7 +31,7 @@ #include "ir3_compiler.h" #include "ir3_context.h" -#ifdef DEBUG +#if MESA_DEBUG #define SCHED_DEBUG (ir3_shader_debug & IR3_DBG_SCHEDMSGS) #else #define SCHED_DEBUG 0 diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index 92e55bf9a4b..2fe1ddd2225 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -72,7 +72,7 @@ print_instr_name(struct log_stream *stream, struct ir3_instruction *instr, { if (!instr) return; -#ifdef DEBUG +#if MESA_DEBUG mesa_log_stream_printf(stream, "%04u:", instr->serialno); #endif mesa_log_stream_printf(stream, "%04u:", instr->ip); diff --git a/src/freedreno/ir3/ir3_ra.h b/src/freedreno/ir3/ir3_ra.h index b67b9dd7839..799965f71ba 100644 --- a/src/freedreno/ir3/ir3_ra.h +++ b/src/freedreno/ir3/ir3_ra.h @@ -28,7 +28,7 @@ #include "ir3.h" #include "ir3_compiler.h" -#ifdef DEBUG +#if MESA_DEBUG #define RA_DEBUG (ir3_shader_debug & IR3_DBG_RAMSGS) #else #define RA_DEBUG 0 diff --git a/src/freedreno/ir3/ir3_sched.c b/src/freedreno/ir3/ir3_sched.c index aad52b194a3..7fb3f53ca76 100644 --- a/src/freedreno/ir3/ir3_sched.c +++ b/src/freedreno/ir3/ir3_sched.c @@ -30,7 +30,7 @@ #include "ir3.h" #include "ir3_compiler.h" -#ifdef DEBUG +#if MESA_DEBUG #define SCHED_DEBUG (ir3_shader_debug & IR3_DBG_SCHEDMSGS) #else #define SCHED_DEBUG 0 diff --git a/src/freedreno/vulkan/tu_knl_drm_msm.cc b/src/freedreno/vulkan/tu_knl_drm_msm.cc index 31ab576c06e..0e23e71c11c 100644 --- a/src/freedreno/vulkan/tu_knl_drm_msm.cc +++ b/src/freedreno/vulkan/tu_knl_drm_msm.cc @@ -489,7 +489,7 @@ static void tu_bo_set_kernel_name(struct tu_device *dev, struct tu_bo *bo, const char *name) { bool kernel_bo_names = dev->bo_sizes != NULL; -#ifdef DEBUG +#if MESA_DEBUG kernel_bo_names = true; #endif if (!kernel_bo_names) diff --git a/src/freedreno/vulkan/tu_knl_drm_virtio.cc b/src/freedreno/vulkan/tu_knl_drm_virtio.cc index 81e436fb94e..964b4211d7b 100644 --- a/src/freedreno/vulkan/tu_knl_drm_virtio.cc +++ b/src/freedreno/vulkan/tu_knl_drm_virtio.cc @@ -534,7 +534,7 @@ static void tu_bo_set_kernel_name(struct tu_device *dev, struct tu_bo *bo, const char *name) { bool kernel_bo_names = dev->bo_sizes != NULL; -#ifdef DEBUG +#if MESA_DEBUG kernel_bo_names = true; #endif if (!kernel_bo_names) diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h index a2d58f2c7d2..1a7b378116b 100644 --- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h +++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h @@ -173,7 +173,7 @@ TAG(do_cliptest)(struct pt_post_vs *pvs, position[2] = position[2] * w * scale[2] + trans[2]; position[3] = w; } -#ifdef DEBUG +#if MESA_DEBUG /* For debug builds, set the clipped vertex's window coordinate * to NaN to help catch potential errors later. */ diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 2ebbcac74de..cd93f1469cd 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -245,7 +245,7 @@ draw_pipeline_run(struct draw_context *draw, start += prim_info->primitive_lengths[i], i++) { const unsigned count = prim_info->primitive_lengths[i]; -#ifdef DEBUG +#if MESA_DEBUG /* Warn if one of the element indexes go outside the vertex buffer */ { unsigned max_index = 0x0; diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 9720faa200e..dcda6a7ff28 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -334,7 +334,7 @@ generate_aaline_fs(struct aaline_stage *aaline) if (!aaline_fs.tokens) return false; -#if 0 /* DEBUG */ +#if 0 /* debug */ debug_printf("draw_aaline, orig shader:\n"); tgsi_dump(orig_fs->tokens, 0); debug_printf("draw_aaline, new shader:\n"); diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 14fbb842026..6df62094e39 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -387,7 +387,7 @@ generate_aapoint_fs(struct aapoint_stage *aapoint) if (!aapoint_fs.tokens) return false; -#if 0 /* DEBUG */ +#if 0 /* debug */ debug_printf("draw_aapoint, orig shader:\n"); tgsi_dump(orig_fs->tokens, 0); debug_printf("draw_aapoint, new shader:\n"); diff --git a/src/gallium/auxiliary/driver_trace/tr_context.h b/src/gallium/auxiliary/driver_trace/tr_context.h index 0d947abb106..fb69a00a323 100644 --- a/src/gallium/auxiliary/driver_trace/tr_context.h +++ b/src/gallium/auxiliary/driver_trace/tr_context.h @@ -73,7 +73,7 @@ static inline struct trace_context * trace_context(struct pipe_context *pipe) { assert(pipe); -#ifdef DEBUG +#if MESA_DEBUG trace_context_check(pipe); #endif return (struct trace_context *)pipe; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h index a8db59b9bc4..9eb103369d5 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -62,7 +62,7 @@ extern unsigned gallivm_debug; static inline void lp_build_name(LLVMValueRef val, const char *format, ...) { -#ifdef DEBUG +#if MESA_DEBUG char name[32]; va_list ap; va_start(ap, format); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 1345d85b224..4b859776e5c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -76,7 +76,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = { { "perf", GALLIVM_DEBUG_PERF, NULL }, { "gc", GALLIVM_DEBUG_GC, NULL }, /* Don't allow setting DUMP_BC for release builds, since writing the files may be an issue with setuid. */ -#ifdef DEBUG +#if MESA_DEBUG { "dumpbc", GALLIVM_DEBUG_DUMP_BC, NULL }, #endif DEBUG_NAMED_VALUE_END @@ -525,7 +525,7 @@ gallivm_verify_function(struct gallivm_state *gallivm, LLVMValueRef func) { /* Verify the LLVM IR. If invalid, dump and abort */ -#ifdef DEBUG +#if MESA_DEBUG if (LLVMVerifyFunction(func, LLVMPrintMessageAction)) { lp_debug_dump_value(func); assert(0); @@ -634,7 +634,7 @@ gallivm_compile_module(struct gallivm_state *gallivm) /* Disable frame pointer omission on debug/profile builds */ /* XXX: And workaround http://llvm.org/PR21435 */ -#if defined(DEBUG) || defined(PROFILE) || DETECT_ARCH_X86 || DETECT_ARCH_X86_64 +#if MESA_DEBUG || defined(PROFILE) || DETECT_ARCH_X86 || DETECT_ARCH_X86_64 LLVMAddTargetDependentFunctionAttr(func, "no-frame-pointer-elim", "true"); LLVMAddTargetDependentFunctionAttr(func, "no-frame-pointer-elim-non-leaf", "true"); #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 753ac8a4b50..2ef45606275 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -130,7 +130,7 @@ static void init_native_targets() llvm::InitializeNativeTargetAsmPrinter(); llvm::InitializeNativeTargetDisassembler(); -#ifdef DEBUG +#if MESA_DEBUG { char *env_llc_options = getenv("GALLIVM_LLC_OPTIONS"); if (env_llc_options) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.c b/src/gallium/auxiliary/gallivm/lp_bld_struct.c index 0595c3d3df2..8c6c927f212 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_struct.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.c @@ -91,7 +91,7 @@ lp_build_array_get_ptr2(struct gallivm_state *gallivm, indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = index; element_ptr = LLVMBuildGEP2(gallivm->builder, array_type, ptr, indices, ARRAY_SIZE(indices), ""); -#ifdef DEBUG +#if MESA_DEBUG lp_build_name(element_ptr, "&%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index)); #endif return element_ptr; @@ -111,7 +111,7 @@ lp_build_array_get2(struct gallivm_state *gallivm, element_ptr = lp_build_array_get_ptr2(gallivm, array_type, ptr, index); LLVMTypeRef element_type = LLVMGetElementType(array_type); res = LLVMBuildLoad2(gallivm->builder, element_type, element_ptr, ""); -#ifdef DEBUG +#if MESA_DEBUG lp_build_name(res, "%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index)); #endif return res; @@ -131,7 +131,7 @@ lp_build_pointer_get_unaligned2(LLVMBuilderRef builder, res = LLVMBuildLoad2(builder, ptr_type, element_ptr, ""); if (alignment) LLVMSetAlignment(res, alignment); -#ifdef DEBUG +#if MESA_DEBUG lp_build_name(res, "%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index)); #endif return res; diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 055fb3f9cbc..98cea869cfb 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -196,7 +196,7 @@ fenced_buffer_copy_storage_to_cpu_locked(struct fenced_buffer *fenced_buf); static void fenced_manager_dump_locked(struct fenced_manager *fenced_mgr) { -#ifdef DEBUG +#if MESA_DEBUG struct pb_fence_ops *ops = fenced_mgr->ops; struct list_head *curr, *next; struct fenced_buffer *fenced_buf; @@ -987,7 +987,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr) ; } -#ifdef DEBUG +#if MESA_DEBUG /* assert(!fenced_mgr->num_unfenced); */ #endif diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 75d8af2b7a8..3880a0f387e 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -46,7 +46,7 @@ #include "pb_bufmgr.h" -#ifdef DEBUG +#if MESA_DEBUG #define PB_DEBUG_CREATE_BACKTRACE 8 @@ -483,7 +483,7 @@ pb_debug_manager_create(struct pb_manager *provider, } -#else /* !DEBUG */ +#else /* !MESA_DEBUG */ struct pb_manager * @@ -494,4 +494,4 @@ pb_debug_manager_create(struct pb_manager *provider, } -#endif /* !DEBUG */ +#endif /* MESA_DEBUG */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index e9cbd7e1af5..3b5398d6120 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -411,7 +411,7 @@ static void micro_exp2(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { -#ifdef DEBUG +#if MESA_DEBUG /* Inf is okay for this instruction, so clamp it to silence assertions. */ unsigned i; union tgsi_exec_channel clamped; @@ -426,7 +426,7 @@ micro_exp2(union tgsi_exec_channel *dst, } } src = &clamped; -#endif /* DEBUG */ +#endif /* MESA_DEBUG */ dst->f[0] = powf(2.0f, src->f[0]); dst->f[1] = powf(2.0f, src->f[1]); @@ -973,7 +973,7 @@ static const union tgsi_exec_channel M128Vec = { {-128.0f, -128.0f, -128.0f, -128.0f} }; -#ifdef DEBUG +#if MESA_DEBUG static void print_chan(const char *msg, const union tgsi_exec_channel *chan) { @@ -983,7 +983,7 @@ print_chan(const char *msg, const union tgsi_exec_channel *chan) #endif -#ifdef DEBUG +#if MESA_DEBUG static void print_temp(const struct tgsi_exec_machine *mach, unsigned index) { @@ -1233,7 +1233,7 @@ tgsi_exec_machine_create(enum pipe_shader_type shader_type) goto fail; } -#ifdef DEBUG +#if MESA_DEBUG /* silence warnings */ (void) print_chan; (void) print_temp; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 2bf0dc212ca..fdbc37220d0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -2144,7 +2144,7 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg ) tgsi_dump( tokens, 0 ); } -#ifdef DEBUG +#if MESA_DEBUG /* tgsi_sanity doesn't seem to return if there are too many constants. */ bool too_many_constants = false; for (unsigned i = 0; i < ARRAY_SIZE(ureg->const_decls); i++) { diff --git a/src/gallium/auxiliary/util/u_cache.c b/src/gallium/auxiliary/util/u_cache.c index c5f35fedc61..56140b5c524 100644 --- a/src/gallium/auxiliary/util/u_cache.c +++ b/src/gallium/auxiliary/util/u_cache.c @@ -54,7 +54,7 @@ struct util_cache_entry void *key; void *value; -#ifdef DEBUG +#if MESA_DEBUG unsigned count; #endif }; @@ -212,7 +212,7 @@ util_cache_set(struct util_cache *cache, util_cache_entry_destroy(cache, entry); -#ifdef DEBUG +#if MESA_DEBUG ++entry->count; #endif @@ -288,7 +288,7 @@ util_cache_destroy(struct util_cache *cache) if (!cache) return; -#ifdef DEBUG +#if MESA_DEBUG if (cache->count >= 20*cache->size) { /* Normal approximation of the Poisson distribution */ double mean = (double)cache->count/(double)cache->size; @@ -340,7 +340,7 @@ util_cache_remove(struct util_cache *cache, static void ensure_sanity(const struct util_cache *cache) { -#ifdef DEBUG +#if MESA_DEBUG unsigned i, cnt = 0; assert(cache); diff --git a/src/gallium/auxiliary/util/u_debug_flush.c b/src/gallium/auxiliary/util/u_debug_flush.c index 45cfdae876d..713ad502039 100644 --- a/src/gallium/auxiliary/util/u_debug_flush.c +++ b/src/gallium/auxiliary/util/u_debug_flush.c @@ -37,7 +37,7 @@ * @author Thomas Hellstrom */ -#ifdef DEBUG +#if MESA_DEBUG #include "util/compiler.h" #include "util/simple_mtx.h" #include "util/u_debug_stack.h" diff --git a/src/gallium/auxiliary/util/u_debug_flush.h b/src/gallium/auxiliary/util/u_debug_flush.h index 6c3d0b0c059..29c9804fb8b 100644 --- a/src/gallium/auxiliary/util/u_debug_flush.h +++ b/src/gallium/auxiliary/util/u_debug_flush.h @@ -36,7 +36,7 @@ * * @author Thomas Hellstrom */ -#ifdef DEBUG +#if MESA_DEBUG #ifndef U_DEBUG_FLUSH_H_ #define U_DEBUG_FLUSH_H_ diff --git a/src/gallium/auxiliary/util/u_debug_image.c b/src/gallium/auxiliary/util/u_debug_image.c index d560a3267ab..d615ba16906 100644 --- a/src/gallium/auxiliary/util/u_debug_image.c +++ b/src/gallium/auxiliary/util/u_debug_image.c @@ -35,7 +35,7 @@ #include -#ifdef DEBUG +#if MESA_DEBUG /** * Dump an image to .ppm file. diff --git a/src/gallium/auxiliary/util/u_debug_image.h b/src/gallium/auxiliary/util/u_debug_image.h index 25a69b3e654..89570ecd8ab 100644 --- a/src/gallium/auxiliary/util/u_debug_image.h +++ b/src/gallium/auxiliary/util/u_debug_image.h @@ -32,7 +32,7 @@ #include "util/format/u_formats.h" -#ifdef DEBUG +#if MESA_DEBUG struct pipe_context; struct pipe_surface; struct pipe_transfer; diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index c91e2806cea..0e562307c05 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -24,7 +24,7 @@ * **************************************************************************/ -#if defined(DEBUG) +#if MESA_DEBUG /** * If the GALLIUM_REFCNT_LOG env var is defined as a filename, gallium @@ -188,4 +188,4 @@ debug_reference_slowpath(const struct pipe_reference *p, } } -#endif /* DEBUG */ +#endif /* MESA_DEBUG */ diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.h b/src/gallium/auxiliary/util/u_debug_refcnt.h index b831aaffe02..026028090ca 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -36,7 +36,7 @@ extern "C" { typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*); -#if defined(DEBUG) +#if MESA_DEBUG extern int debug_refcnt_state; diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index b0d5b0d1269..f1346877756 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -402,7 +402,7 @@ util_pstipple_create_fragment_shader(const struct tgsi_token *tokens, if (!new_tokens) return NULL; -#if 0 /* DEBUG */ +#if 0 /* debug */ tgsi_dump(fs->tokens, 0); tgsi_dump(new_fs->tokens, 0); #endif diff --git a/src/gallium/drivers/crocus/crocus_batch.c b/src/gallium/drivers/crocus/crocus_batch.c index e2eff9ece77..5d74101c5df 100644 --- a/src/gallium/drivers/crocus/crocus_batch.c +++ b/src/gallium/drivers/crocus/crocus_batch.c @@ -1014,7 +1014,7 @@ _crocus_batch_flush(struct crocus_batch *batch, const char *file, int line) } if (ret < 0) { -#ifdef DEBUG +#if MESA_DEBUG const bool color = INTEL_DEBUG(DEBUG_COLOR); fprintf(stderr, "%scrocus: Failed to submit batchbuffer: %-80s%s\n", color ? "\e[1;41m" : "", strerror(-ret), color ? "\e[0m" : ""); diff --git a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp index ee4661d7240..8dd3aeeff2f 100644 --- a/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_dxgi_screen.cpp @@ -55,7 +55,7 @@ get_dxgi_factory() } UINT flags = 0; -#ifndef DEBUG +#if !MESA_DEBUG if (d3d12_debug & D3D12_DEBUG_DEBUG_LAYER) #endif flags |= DXGI_CREATE_FACTORY_DEBUG; diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp index 22e11e9f3c8..af5ffb63bdb 100644 --- a/src/gallium/drivers/d3d12/d3d12_resource.cpp +++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp @@ -438,7 +438,7 @@ convert_planar_resource(struct d3d12_resource *res) plane_res->base.b.width0 = util_format_get_plane_width(res->base.b.format, plane, res->base.b.width0); plane_res->base.b.height0 = util_format_get_plane_height(res->base.b.format, plane, res->base.b.height0); -#ifdef DEBUG +#if MESA_DEBUG struct d3d12_screen *screen = d3d12_screen(res->base.b.screen); D3D12_RESOURCE_DESC desc = GetDesc(res->bo->res); desc.Flags &= ~D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; diff --git a/src/gallium/drivers/d3d12/d3d12_screen.cpp b/src/gallium/drivers/d3d12/d3d12_screen.cpp index 259d78b5646..0ef4d06450f 100644 --- a/src/gallium/drivers/d3d12/d3d12_screen.cpp +++ b/src/gallium/drivers/d3d12/d3d12_screen.cpp @@ -1521,7 +1521,7 @@ d3d12_init_screen(struct d3d12_screen *screen, IUnknown *adapter) #ifndef _GAMING_XBOX ID3D12DeviceFactory *factory = try_create_device_factory(screen->d3d12_mod); -#ifndef DEBUG +#if !MESA_DEBUG if (d3d12_debug & D3D12_DEBUG_DEBUG_LAYER) #endif enable_d3d12_debug_layer(screen->d3d12_mod, factory); diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp index 93ede43b375..5147adf3c8c 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc.cpp @@ -2094,7 +2094,7 @@ d3d12_video_encoder_encode_bitstream(struct pipe_video_codec * codec, CD3DX12_RESOURCE_DESC referencesTexArrayDesc(GetDesc(referenceFramesDescriptor.ppTexture2Ds[0])); -#ifdef DEBUG +#if MESA_DEBUG // the reconpic output should be all the same texarray allocation if((reconPicOutputTextureDesc.pReconstructedPicture) && (referenceFramesDescriptor.NumTexture2Ds > 0)) assert(referenceFramesDescriptor.ppTexture2Ds[0] == reconPicOutputTextureDesc.pReconstructedPicture); diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_av1.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_av1.cpp index d3cc3ca0f3f..209be39de51 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_av1.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_av1.cpp @@ -96,7 +96,7 @@ d3d12_video_encoder_references_manager_av1::begin_frame(D3D12_VIDEO_ENCODER_PICT reconPic.ReconstructedPictureSubresource; } -#ifdef DEBUG +#if MESA_DEBUG assert(m_PhysicalAllocationsStorage.get_number_of_tracked_allocations() <= (NUM_REF_FRAMES + 1)); // pool is not extended beyond maximum expected usage @@ -314,7 +314,7 @@ d3d12_video_encoder_references_manager_av1::get_current_frame_picture_control_da m_CurrentFramePicParams.ReferenceFramesReconPictureDescriptors[i] = m_CurrentFrameReferencesData.pVirtualDPBEntries[i]; -#ifdef DEBUG // Otherwise may iterate over structures and do no-op debug_printf +#if MESA_DEBUG // Otherwise may iterate over structures and do no-op debug_printf print_ref_frame_idx(); print_virtual_dpb_entries(); print_physical_resource_references(); diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index d0567d717a3..46a7ed56e22 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -408,7 +408,7 @@ create_variant(struct etna_shader *shader, etna_disk_cache_store(shader->compiler, v); -#ifdef DEBUG +#if MESA_DEBUG if (DBG_ENABLED(ETNA_DBG_DUMP_SHADERS)) etna_dump_shader(v); #endif diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c index 86307c21d9d..35d565c8789 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c @@ -293,7 +293,7 @@ setup_border_colors(struct fd_texture_stateobj *tex, } } -#ifdef DEBUG +#if MESA_DEBUG memset(&e->__pad0, 0, sizeof(e->__pad0)); memset(&e->__pad1, 0, sizeof(e->__pad1)); #endif diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc index 5ddd5beec86..76b76705961 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.cc @@ -111,7 +111,7 @@ fd6_emit_shader(struct fd_context *ctx, struct fd_ringbuffer *ring, return; } -#ifdef DEBUG +#if MESA_DEBUG /* Name should generally match what you get with MESA_SHADER_CAPTURE_PATH: */ const char *name = so->name; if (name) @@ -1306,7 +1306,7 @@ fd6_program_create(void *data, const struct ir3_shader_variant *bs, state->binning_stateobj = fd_ringbuffer_new_object(ctx->pipe, 0x1000); state->stateobj = fd_ringbuffer_new_object(ctx->pipe, 0x1000); -#ifdef DEBUG +#if MESA_DEBUG if (!ds) { for (unsigned i = 0; i < bs->inputs_count; i++) { if (vs->inputs[i].sysval) diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c index a8ce3101d67..5198cbb6cfa 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c +++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c @@ -510,7 +510,7 @@ batch_from_key(struct fd_context *ctx, struct fd_batch_key *key) assert_dt } batch = alloc_batch_locked(cache, ctx, false); -#ifdef DEBUG +#if MESA_DEBUG DBG("%p: hash=0x%08x, %ux%u, %u layers, %u samples", batch, hash, key->width, key->height, key->layers, key->samples); for (unsigned idx = 0; idx < key->num_surfs; idx++) { diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index 3dedfd3e641..4e61e5a6792 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -184,7 +184,7 @@ enum fd_dirty_3d_state { static inline void fd_print_dirty_state(BITMASK_ENUM(fd_dirty_3d_state) dirty) { -#ifdef DEBUG +#if MESA_DEBUG if (!FD_DBG(MSGS)) return; diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 893398e7a7b..e93477c494e 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -333,7 +333,7 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key) tpp_x += 1; } -#ifdef DEBUG +#if MESA_DEBUG tpp_x = debug_get_num_option("TPP_X", tpp_x); tpp_y = debug_get_num_option("TPP_Y", tpp_x); #endif diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 8a64622d112..0088694ec90 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -401,7 +401,7 @@ __OUT_IB5(struct fd_ringbuffer *ring, struct fd_ringbuffer *target) */ #define HW_QUERY_BASE_REG REG_AXXX_CP_SCRATCH_REG4 -#ifdef DEBUG +#if MESA_DEBUG #define __EMIT_MARKER 1 #else #define __EMIT_MARKER 0 diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 5831d1f358f..354cccbf8be 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -984,7 +984,7 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line) } if (ret < 0) { -#ifdef DEBUG +#if MESA_DEBUG const bool color = INTEL_DEBUG(DEBUG_COLOR); fprintf(stderr, "%siris: Failed to submit batchbuffer: %-80s%s\n", color ? "\e[1;41m" : "", strerror(-ret), color ? "\e[0m" : ""); diff --git a/src/gallium/drivers/llvmpipe/lp_perf.h b/src/gallium/drivers/llvmpipe/lp_perf.h index 61019218a0c..15483cb0b52 100644 --- a/src/gallium/drivers/llvmpipe/lp_perf.h +++ b/src/gallium/drivers/llvmpipe/lp_perf.h @@ -75,7 +75,7 @@ extern struct lp_counters lp_count; /** Increment the named counter (only for debug builds) */ -#ifdef DEBUG +#if MESA_DEBUG #define LP_COUNT(counter) lp_count.counter++ #define LP_COUNT_ADD(counter, incr) lp_count.counter += (incr) #define LP_COUNT_GET(counter) (lp_count.counter) diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index bb9c3f4aee7..4f493c67302 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -54,7 +54,7 @@ #include #endif -#ifdef DEBUG +#if MESA_DEBUG int jit_line = 0; const struct lp_rast_state *jit_state = NULL; const struct lp_rasterizer_task *jit_task = NULL; @@ -1005,7 +1005,7 @@ rasterize_bin(struct lp_rasterizer_task *task, lp_rast_tile_end(task); -#ifdef DEBUG +#if MESA_DEBUG /* Debug/Perf flags: */ if (bin->head->count == 1) { diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 12f7082b6a2..620117a5438 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -147,7 +147,7 @@ struct lp_rast_plane { * Objects of this type are put into the lp_setup_context::data buffer. */ struct lp_rast_triangle { -#ifdef DEBUG +#if MESA_DEBUG float v[3][2]; float pad0; float pad1; @@ -171,7 +171,7 @@ struct lp_rast_triangle { * Objects of this type are put into the lp_setup_context::data buffer. */ struct lp_rast_rectangle { -#ifdef DEBUG +#if MESA_DEBUG float v[2][2]; /**< diagonal corners */ #endif diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 1e5090f9eae..fb7cd853afb 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -45,7 +45,7 @@ /* If we crash in a jitted function, we can examine jit_line and jit_state * to get some info. This is not thread-safe, however. */ -#ifdef DEBUG +#if MESA_DEBUG struct lp_rasterizer_task; extern int jit_line; diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 7ed08861933..bf80681638e 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -75,7 +75,7 @@ lp_scene_create(struct lp_setup_context *setup) (void) mtx_init(&scene->mutex, mtx_plain); -#ifdef DEBUG +#if MESA_DEBUG /* Do some scene limit sanity checks here */ { size_t maxBins = TILES_X * TILES_Y; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index de6b5638b5e..1555d6756c7 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -629,7 +629,7 @@ try_setup_line(struct lp_setup_context *setup, if (!line) return false; -#ifdef DEBUG +#if MESA_DEBUG line->v[0][0] = v1[0][0]; line->v[1][0] = v2[0][0]; line->v[0][1] = v1[0][1]; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 9403368facb..829158c3fbe 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -475,7 +475,7 @@ try_setup_point(struct lp_setup_context *setup, if (!point) return false; -#ifdef DEBUG +#if MESA_DEBUG point->v[0][0] = v0[0][0]; point->v[0][1] = v0[0][1]; #endif @@ -554,7 +554,7 @@ try_setup_point(struct lp_setup_context *setup, lp_setup_alloc_rectangle(scene, key->num_inputs); if (!point) return false; -#ifdef DEBUG +#if MESA_DEBUG point->v[0][0] = v0[0][0]; point->v[0][1] = v0[0][1]; #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_rect.c b/src/gallium/drivers/llvmpipe/lp_setup_rect.c index 37cd2d64d00..b2a4d4b28b7 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_rect.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_rect.c @@ -315,7 +315,7 @@ try_rect_cw(struct lp_setup_context *setup, if (!rect) return false; -#ifdef DEBUG +#if MESA_DEBUG rect->v[0][0] = v0[0][0]; rect->v[0][1] = v0[0][1]; rect->v[1][0] = v1[0][0]; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index c1fc054b092..02e8e04f588 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -361,7 +361,7 @@ do_triangle_ccw(struct lp_setup_context *setup, if (!tri) return false; -#ifdef DEBUG +#if MESA_DEBUG tri->v[0][0] = v0[0][0]; tri->v[1][0] = v1[0][0]; tri->v[2][0] = v2[0][0]; diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index a3ee46b9a27..1a825351ce0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -241,7 +241,7 @@ llvmpipe_create_sampler_view(struct pipe_context *pipe, pipe_resource_reference(&view->texture, texture); view->context = pipe; -#ifdef DEBUG +#if MESA_DEBUG /* * This is possibly too lenient, but the primary reason is just * to catch gallium frontends which forget to initialize this, so diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 27ef356864b..688034f6469 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -391,7 +391,7 @@ main(int argc, char **argv) n = atoi(argv[i]); } -#ifdef DEBUG +#if MESA_DEBUG if (verbose >= 2) { gallivm_debug |= GALLIVM_DEBUG_IR; gallivm_debug |= GALLIVM_DEBUG_ASM; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 5c5a6cd81be..99710415487 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -59,7 +59,7 @@ #endif -#ifdef DEBUG +#if MESA_DEBUG static struct llvmpipe_resource resource_list; static simple_mtx_t resource_list_mutex = SIMPLE_MTX_INITIALIZER; #endif @@ -303,7 +303,7 @@ llvmpipe_resource_create_all(struct pipe_screen *_screen, lpr->id = id_counter++; -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_lock(&resource_list_mutex); list_addtail(&lpr->list, &resource_list.list); simple_mtx_unlock(&resource_list_mutex); @@ -437,7 +437,7 @@ llvmpipe_resource_from_memobj(struct pipe_screen *pscreen, lpr->id = id_counter++; lpr->imported_memory = true; -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_lock(&resource_list_mutex); list_addtail(&lpr->list, &resource_list.list); simple_mtx_unlock(&resource_list_mutex); @@ -474,7 +474,7 @@ llvmpipe_resource_destroy(struct pipe_screen *pscreen, align_free(lpr->data); } } -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_lock(&resource_list_mutex); if (!list_is_empty(&lpr->list)) list_del(&lpr->list); @@ -611,7 +611,7 @@ llvmpipe_resource_from_handle(struct pipe_screen *_screen, lpr->id = id_counter++; -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_lock(&resource_list_mutex); list_addtail(&lpr->list, &resource_list.list); simple_mtx_unlock(&resource_list_mutex); @@ -670,7 +670,7 @@ llvmpipe_resource_from_user_memory(struct pipe_screen *_screen, } else lpr->data = user_memory; lpr->user_ptr = true; -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_lock(&resource_list_mutex); list_addtail(&lpr->list, &resource_list.list); simple_mtx_unlock(&resource_list_mutex); @@ -1060,7 +1060,7 @@ llvmpipe_unmap_memory(struct pipe_screen *screen, } -#ifdef DEBUG +#if MESA_DEBUG void llvmpipe_print_resources(void) { @@ -1161,7 +1161,7 @@ llvmpipe_resource_get_param(struct pipe_screen *screen, void llvmpipe_init_screen_resource_funcs(struct pipe_screen *screen) { -#ifdef DEBUG +#if MESA_DEBUG /* init linked list for tracking resources */ { static bool first_call = true; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index 43559cd1853..b3ad86aa1e6 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -32,7 +32,7 @@ #include "pipe/p_state.h" #include "util/u_debug.h" #include "lp_limits.h" -#ifdef DEBUG +#if MESA_DEBUG #include "util/list.h" #endif @@ -103,7 +103,7 @@ struct llvmpipe_resource uint64_t backing_offset; bool backable; bool imported_memory; -#ifdef DEBUG +#if MESA_DEBUG struct list_head list; #endif }; diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 31e464795a8..db358a742d2 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -923,7 +923,7 @@ panfrost_load_tiled_images(struct panfrost_transfer *transfer, } } -#ifdef DEBUG +#if MESA_DEBUG static unsigned get_superblock_size(uint32_t *hdr, unsigned uncompressed_size) diff --git a/src/gallium/drivers/r300/r300_cb.h b/src/gallium/drivers/r300/r300_cb.h index 4859e20cf63..c7ecd88c14f 100644 --- a/src/gallium/drivers/r300/r300_cb.h +++ b/src/gallium/drivers/r300/r300_cb.h @@ -65,7 +65,7 @@ * Command buffer setup. */ -#ifdef DEBUG +#if MESA_DEBUG #define CB_LOCALS \ int cs_count = 0; \ diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index b950b3da1d2..a035e4bc143 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -503,7 +503,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, rc_init_regalloc_state(&r300->vs_regalloc_state, RC_VERTEX_PROGRAM); /* Print driver info. */ -#ifdef DEBUG +#if MESA_DEBUG { #else if (DBG_ON(r300, DBG_INFO)) { diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index ff6888b7ff3..58d7412a36f 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -43,7 +43,7 @@ struct radeon_winsys *cs_winsys = (context)->rws; \ int cs_count = 0; (void) cs_count; (void) cs_winsys; -#ifdef DEBUG +#if MESA_DEBUG #define BEGIN_CS(size) do { \ assert(size <= (cs_copy->current.max_dw - cs_copy->current.cdw)); \ diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 7edeb2cfdc6..149dd9597aa 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -3596,7 +3596,7 @@ softpipe_create_sampler_view(struct pipe_context *pipe, pipe_resource_reference(&view->texture, resource); view->context = pipe; -#ifdef DEBUG +#if MESA_DEBUG /* * This is possibly too lenient, but the primary reason is just * to catch gallium frontends which forget to initialize this, so diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 5793f88166d..9d34f493414 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -1057,7 +1057,7 @@ svga_get_time(struct svga_context *svga) * function call with an error value, the purpose is to trigger and test * retry path handling. */ -#ifdef DEBUG +#if MESA_DEBUG /* * Optionally replace a function call with a PIPE_ERROR_OUT_OF_MEMORY diff --git a/src/gallium/drivers/svga/svga_debug.h b/src/gallium/drivers/svga/svga_debug.h index 7ce69de5d34..f8afd854af8 100644 --- a/src/gallium/drivers/svga/svga_debug.h +++ b/src/gallium/drivers/svga/svga_debug.h @@ -50,7 +50,7 @@ #define DEBUG_UAV 0x80000 #define DEBUG_RETRY 0x100000 -#ifdef DEBUG +#if MESA_DEBUG extern int SVGA_DEBUG; #define DBSTR(x) x #else @@ -61,7 +61,7 @@ extern int SVGA_DEBUG; static inline void SVGA_DBG( unsigned flag, const char *fmt, ... ) { -#ifdef DEBUG +#if MESA_DEBUG if (SVGA_DEBUG & flag) { va_list args; diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 16865ba06c3..ebdcca3df7f 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -1376,7 +1376,7 @@ svga_hwtnl_prim(struct svga_hwtnl *hwtnl, else { /* batch up drawing commands */ assert(indirect == NULL); -#ifdef DEBUG +#if MESA_DEBUG check_draw_params(hwtnl, range, min_index, max_index, ib); assert(start_instance == 0); assert(instance_count <= 1); diff --git a/src/gallium/drivers/svga/svga_format.c b/src/gallium/drivers/svga/svga_format.c index 7228a8cf348..1fa8df00889 100644 --- a/src/gallium/drivers/svga/svga_format.c +++ b/src/gallium/drivers/svga/svga_format.c @@ -1682,7 +1682,7 @@ svga_get_format_cap(struct svga_screen *ss, SVGA3dDevCapResult result; const struct format_cap *entry; -#ifdef DEBUG +#if MESA_DEBUG check_format_tables(); #else (void) check_format_tables; @@ -1713,7 +1713,7 @@ svga_get_dx_format_cap(struct svga_screen *ss, struct svga_winsys_screen *sws = ss->sws; const struct format_cap *entry; -#ifdef DEBUG +#if MESA_DEBUG check_format_tables(); #else (void) check_format_tables; diff --git a/src/gallium/drivers/svga/svga_image_view.c b/src/gallium/drivers/svga/svga_image_view.c index 9ff6daf4326..33e37265abf 100644 --- a/src/gallium/drivers/svga/svga_image_view.c +++ b/src/gallium/drivers/svga/svga_image_view.c @@ -178,7 +178,7 @@ svga_set_shader_images(struct pipe_context *pipe, /* number of bound image views */ svga->curr.num_image_views[shader] = start + num; -#ifdef DEBUG +#if MESA_DEBUG SVGA_DBG(DEBUG_UAV, "%s: num_image_views=%d start=%d num=%d unbind_num_trailing_slots=%d\n", __func__, svga->curr.num_image_views[shader], start, num, unbind_num_trailing_slots); diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 17d91d16fcd..58ae73531bf 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -1460,7 +1460,7 @@ svga_texture_transfer_map_upload(struct svga_context *svga, upload_size = st->base.layer_stride * st->base.box.depth; upload_size = align(upload_size, 16); -#ifdef DEBUG +#if MESA_DEBUG if (util_format_is_compressed(texture->format)) { unsigned blockw, blockh, bytesPerBlock; diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index cce6467a3c6..28bcbd98db5 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -53,7 +53,7 @@ #define MESA_GIT_SHA1 "(unknown git revision)" #endif -#ifdef DEBUG +#if MESA_DEBUG int SVGA_DEBUG = 0; static const struct debug_named_value svga_debug_flags[] = { @@ -93,8 +93,8 @@ svga_get_name( struct pipe_screen *pscreen ) { const char *build = "", *llvm = "", *mutex = ""; static char name[100]; -#ifdef DEBUG - /* Only return internal details in the DEBUG version: +#if MESA_DEBUG + /* Only return internal details in the MESA_DEBUG version: */ build = "build: DEBUG;"; mutex = "mutex: " PIPE_ATOMIC ";"; @@ -1051,7 +1051,7 @@ svga_screen_create(struct svga_winsys_screen *sws) struct svga_screen *svgascreen; struct pipe_screen *screen; -#ifdef DEBUG +#if MESA_DEBUG SVGA_DEBUG = debug_get_flags_option("SVGA_DEBUG", svga_debug_flags, 0 ); #endif @@ -1328,7 +1328,7 @@ svga_winsys_screen(struct pipe_screen *screen) } -#ifdef DEBUG +#if MESA_DEBUG struct svga_screen * svga_screen(struct pipe_screen *screen) { diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h index 613a7e65435..1028386406b 100644 --- a/src/gallium/drivers/svga/svga_screen.h +++ b/src/gallium/drivers/svga/svga_screen.h @@ -100,7 +100,7 @@ struct svga_screen } hud; }; -#ifndef DEBUG +#if !MESA_DEBUG /** cast wrapper */ static inline struct svga_screen * svga_screen(struct pipe_screen *pscreen) diff --git a/src/gallium/drivers/svga/svga_shader_buffer.c b/src/gallium/drivers/svga/svga_shader_buffer.c index 61d87b2a28e..8068f3a46fe 100644 --- a/src/gallium/drivers/svga/svga_shader_buffer.c +++ b/src/gallium/drivers/svga/svga_shader_buffer.c @@ -95,7 +95,7 @@ svga_set_shader_buffers(struct pipe_context *pipe, assert(start + num <= SVGA_MAX_SHADER_BUFFERS); -#ifdef DEBUG +#if MESA_DEBUG const struct pipe_shader_buffer *b = buffers; SVGA_DBG(DEBUG_UAV, "%s: shader=%d start=%d num=%d ", __func__, shader, start, num); @@ -141,7 +141,7 @@ svga_set_shader_buffers(struct pipe_context *pipe, svga->curr.num_shader_buffers[shader] = start; } -#ifdef DEBUG +#if MESA_DEBUG SVGA_DBG(DEBUG_UAV, "%s: current num_shader_buffers=%d start=%d num=%d buffers=", __func__, svga->curr.num_shader_buffers[shader], @@ -177,7 +177,7 @@ svga_set_hw_atomic_buffers(struct pipe_context *pipe, assert(start + num <= SVGA_MAX_ATOMIC_BUFFERS); -#ifdef DEBUG +#if MESA_DEBUG SVGA_DBG(DEBUG_UAV, "%s: start=%d num=%d \n", __func__, start, num); #endif @@ -221,7 +221,7 @@ svga_set_hw_atomic_buffers(struct pipe_context *pipe, svga->curr.num_atomic_buffers = start; } -#ifdef DEBUG +#if MESA_DEBUG SVGA_DBG(DEBUG_UAV, "%s: current num_atomic_buffers=%d start=%d num=%d ", __func__, svga->curr.num_atomic_buffers, start, num); diff --git a/src/gallium/drivers/svga/svga_state.c b/src/gallium/drivers/svga/svga_state.c index 869d0ae8585..0c70efe2a9c 100644 --- a/src/gallium/drivers/svga/svga_state.c +++ b/src/gallium/drivers/svga/svga_state.c @@ -216,7 +216,7 @@ update_state(struct svga_context *svga, const struct svga_tracked_state *atoms[], uint64_t *state) { -#ifdef DEBUG +#if MESA_DEBUG bool debug = true; #else bool debug = false; diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 6e3fdfa2d1e..806174833be 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -428,7 +428,7 @@ emit_const_range(struct svga_context *svga, shader == PIPE_SHADER_FRAGMENT); assert(!svga_have_vgpu10(svga)); -#ifdef DEBUG +#if MESA_DEBUG if (offset + count > SVGA3D_CONSTREG_MAX) { debug_printf("svga: too many constants (offset %u + count %u = %u (max = %u))\n", offset, count, offset + count, SVGA3D_CONSTREG_MAX); diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c index a93eaea3651..38d7ec850cd 100644 --- a/src/gallium/drivers/svga/svga_state_fs.c +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -53,7 +53,7 @@ static const struct tgsi_token * get_dummy_fragment_shader(void) { -#ifdef DEBUG +#if MESA_DEBUG static const float color[4] = { 1.0, 0.0, 0.0, 0.0 }; /* red */ #else static const float color[4] = { 0.0, 0.0, 0.0, 0.0 }; /* black */ @@ -200,7 +200,7 @@ make_fs_key(const struct svga_context *svga, key->fs.alpha_to_one = svga->curr.blend->alpha_to_one; -#ifdef DEBUG +#if MESA_DEBUG /* * We expect a consistent set of samplers and sampler views. * Do some debug checks/warnings here. diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c index 5446f7a8a5e..d5bdaf33465 100644 --- a/src/gallium/drivers/svga/svga_state_need_swtnl.c +++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c @@ -130,7 +130,7 @@ update_need_pipeline(struct svga_context *svga, uint64_t dirty) svga->dirty |= SVGA_NEW_NEED_PIPELINE; } - /* DEBUG */ + /* debug */ if (0 && svga->state.sw.need_pipeline) debug_printf("sw.need_pipeline = %d\n", svga->state.sw.need_pipeline); diff --git a/src/gallium/drivers/svga/svga_state_uav.c b/src/gallium/drivers/svga/svga_state_uav.c index b7cda4eca73..2dbeea58f3b 100644 --- a/src/gallium/drivers/svga/svga_state_uav.c +++ b/src/gallium/drivers/svga/svga_state_uav.c @@ -785,7 +785,7 @@ update_uav(struct svga_context *svga, uint64_t dirty) SVGA_DBG(DEBUG_UAV, "%s: SetUAViews uavSpliceIndex=%d", __func__, uavSpliceIndex); -#ifdef DEBUG +#if MESA_DEBUG for (unsigned i = 0; i < ARRAY_SIZE(uaViewIds); i++) { SVGA_DBG(DEBUG_UAV, " %d ", uaViewIds[i]); } @@ -891,7 +891,7 @@ update_cs_uav(struct svga_context *svga, uint64_t dirty) SVGA_DBG(DEBUG_UAV, "%s: SetCSUAViews", __func__); -#ifdef DEBUG +#if MESA_DEBUG for (unsigned i = 0; i < ARRAY_SIZE(uaViewIds); i++) { SVGA_DBG(DEBUG_UAV, " %d ", uaViewIds[i]); } diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c index 94e3d9906b4..f19214d4c49 100644 --- a/src/gallium/drivers/vc4/vc4_bufmgr.c +++ b/src/gallium/drivers/vc4/vc4_bufmgr.c @@ -55,7 +55,7 @@ vc4_bo_label(struct vc4_screen *screen, struct vc4_bo *bo, const char *fmt, ...) * whole-system allocation information), or if VC4_DEBUG=surf is set * (for debugging a single app's allocation). */ -#ifndef DEBUG +#if !MESA_DEBUG if (!VC4_DBG(SURFACE)) return; #endif diff --git a/src/gallium/drivers/vc4/vc4_qir_validate.c b/src/gallium/drivers/vc4/vc4_qir_validate.c index 302eb48265c..2b27444b41e 100644 --- a/src/gallium/drivers/vc4/vc4_qir_validate.c +++ b/src/gallium/drivers/vc4/vc4_qir_validate.c @@ -42,7 +42,7 @@ void qir_validate(struct vc4_compile *c) * keep compiling the validation code to make sure it doesn't get * broken. */ -#ifndef DEBUG +#if !MESA_DEBUG return; #endif diff --git a/src/gallium/drivers/vc4/vc4_qpu_validate.c b/src/gallium/drivers/vc4/vc4_qpu_validate.c index 3765c87c757..c8df5d4bd4c 100644 --- a/src/gallium/drivers/vc4/vc4_qpu_validate.c +++ b/src/gallium/drivers/vc4/vc4_qpu_validate.c @@ -121,7 +121,7 @@ vc4_qpu_validate(uint64_t *insts, uint32_t num_inst) * keep compiling the validation code to make sure it doesn't get * broken. */ -#ifndef DEBUG +#if !MESA_DEBUG return; #endif diff --git a/src/gallium/frontends/d3d10umd/Debug.cpp b/src/gallium/frontends/d3d10umd/Debug.cpp index 6cc1a4a9f51..17f7292e23d 100644 --- a/src/gallium/frontends/d3d10umd/Debug.cpp +++ b/src/gallium/frontends/d3d10umd/Debug.cpp @@ -4,7 +4,7 @@ #include -#ifdef DEBUG +#if MESA_DEBUG unsigned st_debug = 0; diff --git a/src/gallium/frontends/d3d10umd/Debug.h b/src/gallium/frontends/d3d10umd/Debug.h index bcb45978747..06f072289c3 100644 --- a/src/gallium/frontends/d3d10umd/Debug.h +++ b/src/gallium/frontends/d3d10umd/Debug.h @@ -13,14 +13,14 @@ extern "C" { #define ST_DEBUG_TGSI (1 << 1) -#ifdef DEBUG +#if MESA_DEBUG extern unsigned st_debug; #else #define st_debug 0 #endif -#ifdef DEBUG +#if MESA_DEBUG void st_debug_parse(void); #else #define st_debug_parse() ((void)0) diff --git a/src/gallium/frontends/d3d10umd/OutputMerger.cpp b/src/gallium/frontends/d3d10umd/OutputMerger.cpp index c5748b7e2d5..51aad32b45f 100644 --- a/src/gallium/frontends/d3d10umd/OutputMerger.cpp +++ b/src/gallium/frontends/d3d10umd/OutputMerger.cpp @@ -924,7 +924,7 @@ CreateDepthStencilState( face1->zfail_op = translateStencilOp(pDepthStencilDesc->BackFace.StencilDepthFailOp); face1->valuemask = pDepthStencilDesc->StencilReadMask; face1->writemask = pDepthStencilDesc->StencilWriteMask; -#ifdef DEBUG +#if MESA_DEBUG if (!pDepthStencilDesc->FrontEnable) { ASSERT(face0->func == PIPE_FUNC_ALWAYS); ASSERT(face0->fail_op == PIPE_STENCIL_OP_KEEP); diff --git a/src/gallium/frontends/glx/xlib/glx_usefont.c b/src/gallium/frontends/glx/xlib/glx_usefont.c index 9d35054b44d..398a408eb35 100644 --- a/src/gallium/frontends/glx/xlib/glx_usefont.c +++ b/src/gallium/frontends/glx/xlib/glx_usefont.c @@ -38,7 +38,7 @@ /* Some debugging info. */ -#ifdef DEBUG +#if MESA_DEBUG #include int debug_xfonts = 0; @@ -95,7 +95,7 @@ dump_bitmap(unsigned int width, unsigned int height, GLubyte * bitmap) putchar('\n'); } } -#endif /* DEBUG */ +#endif /* MESA_DEBUG */ /* Implementation. */ @@ -286,7 +286,7 @@ glXUseXFont(Font font, int first, int count, int listbase) gc = XCreateGC(dpy, pixmap, valuemask, &values); XFreePixmap(dpy, pixmap); -#ifdef DEBUG +#if MESA_DEBUG if (debug_xfonts) dump_font_struct(fs); #endif @@ -310,7 +310,7 @@ glXUseXFont(Font font, int first, int count, int listbase) valid = 1; } -#ifdef DEBUG +#if MESA_DEBUG if (debug_xfonts) { char s[7]; sprintf(s, isprint(c) ? "%c> " : "\\%03o> ", c); @@ -345,7 +345,7 @@ glXUseXFont(Font font, int first, int count, int listbase) fill_bitmap(dpy, win, gc, bm_width, bm_height, x, y, c, bm); glBitmap(width, height, x0, y0, dx, dy, bm); -#ifdef DEBUG +#if MESA_DEBUG if (debug_xfonts) { printf("width/height = %u/%u\n", width, height); printf("bm_width/bm_height = %u/%u\n", bm_width, bm_height); diff --git a/src/gallium/frontends/hgl/hgl.c b/src/gallium/frontends/hgl/hgl.c index 4096503700e..c9bbf832ad1 100644 --- a/src/gallium/frontends/hgl/hgl.c +++ b/src/gallium/frontends/hgl/hgl.c @@ -19,7 +19,7 @@ #include "state_tracker/st_context.h" -#ifdef DEBUG +#if MESA_DEBUG # define TRACE(x...) printf("hgl:frontend: " x) # define CALLED() TRACE("CALLED: %s\n", __PRETTY_FUNCTION__) #else diff --git a/src/gallium/frontends/nine/basetexture9.c b/src/gallium/frontends/nine/basetexture9.c index ae67533c594..7c35b7c9e8d 100644 --- a/src/gallium/frontends/nine/basetexture9.c +++ b/src/gallium/frontends/nine/basetexture9.c @@ -12,7 +12,7 @@ #include "volumetexture9.h" #include "nine_pipe.h" -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #include "nine_dump.h" #endif @@ -587,7 +587,7 @@ NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This ) BASETEX_REGISTER_UPDATE(This); } -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) void NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) { @@ -602,4 +602,4 @@ NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) This->base.info.array_size, This->base.info.last_level, This->managed.lod, This->managed.lod_resident); } -#endif /* DEBUG || !NDEBUG */ +#endif /* MESA_DEBUG || !NDEBUG */ diff --git a/src/gallium/frontends/nine/basetexture9.h b/src/gallium/frontends/nine/basetexture9.h index df8b7c66da9..0614bfa3fdb 100644 --- a/src/gallium/frontends/nine/basetexture9.h +++ b/src/gallium/frontends/nine/basetexture9.h @@ -139,7 +139,7 @@ NineBindTextureToDevice( struct NineDevice9 *device, nine_bind(slot, tex); } -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) void NineBaseTexture9_Dump( struct NineBaseTexture9 *This ); #else diff --git a/src/gallium/frontends/nine/nine_debug.h b/src/gallium/frontends/nine/nine_debug.h index aba1d0baea4..826c23a6423 100644 --- a/src/gallium/frontends/nine/nine_debug.h +++ b/src/gallium/frontends/nine/nine_debug.h @@ -17,7 +17,7 @@ _nine_debug_printf( unsigned long flag, #define ERR(fmt, ...) _nine_debug_printf(DBG_ERROR, __func__, fmt, ## __VA_ARGS__) -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #define WARN(fmt, ...) _nine_debug_printf(DBG_WARN, __func__, fmt, ## __VA_ARGS__) #define WARN_ONCE(fmt, ...) \ do { \ @@ -32,7 +32,7 @@ _nine_debug_printf( unsigned long flag, #define WARN_ONCE(fmt, ...) do {} while(0) #endif -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #define DBG_FLAG(flag, fmt, ...) \ _nine_debug_printf(flag, __func__, fmt, ## __VA_ARGS__) #else @@ -74,7 +74,7 @@ _nine_stub( const char *file, const char *func, unsigned line ); -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #define STUB(ret) \ do { \ _nine_stub(__FILE__, __func__, __LINE__); \ @@ -88,7 +88,7 @@ _nine_stub( const char *file, * macro is designed to be used in conditionals ala * if (user_error(required condition)) { assertion failed } * It also prints debug message if the assertion fails. */ -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #define user_error(x) \ (!(x) ? (DBG_FLAG(DBG_USER, "User assertion failed: `%s'\n", #x), true) \ : false) @@ -96,7 +96,7 @@ _nine_stub( const char *file, #define user_error(x) (!(x) ? TRUE : FALSE) #endif -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) #define user_warn(x) \ if ((x)) { DBG_FLAG(DBG_USER, "User warning: `%s'\n", #x); } #else diff --git a/src/gallium/frontends/nine/nine_dump.c b/src/gallium/frontends/nine/nine_dump.c index 7d462aa97e4..cfa65b82a86 100644 --- a/src/gallium/frontends/nine/nine_dump.c +++ b/src/gallium/frontends/nine/nine_dump.c @@ -13,7 +13,7 @@ #include "nine_dump.h" -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) static char thread_local tls[128]; @@ -815,4 +815,4 @@ nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps) FREE(s); } -#endif /* DEBUG || !NDEBUG */ +#endif /* MESA_DEBUG || !NDEBUG */ diff --git a/src/gallium/frontends/nine/nine_dump.h b/src/gallium/frontends/nine/nine_dump.h index 9250d0b6d1d..19bc8d36ea9 100644 --- a/src/gallium/frontends/nine/nine_dump.h +++ b/src/gallium/frontends/nine/nine_dump.h @@ -20,7 +20,7 @@ const char *nine_D3DPRESENTFLAG_to_str(DWORD); const char *nine_D3DLOCK_to_str(DWORD); const char *nine_D3DSAMP_to_str(DWORD); -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned, const D3DADAPTER_IDENTIFIER9 *); @@ -33,7 +33,7 @@ nine_dump_D3DMATERIAL9(unsigned, const D3DMATERIAL9 *); void nine_dump_D3DTSS_value(unsigned, D3DTEXTURESTAGESTATETYPE, DWORD); -#else /* !DEBUG && NDEBUG */ +#else /* !(MESA_DEBUG || !NDEBUG) */ static inline void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id) @@ -51,6 +51,6 @@ static inline void nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE tss, DWORD value) { } -#endif /* DEBUG || !NDEBUG */ +#endif /* MESA_DEBUG || !NDEBUG */ #endif /* _NINE_DUMP_H_H_ */ diff --git a/src/gallium/frontends/nine/nine_ff.c b/src/gallium/frontends/nine/nine_ff.c index f16008710c9..b8682b968f9 100644 --- a/src/gallium/frontends/nine/nine_ff.c +++ b/src/gallium/frontends/nine/nine_ff.c @@ -2528,7 +2528,7 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M) for (k = 0; k < 4; k++) D->m[i][k] *= det; -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) { D3DMATRIX I; diff --git a/src/gallium/frontends/nine/nine_memory_helper.c b/src/gallium/frontends/nine/nine_memory_helper.c index 32cdeb64169..433ee973b92 100644 --- a/src/gallium/frontends/nine/nine_memory_helper.c +++ b/src/gallium/frontends/nine/nine_memory_helper.c @@ -202,7 +202,7 @@ struct nine_allocator { struct list_head pending_frees; }; -#ifdef DEBUG +#if MESA_DEBUG static void debug_dump_memfd_state(struct nine_memfd_file *memfd_file, bool details) diff --git a/src/gallium/frontends/nine/nine_state.c b/src/gallium/frontends/nine/nine_state.c index 56848585dde..f2793a3152a 100644 --- a/src/gallium/frontends/nine/nine_state.c +++ b/src/gallium/frontends/nine/nine_state.c @@ -140,7 +140,7 @@ nine_csmt_create( struct NineDevice9 *This ) (void) mtx_init(&ctx->thread_running, mtx_plain); (void) mtx_init(&ctx->thread_resume, mtx_plain); -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) u_thread_setname("Main thread"); #endif diff --git a/src/gallium/frontends/nine/surface9.c b/src/gallium/frontends/nine/surface9.c index 4bd322488ba..e5f2d013c16 100644 --- a/src/gallium/frontends/nine/surface9.c +++ b/src/gallium/frontends/nine/surface9.c @@ -277,7 +277,7 @@ NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ) assert(This->surface[1]); } -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) void NineSurface9_Dump( struct NineSurface9 *This ) { @@ -305,7 +305,7 @@ NineSurface9_Dump( struct NineSurface9 *This ) NineUnknown_Release(NineUnknown(tex)); } } -#endif /* DEBUG || !NDEBUG */ +#endif /* MESA_DEBUG || !NDEBUG */ HRESULT NINE_WINAPI NineSurface9_GetContainer( struct NineSurface9 *This, diff --git a/src/gallium/frontends/nine/surface9.h b/src/gallium/frontends/nine/surface9.h index f95ea51a7f1..374860a4554 100644 --- a/src/gallium/frontends/nine/surface9.h +++ b/src/gallium/frontends/nine/surface9.h @@ -123,7 +123,7 @@ NineSurface9_IsOffscreenPlain (struct NineSurface9 *This ) return This->base.usage == 0 && !This->texture; } -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) void NineSurface9_Dump( struct NineSurface9 *This ); #else diff --git a/src/gallium/frontends/nine/volume9.c b/src/gallium/frontends/nine/volume9.c index 9f9c05ab0c9..c1e6d01000e 100644 --- a/src/gallium/frontends/nine/volume9.c +++ b/src/gallium/frontends/nine/volume9.c @@ -172,7 +172,7 @@ static inline void NineVolume9_MarkContainerDirty( struct NineVolume9 *This ) { struct NineBaseTexture9 *tex; -#if defined(DEBUG) || !defined(NDEBUG) +#if MESA_DEBUG || !defined(NDEBUG) /* This is always contained by a NineVolumeTexture9. */ GUID id = IID_IDirect3DVolumeTexture9; REFIID ref = &id; diff --git a/src/gallium/frontends/omx/bellagio/vid_dec.c b/src/gallium/frontends/omx/bellagio/vid_dec.c index 08c936cafd3..d17caa30b72 100644 --- a/src/gallium/frontends/omx/bellagio/vid_dec.c +++ b/src/gallium/frontends/omx/bellagio/vid_dec.c @@ -37,7 +37,7 @@ #include /* bellagio defines a DEBUG macro that we don't want */ -#ifndef DEBUG +#if !MESA_DEBUG #include #undef DEBUG #else diff --git a/src/gallium/frontends/omx/bellagio/vid_enc.c b/src/gallium/frontends/omx/bellagio/vid_enc.c index b7eb16087fa..50f1ee1a774 100644 --- a/src/gallium/frontends/omx/bellagio/vid_enc.c +++ b/src/gallium/frontends/omx/bellagio/vid_enc.c @@ -37,7 +37,7 @@ #include /* bellagio defines a DEBUG macro that we don't want */ -#ifndef DEBUG +#if !MESA_DEBUG #include #undef DEBUG #else diff --git a/src/gallium/frontends/wgl/stw_device.h b/src/gallium/frontends/wgl/stw_device.h index 7f70aedf65b..6b53a161304 100644 --- a/src/gallium/frontends/wgl/stw_device.h +++ b/src/gallium/frontends/wgl/stw_device.h @@ -77,7 +77,7 @@ struct stw_device CRITICAL_SECTION fb_mutex; struct stw_framebuffer *fb_head; -#ifdef DEBUG +#if MESA_DEBUG unsigned long memdbg_no; #endif diff --git a/src/gallium/frontends/wgl/stw_ext_pbuffer.c b/src/gallium/frontends/wgl/stw_ext_pbuffer.c index b8066b6e7ba..8522e88ab59 100644 --- a/src/gallium/frontends/wgl/stw_ext_pbuffer.c +++ b/src/gallium/frontends/wgl/stw_ext_pbuffer.c @@ -135,7 +135,7 @@ stw_pbuffer_create(const struct stw_pixelformat_info *pfi, int iWidth, int iHeig return 0; } -#ifdef DEBUG +#if MESA_DEBUG /* * Verify the client area size matches the specified size. */ diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c index 9eb33c69cba..1039630355a 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c @@ -21,7 +21,7 @@ #include #ifndef AMDGPU_VA_RANGE_HIGH -#define AMDGPU_VA_RANGE_HIGH 0x2 +#define AMDGPU_VA_RANGE_HIGH 0x2 #endif /* Set to 1 for verbose output showing committed sparse buffer ranges. */ @@ -195,7 +195,7 @@ void amdgpu_bo_destroy(struct amdgpu_winsys *aws, struct pb_buffer_lean *_buf) amdgpu_bo_free(bo->bo_handle); -#ifdef DEBUG +#if MESA_DEBUG if (aws->debug_all_bos) { simple_mtx_lock(&aws->global_bo_list_lock); list_del(&bo->global_list_item); @@ -305,7 +305,7 @@ void *amdgpu_bo_map(struct radeon_winsys *rws, if (cs && amdgpu_bo_is_referenced_by_cs_with_usage(cs, bo, RADEON_USAGE_WRITE)) { cs->flush_cs(cs->flush_data, - RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); + RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); return NULL; } @@ -316,7 +316,7 @@ void *amdgpu_bo_map(struct radeon_winsys *rws, } else { if (cs && amdgpu_bo_is_referenced_by_cs(cs, bo)) { cs->flush_cs(cs->flush_data, - RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); + RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); return NULL; } @@ -340,7 +340,7 @@ void *amdgpu_bo_map(struct radeon_winsys *rws, if (amdgpu_bo_is_referenced_by_cs_with_usage(cs, bo, RADEON_USAGE_WRITE)) { cs->flush_cs(cs->flush_data, - RADEON_FLUSH_START_NEXT_GFX_IB_NOW, NULL); + RADEON_FLUSH_START_NEXT_GFX_IB_NOW, NULL); } else { /* Try to avoid busy-waiting in amdgpu_bo_wait. */ if (p_atomic_read(&bo->num_active_ioctls)) @@ -355,7 +355,7 @@ void *amdgpu_bo_map(struct radeon_winsys *rws, if (cs) { if (amdgpu_bo_is_referenced_by_cs(cs, bo)) { cs->flush_cs(cs->flush_data, - RADEON_FLUSH_START_NEXT_GFX_IB_NOW, NULL); + RADEON_FLUSH_START_NEXT_GFX_IB_NOW, NULL); } else { /* Try to avoid busy-waiting in amdgpu_bo_wait. */ if (p_atomic_read(&bo->num_active_ioctls)) @@ -440,7 +440,7 @@ void amdgpu_bo_unmap(struct radeon_winsys *rws, struct pb_buffer_lean *buf) static void amdgpu_add_buffer_to_global_list(struct amdgpu_winsys *aws, struct amdgpu_bo_real *bo) { -#ifdef DEBUG +#if MESA_DEBUG if (aws->debug_all_bos) { simple_mtx_lock(&aws->global_bo_list_lock); list_addtail(&bo->global_list_item, &aws->global_bo_list); @@ -1690,8 +1690,8 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws, } static struct pb_buffer_lean *amdgpu_bo_from_ptr(struct radeon_winsys *rws, - void *pointer, uint64_t size, - enum radeon_bo_flag flags) + void *pointer, uint64_t size, + enum radeon_bo_flag flags) { struct amdgpu_winsys *aws = amdgpu_winsys(rws); amdgpu_bo_handle buf_handle; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h index 049efd0e3f0..dfc234f56fb 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.h @@ -92,7 +92,7 @@ struct amdgpu_bo_real { void *cpu_ptr; /* for user_ptr and permanent maps */ int map_count; uint32_t kms_handle; -#ifdef DEBUG +#if MESA_DEBUG struct list_head global_list_item; #endif simple_mtx_t map_lock; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp index 89286108f22..cb594e02af6 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.cpp @@ -1478,7 +1478,7 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index) } simple_mtx_unlock(&aws->bo_fence_lock); -#ifdef DEBUG +#if MESA_DEBUG /* Prepare the buffer list. */ if (aws->debug_all_bos) { /* The buffer list contains all buffers. This is a slow path that diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index 9343bc58047..1d4e0638990 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -26,7 +26,7 @@ static struct hash_table *dev_tab = NULL; static simple_mtx_t dev_tab_mutex = SIMPLE_MTX_INITIALIZER; -#ifdef DEBUG +#if MESA_DEBUG DEBUG_GET_ONCE_BOOL_OPTION(all_bos, "RADEON_ALL_BOS", false) #endif @@ -51,7 +51,7 @@ static bool do_winsys_init(struct amdgpu_winsys *aws, aws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL || strstr(debug_get_option("AMD_DEBUG", ""), "check_vm") != NULL; aws->noop_cs = aws->info.family_overridden || debug_get_bool_option("RADEON_NOOP", false); -#ifdef DEBUG +#if MESA_DEBUG aws->debug_all_bos = debug_get_option_all_bos(); #endif aws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL || @@ -89,7 +89,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *aws) pb_cache_deinit(&aws->bo_cache); _mesa_hash_table_destroy(aws->bo_export_table, NULL); simple_mtx_destroy(&aws->sws_list_lock); -#ifdef DEBUG +#if MESA_DEBUG simple_mtx_destroy(&aws->global_bo_list_lock); #endif simple_mtx_destroy(&aws->bo_export_table_lock); @@ -357,7 +357,7 @@ amdgpu_drm_winsys_get_fd(struct radeon_winsys *rws) PUBLIC struct radeon_winsys * amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, - radeon_screen_create_t screen_create) + radeon_screen_create_t screen_create) { struct amdgpu_screen_winsys *sws; struct amdgpu_winsys *aws; @@ -430,7 +430,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, int device_fd = amdgpu_device_get_fd(dev); if (!are_file_descriptions_equal(device_fd, fd)) { sws->kms_handles = _mesa_hash_table_create(NULL, kms_handle_hash, - kms_handle_equals); + kms_handle_equals); if (!sws->kms_handles) goto fail; /* We could avoid storing the fd and use amdgpu_device_get_fd() where @@ -479,13 +479,13 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config, /* init reference */ pipe_reference_init(&aws->reference, 1); -#ifdef DEBUG +#if MESA_DEBUG list_inithead(&aws->global_bo_list); #endif aws->bo_export_table = util_hash_table_create_ptr_keys(); (void) simple_mtx_init(&aws->sws_list_lock, mtx_plain); -#ifdef DEBUG +#if MESA_DEBUG (void) simple_mtx_init(&aws->global_bo_list_lock, mtx_plain); #endif (void) simple_mtx_init(&aws->bo_fence_lock, mtx_plain); diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h index a08f9911a2a..8baa8ec8ced 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h @@ -229,7 +229,7 @@ struct amdgpu_winsys { bool noop_cs; bool reserve_vmid; bool zero_all_vram_allocs; -#ifdef DEBUG +#if MESA_DEBUG bool debug_all_bos; /* List of all allocated buffers */ diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c index de8f0a8ccd8..9c0086e9f8a 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c +++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c @@ -225,7 +225,7 @@ i915_drm_buffer_destroy(struct i915_winsys *iws, { drm_intel_bo_unreference(intel_bo(buffer)); -#ifdef DEBUG +#if MESA_DEBUG i915_drm_buffer(buffer)->magic = 0; i915_drm_buffer(buffer)->bo = NULL; #endif diff --git a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c index 321b8cb444b..6e23275c366 100644 --- a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c +++ b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c @@ -160,7 +160,7 @@ fenced_buffer_create_gpu_storage_locked(struct fenced_manager *fenced_mgr, static void fenced_manager_dump_locked(struct fenced_manager *fenced_mgr) { -#ifdef DEBUG +#if MESA_DEBUG struct pb_fence_ops *ops = fenced_mgr->ops; struct list_head *curr, *next; struct fenced_buffer *fenced_buf; @@ -804,7 +804,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr) ; } -#ifdef DEBUG +#if MESA_DEBUG /*assert(!fenced_mgr->num_unfenced);*/ #endif diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.c b/src/gallium/winsys/svga/drm/vmw_buffer.c index 20c45694c16..2899099c232 100644 --- a/src/gallium/winsys/svga/drm/vmw_buffer.c +++ b/src/gallium/winsys/svga/drm/vmw_buffer.c @@ -297,7 +297,7 @@ vmw_dma_bufmgr_region_ptr(struct pb_buffer *buf, return true; } -#ifdef DEBUG +#if MESA_DEBUG struct svga_winsys_buffer { struct pb_buffer *pb_buf; struct debug_flush_buf *fbuf; @@ -344,7 +344,7 @@ vmw_svga_winsys_buffer_destroy(struct svga_winsys_screen *sws, struct pb_buffer *pbuf = vmw_pb_buffer(buf); (void)sws; pb_reference(&pbuf, NULL); -#ifdef DEBUG +#if MESA_DEBUG debug_flush_buf_reference(&buf->fbuf, NULL); FREE(buf); #endif @@ -377,7 +377,7 @@ vmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws, map = pb_map(vmw_pb_buffer(buf), pb_flags, NULL); -#ifdef DEBUG +#if MESA_DEBUG if (map != NULL) debug_flush_map(buf->fbuf, pb_flags); #endif @@ -392,7 +392,7 @@ vmw_svga_winsys_buffer_unmap(struct svga_winsys_screen *sws, { (void)sws; -#ifdef DEBUG +#if MESA_DEBUG debug_flush_unmap(buf->fbuf); #endif diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.h b/src/gallium/winsys/svga/drm/vmw_buffer.h index deb6b9a0a40..b9765a48f7a 100644 --- a/src/gallium/winsys/svga/drm/vmw_buffer.h +++ b/src/gallium/winsys/svga/drm/vmw_buffer.h @@ -50,7 +50,7 @@ struct vmw_buffer_desc { }; -#ifdef DEBUG +#if MESA_DEBUG struct pb_buffer * vmw_pb_buffer(struct svga_winsys_buffer *buffer); diff --git a/src/gallium/winsys/svga/drm/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c index 4dde2e5404e..cc33a80c05e 100644 --- a/src/gallium/winsys/svga/drm/vmw_context.c +++ b/src/gallium/winsys/svga/drm/vmw_context.c @@ -98,7 +98,7 @@ struct vmw_svga_winsys_context struct vmw_winsys_screen *vws; struct hash_table *hash; -#ifdef DEBUG +#if MESA_DEBUG bool must_flush; struct debug_stack_frame must_flush_stack[VMW_MUST_FLUSH_STACK]; struct debug_flush_ctx *fctx; @@ -278,7 +278,7 @@ vmw_swc_flush(struct svga_winsys_context *swc, vswc->region.used = 0; vswc->region.reserved = 0; -#ifdef DEBUG +#if MESA_DEBUG vswc->must_flush = false; debug_flush_flush(vswc->fctx); #endif @@ -309,7 +309,7 @@ vmw_swc_reserve(struct svga_winsys_context *swc, { struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); -#ifdef DEBUG +#if MESA_DEBUG /* Check if somebody forgot to check the previous failure */ if(vswc->must_flush) { debug_printf("Forgot to flush:\n"); @@ -328,7 +328,7 @@ vmw_swc_reserve(struct svga_winsys_context *swc, vswc->surface.used + nr_relocs > vswc->surface.size || vswc->shader.used + nr_relocs > vswc->shader.size || vswc->region.used + nr_relocs > vswc->region.size) { -#ifdef DEBUG +#if MESA_DEBUG vswc->must_flush = true; debug_backtrace_capture(vswc->must_flush_stack, 1, VMW_MUST_FLUSH_STACK); @@ -413,7 +413,7 @@ vmw_swc_region_relocation(struct svga_winsys_context *swc, vswc->preemptive_flush = true; } -#ifdef DEBUG +#if MESA_DEBUG if (!(flags & SVGA_RELOC_INTERNAL)) debug_flush_cb_reference(vswc->fctx, vmw_debug_flush_buf(buffer)); #endif @@ -457,7 +457,7 @@ vmw_swc_mob_relocation(struct svga_winsys_context *swc, vswc->preemptive_flush = true; } -#ifdef DEBUG +#if MESA_DEBUG if (!(flags & SVGA_RELOC_INTERNAL)) debug_flush_cb_reference(vswc->fctx, vmw_debug_flush_buf(buffer)); #endif @@ -678,7 +678,7 @@ vmw_swc_destroy(struct svga_winsys_context *swc) _mesa_hash_table_destroy(vswc->hash, NULL); pb_validate_destroy(vswc->validate); vmw_ioctl_context_destroy(vswc->vws, swc->cid); -#ifdef DEBUG +#if MESA_DEBUG debug_flush_ctx_destroy(vswc->fctx); #endif FREE(vswc); @@ -829,7 +829,7 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws) if (!vswc->hash) goto out_no_hash; -#ifdef DEBUG +#if MESA_DEBUG vswc->fctx = debug_flush_ctx_create(true, VMW_DEBUG_FLUSH_STACK); #endif diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index 4a2268b718a..03e2d6e52e2 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -514,7 +514,7 @@ vmw_ioctl_command(struct vmw_winsys_screen *vws, int32_t cid, int ret; int argsize; -#ifdef DEBUG +#if MESA_DEBUG { static bool firsttime = true; static bool debug = false; diff --git a/src/gallium/winsys/svga/drm/vmw_shader.c b/src/gallium/winsys/svga/drm/vmw_shader.c index c1018daf2e3..62cc7481b68 100644 --- a/src/gallium/winsys/svga/drm/vmw_shader.c +++ b/src/gallium/winsys/svga/drm/vmw_shader.c @@ -54,7 +54,7 @@ vmw_svga_winsys_shader_reference(struct vmw_svga_winsys_shader **pdst, if (!sws->have_vgpu10) vmw_ioctl_shader_destroy(dst->screen, dst->shid); -#ifdef DEBUG +#if MESA_DEBUG /* to detect dangling pointers */ assert(p_atomic_read(&dst->validated) == 0); dst->shid = SVGA3D_INVALID_ID; diff --git a/src/gallium/winsys/svga/drm/vmw_surface.c b/src/gallium/winsys/svga/drm/vmw_surface.c index 392288eb290..a68118be08e 100644 --- a/src/gallium/winsys/svga/drm/vmw_surface.c +++ b/src/gallium/winsys/svga/drm/vmw_surface.c @@ -261,7 +261,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, if (dst->buf) vmw_svga_winsys_buffer_destroy(&dst->screen->base, dst->buf); vmw_ioctl_surface_destroy(dst->screen, dst->sid); -#ifdef DEBUG +#if MESA_DEBUG /* to detect dangling pointers */ assert(p_atomic_read(&dst->validated) == 0); dst->sid = SVGA3D_INVALID_ID; diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.cpp b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.cpp index 0533483e360..6097b113ebf 100644 --- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.cpp +++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.cpp @@ -42,7 +42,7 @@ #include #include -#ifdef DEBUG +#if MESA_DEBUG # define TRACE(x...) printf("hgl:winsys: " x) # define CALLED() TRACE("CALLED: %s\n", __PRETTY_FUNCTION__) #else diff --git a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c index 9807c0f0f49..5a561d5fa13 100644 --- a/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c +++ b/src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c @@ -57,7 +57,7 @@ #include "util/simple_mtx.h" -#ifdef DEBUG +#if MESA_DEBUG #define DEBUG_PRINT(msg, ...) fprintf(stderr, msg, __VA_ARGS__) #else #define DEBUG_PRINT(msg, ...) diff --git a/src/glx/xfont.c b/src/glx/xfont.c index 412d8968bfa..c893e61af45 100644 --- a/src/glx/xfont.c +++ b/src/glx/xfont.c @@ -267,7 +267,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis fill_bitmap(dpy, screen, gc, bm_width, bm_height, x, y, c, bm); glBitmap(width, height, x0, y0, dx, dy, bm); - } + } else { glBitmap(0, 0, 0.0, 0.0, dx, dy, NULL); } diff --git a/src/imagination/vulkan/pds/pvr_pds.c b/src/imagination/vulkan/pds/pvr_pds.c index 7d0a1285b12..604182ebb72 100644 --- a/src/imagination/vulkan/pds/pvr_pds.c +++ b/src/imagination/vulkan/pds/pvr_pds.c @@ -751,7 +751,7 @@ pvr_pds_vertex_shader(struct pvr_pds_vertex_shader_program *restrict program, /* Generate the PDS vertex shader data. */ -#if defined(DEBUG) +#if MESA_DEBUG if (gen_mode == PDS_GENERATE_DATA_SEGMENT) { for (uint32_t i = 0; i < program->data_size; i++) buffer[i] = 0xDEADBEEF; @@ -1781,7 +1781,7 @@ pvr_pds_compute_shader(struct pvr_pds_compute_shader_program *restrict program, /* 2x 64 bit registers that will mask out the Predicate load. */ uint32_t cond_render_pred_mask_constant = 0; -#if defined(DEBUG) +#if MESA_DEBUG if (gen_mode == PDS_GENERATE_DATA_SEGMENT) { for (uint32_t j = 0; j < program->data_size; j++) buffer[j] = 0xDEADBEEF; diff --git a/src/imagination/vulkan/pds/pvr_pipeline_pds.c b/src/imagination/vulkan/pds/pvr_pipeline_pds.c index f441106b5f7..e4532022fec 100644 --- a/src/imagination/vulkan/pds/pvr_pipeline_pds.c +++ b/src/imagination/vulkan/pds/pvr_pipeline_pds.c @@ -294,7 +294,7 @@ static uint32_t pvr_encode_direct_write( #define RESERVE_32BIT 1U #define RESERVE_64BIT 2U -#if defined(DEBUG) +#if MESA_DEBUG # define pvr_find_constant(usage, words, name) \ pvr_find_constant2(usage, words, name) # define pvr_get_temps(usage, words, name) pvr_get_temps2(usage, words, name) diff --git a/src/imagination/vulkan/pvr_border.c b/src/imagination/vulkan/pvr_border.c index b630a881211..9507812d6a4 100644 --- a/src/imagination/vulkan/pvr_border.c +++ b/src/imagination/vulkan/pvr_border.c @@ -210,7 +210,7 @@ err_out: void pvr_border_color_table_finish(struct pvr_border_color_table *const table, struct pvr_device *const device) { -#if defined(DEBUG) +#if MESA_DEBUG BITSET_SET_RANGE_INSIDE_WORD(table->unused_entries, 0, PVR_BORDER_COLOR_TABLE_NR_BUILTIN_ENTRIES - 1); diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index c510640bb48..482cfc9f2f1 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -2485,7 +2485,7 @@ void pvr_CmdBindPipeline(VkCommandBuffer commandBuffer, } } -#if defined(DEBUG) +#if MESA_DEBUG static void check_viewport_quirk_70165(const struct pvr_device *device, const VkViewport *pViewport) { @@ -2565,7 +2565,7 @@ void pvr_CmdSetViewport(VkCommandBuffer commandBuffer, PVR_CHECK_COMMAND_BUFFER_BUILDING_STATE(cmd_buffer); -#if defined(DEBUG) +#if MESA_DEBUG if (PVR_HAS_QUIRK(&cmd_buffer->device->pdevice->dev_info, 70165)) { for (uint32_t viewport = 0; viewport < viewportCount; viewport++) { check_viewport_quirk_70165(cmd_buffer->device, &pViewports[viewport]); @@ -2706,7 +2706,7 @@ void pvr_CmdPushConstants(VkCommandBuffer commandBuffer, uint32_t size, const void *pValues) { -#if defined(DEBUG) +#if MESA_DEBUG const uint64_t ending = (uint64_t)offset + (uint64_t)size; #endif @@ -3916,7 +3916,7 @@ static VkResult pvr_cmd_buffer_upload_patched_desc_set( descriptors[desc_idx].buffer_whole_range - dynamic_offsets[desc_idx]); -#if defined(DEBUG) +#if MESA_DEBUG uint32_t desc_primary_offset; uint32_t desc_secondary_offset; diff --git a/src/imagination/vulkan/pvr_csb.c b/src/imagination/vulkan/pvr_csb.c index 44571b9300e..d3c5d876e09 100644 --- a/src/imagination/vulkan/pvr_csb.c +++ b/src/imagination/vulkan/pvr_csb.c @@ -81,7 +81,7 @@ void pvr_csb_init(struct pvr_device *device, csb->end = NULL; csb->relocation_mark = NULL; -#if defined(DEBUG) +#if MESA_DEBUG csb->relocation_mark_status = PVR_CSB_RELOCATION_MARK_UNINITIALIZED; #endif @@ -104,7 +104,7 @@ void pvr_csb_init(struct pvr_device *device, */ void pvr_csb_finish(struct pvr_csb *csb) { -#if defined(DEBUG) +#if MESA_DEBUG assert(csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_UNINITIALIZED || csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_CLEARED); @@ -272,7 +272,7 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb) memcpy(new_buffer, csb->relocation_mark, current_state_update_size); -#if defined(DEBUG) +#if MESA_DEBUG assert(csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_SET); csb->relocation_mark_status = PVR_CSB_RELOCATION_MARK_SET_AND_CONSUMED; zero_after_move = true; @@ -330,7 +330,7 @@ void *pvr_csb_alloc_dwords(struct pvr_csb *csb, uint32_t num_dwords) return p; } -#if defined(DEBUG) +#if MESA_DEBUG if (csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_CLEARED) mesa_logd_once("CS memory without relocation mark detected."); #endif diff --git a/src/imagination/vulkan/pvr_csb.h b/src/imagination/vulkan/pvr_csb.h index 99e862a104c..09919945b2b 100644 --- a/src/imagination/vulkan/pvr_csb.h +++ b/src/imagination/vulkan/pvr_csb.h @@ -80,7 +80,7 @@ struct pvr_csb { * be relocated into the new bo without breaking the update. */ void *relocation_mark; -#if defined(DEBUG) +#if MESA_DEBUG /* Used to track the state of the `relocation_mark` and to catch cases where * the driver might have emitted to the cs without using the * `relocation_mark`. Doing so is mostly harmless but will waste memory in @@ -201,7 +201,7 @@ pvr_csb_get_start_address(const struct pvr_csb *csb) */ static inline void pvr_csb_set_relocation_mark(struct pvr_csb *csb) { -#if defined(DEBUG) +#if MESA_DEBUG assert(csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_UNINITIALIZED || csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_CLEARED); @@ -220,7 +220,7 @@ static inline void pvr_csb_set_relocation_mark(struct pvr_csb *csb) */ static inline void pvr_csb_clear_relocation_mark(UNUSED struct pvr_csb *csb) { -#if defined(DEBUG) +#if MESA_DEBUG assert(csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_SET || csb->relocation_mark_status == PVR_CSB_RELOCATION_MARK_SET_AND_CONSUMED); diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 5173ada4566..832e651ba07 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -1170,7 +1170,7 @@ uint32_t pvr_calc_fscommon_size_and_tiles_in_flight( num_tile_in_flight /= num_allocs; -#if defined(DEBUG) +#if MESA_DEBUG /* Validate the above result. */ assert(num_tile_in_flight >= MIN2(num_tile_in_flight, max_tiles_in_flight)); diff --git a/src/imagination/vulkan/pvr_private.h b/src/imagination/vulkan/pvr_private.h index cb937cd95b7..0f0bb73c8d2 100644 --- a/src/imagination/vulkan/pvr_private.h +++ b/src/imagination/vulkan/pvr_private.h @@ -1598,7 +1598,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_render_pass, } while (0) /* A non-fatal assert. Useful for debugging. */ -#ifdef DEBUG +#if MESA_DEBUG # define pvr_assert(x) \ ({ \ if (unlikely(!(x))) \ diff --git a/src/imagination/vulkan/pvr_spm.c b/src/imagination/vulkan/pvr_spm.c index 0a6c50fac31..e20750cfc0e 100644 --- a/src/imagination/vulkan/pvr_spm.c +++ b/src/imagination/vulkan/pvr_spm.c @@ -861,7 +861,7 @@ static VkResult pvr_pds_bgnd_program_create_and_upload( texture_program.num_texture_dma_kicks += 1; -#if defined(DEBUG) +#if MESA_DEBUG pvr_pds_set_sizes_pixel_shader_sa_texture_data(&texture_program, dev_info); assert(texture_program_data_size_in_dwords == texture_program.data_size); #endif @@ -956,7 +956,7 @@ pvr_spm_init_bgobj_state(struct pvr_device *device, pvr_dev_addr_t tile_buffer_addr; if (const_map[i] == PVR_SPM_LOAD_DEST_UNUSED) { -#if defined(DEBUG) +#if MESA_DEBUG for (uint32_t j = i; j < PVR_SPM_LOAD_CONST_COUNT; j++) assert(const_map[j] == PVR_SPM_LOAD_DEST_UNUSED); #endif diff --git a/src/imagination/vulkan/pvr_transfer_frag_store.c b/src/imagination/vulkan/pvr_transfer_frag_store.c index 1a0d29685b1..a67bb030526 100644 --- a/src/imagination/vulkan/pvr_transfer_frag_store.c +++ b/src/imagination/vulkan/pvr_transfer_frag_store.c @@ -99,7 +99,7 @@ static uint32_t pvr_transfer_frag_shader_key( uint32_t sample_cnt_bits = util_last_bit(util_logbase2(max_multisample)); uint32_t hash = 0U; -#if defined(DEBUG) +#if MESA_DEBUG uint32_t max_shift = 0U; # define shift_hash(hash, num) \ do { \ diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c index a63ab22c1db..7b15015fced 100644 --- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c +++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_job_render.c @@ -128,7 +128,7 @@ VkResult pvr_srv_winsys_free_list_create( grow_num_pages, grow_threshold, parent_handle, -#if defined(DEBUG) +#if MESA_DEBUG PVR_SRV_TRUE /* free_list_check */, #else PVR_SRV_FALSE /* free_list_check */, diff --git a/src/intel/compiler/brw_disasm.c b/src/intel/compiler/brw_disasm.c index 09aa0191b31..73b25e55d73 100644 --- a/src/intel/compiler/brw_disasm.c +++ b/src/intel/compiler/brw_disasm.c @@ -1867,7 +1867,7 @@ swsb(FILE *file, const struct brw_isa_info *isa, const brw_inst *inst) return 0; } -#ifdef DEBUG +#if MESA_DEBUG static __attribute__((__unused__)) int brw_disassemble_imm(const struct brw_isa_info *isa, uint32_t dw3, uint32_t dw2, uint32_t dw1, uint32_t dw0) diff --git a/src/intel/compiler/brw_fs_combine_constants.cpp b/src/intel/compiler/brw_fs_combine_constants.cpp index f8e22f96173..8dd0ec5e7c0 100644 --- a/src/intel/compiler/brw_fs_combine_constants.cpp +++ b/src/intel/compiler/brw_fs_combine_constants.cpp @@ -1641,7 +1641,7 @@ brw_fs_opt_combine_constants(fs_visitor &s) reg->type = brw_int_type(type_sz(reg->type), true); } -#ifdef DEBUG +#if MESA_DEBUG switch (reg->type) { case BRW_REGISTER_TYPE_DF: assert((isnan(reg->df) && isnan(table.imm[i].df)) || diff --git a/src/intel/compiler/elk/elk_disasm.c b/src/intel/compiler/elk/elk_disasm.c index c316883c23b..d4a790540dd 100644 --- a/src/intel/compiler/elk/elk_disasm.c +++ b/src/intel/compiler/elk/elk_disasm.c @@ -1450,7 +1450,7 @@ inst_has_type(const struct elk_isa_info *isa, } } -#ifdef DEBUG +#if MESA_DEBUG static __attribute__((__unused__)) int elk_disassemble_imm(const struct elk_isa_info *isa, uint32_t dw3, uint32_t dw2, uint32_t dw1, uint32_t dw0) diff --git a/src/intel/compiler/elk/elk_fs_combine_constants.cpp b/src/intel/compiler/elk/elk_fs_combine_constants.cpp index b14b43e9d09..d86767772dc 100644 --- a/src/intel/compiler/elk/elk_fs_combine_constants.cpp +++ b/src/intel/compiler/elk/elk_fs_combine_constants.cpp @@ -1595,7 +1595,7 @@ elk_fs_visitor::opt_combine_constants() reg->type = elk_int_type(type_sz(reg->type), true); } -#ifdef DEBUG +#if MESA_DEBUG switch (reg->type) { case ELK_REGISTER_TYPE_DF: assert((isnan(reg->df) && isnan(table.imm[i].df)) || diff --git a/src/intel/perf/intel_perf_query.c b/src/intel/perf/intel_perf_query.c index 7de68670dfc..0336f341c71 100644 --- a/src/intel/perf/intel_perf_query.c +++ b/src/intel/perf/intel_perf_query.c @@ -850,7 +850,7 @@ intel_perf_begin_query(struct intel_perf_context *perf_ctx, query->oa.bo = perf_cfg->vtbl.bo_alloc(perf_ctx->bufmgr, "perf. query OA MI_RPC bo", MI_RPC_BO_SIZE); -#ifdef DEBUG +#if MESA_DEBUG /* Pre-filling the BO helps debug whether writes landed. */ void *map = perf_cfg->vtbl.bo_map(perf_ctx->ctx, query->oa.bo, MAP_WRITE); memset(map, 0x80, MI_RPC_BO_SIZE); diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 42ff6007f55..4925f689e90 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1096,7 +1096,7 @@ static void check_memory_bindings(const struct anv_device *device, const struct anv_image *image) { -#ifdef DEBUG +#if MESA_DEBUG /* As we inspect each part of the image, we merge the part's memory range * into these accumulation ranges. */ diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index a879cf2bea7..ad3ee77d270 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -357,7 +357,7 @@ void __anv_perf_warn(struct anv_device *device, } while (0) /* A non-fatal assert. Useful for debugging. */ -#ifdef DEBUG +#if MESA_DEBUG #define anv_assert(x) ({ \ if (unlikely(!(x))) \ mesa_loge("%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \ diff --git a/src/intel/vulkan_hasvk/anv_image.c b/src/intel/vulkan_hasvk/anv_image.c index 74bced161f7..5b272779794 100644 --- a/src/intel/vulkan_hasvk/anv_image.c +++ b/src/intel/vulkan_hasvk/anv_image.c @@ -833,7 +833,7 @@ static void check_memory_bindings(const struct anv_device *device, const struct anv_image *image) { -#ifdef DEBUG +#if MESA_DEBUG /* As we inspect each part of the image, we merge the part's memory range * into these accumulation ranges. */ diff --git a/src/intel/vulkan_hasvk/anv_private.h b/src/intel/vulkan_hasvk/anv_private.h index 5c6d0fea238..22c3b517ac0 100644 --- a/src/intel/vulkan_hasvk/anv_private.h +++ b/src/intel/vulkan_hasvk/anv_private.h @@ -379,7 +379,7 @@ void __anv_perf_warn(struct anv_device *device, } while (0) /* A non-fatal assert. Useful for debugging. */ -#ifdef DEBUG +#if MESA_DEBUG #define anv_assert(x) ({ \ if (unlikely(!(x))) \ mesa_loge("%s:%d ASSERT: %s", __FILE__, __LINE__, #x); \ diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 960ccc0e8b0..a3bb608040b 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -53,7 +53,7 @@ #define NAME(func) gl##func -#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ +#if 0 /* Use this to log GL calls to stdout (for debug only!) */ #define F stdout #define DISPATCH(FUNC, ARGS, MESSAGE) \ diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py index b677ef619f7..5d0ffe95408 100644 --- a/src/mapi/mapi_abi.py +++ b/src/mapi/mapi_abi.py @@ -497,7 +497,7 @@ class ABIPrinter(object): if self.lib_need_noop_array: print() print('#ifdef MAPI_TMP_NOOP_ARRAY') - print('#ifdef DEBUG') + print('#if MESA_DEBUG') print() print(self.c_noop_functions(self.prefix_noop, self.prefix_warn)) print() @@ -505,13 +505,13 @@ class ABIPrinter(object): print(self.c_noop_initializer(self.prefix_noop, False)) print('};') print() - print('#else /* DEBUG */') + print('#else /* !MESA_DEBUG */') print() print('const mapi_func table_%s_array[] = {' % (self.prefix_noop)) print(self.c_noop_initializer(self.prefix_noop, True)) print('};') print() - print('#endif /* DEBUG */') + print('#endif /* MESA_DEBUG */') print('#undef MAPI_TMP_NOOP_ARRAY') print('#endif /* MAPI_TMP_NOOP_ARRAY */') diff --git a/src/mapi/new/gen_gldispatch_mapi.py b/src/mapi/new/gen_gldispatch_mapi.py index 19fabf9b003..c3b577a5565 100755 --- a/src/mapi/new/gen_gldispatch_mapi.py +++ b/src/mapi/new/gen_gldispatch_mapi.py @@ -93,7 +93,7 @@ def generate_table(functions, allFunctions): def generate_noop_array(functions): text = "#ifdef MAPI_TMP_NOOP_ARRAY\n" - text += "#ifdef DEBUG\n\n" + text += "#if MESA_DEBUG\n\n" for func in functions: text += "static {f.rt} GLAPIENTRY noop{f.basename}({f.decArgs})\n".format(f=func) @@ -115,14 +115,14 @@ def generate_noop_array(functions): text += " (mapi_func) noop_generic,\n" text += " (mapi_func) noop_generic\n" text += "};\n\n" - text += "#else /* DEBUG */\n\n" + text += "#else /* !MESA_DEBUG */\n\n" text += "const mapi_func table_noop_array[] = {\n" for i in range(len(functions) + genCommon.MAPI_TABLE_NUM_DYNAMIC - 1): text += " (mapi_func) noop_generic,\n" text += " (mapi_func) noop_generic\n" text += "};\n\n" - text += "#endif /* DEBUG */\n" + text += "#endif /* MESA_DEBUG */\n" text += "#undef MAPI_TMP_NOOP_ARRAY\n" text += "#endif /* MAPI_TMP_NOOP_ARRAY */\n" return text diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2029959c203..cbe8b4c0914 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -220,7 +220,7 @@ one_time_init(const char *extensions_override) atexit(one_time_fini); -#if defined(DEBUG) +#if MESA_DEBUG if (MESA_VERBOSE != 0) { _mesa_debug(NULL, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n"); } @@ -472,7 +472,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) consts->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS; consts->MaxGeometryShaderInvocations = MAX_GEOMETRY_SHADER_INVOCATIONS; -#ifdef DEBUG +#if MESA_DEBUG consts->GenerateTemporaryNames = true; #else consts->GenerateTemporaryNames = false; diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c index a23483db887..848c9bf1aa4 100644 --- a/src/mesa/main/draw.c +++ b/src/mesa/main/draw.c @@ -181,7 +181,7 @@ static GLenum valid_prim_mode_custom(struct gl_context *ctx, GLenum mode, GLbitfield valid_prim_mask) { -#ifdef DEBUG +#if MESA_DEBUG ASSERTED unsigned mask = ctx->ValidPrimMask; ASSERTED unsigned mask_indexed = ctx->ValidPrimMaskIndexed; ASSERTED bool drawpix_valid = ctx->DrawPixValid; diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index b8da3a46202..9e77284c3f9 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -446,7 +446,7 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx) mask &= ~(1 << GL_PATCHES); } -#ifdef DEBUG +#if MESA_DEBUG if (shader->Flags & GLSL_LOG) { struct gl_program **prog = shader->CurrentProgram; diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 70813744cd2..c42696074b3 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -101,7 +101,7 @@ flush_delayed_errors( struct gl_context *ctx ) /** * Report a warning (a recoverable error condition) to stderr if - * either DEBUG is defined or the MESA_DEBUG env var is set. + * either MESA_DEBUG is defined to 1 or the MESA_DEBUG env var is set. * * \param ctx GL context. * \param fmtString printf()-like format string. @@ -257,7 +257,7 @@ _mesa_gl_debug(struct gl_context *ctx, * Record an OpenGL state error. These usually occur when the user * passes invalid parameters to a GL function. * - * If debugging is enabled (either at compile-time via the DEBUG macro, or + * If debugging is enabled (either at compile-time via the MESA_DEBUG macro, or * run-time via the MESA_DEBUG environment variable), report the error with * _mesa_debug(). * @@ -341,8 +341,8 @@ _mesa_error_no_memory(const char *caller) } /** - * Report debug information. Print error message to stderr via fprintf(). - * No-op if DEBUG mode not enabled. + * Report debug information. Print error message to stderr via fprintf() + * when debug mode is enabled by NDEBUG; otherwise no-op. * * \param ctx GL context. * \param fmtString printf()-style format string, followed by optional args. @@ -357,7 +357,7 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args); va_end(args); output_if_debug(MESA_LOG_DEBUG, s); -#endif /* DEBUG */ +#endif /* !NDEBUG */ (void) ctx; (void) fmtString; } diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 93a5f1357d6..16268d4dd7c 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -145,7 +145,7 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] ***/ -#ifndef DEBUG +#if !MESA_DEBUG /* This function/macro is sensitive to precision. Test very carefully * if you change it! */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 24464f6d0ef..b10c1a3fc02 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -739,7 +739,7 @@ make_null_texture(GLint width, GLint height, GLint depth, GLenum format) const GLint numPixels = width * height * depth; GLubyte *data = (GLubyte *) malloc(numPixels * components * sizeof(GLubyte)); -#ifdef DEBUG +#if MESA_DEBUG /* * Let's see if anyone finds this. If glTexImage2D() is called with * a NULL image pointer then load the texture image with something diff --git a/src/util/fast_urem_by_const.h b/src/util/fast_urem_by_const.h index ab0f9d1aee0..35f97e2047d 100644 --- a/src/util/fast_urem_by_const.h +++ b/src/util/fast_urem_by_const.h @@ -68,7 +68,7 @@ util_fast_urem32(uint32_t n, uint32_t d, uint64_t magic) { uint64_t lowbits = magic * n; uint32_t result = _mul32by64_hi(d, lowbits); -#ifdef DEBUG +#if MESA_DEBUG assert(result == n % d); #endif return result; diff --git a/src/util/libsync.h b/src/util/libsync.h index f810b7ceb45..1515484c4b4 100644 --- a/src/util/libsync.h +++ b/src/util/libsync.h @@ -204,7 +204,7 @@ static inline int sync_accumulate(const char *name, int *fd1, int fd2) /* Helper macro to complain if fd is non-negative and not a valid fence fd. * Sprinkle this around to help catch fd lifetime issues. */ -#ifdef DEBUG +#if MESA_DEBUG # include "util/log.h" # define validate_fence_fd(fd) do { \ if (((fd) >= 0) && !sync_valid_fd(fd)) \ diff --git a/src/util/log.h b/src/util/log.h index 17670cc97d9..b9d062dc3d7 100644 --- a/src/util/log.h +++ b/src/util/log.h @@ -57,7 +57,7 @@ mesa_log_v(enum mesa_log_level, const char *tag, const char *format, #define mesa_loge(fmt, ...) mesa_log(MESA_LOG_ERROR, (MESA_LOG_TAG), (fmt), ##__VA_ARGS__) #define mesa_logw(fmt, ...) mesa_log(MESA_LOG_WARN, (MESA_LOG_TAG), (fmt), ##__VA_ARGS__) #define mesa_logi(fmt, ...) mesa_log(MESA_LOG_INFO, (MESA_LOG_TAG), (fmt), ##__VA_ARGS__) -#ifdef DEBUG +#if MESA_DEBUG #define mesa_logd(fmt, ...) mesa_log(MESA_LOG_DEBUG, (MESA_LOG_TAG), (fmt), ##__VA_ARGS__) #else #define mesa_logd(fmt, ...) __mesa_log_use_args((fmt), ##__VA_ARGS__) @@ -66,7 +66,7 @@ mesa_log_v(enum mesa_log_level, const char *tag, const char *format, #define mesa_loge_v(fmt, va) mesa_log_v(MESA_LOG_ERROR, (MESA_LOG_TAG), (fmt), (va)) #define mesa_logw_v(fmt, va) mesa_log_v(MESA_LOG_WARN, (MESA_LOG_TAG), (fmt), (va)) #define mesa_logi_v(fmt, va) mesa_log_v(MESA_LOG_INFO, (MESA_LOG_TAG), (fmt), (va)) -#ifdef DEBUG +#if MESA_DEBUG #define mesa_logd_v(fmt, va) mesa_log_v(MESA_LOG_DEBUG, (MESA_LOG_TAG), (fmt), (va)) #else #define mesa_logd_v(fmt, va) __mesa_log_use_args((fmt), (va)) @@ -104,7 +104,7 @@ void mesa_log_stream_printf(struct log_stream *stream, const char *format, ...) void _mesa_log_multiline(enum mesa_log_level level, const char *tag, const char *lines); #define mesa_log_multiline(level, lines) _mesa_log_multiline(level, (MESA_LOG_TAG), lines) -#ifndef DEBUG +#if !MESA_DEBUG /* Suppres -Wunused */ static inline void PRINTFLIKE(1, 2) __mesa_log_use_args(UNUSED const char *format, ...) { } diff --git a/src/util/os_misc.c b/src/util/os_misc.c index 7261577488f..19fecb309d9 100644 --- a/src/util/os_misc.c +++ b/src/util/os_misc.c @@ -82,7 +82,7 @@ os_log_message(const char *message) static FILE *fout = NULL; if (!fout) { -#ifdef DEBUG +#if MESA_DEBUG /* one-time init */ const char *filename = os_get_option("GALLIUM_LOG_FILE"); if (filename) { diff --git a/src/util/os_misc.h b/src/util/os_misc.h index 9be6cbc50a5..4301ae4594e 100644 --- a/src/util/os_misc.h +++ b/src/util/os_misc.h @@ -68,7 +68,7 @@ extern "C" { /* * Abort the program. */ -#if defined(DEBUG) +#if MESA_DEBUG # define os_abort() do { os_break(); abort(); } while(0) #else # define os_abort() abort() diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 2394ab48c1d..66e9d48f39c 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -198,7 +198,7 @@ check_os_altivec_support(void) } else { bool enable_altivec = true; /* Default: enable if available, and if not overridden */ bool enable_vsx = true; -#ifdef DEBUG +#if MESA_DEBUG /* Disabling Altivec code generation is not the same as disabling VSX code generation, * which can be done simply by passing -mattr=-vsx to the LLVM compiler; cf. * lp_build_create_jit_compiler_for_module(). @@ -638,7 +638,7 @@ void check_cpu_caps_override(void) if (debug_get_bool_option("GALLIUM_NOSSE", false)) { util_cpu_caps.has_sse = 0; } -#ifdef DEBUG +#if MESA_DEBUG /* For simulating less capable machines */ if (debug_get_bool_option("LP_FORCE_SSE2", false)) { util_cpu_caps.has_sse3 = 0; diff --git a/src/util/u_debug.h b/src/util/u_debug.h index 8e8319c0601..ff10e3bacda 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -133,7 +133,7 @@ debug_printf(const char *format, ...) _util_printf_format(1,2); static inline void debug_printf(const char *format, ...) { -#ifdef DEBUG +#if MESA_DEBUG va_list ap; va_start(ap, format); _debug_vprintf(format, ap); @@ -161,7 +161,7 @@ debug_printf(const char *format, ...) } while (0) -#ifdef DEBUG +#if MESA_DEBUG #define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap) #else #define debug_vprintf(_format, _ap) ((void)0) @@ -181,11 +181,11 @@ debug_disable_win32_error_dialogs(void); /** * Hard-coded breakpoint. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_break() os_break() -#else /* !DEBUG */ +#else /* !MESA_DEBUG */ #define debug_break() ((void)0) -#endif /* !DEBUG */ +#endif /* MESA_DEBUG */ void @@ -195,7 +195,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); /** * Output the current function name. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_checkpoint() \ _debug_printf("%s\n", __func__) #else @@ -207,7 +207,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); /** * Output the full source code position. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_checkpoint_full() \ _debug_printf("%s:%u:%s\n", __FILE__, __LINE__, __func__) #else @@ -219,7 +219,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); /** * Output a warning message. Muted on release version. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_warning(__msg) \ _debug_printf("%s:%u:%s: warning: %s\n", __FILE__, __LINE__, __func__, __msg) #else @@ -231,7 +231,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); /** * Emit a warning message, but only once. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_warn_once(__msg) \ do { \ static bool warned = false; \ @@ -250,7 +250,7 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); /** * Output an error message. Not muted on release version. */ -#ifdef DEBUG +#if MESA_DEBUG #define debug_error(__msg) \ _debug_printf("%s:%u:%s: error: %s\n", __FILE__, __LINE__, __func__, __msg) #else diff --git a/src/vulkan/runtime/vk_log.c b/src/vulkan/runtime/vk_log.c index 4badad665f1..afe42aedcd7 100644 --- a/src/vulkan/runtime/vk_log.c +++ b/src/vulkan/runtime/vk_log.c @@ -111,7 +111,7 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity, } } -#ifndef DEBUG +#if !MESA_DEBUG if (unlikely(!instance) || (likely(list_is_empty(&instance->debug_utils.callbacks)) && likely(list_is_empty(&instance->debug_report.callbacks)))) @@ -127,7 +127,7 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity, char *message_idname = ralloc_asprintf(NULL, "%s:%d", file, line); -#ifdef DEBUG +#if MESA_DEBUG switch (severity) { case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: mesa_logd("%s: %s", message_idname, message);