summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/trace/tr_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/trace/tr_screen.c')
-rw-r--r--src/gallium/drivers/trace/tr_screen.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 12a8535342..5b1e26a52d 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -30,13 +30,16 @@
#include "tr_buffer.h"
#include "tr_dump.h"
-#include "tr_state.h"
+#include "tr_dump_state.h"
#include "tr_texture.h"
#include "tr_screen.h"
#include "pipe/p_inlines.h"
+static boolean trace = FALSE;
+static boolean rbug = FALSE;
+
static const char *
trace_screen_get_name(struct pipe_screen *_screen)
{
@@ -212,10 +215,12 @@ static struct pipe_texture *
trace_screen_texture_blanket(struct pipe_screen *_screen,
const struct pipe_texture *templat,
const unsigned *ppitch,
- struct pipe_buffer *buffer)
+ struct pipe_buffer *_buffer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_buffer *tr_buf = trace_buffer(_buffer);
struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_buffer *buffer = tr_buf->buffer;
unsigned pitch = *ppitch;
struct pipe_texture *result;
@@ -818,18 +823,41 @@ 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);
-
- screen->destroy(screen);
-
trace_dump_call_end();
-
trace_dump_trace_end();
+ if (tr_scr->rbug)
+ trace_rbug_stop(tr_scr->rbug);
+
+ screen->destroy(screen);
+
FREE(tr_scr);
}
+boolean
+trace_enabled(void)
+{
+ static boolean firstrun = TRUE;
+
+ if (!firstrun)
+ return trace;
+ firstrun = FALSE;
+
+ trace_dump_init();
+
+ if(trace_dump_trace_begin()) {
+ trace_dumping_start();
+ trace = TRUE;
+ }
+
+ if (debug_get_bool_option("GALLIUM_RBUG", FALSE)) {
+ trace = TRUE;
+ rbug = TRUE;
+ }
+
+ return trace;
+}
struct pipe_screen *
trace_screen_create(struct pipe_screen *screen)
@@ -840,13 +868,9 @@ trace_screen_create(struct pipe_screen *screen)
if(!screen)
goto error1;
- trace_dump_init();
-
- if(!trace_dump_trace_begin())
+ if (!trace_enabled())
goto error1;
- trace_dumping_start();
-
trace_dump_call_begin("", "pipe_screen_create");
tr_scr = CALLOC_STRUCT(trace_screen);
@@ -904,6 +928,9 @@ trace_screen_create(struct pipe_screen *screen)
trace_dump_ret(ptr, screen);
trace_dump_call_end();
+ if (rbug)
+ tr_scr->rbug = trace_rbug_start(tr_scr);
+
return &tr_scr->base;
#if 0