summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_winsys.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2008-08-21 13:57:59 +0100
committerJosé Fonseca <[email protected]>2008-08-21 18:46:04 +0100
commit34d12c1787116c254e528dd981810b7b78b7a2ee (patch)
tree0d2cf651b01571b459b78182a3cae12d0696848c /src/gallium/drivers/trace/tr_winsys.c
parent0fff3e4ea991ce2f841739ee8c8e8937452e56fa (diff)
trace: Hack to detect writes to user buffers.
It often happens that new data is written directly to the user buffers without mapping/unmapping. This hack marks user buffers and dumps them before passing them to pipe context.
Diffstat (limited to 'src/gallium/drivers/trace/tr_winsys.c')
-rw-r--r--src/gallium/drivers/trace/tr_winsys.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/tr_winsys.c b/src/gallium/drivers/trace/tr_winsys.c
index 120006ea9f0..2c7a6f893b0 100644
--- a/src/gallium/drivers/trace/tr_winsys.c
+++ b/src/gallium/drivers/trace/tr_winsys.c
@@ -242,10 +242,50 @@ trace_winsys_user_buffer_create(struct pipe_winsys *_winsys,
trace_dump_call_end();
+ /* XXX: Mark the user buffers. (we should wrap pipe_buffers, but is is
+ * impossible to do so while texture-less surfaces are still around */
+ if(result) {
+ assert(!(result->usage & TRACE_BUFFER_USAGE_USER));
+ result->usage |= TRACE_BUFFER_USAGE_USER;
+ }
+
return result;
}
+void
+trace_winsys_user_buffer_update(struct pipe_winsys *_winsys,
+ struct pipe_buffer *buffer)
+{
+ struct trace_winsys *tr_ws = trace_winsys(_winsys);
+ struct pipe_winsys *winsys = tr_ws->winsys;
+ const void *map;
+
+ if(buffer && buffer->usage & TRACE_BUFFER_USAGE_USER) {
+ map = winsys->buffer_map(winsys, buffer, PIPE_BUFFER_USAGE_CPU_READ);
+ if(map) {
+ trace_dump_call_begin("pipe_winsys", "buffer_write");
+
+ trace_dump_arg(ptr, winsys);
+
+ trace_dump_arg(ptr, buffer);
+
+ trace_dump_arg_begin("data");
+ trace_dump_bytes(map, buffer->size);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("size");
+ trace_dump_uint(buffer->size);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ winsys->buffer_unmap(winsys, buffer);
+ }
+ }
+}
+
+
static void *
trace_winsys_buffer_map(struct pipe_winsys *_winsys,
struct pipe_buffer *buffer,