summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_dump.c
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2009-04-20 16:05:01 +0200
committerJakob Bornecrantz <[email protected]>2009-04-20 16:07:44 +0200
commit8ae52413c7883fa4e9bee303f7d28d6dd6953101 (patch)
tree3a23f2c4a0c250ea8aa4c15450c2bcf885029463 /src/gallium/drivers/trace/tr_dump.c
parent6900046aad77b3b01feb30af9e50375224747b7d (diff)
trace: Add initializer for static variables
Diffstat (limited to 'src/gallium/drivers/trace/tr_dump.c')
-rw-r--r--src/gallium/drivers/trace/tr_dump.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 63811b7c81e..3a1409e95a7 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -62,6 +62,7 @@ static unsigned refcount = 0;
static pipe_mutex call_mutex;
static long unsigned call_no = 0;
static boolean dumping = FALSE;
+static boolean initialized = FALSE;
static INLINE void
@@ -227,10 +228,22 @@ trace_dump_trace_close(void)
}
}
+void trace_dump_init()
+{
+ if (initialized)
+ return;
+
+ pipe_mutex_init(call_mutex);
+ dumping = FALSE;
+ initialized = TRUE;
+}
+
boolean trace_dump_trace_begin()
{
const char *filename;
+ assert(initialized);
+
filename = debug_get_option("GALLIUM_TRACE", NULL);
if(!filename)
return FALSE;
@@ -241,8 +254,6 @@ boolean trace_dump_trace_begin()
if(!stream)
return FALSE;
- pipe_mutex_init(call_mutex);
-
trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n");
trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
trace_dump_writes("<trace version='0.1'>\n");