From 28e6a272fc0d16b2c3c8972f8936126ebf0aa764 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 25 Apr 2013 14:18:33 +0100 Subject: [PATCH] trace: Only close trace files on exit. Many applications don't exit cleanly, others may create and destroy a screen multiple times, so we only write tag and close at exit time. --- src/gallium/drivers/trace/tr_dump.c | 19 ++++--------------- src/gallium/drivers/trace/tr_dump.h | 1 - src/gallium/drivers/trace/tr_screen.c | 2 -- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 826ce5bc1ba..7111e0d174d 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -59,7 +59,6 @@ static boolean close_stream = FALSE; static FILE *stream = NULL; -static unsigned refcount = 0; pipe_static_mutex(call_mutex); static long unsigned call_no = 0; static boolean dumping = FALSE; @@ -234,7 +233,6 @@ trace_dump_trace_close(void) close_stream = FALSE; stream = NULL; } - refcount = 0; call_no = 0; } } @@ -283,15 +281,13 @@ trace_dump_trace_begin(void) trace_dump_writes("\n"); trace_dump_writes("\n"); -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) - /* Linux applications rarely cleanup GL / Gallium resources so catch - * application exit here */ + /* Many applications don't exit cleanly, others may create and destroy a + * screen multiple times, so we only write tag and close at exit + * time. + */ atexit(trace_dump_trace_close); -#endif } - ++refcount; - return TRUE; } @@ -300,13 +296,6 @@ boolean trace_dump_trace_enabled(void) return stream ? TRUE : FALSE; } -void trace_dump_trace_end(void) -{ - if(stream) - if(!--refcount) - trace_dump_trace_close(); -} - /* * Call lock */ diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index ef0129281c1..4737a93a6c3 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -50,7 +50,6 @@ struct pipe_box; boolean trace_dump_trace_begin(void); boolean trace_dump_trace_enabled(void); void trace_dump_trace_flush(void); -void trace_dump_trace_end(void); /* * Lock and unlock the call mutex. diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index df775072fa3..5281ba8b47b 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -427,7 +427,6 @@ trace_screen_destroy(struct pipe_screen *_screen) trace_dump_call_begin("pipe_screen", "destroy"); trace_dump_arg(ptr, screen); trace_dump_call_end(); - trace_dump_trace_end(); screen->destroy(screen); @@ -497,7 +496,6 @@ trace_screen_create(struct pipe_screen *screen) error2: trace_dump_ret(ptr, screen); trace_dump_call_end(); - trace_dump_trace_end(); error1: return screen; } -- 2.30.2