treewide: Replace the invalid usage #if DEBUG with #ifdef DEBUG

This is done by find&replace and exclude the following folders in vscode
docs,*.rs,addrlib,src/imgui,*.sh,src/intel/vulkan/grl/gpu

This is a prepare step for re-working https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21946

These issues are found when to try switch DEBUG to MESA_DEBUG=0|1 in MR

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28092

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28083>
This commit is contained in:
Yonggang Luo
2024-03-09 04:40:19 +08:00
committed by Marge Bot
parent 3f1cb470f0
commit 680e707534
14 changed files with 19 additions and 19 deletions

View File

@@ -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;
#if DEBUG
#ifdef DEBUG
fprintf(stderr, "Skipping gl_LayerID shader sanity check for "
"secondary command buffer\n");
#endif

View File

@@ -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];
#if DEBUG
#ifdef DEBUG
/* Warn if one of the element indexes go outside the vertex buffer */
{
unsigned max_index = 0x0;

View File

@@ -130,7 +130,7 @@ static void init_native_targets()
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeNativeTargetDisassembler();
#if DEBUG
#ifdef DEBUG
{
char *env_llc_options = getenv("GALLIVM_LLC_OPTIONS");
if (env_llc_options) {

View File

@@ -411,7 +411,7 @@ static void
micro_exp2(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
#if DEBUG
#ifdef DEBUG
/* Inf is okay for this instruction, so clamp it to silence assertions. */
unsigned i;
union tgsi_exec_channel clamped;

View File

@@ -2144,7 +2144,7 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
tgsi_dump( tokens, 0 );
}
#if DEBUG
#ifdef 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++) {

View File

@@ -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);
#if DEBUG
#ifdef 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;

View File

@@ -2094,7 +2094,7 @@ d3d12_video_encoder_encode_bitstream(struct pipe_video_codec * codec,
CD3DX12_RESOURCE_DESC referencesTexArrayDesc(GetDesc(referenceFramesDescriptor.ppTexture2Ds[0]));
#if DEBUG
#ifdef DEBUG
// the reconpic output should be all the same texarray allocation
if((reconPicOutputTextureDesc.pReconstructedPicture) && (referenceFramesDescriptor.NumTexture2Ds > 0))
assert(referenceFramesDescriptor.ppTexture2Ds[0] == reconPicOutputTextureDesc.pReconstructedPicture);

View File

@@ -195,7 +195,7 @@ void amdgpu_bo_destroy(struct amdgpu_winsys *ws, struct pb_buffer_lean *_buf)
amdgpu_bo_free(bo->bo_handle);
#if DEBUG
#ifdef DEBUG
if (ws->debug_all_bos) {
simple_mtx_lock(&ws->global_bo_list_lock);
list_del(&bo->global_list_item);
@@ -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 *ws, struct amdgpu_bo_real *bo)
{
#if DEBUG
#ifdef DEBUG
if (ws->debug_all_bos) {
simple_mtx_lock(&ws->global_bo_list_lock);
list_addtail(&bo->global_list_item, &ws->global_bo_list);

View File

@@ -92,7 +92,7 @@ struct amdgpu_bo_real {
void *cpu_ptr; /* for user_ptr and permanent maps */
int map_count;
uint32_t kms_handle;
#if DEBUG
#ifdef DEBUG
struct list_head global_list_item;
#endif
simple_mtx_t map_lock;

View File

@@ -1478,7 +1478,7 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index)
}
simple_mtx_unlock(&ws->bo_fence_lock);
#if DEBUG
#ifdef DEBUG
/* Prepare the buffer list. */
if (ws->debug_all_bos) {
/* The buffer list contains all buffers. This is a slow path that

View File

@@ -26,7 +26,7 @@
static struct hash_table *dev_tab = NULL;
static simple_mtx_t dev_tab_mutex = SIMPLE_MTX_INITIALIZER;
#if DEBUG
#ifdef 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 *ws,
ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL ||
strstr(debug_get_option("AMD_DEBUG", ""), "check_vm") != NULL;
ws->noop_cs = ws->info.family_overridden || debug_get_bool_option("RADEON_NOOP", false);
#if DEBUG
#ifdef DEBUG
ws->debug_all_bos = debug_get_option_all_bos();
#endif
ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL ||
@@ -89,7 +89,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *ws)
pb_cache_deinit(&ws->bo_cache);
_mesa_hash_table_destroy(ws->bo_export_table, NULL);
simple_mtx_destroy(&ws->sws_list_lock);
#if DEBUG
#ifdef DEBUG
simple_mtx_destroy(&ws->global_bo_list_lock);
#endif
simple_mtx_destroy(&ws->bo_export_table_lock);
@@ -479,13 +479,13 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
/* init reference */
pipe_reference_init(&aws->reference, 1);
#if DEBUG
#ifdef 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);
#if DEBUG
#ifdef DEBUG
(void) simple_mtx_init(&aws->global_bo_list_lock, mtx_plain);
#endif
(void) simple_mtx_init(&aws->bo_fence_lock, mtx_plain);

View File

@@ -182,7 +182,7 @@ struct amdgpu_winsys {
bool noop_cs;
bool reserve_vmid;
bool zero_all_vram_allocs;
#if DEBUG
#ifdef DEBUG
bool debug_all_bos;
/* List of all allocated buffers */

View File

@@ -181,7 +181,7 @@ static GLenum
valid_prim_mode_custom(struct gl_context *ctx, GLenum mode,
GLbitfield valid_prim_mask)
{
#if DEBUG
#ifdef DEBUG
ASSERTED unsigned mask = ctx->ValidPrimMask;
ASSERTED unsigned mask_indexed = ctx->ValidPrimMaskIndexed;
ASSERTED bool drawpix_valid = ctx->DrawPixValid;

View File

@@ -127,7 +127,7 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
char *message_idname = ralloc_asprintf(NULL, "%s:%d", file, line);
#if DEBUG
#ifdef DEBUG
switch (severity) {
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
mesa_logd("%s: %s", message_idname, message);