summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/trace
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/trace')
-rw-r--r--src/gallium/drivers/trace/README6
-rw-r--r--src/gallium/drivers/trace/tr_context.c31
-rw-r--r--src/gallium/drivers/trace/tr_dump.c33
-rw-r--r--src/gallium/drivers/trace/tr_screen.c31
-rw-r--r--src/gallium/drivers/trace/tr_state.c2
-rw-r--r--src/gallium/drivers/trace/tr_texture.c12
-rw-r--r--src/gallium/drivers/trace/tr_texture.h27
-rw-r--r--src/gallium/drivers/trace/trace.xsl3
8 files changed, 69 insertions, 76 deletions
diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README
index f0e1cd596d..73dce20372 100644
--- a/src/gallium/drivers/trace/README
+++ b/src/gallium/drivers/trace/README
@@ -10,15 +10,14 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls.
To build, invoke scons on the top dir as
- scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
+ scons dri=no statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
= Usage =
To use do
- ln -s libGL.so build/linux-x86-debug/gallium/winsys/xlib/libGL.so.1
- export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/gallium/winsys/xlib
+ export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib
ensure the right libGL.so is being picked by doing
@@ -26,6 +25,7 @@ ensure the right libGL.so is being picked by doing
and then try running
+ export XMESA_TRACE=y
GALLIUM_TRACE=tri.trace progs/trivial/tri
which should create a tri.trace file, which is an XML file. You can view copying
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c894972904..d8d5821a1d 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -58,16 +58,14 @@ static INLINE struct pipe_texture *
trace_texture_unwrap(struct trace_context *tr_ctx,
struct pipe_texture *texture)
{
- struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
struct trace_texture *tr_tex;
if(!texture)
return NULL;
- tr_tex = trace_texture(tr_scr, texture);
+ tr_tex = trace_texture(texture);
assert(tr_tex->texture);
- assert(tr_tex->texture->screen == tr_scr->screen);
return tr_tex->texture;
}
@@ -77,7 +75,6 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
struct pipe_surface *surface)
{
struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
- struct trace_texture *tr_tex;
struct trace_surface *tr_surf;
if(!surface)
@@ -87,8 +84,7 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
if(!surface->texture)
return surface;
- tr_tex = trace_texture(tr_scr, surface->texture);
- tr_surf = trace_surface(tr_tex, surface);
+ tr_surf = trace_surface(surface);
assert(tr_surf->surface);
assert(tr_surf->surface->texture->screen == tr_scr->screen);
@@ -973,21 +969,23 @@ trace_context_surface_fill(struct pipe_context *_pipe,
static INLINE void
trace_context_clear(struct pipe_context *_pipe,
- struct pipe_surface *surface,
- unsigned clearValue)
+ unsigned buffers,
+ const float *rgba,
+ double depth,
+ unsigned stencil)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- surface = trace_surface_unwrap(tr_ctx, surface);
-
trace_dump_call_begin("pipe_context", "clear");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(ptr, surface);
- trace_dump_arg(uint, clearValue);
+ trace_dump_arg(uint, buffers);
+ trace_dump_arg_array(float, rgba, 4);
+ trace_dump_arg(float, depth);
+ trace_dump_arg(uint, stencil);
- pipe->clear(pipe, surface, clearValue);;
+ pipe->clear(pipe, buffers, rgba, depth, stencil);
trace_dump_call_end();
}
@@ -1037,9 +1035,9 @@ struct pipe_context *
trace_context_create(struct pipe_screen *_screen,
struct pipe_context *pipe)
{
- struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_screen *tr_scr;
struct trace_context *tr_ctx;
- struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_screen *screen;
if(!pipe)
goto error1;
@@ -1047,6 +1045,9 @@ trace_context_create(struct pipe_screen *_screen,
if(!trace_dump_enabled())
goto error1;
+ tr_scr = trace_screen(_screen);
+ screen = tr_scr->screen;
+
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 6837c94542..2618883e70 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -40,11 +40,12 @@
#include "pipe/p_config.h"
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
#include <stdlib.h>
#endif
#include "pipe/p_compiler.h"
+#include "pipe/p_thread.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_string.h"
@@ -58,6 +59,8 @@
static struct util_stream *stream = NULL;
static unsigned refcount = 0;
+static pipe_mutex call_mutex;
+static long unsigned call_no = 0;
static INLINE void
@@ -218,6 +221,8 @@ trace_dump_trace_close(void)
util_stream_close(stream);
stream = NULL;
refcount = 0;
+ call_no = 0;
+ pipe_mutex_destroy(call_mutex);
}
}
@@ -235,11 +240,13 @@ boolean trace_dump_trace_begin()
if(!stream)
return FALSE;
+ pipe_mutex_init(call_mutex);
+
trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n");
trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
trace_dump_writes("<trace version='0.1'>\n");
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
/* Linux applications rarely cleanup GL / Gallium resources so catch
* application exit here */
atexit(trace_dump_trace_close);
@@ -265,8 +272,16 @@ void trace_dump_trace_end(void)
void trace_dump_call_begin(const char *klass, const char *method)
{
+ pipe_mutex_lock(call_mutex);
+ ++call_no;
trace_dump_indent(1);
- trace_dump_tag_begin2("call", "class", klass, "method", method);
+ trace_dump_writes("<call no=\'");
+ trace_dump_writef("%lu", call_no);
+ trace_dump_writes("\' class =\'");
+ trace_dump_escape(klass);
+ trace_dump_writes("\' method=\'");
+ trace_dump_escape(method);
+ trace_dump_writes("\'>");
trace_dump_newline();
}
@@ -276,6 +291,7 @@ void trace_dump_call_end(void)
trace_dump_tag_end("call");
trace_dump_newline();
util_stream_flush(stream);
+ pipe_mutex_unlock(call_mutex);
}
void trace_dump_arg_begin(const char *name)
@@ -420,8 +436,7 @@ void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
void trace_dump_texture_ptr(struct pipe_texture *_texture)
{
if (_texture) {
- struct trace_screen *tr_scr = trace_screen(_texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
trace_dump_ptr(tr_tex->texture);
} else {
trace_dump_null();
@@ -431,9 +446,7 @@ void trace_dump_texture_ptr(struct pipe_texture *_texture)
void trace_dump_surface_ptr(struct pipe_surface *_surface)
{
if (_surface) {
- struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
trace_dump_ptr(tr_surf->surface);
} else {
trace_dump_null();
@@ -443,9 +456,7 @@ void trace_dump_surface_ptr(struct pipe_surface *_surface)
void trace_dump_transfer_ptr(struct pipe_transfer *_transfer)
{
if (_transfer) {
- struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_tran = trace_transfer(_transfer);
trace_dump_ptr(tr_tran->transfer);
} else {
trace_dump_null();
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 954576d721..6792505383 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -159,8 +159,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
void *context_private)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_surface *surface = tr_surf->surface;
@@ -242,7 +241,7 @@ static void
trace_screen_texture_destroy(struct pipe_texture *_texture)
{
struct trace_screen *tr_scr = trace_screen(_texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
@@ -255,7 +254,7 @@ trace_screen_texture_destroy(struct pipe_texture *_texture)
trace_dump_call_end();
- trace_texture_destroy(tr_scr, _texture);
+ trace_texture_destroy(tr_tex);
}
@@ -272,7 +271,7 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen,
unsigned usage)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
struct pipe_surface *result = NULL;
@@ -304,8 +303,7 @@ static void
trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
{
struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
- struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+ struct trace_surface *tr_surf = trace_surface(_surface);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_surface *surface = tr_surf->surface;
@@ -316,7 +314,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
trace_dump_call_end();
- trace_surface_destroy(tr_tex, _surface);
+ trace_surface_destroy(tr_surf);
}
@@ -334,7 +332,7 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen,
unsigned x, unsigned y, unsigned w, unsigned h)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+ struct trace_texture *tr_tex = trace_texture(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_texture *texture = tr_tex->texture;
struct pipe_transfer *result = NULL;
@@ -372,10 +370,9 @@ static void
trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_tran->transfer;
+ struct pipe_transfer *transfer = tr_trans->transfer;
trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
@@ -384,7 +381,7 @@ trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
trace_dump_call_end();
- trace_transfer_destroy(tr_tex, _transfer);
+ trace_transfer_destroy(tr_trans);
}
@@ -393,8 +390,7 @@ trace_screen_transfer_map(struct pipe_screen *_screen,
struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_transfer *transfer = tr_trans->transfer;
void *map;
@@ -416,8 +412,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
struct pipe_transfer *_transfer)
{
struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_transfer *transfer = tr_trans->transfer;
@@ -706,7 +701,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen,
struct pipe_buffer *buffer = tr_buf->buffer;
if (tr_buf->map && !tr_buf->range_flushed)
- buffer_write(screen, buffer, tr_buf->map, 0, buffer->size);
+ buffer_write(screen, buffer, 0, tr_buf->map, buffer->size);
tr_buf->map = NULL;
tr_buf->range_flushed = FALSE;
screen->buffer_unmap(screen, buffer);
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
index f9fbe9aee7..a9570c1aeb 100644
--- a/src/gallium/drivers/trace/tr_state.c
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state)
trace_dump_reference(&state->reference);
trace_dump_member(format, state, format);
- trace_dump_member(uint, state, status);
- trace_dump_member(uint, state, clear_value);
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 7b392f0728..f4e433792b 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -62,10 +62,8 @@ error:
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture_destroy(struct trace_texture *tr_tex)
{
- struct trace_texture *tr_tex = trace_texture(tr_scr, texture);
pipe_texture_reference(&tr_tex->texture, NULL);
FREE(tr_tex);
}
@@ -102,10 +100,8 @@ error:
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface_destroy(struct trace_surface *tr_surf)
{
- struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
pipe_texture_reference(&tr_surf->base.texture, NULL);
pipe_surface_reference(&tr_surf->surface, NULL);
FREE(tr_surf);
@@ -143,10 +139,8 @@ error:
void
-trace_transfer_destroy(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer_destroy(struct trace_transfer *tr_trans)
{
- struct trace_transfer *tr_trans = trace_transfer(tr_tex, transfer);
struct pipe_screen *screen = tr_trans->transfer->texture->screen;
pipe_texture_reference(&tr_trans->base.texture, NULL);
screen->tex_transfer_destroy(tr_trans->transfer);
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index 9c21bc7d27..14dafd8b2c 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -62,37 +62,31 @@ struct trace_transfer
static INLINE struct trace_texture *
-trace_texture(struct trace_screen *tr_scr,
- struct pipe_texture *texture)
+trace_texture(struct pipe_texture *texture)
{
if(!texture)
return NULL;
- assert(tr_scr);
- assert(texture->screen == &tr_scr->base);
+ (void)trace_screen(texture->screen);
return (struct trace_texture *)texture;
}
static INLINE struct trace_surface *
-trace_surface(struct trace_texture *tr_tex,
- struct pipe_surface *surface)
+trace_surface(struct pipe_surface *surface)
{
if(!surface)
return NULL;
- assert(tr_tex);
- assert(surface->texture == &tr_tex->base);
+ (void)trace_texture(surface->texture);
return (struct trace_surface *)surface;
}
static INLINE struct trace_transfer *
-trace_transfer(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer(struct pipe_transfer *transfer)
{
if(!transfer)
return NULL;
- assert(tr_tex);
- assert(transfer->texture == &tr_tex->base);
+ (void)trace_texture(transfer->texture);
return (struct trace_transfer *)transfer;
}
@@ -102,24 +96,21 @@ trace_texture_create(struct trace_screen *tr_scr,
struct pipe_texture *texture);
void
-trace_texture_destroy(struct trace_screen *tr_scr,
- struct pipe_texture *texture);
+trace_texture_destroy(struct trace_texture *tr_tex);
struct pipe_surface *
trace_surface_create(struct trace_texture *tr_tex,
struct pipe_surface *surface);
void
-trace_surface_destroy(struct trace_texture *tr_tex,
- struct pipe_surface *surface);
+trace_surface_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
trace_transfer_create(struct trace_texture *tr_tex,
struct pipe_transfer *transfer);
void
-trace_transfer_destroy(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer);
+trace_transfer_destroy(struct trace_transfer *tr_trans);
#endif /* TR_TEXTURE_H_ */
diff --git a/src/gallium/drivers/trace/trace.xsl b/src/gallium/drivers/trace/trace.xsl
index 9cd621e7ab..7be95e0e75 100644
--- a/src/gallium/drivers/trace/trace.xsl
+++ b/src/gallium/drivers/trace/trace.xsl
@@ -68,6 +68,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<xsl:template match="call">
<li>
+ <xsl:attribute name="value">
+ <xsl:apply-templates select="@no"/>
+ </xsl:attribute>
<span class="fun">
<xsl:value-of select="@class"/>
<xsl:text>::</xsl:text>