OSDN Git Service

i965: Initialize INTEL_DEBUG once per process.
authorMatt Turner <mattst88@gmail.com>
Sat, 22 Nov 2014 02:05:40 +0000 (18:05 -0800)
committerMatt Turner <mattst88@gmail.com>
Mon, 1 Dec 2014 19:32:52 +0000 (11:32 -0800)
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/intel_debug.c

index a283357..6391cf7 100644 (file)
@@ -32,6 +32,7 @@
 #include "brw_context.h"
 #include "intel_debug.h"
 #include "utils.h"
+#include "util/u_atomic.h" /* for p_atomic_cmpxchg */
 
 uint64_t INTEL_DEBUG = 0;
 
@@ -73,7 +74,9 @@ static const struct dri_debug_control debug_control[] = {
 void
 brw_process_intel_debug_variable(struct brw_context *brw)
 {
-   INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+   uint64_t intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+   (void) p_atomic_cmpxchg(&INTEL_DEBUG, 0, intel_debug);
+
    if (INTEL_DEBUG & DEBUG_BUFMGR)
       dri_bufmgr_set_debug(brw->bufmgr, true);