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;
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;
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");
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_ */
screen->destroy(screen);
trace_dump_call_end(stream);
-
+
+ trace_dump_trace_end(stream);
+
+ trace_stream_close(stream);
+
FREE(tr_scr);
}
{
struct trace_stream *stream;
struct trace_screen *tr_scr;
+ struct pipe_winsys *winsys;
if(!debug_get_bool_option("GALLIUM_TRACE", FALSE))
return 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;
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");
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)
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);
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_ */