[Mesa-dev] [PATCH] i965: don't require 64bit cmpxchg

Grazvydas Ignotas notasas at gmail.com
Sun Mar 5 19:07:07 UTC 2017


There are still some distributions trying to support unfortunate people
with old or exotic CPUs that don't have 64bit atomic operations. The
only thing preventing compile of the Intel driver for them seems to be
initialization of a debug variable.

It is very unlikely to be set simultaneously by multiple threads that
somehow manage to change the environment variable without affecting each
other, so just provide a thread-unsafe fallback.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93089
Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
---
no commit access

 src/intel/common/gen_debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/intel/common/gen_debug.c b/src/intel/common/gen_debug.c
index 858f04d..b206e8f 100644
--- a/src/intel/common/gen_debug.c
+++ b/src/intel/common/gen_debug.c
@@ -105,5 +105,10 @@ void
 brw_process_intel_debug_variable(void)
 {
    uint64_t intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
+#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
    (void) p_atomic_cmpxchg(&INTEL_DEBUG, 0, intel_debug);
+#else
+   if (!INTEL_DEBUG)
+      INTEL_DEBUG = intel_debug;
+#endif
 }
-- 
2.7.4



More information about the mesa-dev mailing list