summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-04-12 15:03:25 +0900
committerJosé Fonseca <[email protected]>2010-04-12 15:32:22 +0900
commitb77583203e44a8937577bf3b813dc66cea1a2005 (patch)
treef8f9ea7adf655fefc1dfca3fb9e912b0fd6568e4 /src/gallium/drivers
parent5a549d8b48c068040a47e845e6f7d069ec42bf7d (diff)
trace: Fix several regressions introduced by recent interface changes.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/trace/tr_context.c121
-rw-r--r--src/gallium/drivers/trace/tr_dump.c9
-rw-r--r--src/gallium/drivers/trace/tr_dump.h10
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c68
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.h8
-rw-r--r--src/gallium/drivers/trace/tr_screen.c2
6 files changed, 142 insertions, 76 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index dd0fd8ed98d..9f92b4426b3 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1003,27 +1003,34 @@ trace_create_sampler_view(struct pipe_context *_pipe,
struct trace_resource *tr_tex = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_resource *texture = tr_tex->resource;
- struct trace_sampler_view *result = CALLOC_STRUCT(trace_sampler_view);
+ struct pipe_sampler_view *result;
+ struct trace_sampler_view *tr_view;
trace_dump_call_begin("pipe_context", "create_sampler_view");
trace_dump_arg(ptr, pipe);
trace_dump_arg(ptr, texture);
- trace_dump_arg(ptr, templ);
-
- result->sampler_view = pipe->create_sampler_view(pipe, texture, templ);
+ trace_dump_arg(sampler_view_template, templ);
- result->base = *templ;
- result->base.reference.count = 1;
- result->base.texture = NULL;
- pipe_resource_reference(&result->base.texture, _resource);
- result->base.context = _pipe;
+ result = pipe->create_sampler_view(pipe, texture, templ);
trace_dump_ret(ptr, result);
trace_dump_call_end();
- return &result->base;
+ /*
+ * Wrap pipe_sampler_view
+ */
+ tr_view = CALLOC_STRUCT(trace_sampler_view);
+ tr_view->base = *templ;
+ tr_view->base.reference.count = 1;
+ tr_view->base.texture = NULL;
+ pipe_resource_reference(&tr_view->base.texture, _resource);
+ tr_view->base.context = _pipe;
+ tr_view->sampler_view = result;
+ result = &tr_view->base;
+
+ return result;
}
@@ -1316,26 +1323,13 @@ trace_context_get_transfer(struct pipe_context *_context,
assert(texture->screen == context->screen);
- trace_dump_call_begin("pipe_context", "get_transfer");
-
- trace_dump_arg(ptr, context);
- trace_dump_arg(ptr, texture);
- trace_dump_arg(uint, sr.face);
- trace_dump_arg(uint, sr.level);
- trace_dump_arg(uint, usage);
- trace_dump_arg(uint, box->x);
- trace_dump_arg(uint, box->y);
- trace_dump_arg(uint, box->z);
- trace_dump_arg(uint, box->width);
- trace_dump_arg(uint, box->height);
- trace_dump_arg(uint, box->depth);
+ /*
+ * Map and transfers can't be serialized so we convert all write transfers
+ * to transfer_inline_write and ignore read transfers.
+ */
result = context->get_transfer(context, texture, sr, usage, box);
- trace_dump_ret(ptr, result);
-
- trace_dump_call_end();
-
if (result)
result = trace_transfer_create(tr_context, tr_tex, result);
@@ -1349,15 +1343,6 @@ trace_context_transfer_destroy(struct pipe_context *_context,
{
struct trace_context *tr_context = trace_context(_context);
struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_context *context = tr_context->pipe;
- struct pipe_transfer *transfer = tr_trans->transfer;
-
- trace_dump_call_begin("pipe_context", "transfer_destroy");
-
- trace_dump_arg(ptr, context);
- trace_dump_arg(ptr, transfer);
-
- trace_dump_call_end();
trace_transfer_destroy(tr_context, tr_trans);
}
@@ -1399,12 +1384,7 @@ trace_context_transfer_flush_region( struct pipe_context *_context,
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, transfer);
- trace_dump_arg(uint, box->x);
- trace_dump_arg(uint, box->y);
- trace_dump_arg(uint, box->z);
- trace_dump_arg(uint, box->width);
- trace_dump_arg(uint, box->height);
- trace_dump_arg(uint, box->depth);
+ trace_dump_arg(box, box);
trace_dump_call_end();
context->transfer_flush_region(context,
@@ -1422,27 +1402,35 @@ trace_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *transfer = tr_trans->transfer;
if(tr_trans->map) {
- trace_dump_call_begin("pipe_context", "transfer_write");
+ /*
+ * Fake a transfer_inline_write
+ */
- trace_dump_arg(ptr, context);
+ struct pipe_resource *resource = transfer->resource;
+ struct pipe_subresource sr = transfer->sr;
+ unsigned usage = transfer->usage;
+ const struct pipe_box *box = &transfer->box;
+ unsigned stride = transfer->stride;
+ unsigned slice_stride = transfer->slice_stride;
- trace_dump_arg(ptr, transfer);
+ trace_dump_call_begin("pipe_context", "transfer_inline_write");
- trace_dump_arg_begin("stride");
- trace_dump_uint(transfer->stride);
- trace_dump_arg_end();
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, resource);
+ trace_dump_arg_struct(subresource, sr);
+ trace_dump_arg(uint, usage);
+ trace_dump_arg(box, box);
trace_dump_arg_begin("data");
trace_dump_box_bytes(tr_trans->map,
- transfer->resource->format,
- &transfer->box,
- transfer->stride,
- transfer->slice_stride);
+ resource->format,
+ box,
+ stride,
+ slice_stride);
trace_dump_arg_end();
-// trace_dump_arg_begin("size");
-// trace_dump_uint(size);
-// trace_dump_arg_end();
+ trace_dump_arg(uint, stride);
+ trace_dump_arg(uint, slice_stride);
trace_dump_call_end();
@@ -1474,26 +1462,21 @@ trace_context_transfer_inline_write(struct pipe_context *_context,
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, resource);
- trace_dump_arg(uint, sr.face);
- trace_dump_arg(uint, sr.level);
+ trace_dump_arg_struct(subresource, sr);
trace_dump_arg(uint, usage);
- trace_dump_arg(uint, box->x);
- trace_dump_arg(uint, box->y);
- trace_dump_arg(uint, box->z);
- trace_dump_arg(uint, box->width);
- trace_dump_arg(uint, box->height);
- trace_dump_arg(uint, box->depth);
- trace_dump_arg(uint, stride);
- trace_dump_arg(uint, slice_stride);
+ trace_dump_arg(box, box);
trace_dump_arg_begin("data");
trace_dump_box_bytes(data,
- resource->format,
- box,
- stride,
- slice_stride);
+ resource->format,
+ box,
+ stride,
+ slice_stride);
trace_dump_arg_end();
+ trace_dump_arg(uint, stride);
+ trace_dump_arg(uint, slice_stride);
+
trace_dump_call_end();
context->transfer_inline_write(context, resource,
diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c
index 19cf0de1d38..8ff25fb1e85 100644
--- a/src/gallium/drivers/trace/tr_dump.c
+++ b/src/gallium/drivers/trace/tr_dump.c
@@ -50,6 +50,8 @@
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_string.h"
+#include "util/u_math.h"
+#include "util/u_format.h"
#include "tr_dump.h"
#include "tr_screen.h"
@@ -471,13 +473,14 @@ void trace_dump_bytes(const void *data,
}
void trace_dump_box_bytes(const void *data,
- unsigned format,
+ enum pipe_format format,
const struct pipe_box *box,
unsigned stride,
unsigned slice_stride)
{
- //size_t size = util_format_get_nblocksy(transfer->resource->format, transfer->box.height) * transfer->stride;
-
+ size_t size = MAX2(util_format_get_nblocksy(format, box->height) * stride,
+ box->depth * slice_stride);
+ trace_dump_bytes(data, size);
}
void trace_dump_string(const char *str)
diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h
index 9383ccdecb9..f21f72b0c79 100644
--- a/src/gallium/drivers/trace/tr_dump.h
+++ b/src/gallium/drivers/trace/tr_dump.h
@@ -35,6 +35,7 @@
#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
struct pipe_buffer;
struct pipe_resource;
@@ -93,7 +94,7 @@ void trace_dump_uint(long long unsigned value);
void trace_dump_float(double value);
void trace_dump_bytes(const void *data, size_t size);
void trace_dump_box_bytes(const void *data,
- unsigned format,
+ enum pipe_format format,
const struct pipe_box *box,
unsigned stride,
unsigned slice_stride);
@@ -125,6 +126,13 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
trace_dump_arg_end(); \
} while(0)
+#define trace_dump_arg_struct(_type, _arg) \
+ do { \
+ trace_dump_arg_begin(#_arg); \
+ trace_dump_##_type(&_arg); \
+ trace_dump_arg_end(); \
+ } while(0)
+
#define trace_dump_ret(_type, _arg) \
do { \
trace_dump_ret_begin(); \
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 1b917ff3fb9..ab347182ed9 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -44,7 +44,7 @@ void trace_dump_format(enum pipe_format format)
}
-void trace_dump_template(const struct pipe_resource *templat)
+void trace_dump_resource_template(const struct pipe_resource *templat)
{
if (!trace_dumping_enabled_locked())
return;
@@ -80,6 +80,48 @@ void trace_dump_template(const struct pipe_resource *templat)
}
+void trace_dump_subresource(const struct pipe_subresource *subresource)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if(!subresource) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_subresource");
+
+ trace_dump_member(uint, subresource, face);
+ trace_dump_member(uint, subresource, level);
+
+ trace_dump_struct_end();
+}
+
+
+void trace_dump_box(const struct pipe_box *box)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if(!box) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_box");
+
+ trace_dump_member(uint, box, x);
+ trace_dump_member(uint, box, y);
+ trace_dump_member(uint, box, z);
+ trace_dump_member(uint, box, width);
+ trace_dump_member(uint, box, height);
+ trace_dump_member(uint, box, depth);
+
+ trace_dump_struct_end();
+}
+
+
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
{
if (!trace_dumping_enabled_locked())
@@ -389,6 +431,30 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state)
}
+void trace_dump_sampler_view_template(const struct pipe_sampler_view *state)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if(!state) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_sampler_view");
+
+ trace_dump_member(format, state, format);
+ trace_dump_member(uint, state, first_level);
+ trace_dump_member(uint, state, last_level);
+ trace_dump_member(uint, state, swizzle_r);
+ trace_dump_member(uint, state, swizzle_g);
+ trace_dump_member(uint, state, swizzle_b);
+ trace_dump_member(uint, state, swizzle_a);
+
+ trace_dump_struct_end();
+}
+
+
void trace_dump_surface(const struct pipe_surface *state)
{
if (!trace_dumping_enabled_locked())
diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h
index 41f6263935f..e614e8355e3 100644
--- a/src/gallium/drivers/trace/tr_dump_state.h
+++ b/src/gallium/drivers/trace/tr_dump_state.h
@@ -35,7 +35,11 @@
void trace_dump_format(enum pipe_format format);
-void trace_dump_template(const struct pipe_resource *templat);
+void trace_dump_resource_template(const struct pipe_resource *templat);
+
+void trace_dump_subresource(const struct pipe_subresource *subresource);
+
+void trace_dump_box(const struct pipe_box *box);
void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state);
@@ -63,6 +67,8 @@ void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state);
void trace_dump_sampler_state(const struct pipe_sampler_state *state);
+void trace_dump_sampler_view_template(const struct pipe_sampler_view *view);
+
void trace_dump_surface(const struct pipe_surface *state);
void trace_dump_transfer(const struct pipe_transfer *state);
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 8b0715beed8..63a45d7e512 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -222,7 +222,7 @@ trace_screen_resource_create(struct pipe_screen *_screen,
trace_dump_call_begin("pipe_screen", "resource_create");
trace_dump_arg(ptr, screen);
- trace_dump_arg(template, templat);
+ trace_dump_arg(resource_template, templat);
result = screen->resource_create(screen, templat);