intel: fix INTEL_DEBUG environment variable on 32-bit systems
authorMarcin Ślusarz <marcin.slusarz@intel.com>
Wed, 13 Oct 2021 09:21:41 +0000 (11:21 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 15 Oct 2021 19:55:14 +0000 (19:55 +0000)
commitd05f7b4a2ca68cc11825239273f6d8558b5ffde8
treec7c314bd16f2a10ffe37955827d7312dd89d213f
parent182237e1e89122b6a09f2a5607e9fc2b138fb11b
intel: fix INTEL_DEBUG environment variable on 32-bit systems

INTEL_DEBUG is defined (since 4015e1876a77162e3444eeaa29a0dfbc47efe90e) as:

 #define INTEL_DEBUG __builtin_expect(intel_debug, 0)

which unfortunately chops off upper 32 bits from intel_debug
on platforms where sizeof(long) != sizeof(uint64_t) because
__builtin_expect is defined only for the long type.

Fix this by changing the definition of INTEL_DEBUG to be function-like
macro with "flags" argument. New definition returns 0 or 1 when
any of the flags match.

Most of the changes in this commit were generated using:
for c in `git grep INTEL_DEBUG | grep "&" | grep -v i915 | awk -F: '{print $1}' | sort | uniq`; do
    perl -pi -e "s/INTEL_DEBUG & ([A-Z0-9a-z_]+)/INTEL_DBG(\1)/" $c
    perl -pi -e "s/INTEL_DEBUG & (\([A-Z0-9_ |]+\))/INTEL_DBG\1/" $c
done
but it didn't handle all cases and required minor cleanups (like removal
of round brackets which were not needed anymore).

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13334>
68 files changed:
src/gallium/drivers/crocus/crocus_batch.c
src/gallium/drivers/crocus/crocus_clear.c
src/gallium/drivers/crocus/crocus_context.h
src/gallium/drivers/crocus/crocus_disk_cache.c
src/gallium/drivers/crocus/crocus_draw.c
src/gallium/drivers/crocus/crocus_program.c
src/gallium/drivers/crocus/crocus_resource.c
src/gallium/drivers/crocus/crocus_screen.c
src/gallium/drivers/crocus/crocus_state.c
src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_clear.c
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_disk_cache.c
src/gallium/drivers/iris/iris_draw.c
src/gallium/drivers/iris/iris_fence.c
src/gallium/drivers/iris/iris_program.c
src/gallium/drivers/iris/iris_resource.c
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_state.c
src/intel/compiler/brw_compile_clip.c
src/intel/compiler/brw_compile_ff_gs.c
src/intel/compiler/brw_compile_sf.c
src/intel/compiler/brw_compiler.c
src/intel/compiler/brw_disasm_info.c
src/intel/compiler/brw_eu.cpp
src/intel/compiler/brw_eu_compact.c
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_shader.cpp
src/intel/compiler/brw_vec4.cpp
src/intel/compiler/brw_vec4_gs_visitor.cpp
src/intel/compiler/brw_vec4_tcs.cpp
src/intel/compiler/brw_vec4_tes.cpp
src/intel/compiler/brw_vec4_vs_visitor.cpp
src/intel/dev/intel_debug.h
src/intel/isl/isl_drm.c
src/intel/perf/intel_perf.c
src/intel/vulkan/anv_batch_chain.c
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_image.c
src/intel/vulkan/anv_perf.c
src/intel/vulkan/anv_pipeline.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_cmd_buffer.c
src/mesa/drivers/dri/i965/brw_batch.c
src/mesa/drivers/dri/i965/brw_binding_tables.c
src/mesa/drivers/dri/i965/brw_blorp.c
src/mesa/drivers/dri/i965/brw_clear.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_disk_cache.c
src/mesa/drivers/dri/i965/brw_draw_upload.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_mipmap_tree.c
src/mesa/drivers/dri/i965/brw_performance_query.c
src/mesa/drivers/dri/i965/brw_pixel_bitmap.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_screen.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_urb.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/genX_state_upload.c
src/mesa/drivers/dri/i965/gfx7_l3_state.c