trace: Separate the trace screen/context vs the original screen/context.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 14 Aug 2008 09:46:38 +0000 (10:46 +0100)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 14 Aug 2008 10:01:42 +0000 (11:01 +0100)
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_context.h
src/gallium/drivers/trace/tr_screen.c
src/gallium/drivers/trace/tr_winsys.c
src/gallium/drivers/trace/tr_winsys.h

index f82126370cf2eb3b60e0efaf3012fb0773eb9432..e43fc01c557f18daf4d37103e2f7844ef6e6f9da 100644 (file)
@@ -959,7 +959,8 @@ trace_context_destroy(struct pipe_context *_pipe)
 
 
 struct pipe_context *
-trace_context_create(struct pipe_context *pipe)
+trace_context_create(struct pipe_screen *screen, 
+                     struct pipe_context *pipe)
 {
    struct trace_stream *stream;
    struct trace_context *tr_ctx;
@@ -971,8 +972,8 @@ trace_context_create(struct pipe_context *pipe)
    if(!tr_ctx)
       return NULL;
 
-   tr_ctx->base.winsys = pipe->winsys;
-   tr_ctx->base.screen = pipe->screen;
+   tr_ctx->base.winsys = screen->winsys;
+   tr_ctx->base.screen = screen;
    tr_ctx->base.destroy = trace_context_destroy;
    tr_ctx->base.set_edgeflags = trace_context_set_edgeflags;
    tr_ctx->base.draw_arrays = trace_context_draw_arrays;
@@ -1017,11 +1018,7 @@ trace_context_create(struct pipe_context *pipe)
    tr_ctx->base.flush = trace_context_flush;
 
    tr_ctx->pipe = pipe;
-   tr_ctx->stream = stream = trace_winsys(pipe->winsys)->stream;
-   
-   /* We don't want to trace the internal pipe calls */
-   pipe->winsys = trace_winsys(pipe->winsys)->winsys;
-   pipe->screen = trace_screen(pipe->screen)->screen;
+   tr_ctx->stream = stream = trace_screen(screen)->stream;
    
    trace_dump_call_begin(stream, "", "pipe_context_create");
    trace_dump_arg_begin(stream, "screen");
index 2c0b0c72e45051cc3ee97294576d77b30aaed4ea..1aa822ba02e4084a64b0e3de26b0f2b8a5829914 100644 (file)
@@ -57,7 +57,8 @@ trace_context(struct pipe_context *pipe)
 
 
 struct pipe_context *
-trace_context_create(struct pipe_context *pipe);
+trace_context_create(struct pipe_screen *screen,
+                     struct pipe_context *pipe);
 
 
 #endif /* TR_CONTEXT_H_ */
index 27c218039ec698efd58f3d5a709ff012910db49f..0e253123aee230ff9840a5f175cc985a3ffa36c8 100644 (file)
@@ -338,7 +338,11 @@ trace_screen_destroy(struct pipe_screen *_screen)
    screen->destroy(screen);
    
    trace_dump_call_end(stream);
-   
+
+   trace_dump_trace_end(stream);
+
+   trace_stream_close(stream);
+
    FREE(tr_scr);
 }
 
@@ -348,6 +352,7 @@ trace_screen_create(struct pipe_screen *screen)
 {
    struct trace_stream *stream;
    struct trace_screen *tr_scr;
+   struct pipe_winsys *winsys;
    
    if(!debug_get_bool_option("GALLIUM_TRACE", FALSE))
       return screen;
@@ -356,7 +361,17 @@ trace_screen_create(struct pipe_screen *screen)
    if(!tr_scr)
       return NULL;
 
-   tr_scr->base.winsys = screen->winsys;
+   tr_scr->stream = stream = trace_stream_create("gallium", "trace");
+   if(!tr_scr->stream)
+      return NULL;
+
+   trace_dump_trace_begin(stream, 0);
+
+   winsys = trace_winsys_create(stream, screen->winsys);
+   if(!winsys)
+      return NULL;
+   
+   tr_scr->base.winsys = winsys;
    tr_scr->base.destroy = trace_screen_destroy;
    tr_scr->base.get_name = trace_screen_get_name;
    tr_scr->base.get_vendor = trace_screen_get_vendor;
@@ -372,10 +387,7 @@ trace_screen_create(struct pipe_screen *screen)
    tr_scr->base.surface_unmap = trace_screen_surface_unmap;
    
    tr_scr->screen = screen;
-   tr_scr->stream = stream = trace_winsys(screen->winsys)->stream;
-
-   /* We don't want to trace the internal pipe calls */
-   screen->winsys = trace_winsys(screen->winsys)->winsys;
+   tr_scr->stream = stream = trace_winsys(winsys)->stream;
 
    trace_dump_call_begin(stream, "", "pipe_screen_create");
    trace_dump_arg_begin(stream, "winsys");
index eec84a19816dedf73f4b99f2086f52ad77f0addb..524049148d0b7bdaf7e6df80c89baed2da30d3ec 100644 (file)
@@ -393,28 +393,24 @@ trace_winsys_destroy(struct pipe_winsys *_winsys)
    
    trace_dump_arg(stream, ptr, winsys);
 
-   winsys->destroy(winsys);
+   /* 
+   winsys->destroy(winsys); 
+   */
    
    trace_dump_call_end(stream);
    
-   trace_dump_trace_end(stream);
-   
    hash_table_destroy(tr_ws->buffer_maps);
 
-   trace_stream_close(tr_ws->stream);
-   
    FREE(tr_ws);
 }
 
 
 struct pipe_winsys *
-trace_winsys_create(struct pipe_winsys *winsys)
+trace_winsys_create(struct trace_stream *stream, 
+                    struct pipe_winsys *winsys)
 {
-   struct trace_stream *stream;
-   struct trace_winsys *tr_ws;
    
-   if(!debug_get_bool_option("GALLIUM_TRACE", FALSE))
-      return winsys;
+   struct trace_winsys *tr_ws;
    
    tr_ws = CALLOC_STRUCT(trace_winsys);
    if(!tr_ws)
@@ -436,18 +432,13 @@ trace_winsys_create(struct pipe_winsys *winsys)
    tr_ws->base.fence_finish = trace_winsys_fence_finish;
    
    tr_ws->winsys = winsys;
-
-   tr_ws->stream = stream = trace_stream_create("gallium", "trace");
-   if(!tr_ws->stream)
-      return NULL;
+   tr_ws->stream = stream;
 
    tr_ws->buffer_maps = hash_table_create(trace_buffer_hash, 
                                           trace_buffer_compare);
    if(!tr_ws->buffer_maps)
       return NULL;
    
-   trace_dump_trace_begin(tr_ws->stream, 0);
-   
    trace_dump_call_begin(stream, "", "pipe_winsys_create");
    trace_dump_ret(stream, ptr, winsys);
    trace_dump_call_end(stream);
index a3576da867e4b98d792f3aff088225dde9b4cbdf..704d2c57c86a0e8887f5bcda2aecfc58fda64188 100644 (file)
@@ -60,7 +60,8 @@ trace_winsys(struct pipe_winsys *winsys)
 
 
 struct pipe_winsys *
-trace_winsys_create(struct pipe_winsys *winsys);
+trace_winsys_create(struct trace_stream *stream,
+                    struct pipe_winsys *winsys);
 
 
 #endif /* TR_WINSYS_H_ */