trace: Export enabled status
authorJakob Bornecrantz <jakob@vmware.com>
Sat, 16 May 2009 00:49:11 +0000 (01:49 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Sat, 16 May 2009 00:50:53 +0000 (01:50 +0100)
src/gallium/drivers/trace/Makefile
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_screen.c
src/gallium/drivers/trace/tr_screen.h

index 94be0bfd5a5a0f2fbef9b1a831f2bcb637839a44..ecb69fb9964186cb9ddaad33eec7af6af4196866 100644 (file)
@@ -8,8 +8,8 @@ C_SOURCES = \
        tr_context.c \
        tr_dump.c \
        tr_dump_state.c \
-       tr_state.c \
        tr_screen.c \
+       tr_state.c \
        tr_texture.c
 
 include ../../Makefile.template
index e51af2451b2e653f1c0c636a10570a5a5b50b112..a4166285628388708fb6568cdbb40094c965761e 100644 (file)
@@ -1124,7 +1124,7 @@ trace_context_create(struct pipe_screen *_screen,
    if(!pipe)
       goto error1;
 
-   if(!trace_dump_trace_enabled())
+   if(!trace_enabled())
       goto error1;
 
    tr_scr = trace_screen(_screen);
index 58855a8346094f41279ebcdebcdb7232f4de6226..bc14248eebba7e631b45cdc9d27bd80a8eb6a13f 100644 (file)
@@ -37,6 +37,8 @@
 #include "pipe/p_inlines.h"
 
 
+static boolean trace = FALSE;
+
 static const char *
 trace_screen_get_name(struct pipe_screen *_screen)
 {
@@ -820,16 +822,20 @@ trace_screen_destroy(struct pipe_screen *_screen)
    struct pipe_screen *screen = tr_scr->screen;
 
    trace_dump_call_begin("pipe_screen", "destroy");
-
    trace_dump_arg(ptr, screen);
+   trace_dump_call_end();
+   trace_dump_trace_end();
 
    screen->destroy(screen);
 
-   trace_dump_call_end();
+   FREE(tr_scr);
+}
 
-   trace_dump_trace_end();
 
-   FREE(tr_scr);
+boolean
+trace_enabled(void)
+{
+   return trace;
 }
 
 
@@ -844,10 +850,13 @@ trace_screen_create(struct pipe_screen *screen)
 
    trace_dump_init();
 
-   if(!trace_dump_trace_begin())
-      goto error1;
+   if(trace_dump_trace_begin()) {
+      trace_dumping_start();
+      trace = TRUE;
+   }
 
-   trace_dumping_start();
+   if (!trace)
+      goto error1;
 
    trace_dump_call_begin("", "pipe_screen_create");
 
index 59f254166d4dcb317903161c15302041e4e4fe77..7fae18298580e9d87bed0de281a8bd5090b657e1 100644 (file)
@@ -71,6 +71,13 @@ struct trace_screen
 };
 
 
+/*
+ * tr_screen.c
+ */
+
+boolean
+trace_enabled(void);
+
 struct trace_screen *
 trace_screen(struct pipe_screen *screen);