intel: fix INTEL_DEBUG environment variable on 32-bit systems
INTEL_DEBUG is defined (since 4015e1876a) 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>
This commit is contained in:
committed by
Marge Bot
parent
182237e1e8
commit
d05f7b4a2c
@@ -42,7 +42,8 @@ extern "C" {
|
||||
|
||||
extern uint64_t intel_debug;
|
||||
|
||||
#define INTEL_DEBUG __builtin_expect(intel_debug, 0)
|
||||
/* Returns 0/1, not the matching bit mask. */
|
||||
#define INTEL_DEBUG(flags) unlikely(intel_debug & (flags))
|
||||
|
||||
#define DEBUG_TEXTURE (1ull << 0)
|
||||
#define DEBUG_STATE (1ull << 1)
|
||||
@@ -94,6 +95,8 @@ extern uint64_t intel_debug;
|
||||
#define DEBUG_NO32 (1ull << 47)
|
||||
#define DEBUG_RT (1ull << 48)
|
||||
|
||||
#define DEBUG_ANY (~0ull)
|
||||
|
||||
/* These flags are not compatible with the disk shader cache */
|
||||
#define DEBUG_DISK_CACHE_DISABLE_MASK DEBUG_SHADER_TIME
|
||||
|
||||
@@ -118,9 +121,9 @@ extern uint64_t intel_debug;
|
||||
#define dbg_printf(...) fprintf(stderr, __VA_ARGS__)
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
#define DBG(...) do { \
|
||||
if (INTEL_DEBUG & FILE_DEBUG_FLAG) \
|
||||
dbg_printf(__VA_ARGS__); \
|
||||
#define DBG(...) do { \
|
||||
if (INTEL_DEBUG(FILE_DEBUG_FLAG)) \
|
||||
dbg_printf(__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
extern uint64_t intel_debug_flag_for_shader_stage(gl_shader_stage stage);
|
||||
|
||||
Reference in New Issue
Block a user