summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/trace/README37
-rw-r--r--src/gallium/drivers/trace/SConscript15
-rw-r--r--src/gallium/drivers/trace/tr_context.c41
-rw-r--r--src/gallium/drivers/trace/tr_context.h58
-rw-r--r--src/gallium/drivers/trace/tr_dump.c329
-rw-r--r--src/gallium/drivers/trace/tr_dump.h102
-rw-r--r--src/gallium/drivers/trace/tr_screen.c385
-rw-r--r--src/gallium/drivers/trace/tr_screen.h65
-rw-r--r--src/gallium/drivers/trace/tr_state.c72
-rw-r--r--src/gallium/drivers/trace/tr_state.h44
-rw-r--r--src/gallium/drivers/trace/tr_stream.c100
-rw-r--r--src/gallium/drivers/trace/tr_stream.h52
12 files changed, 1300 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README
new file mode 100644
index 00000000000..81da610bd5e
--- /dev/null
+++ b/src/gallium/drivers/trace/README
@@ -0,0 +1,37 @@
+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,i915simple,trace winsys=xlib
+
+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 GALLIUM_TRACE=y
+
+ensure the right libGL.so is being picked by doing
+
+ ldd `which glxingo`
+
+and then try running
+
+ glxinfo
+
+which should create a gallium.*.trace file, which is an XML file. You can view
+copying trace.xsl and trace.css to the same directory, and opening with a
+XSLT capable browser like Firefox or Internet Explorer. It often happens that
+the trace file was not properly terminated, and a
+
+ </trace>
+
+closing tag is missing from the file end. Add it before try to open or
+further transform it by doing
+
+ echo '</trace>' >> gallium.??.trace
+
+
+This is still work in progress.
+
+--
+Jose Fonseca <[email protected]>
diff --git a/src/gallium/drivers/trace/SConscript b/src/gallium/drivers/trace/SConscript
new file mode 100644
index 00000000000..30225b5a54c
--- /dev/null
+++ b/src/gallium/drivers/trace/SConscript
@@ -0,0 +1,15 @@
+Import('*')
+
+env = env.Clone()
+
+trace = env.ConvenienceLibrary(
+ target = 'trace',
+ source = [
+ 'tr_context.c',
+ 'tr_dump.c',
+ 'tr_screen.c',
+ 'tr_state.c',
+ 'tr_stream.c',
+ ])
+
+Export('trace') \ No newline at end of file
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
new file mode 100644
index 00000000000..67a67b3da62
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -0,0 +1,41 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_util.h"
+
+#include "tr_stream.h"
+#include "tr_dump.h"
+#include "tr_state.h"
+#include "tr_context.h"
+
+
+struct pipe_context *
+trace_context_create(struct pipe_context *pipe)
+{
+ /* TODO */
+ return pipe;
+}
diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h
new file mode 100644
index 00000000000..75b8d11a7ac
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_context.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef TR_CONTEXT_H_
+#define TR_CONTEXT_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
+#include "pipe/p_context.h"
+
+
+struct trace_context
+{
+ struct pipe_context base;
+
+ /* TODO */
+};
+
+
+static INLINE struct trace_context *
+trace_context(struct pipe_context *context)
+{
+ assert(context);
+ return (struct trace_context *)context;
+}
+
+
+
+struct pipe_context *
+trace_context_create(struct pipe_context *context);
+
+
+#endif /* TR_CONTEXT_H_ */
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
new file mode 100644
index 00000000000..30c09863634
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -0,0 +1,329 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+/**
+ * @file
+ * Trace dumping functions.
+ *
+ * For now we just use standard XML for dumping the trace calls, as this is
+ * simple to write, parse, and visually inspect, but the actual representation
+ * is abstracted out of this file, so that we can switch to a binary
+ * representation if/when it becomes justified.
+ *
+ * @author Jose Fonseca <[email protected]>
+ */
+
+
+#include "pipe/p_compiler.h"
+#include "util/u_string.h"
+
+#include "tr_stream.h"
+#include "tr_dump.h"
+
+
+static INLINE void
+trace_dump_write(struct trace_stream *stream, const char *s)
+{
+ trace_stream_write(stream, s, strlen(s));
+}
+
+
+static INLINE void
+trace_dump_writef(struct trace_stream *stream, const char *format, ...)
+{
+ char buf[1024];
+ va_list ap;
+ va_start(ap, format);
+ util_vsnprintf(buf, sizeof(buf), format, ap);
+ va_end(ap);
+ trace_dump_write(stream, buf);
+}
+
+
+static INLINE void
+trace_dump_escape(struct trace_stream *stream, const char *str)
+{
+ const unsigned char *p = (const unsigned char *)str;
+ unsigned char c;
+ while((c = *p++) != 0) {
+ if(c == '<')
+ trace_dump_write(stream, "&lt;");
+ else if(c == '>')
+ trace_dump_write(stream, "&gt;");
+ else if(c == '&')
+ trace_dump_write(stream, "&amp;");
+ else if(c == '\'')
+ trace_dump_write(stream, "&apos;");
+ else if(c == '\"')
+ trace_dump_write(stream, "&quot;");
+ else if(c >= 0x20 && c <= 0x7e)
+ trace_dump_writef(stream, "%c", c);
+ else
+ trace_dump_writef(stream, "&#%u;", c);
+ }
+}
+
+
+static INLINE void
+trace_dump_indent(struct trace_stream *stream, unsigned level)
+{
+ unsigned i;
+ for(i = 0; i < level; ++i)
+ trace_dump_write(stream, "\t");
+}
+
+
+static INLINE void
+trace_dump_newline(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "\n");
+}
+
+
+static INLINE void
+trace_dump_tag(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_write(stream, "<");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, "/>");
+}
+
+
+static INLINE void
+trace_dump_tag_begin(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_write(stream, "<");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, ">");
+}
+
+static INLINE void
+trace_dump_tag_begin1(struct trace_stream *stream,
+ const char *name,
+ const char *attr1, const char *value1)
+{
+ trace_dump_write(stream, "<");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, " ");
+ trace_dump_write(stream, attr1);
+ trace_dump_write(stream, "='");
+ trace_dump_escape(stream, value1);
+ trace_dump_write(stream, "'>");
+}
+
+
+static INLINE void
+trace_dump_tag_begin2(struct trace_stream *stream,
+ const char *name,
+ const char *attr1, const char *value1,
+ const char *attr2, const char *value2)
+{
+ trace_dump_write(stream, "<");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, " ");
+ trace_dump_write(stream, attr1);
+ trace_dump_write(stream, "=\'");
+ trace_dump_escape(stream, value1);
+ trace_dump_write(stream, "\' ");
+ trace_dump_write(stream, attr2);
+ trace_dump_write(stream, "=\'");
+ trace_dump_escape(stream, value2);
+ trace_dump_write(stream, "\'>");
+}
+
+
+static INLINE void
+trace_dump_tag_begin3(struct trace_stream *stream,
+ const char *name,
+ const char *attr1, const char *value1,
+ const char *attr2, const char *value2,
+ const char *attr3, const char *value3)
+{
+ trace_dump_write(stream, "<");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, " ");
+ trace_dump_write(stream, attr1);
+ trace_dump_write(stream, "=\'");
+ trace_dump_escape(stream, value1);
+ trace_dump_write(stream, "\' ");
+ trace_dump_write(stream, attr2);
+ trace_dump_write(stream, "=\'");
+ trace_dump_escape(stream, value2);
+ trace_dump_write(stream, "\' ");
+ trace_dump_write(stream, attr3);
+ trace_dump_write(stream, "=\'");
+ trace_dump_escape(stream, value3);
+ trace_dump_write(stream, "\'>");
+}
+
+
+static INLINE void
+trace_dump_tag_end(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_write(stream, "</");
+ trace_dump_write(stream, name);
+ trace_dump_write(stream, ">");
+}
+
+
+void trace_dump_trace_begin(struct trace_stream *stream,
+ unsigned version)
+{
+ trace_dump_write(stream, "<?xml version='1.0' encoding='UTF-8'?>\n");
+ trace_dump_write(stream, "<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
+ trace_dump_writef(stream, "<trace version='%u'>\n", version);
+}
+
+
+void trace_dump_trace_end(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "</trace>\n");
+}
+
+void trace_dump_call_begin(struct trace_stream *stream,
+ const char *klass, const char *method)
+{
+ trace_dump_indent(stream, 1);
+ trace_dump_tag_begin2(stream, "call", "class", klass, "method", method);
+ trace_dump_newline(stream);
+}
+
+void trace_dump_call_end(struct trace_stream *stream)
+{
+ trace_dump_indent(stream, 1);
+ trace_dump_tag_end(stream, "call");
+ trace_dump_newline(stream);
+}
+
+void trace_dump_arg_begin(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_indent(stream, 2);
+ trace_dump_tag_begin1(stream, "arg", "name", name);
+}
+
+void trace_dump_arg_end(struct trace_stream *stream)
+{
+ trace_dump_tag_end(stream, "arg");
+ trace_dump_newline(stream);
+}
+
+void trace_dump_ret_begin(struct trace_stream *stream)
+{
+ trace_dump_indent(stream, 2);
+ trace_dump_tag_begin(stream, "ret");
+}
+
+void trace_dump_ret_end(struct trace_stream *stream)
+{
+ trace_dump_tag_end(stream, "ret");
+ trace_dump_newline(stream);
+}
+
+void trace_dump_bool(struct trace_stream *stream,
+ int value)
+{
+ trace_dump_writef(stream, "<bool>%c</bool>", value ? '1' : '0');
+}
+
+void trace_dump_int(struct trace_stream *stream,
+ long int value)
+{
+ trace_dump_writef(stream, "<int>%li</int>", value);
+}
+
+void trace_dump_uint(struct trace_stream *stream,
+ long unsigned value)
+{
+ trace_dump_writef(stream, "<uint>%lu</uint>", value);
+}
+
+void trace_dump_float(struct trace_stream *stream,
+ double value)
+{
+ trace_dump_writef(stream, "<float>%g</float>", value);
+}
+
+void trace_dump_string(struct trace_stream *stream,
+ const char *str)
+{
+ trace_dump_write(stream, "<string>");
+ trace_dump_escape(stream, str);
+ trace_dump_write(stream, "</string>");
+}
+
+void trace_dump_array_begin(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "<array>");
+}
+
+void trace_dump_array_end(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "</array>");
+}
+
+void trace_dump_elem_begin(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "<elem>");
+}
+
+void trace_dump_elem_end(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "</elem>");
+}
+
+void trace_dump_struct_begin(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_writef(stream, "<struct name='%s'>", name);
+}
+
+void trace_dump_struct_end(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "</struct>");
+}
+
+void trace_dump_member_begin(struct trace_stream *stream,
+ const char *name)
+{
+ trace_dump_writef(stream, "<member name='%s'>", name);
+}
+
+void trace_dump_member_end(struct trace_stream *stream)
+{
+ trace_dump_write(stream, "</member>");
+}
+
+void trace_dump_ptr(struct trace_stream *stream,
+ const void *value)
+{
+ trace_dump_writef(stream, "<ptr>%p</ptr>", value);
+}
diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h
new file mode 100644
index 00000000000..f0864865912
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_dump.h
@@ -0,0 +1,102 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation streams (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Trace data dumping primitives.
+ */
+
+#ifndef TR_DUMP_H
+#define TR_DUMP_H
+
+
+struct trace_stream;
+
+
+void trace_dump_trace_begin(struct trace_stream *stream, unsigned version);
+void trace_dump_trace_end(struct trace_stream *stream);
+void trace_dump_call_begin(struct trace_stream *stream, const char *klass, const char *method);
+void trace_dump_call_end(struct trace_stream *stream);
+void trace_dump_arg_begin(struct trace_stream *stream, const char *name);
+void trace_dump_arg_end(struct trace_stream *stream);
+void trace_dump_ret_begin(struct trace_stream *stream);
+void trace_dump_ret_end(struct trace_stream *stream);
+void trace_dump_bool(struct trace_stream *stream, int value);
+void trace_dump_int(struct trace_stream *stream, long int value);
+void trace_dump_uint(struct trace_stream *stream, long unsigned value);
+void trace_dump_float(struct trace_stream *stream, double value);
+void trace_dump_string(struct trace_stream *stream, const char *str);
+void trace_dump_array_begin(struct trace_stream *stream);
+void trace_dump_array_end(struct trace_stream *stream);
+void trace_dump_elem_begin(struct trace_stream *stream);
+void trace_dump_elem_end(struct trace_stream *stream);
+void trace_dump_struct_begin(struct trace_stream *stream, const char *name);
+void trace_dump_struct_end(struct trace_stream *stream);
+void trace_dump_member_begin(struct trace_stream *stream, const char *name);
+void trace_dump_member_end(struct trace_stream *stream);
+void trace_dump_ptr(struct trace_stream *stream, const void *value);
+
+
+/*
+ * Code saving macros.
+ */
+
+#define trace_dump_arg(_stream, _type, _arg) \
+ do { \
+ trace_dump_arg_begin(_stream, #_arg); \
+ trace_dump_##_type(_stream, _arg); \
+ trace_dump_arg_end(_stream); \
+ } while(0)
+
+#define trace_dump_ret(_stream, _type, _arg) \
+ do { \
+ trace_dump_ret_begin(_stream); \
+ trace_dump_##_type(_stream, _arg); \
+ trace_dump_ret_end(_stream); \
+ } while(0)
+
+#define trace_dump_array(_stream, _type, _obj, _size) \
+ do { \
+ unsigned long idx; \
+ trace_dump_array_begin(_stream); \
+ for(idx = 0; idx < _size; ++idx) { \
+ trace_dump_elem_begin(_stream); \
+ trace_dump_##_type(_stream, _obj[idx]); \
+ trace_dump_elem_end(_stream); \
+ } \
+ trace_dump_array_end(_stream); \
+ } while(0)
+
+#define trace_dump_member(_stream, _type, _obj, _member) \
+ do { \
+ trace_dump_member_begin(_stream, #_member); \
+ trace_dump_##_type(_stream, _obj->_member); \
+ trace_dump_member_end(_stream); \
+ } while(0)
+
+
+#endif /* TR_DUMP_H */
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
new file mode 100644
index 00000000000..20a2026e1d0
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -0,0 +1,385 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_util.h"
+
+#include "tr_stream.h"
+#include "tr_dump.h"
+#include "tr_state.h"
+#include "tr_screen.h"
+
+
+static const char *
+trace_screen_get_name(struct pipe_screen *_screen)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ const char *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "get_name");
+
+ trace_dump_arg(stream, ptr, screen);
+
+ result = screen->get_name(screen);
+
+ trace_dump_ret(stream, string, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static const char *
+trace_screen_get_vendor(struct pipe_screen *_screen)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ const char *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "get_vendor");
+
+ trace_dump_arg(stream, ptr, screen);
+
+ result = screen->get_vendor(screen);
+
+ trace_dump_ret(stream, string, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static int
+trace_screen_get_param(struct pipe_screen *_screen,
+ int param)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ int result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "get_param");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, int, param);
+
+ result = screen->get_param(screen, param);
+
+ trace_dump_ret(stream, int, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static float
+trace_screen_get_paramf(struct pipe_screen *_screen,
+ int param)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ float result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "get_paramf");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, int, param);
+
+ result = screen->get_paramf(screen, param);
+
+ trace_dump_ret(stream, float, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static boolean
+trace_screen_is_format_supported(struct pipe_screen *_screen,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned tex_usage,
+ unsigned geom_flags)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ boolean result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "is_format_supported");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, int, format);
+ trace_dump_arg(stream, int, target);
+ trace_dump_arg(stream, uint, tex_usage);
+ trace_dump_arg(stream, uint, geom_flags);
+
+ result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags);
+
+ trace_dump_ret(stream, bool, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static struct pipe_texture *
+trace_screen_texture_create(struct pipe_screen *_screen,
+ const struct pipe_texture *templat)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_texture *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "texture_create");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, template, templat);
+
+ result = screen->texture_create(screen, templat);
+
+ trace_dump_ret(stream, ptr, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+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 trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ unsigned pitch = *ppitch;
+ struct pipe_texture *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "texture_blanket");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, template, templat);
+ trace_dump_arg(stream, uint, pitch);
+ trace_dump_arg(stream, ptr, buffer);
+
+ result = screen->texture_blanket(screen, templat, ppitch, buffer);
+
+ trace_dump_ret(stream, ptr, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static void
+trace_screen_texture_release(struct pipe_screen *_screen,
+ struct pipe_texture **ptexture)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_texture *texture = *ptexture;
+
+ trace_dump_call_begin(stream, "pipe_screen", "texture_release");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, ptr, texture);
+
+ screen->texture_release(screen, ptexture);
+
+ trace_dump_call_end(stream);
+}
+
+static struct pipe_surface *
+trace_screen_get_tex_surface(struct pipe_screen *_screen,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ unsigned usage)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_surface *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "get_tex_surface");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, ptr, texture);
+ trace_dump_arg(stream, uint, face);
+ trace_dump_arg(stream, uint, level);
+ trace_dump_arg(stream, uint, zslice);
+ trace_dump_arg(stream, uint, usage);
+
+ result = screen->get_tex_surface(screen, texture, face, level, zslice, usage);
+
+ trace_dump_ret(stream, ptr, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static void
+trace_screen_tex_surface_release(struct pipe_screen *_screen,
+ struct pipe_surface **psurface)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_surface *surface = *psurface;
+
+ trace_dump_call_begin(stream, "pipe_screen", "tex_surface_release");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, ptr, surface);
+
+ screen->tex_surface_release(screen, psurface);
+
+ trace_dump_call_end(stream);
+}
+
+
+static void *
+trace_screen_surface_map(struct pipe_screen *_screen,
+ struct pipe_surface *surface,
+ unsigned flags)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_surface *result;
+
+ trace_dump_call_begin(stream, "pipe_screen", "surface_map");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, ptr, surface);
+ trace_dump_arg(stream, uint, flags);
+
+ result = screen->surface_map(screen, surface, flags);
+
+ trace_dump_ret(stream, ptr, result);
+
+ trace_dump_call_end(stream);
+
+ return result;
+}
+
+
+static void
+trace_screen_surface_unmap(struct pipe_screen *_screen,
+ struct pipe_surface *surface)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+
+ trace_dump_call_begin(stream, "pipe_screen", "surface_unmap");
+
+ trace_dump_arg(stream, ptr, screen);
+ trace_dump_arg(stream, ptr, surface);
+
+ screen->surface_unmap(screen, surface);
+
+ trace_dump_call_end(stream);
+}
+
+
+static void
+trace_screen_destroy(struct pipe_screen *_screen)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_stream *stream = tr_scr->stream;
+ struct pipe_screen *screen = tr_scr->screen;
+
+ trace_dump_call_begin(stream, "pipe_screen", "destroy");
+
+ trace_dump_arg(stream, ptr, screen);
+
+ screen->destroy(screen);
+
+ trace_dump_call_end(stream);
+
+ trace_dump_trace_end(stream);
+
+ trace_stream_close(tr_scr->stream);
+
+ FREE(tr_scr);
+}
+
+
+struct pipe_screen *
+trace_screen_create(struct pipe_screen *screen)
+{
+ struct trace_screen *tr_scr;
+
+ if(!debug_get_bool_option("GALLIUM_TRACE", FALSE))
+ return screen;
+
+ tr_scr = CALLOC_STRUCT(trace_screen);
+ if(!tr_scr)
+ return NULL;
+
+ tr_scr->base.winsys = screen->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.get_param = trace_screen_get_param;
+ tr_scr->base.get_paramf = trace_screen_get_paramf;
+ tr_scr->base.is_format_supported = trace_screen_is_format_supported;
+ tr_scr->base.texture_create = trace_screen_texture_create;
+ tr_scr->base.texture_blanket = trace_screen_texture_blanket;
+ tr_scr->base.texture_release = trace_screen_texture_release;
+ tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
+ tr_scr->base.tex_surface_release = trace_screen_tex_surface_release;
+ tr_scr->base.surface_map = trace_screen_surface_map;
+ tr_scr->base.surface_unmap = trace_screen_surface_unmap;
+
+ tr_scr->screen = screen;
+
+ tr_scr->stream = trace_stream_create("gallium", "trace");
+ if(!tr_scr->stream)
+ return NULL;
+
+ trace_dump_trace_begin(tr_scr->stream, 0);
+
+ return &tr_scr->base;
+}
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
new file mode 100644
index 00000000000..5d7d667f719
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -0,0 +1,65 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef TR_SCREEN_H_
+#define TR_SCREEN_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_debug.h"
+#include "pipe/p_screen.h"
+
+
+struct trace_stream;
+
+
+struct trace_screen
+{
+ struct pipe_screen base;
+
+ struct pipe_screen *screen;
+
+ struct trace_stream *stream;
+
+ unsigned event_no;
+};
+
+
+static INLINE struct trace_screen *
+trace_screen(struct pipe_screen *screen)
+{
+ assert(screen);
+ return (struct trace_screen *)screen;
+}
+
+
+
+struct pipe_screen *
+trace_screen_create(struct pipe_screen *screen);
+
+
+#endif /* TR_SCREEN_H_ */
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
new file mode 100644
index 00000000000..1e0e87f7fd8
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -0,0 +1,72 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+#include "tr_dump.h"
+#include "tr_state.h"
+
+
+void trace_dump_block(struct trace_stream *stream,
+ const struct pipe_format_block *block)
+{
+ trace_dump_struct_begin(stream, "pipe_format_block");
+ trace_dump_member(stream, uint, block, size);
+ trace_dump_member(stream, uint, block, width);
+ trace_dump_member(stream, uint, block, height);
+ trace_dump_struct_end(stream);
+}
+
+
+void trace_dump_template(struct trace_stream *stream,
+ const struct pipe_texture *templat)
+{
+ trace_dump_struct_begin(stream, "pipe_texture");
+
+ trace_dump_member(stream, int, templat, target);
+ trace_dump_member(stream, int, templat, format);
+
+ trace_dump_member_begin(stream, "width");
+ trace_dump_array(stream, uint, templat->width, 1);
+ trace_dump_member_end(stream);
+
+ trace_dump_member_begin(stream, "height");
+ trace_dump_array(stream, uint, templat->height, 1);
+ trace_dump_member_end(stream);
+
+ trace_dump_member_begin(stream, "block");
+ trace_dump_block(stream, &templat->block);
+ trace_dump_member_end(stream);
+
+ trace_dump_member(stream, uint, templat, last_level);
+ trace_dump_member(stream, uint, templat, tex_usage);
+
+ trace_dump_struct_end(stream);
+}
+
diff --git a/src/gallium/drivers/trace/tr_state.h b/src/gallium/drivers/trace/tr_state.h
new file mode 100644
index 00000000000..e52524ee90f
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_state.h
@@ -0,0 +1,44 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation streams (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef TR_STATE_H
+#define TR_STATE_H
+
+
+struct trace_stream;
+
+struct pipe_format_block;
+struct pipe_texture;
+
+void trace_dump_block(struct trace_stream *stream,
+ const struct pipe_format_block *block);
+
+void trace_dump_template(struct trace_stream *stream,
+ const struct pipe_texture *templat);
+
+
+#endif /* TR_STATE_H */
diff --git a/src/gallium/drivers/trace/tr_stream.c b/src/gallium/drivers/trace/tr_stream.c
new file mode 100644
index 00000000000..14cc257e154
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_stream.c
@@ -0,0 +1,100 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_config.h"
+
+#if defined(PIPE_OS_LINUX)
+#include <stdio.h>
+#else
+#error Unsupported platform
+#endif
+
+#include "pipe/p_util.h"
+
+#include "tr_stream.h"
+
+
+struct trace_stream
+{
+#if defined(PIPE_OS_LINUX)
+ FILE *file;
+#endif
+};
+
+
+struct trace_stream *
+trace_stream_create(const char *name, const char *ext)
+{
+ struct trace_stream *stream;
+ static unsigned file_no = 0;
+ char filename[1024];
+
+ stream = CALLOC_STRUCT(trace_stream);
+ if(!stream)
+ goto error1;
+
+ snprintf(filename, sizeof(filename), "%s.%u.%s", name, file_no, ext);
+
+#if defined(PIPE_OS_LINUX)
+ stream->file = fopen(filename, "w");
+ if(!stream->file)
+ goto error2;
+#endif
+
+ return stream;
+
+error2:
+ FREE(stream);
+error1:
+ return NULL;
+}
+
+
+boolean
+trace_stream_write(struct trace_stream *stream, const void *data, size_t size)
+{
+ if(!stream)
+ return FALSE;
+
+#if defined(PIPE_OS_LINUX)
+ return fwrite(data, size, 1, stream->file) == size ? TRUE : FALSE;
+#endif
+}
+
+
+void
+trace_stream_close(struct trace_stream *stream)
+{
+ if(!stream)
+ return;
+
+#if defined(PIPE_OS_LINUX)
+ fclose(stream->file);
+#endif
+
+ FREE(stream);
+}
diff --git a/src/gallium/drivers/trace/tr_stream.h b/src/gallium/drivers/trace/tr_stream.h
new file mode 100644
index 00000000000..d50fed26917
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_stream.h
@@ -0,0 +1,52 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation streams (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Cross-platform sequential access stream abstraction.
+ */
+
+#ifndef TR_STREAM_H
+#define TR_STREAM_H
+
+
+#include "pipe/p_compiler.h"
+
+struct trace_stream;
+
+
+struct trace_stream *
+trace_stream_create(const char *name, const char *ext);
+
+boolean
+trace_stream_write(struct trace_stream *stream, const void *data, size_t size);
+
+void
+trace_stream_close(struct trace_stream *stream);
+
+
+#endif /* TR_STREAM_H */