intel: add INTEL_DEBUG expected value in declaration
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6732>
diff --git a/src/intel/dev/gen_debug.c b/src/intel/dev/gen_debug.c
index 3671ba1..a270b9b 100644
--- a/src/intel/dev/gen_debug.c
+++ b/src/intel/dev/gen_debug.c
@@ -39,7 +39,7 @@
#include "util/debug.h"
#include "c11/threads.h"
-uint64_t INTEL_DEBUG = 0;
+uint64_t intel_debug = 0;
static const struct debug_control debug_control[] = {
{ "tex", DEBUG_TEXTURE},
@@ -117,7 +117,7 @@
static void
brw_process_intel_debug_variable_once(void)
{
- INTEL_DEBUG = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
+ intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
}
void
diff --git a/src/intel/dev/gen_debug.h b/src/intel/dev/gen_debug.h
index 616d473..6102e54 100644
--- a/src/intel/dev/gen_debug.h
+++ b/src/intel/dev/gen_debug.h
@@ -28,6 +28,7 @@
#include <stdint.h>
#include "compiler/shader_enums.h"
+#include "util/macros.h"
#ifdef __cplusplus
extern "C" {
@@ -39,7 +40,9 @@
* list of debugging flags, as well as some macros for handling them.
*/
-extern uint64_t INTEL_DEBUG;
+extern uint64_t intel_debug;
+
+#define INTEL_DEBUG __builtin_expect(intel_debug, 0)
#define DEBUG_TEXTURE (1ull << 0)
#define DEBUG_STATE (1ull << 1)
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 1fb4330..2025f51 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -2574,7 +2574,7 @@
if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && devinfo->gen < 7) {
fprintf(stderr,
"shader_time debugging requires gen7 (Ivybridge) or better.\n");
- INTEL_DEBUG &= ~DEBUG_SHADER_TIME;
+ intel_debug &= ~DEBUG_SHADER_TIME;
}
if (intel_get_integer(screen, I915_PARAM_MMAP_GTT_VERSION) >= 1) {