Commit a6ba315e authored by Keith Whitwell's avatar Keith Whitwell

trace: get running

Some dumping will be incorrect or disabled, but it runs without
crashing
parent 2133f1d9
......@@ -190,8 +190,6 @@ trace_context_draw_elements(struct pipe_context *_pipe,
trace_context_draw_block(tr_ctx, 1);
trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
trace_dump_call_begin("pipe_context", "draw_elements");
trace_dump_arg(ptr, pipe);
......@@ -229,8 +227,6 @@ trace_context_draw_range_elements(struct pipe_context *_pipe,
trace_context_draw_block(tr_ctx, 1);
trace_screen_user_buffer_update(_pipe->screen, indexBuffer);
trace_dump_call_begin("pipe_context", "draw_range_elements");
trace_dump_arg(ptr, pipe);
......@@ -886,7 +882,6 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
if (buffer) {
trace_screen_user_buffer_update(_pipe->screen, buffer);
buffer = trace_resource_unwrap(tr_ctx, buffer);
}
......@@ -1001,11 +996,11 @@ trace_context_set_viewport_state(struct pipe_context *_pipe,
static struct pipe_sampler_view *
trace_create_sampler_view(struct pipe_context *_pipe,
struct pipe_resource *_texture,
struct pipe_resource *_resource,
const struct pipe_sampler_view *templ)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_resource *tr_tex = trace_resource(_texture);
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);
......@@ -1021,7 +1016,7 @@ trace_create_sampler_view(struct pipe_context *_pipe,
result->base = *templ;
result->base.reference.count = 1;
result->base.texture = NULL;
pipe_resource_reference(&result->base.texture, _texture);
pipe_resource_reference(&result->base.texture, _resource);
result->base.context = _pipe;
trace_dump_ret(ptr, result);
......@@ -1126,9 +1121,6 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
struct pipe_context *pipe = tr_ctx->pipe;
unsigned i;
for(i = 0; i < num_buffers; ++i)
trace_screen_user_buffer_update(_pipe->screen, buffers[i].buffer);
trace_dump_call_begin("pipe_context", "set_vertex_buffers");
trace_dump_arg(ptr, pipe);
......@@ -1280,11 +1272,11 @@ trace_context_destroy(struct pipe_context *_pipe)
static unsigned int
trace_is_resource_referenced( struct pipe_context *_pipe,
struct pipe_resource *_texture,
struct pipe_resource *_resource,
unsigned face, unsigned level)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct trace_resource *tr_tex = trace_resource(_texture);
struct trace_resource *tr_tex = trace_resource(_resource);
struct pipe_context *pipe = tr_ctx->pipe;
struct pipe_resource *texture = tr_tex->resource;
unsigned int referenced;
......@@ -1311,14 +1303,13 @@ trace_is_resource_referenced( struct pipe_context *_pipe,
static struct pipe_transfer *
trace_context_get_transfer(struct pipe_context *_context,
struct pipe_resource *_texture,
unsigned face, unsigned level,
unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
struct pipe_resource *_resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box)
{
struct trace_context *tr_context = trace_context(_context);
struct trace_resource *tr_tex = trace_resource(_texture);
struct trace_resource *tr_tex = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
struct pipe_resource *texture = tr_tex->resource;
struct pipe_transfer *result = NULL;
......@@ -1329,18 +1320,17 @@ trace_context_get_transfer(struct pipe_context *_context,
trace_dump_arg(ptr, context);
trace_dump_arg(ptr, texture);
trace_dump_arg(uint, face);
trace_dump_arg(uint, level);
trace_dump_arg(uint, zslice);
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);
trace_dump_arg(uint, x);
trace_dump_arg(uint, y);
trace_dump_arg(uint, w);
trace_dump_arg(uint, h);
result = pipe_get_transfer(context, texture, face, level, zslice, usage,
x, y, w, h);
result = context->get_transfer(context, texture, sr, usage, box);
trace_dump_ret(ptr, result);
......@@ -1395,6 +1385,33 @@ trace_context_transfer_map(struct pipe_context *_context,
}
static void
trace_context_transfer_flush_region( struct pipe_context *_context,
struct pipe_transfer *_transfer,
const struct pipe_box *box)
{
struct trace_context *tr_context = trace_context(_context);
struct trace_transfer *tr_transfer = trace_transfer(_transfer);
struct pipe_context *context = tr_context->pipe;
struct pipe_transfer *transfer = tr_transfer->transfer;
trace_dump_call_begin("pipe_context", "transfer_flush_region");
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_call_end();
context->transfer_flush_region(context,
transfer,
box);
}
static void
trace_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *_transfer)
......@@ -1405,8 +1422,6 @@ trace_context_transfer_unmap(struct pipe_context *_context,
struct pipe_transfer *transfer = tr_trans->transfer;
if(tr_trans->map) {
size_t size = util_format_get_nblocksy(transfer->resource->format, transfer->box.height) * transfer->stride;
trace_dump_call_begin("pipe_context", "transfer_write");
trace_dump_arg(ptr, context);
......@@ -1418,12 +1433,16 @@ trace_context_transfer_unmap(struct pipe_context *_context,
trace_dump_arg_end();
trace_dump_arg_begin("data");
trace_dump_bytes(tr_trans->map, size);
trace_dump_box_bytes(tr_trans->map,
transfer->resource->format,
&transfer->box,
transfer->stride,
transfer->slice_stride);
trace_dump_arg_end();
trace_dump_arg_begin("size");
trace_dump_uint(size);
trace_dump_arg_end();
// trace_dump_arg_begin("size");
// trace_dump_uint(size);
// trace_dump_arg_end();
trace_dump_call_end();
......@@ -1433,6 +1452,57 @@ trace_context_transfer_unmap(struct pipe_context *_context,
context->transfer_unmap(context, transfer);
}
static void
trace_context_transfer_inline_write(struct pipe_context *_context,
struct pipe_resource *_resource,
struct pipe_subresource sr,
enum pipe_transfer_usage usage,
const struct pipe_box *box,
const void *data,
unsigned stride,
unsigned slice_stride)
{
struct trace_context *tr_context = trace_context(_context);
struct trace_resource *tr_tex = trace_resource(_resource);
struct pipe_context *context = tr_context->pipe;
struct pipe_resource *resource = tr_tex->resource;
assert(resource->screen == context->screen);
trace_dump_call_begin("pipe_context", "transfer_inline_write");
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(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_begin("data");
trace_dump_box_bytes(data,
resource->format,
box,
stride,
slice_stride);
trace_dump_arg_end();
trace_dump_call_end();
context->transfer_inline_write(context, resource,
sr, usage, box, data, stride, slice_stride);
}
static const struct debug_named_value rbug_blocker_flags[] = {
{"before", 1},
{"after", 2},
......@@ -1522,6 +1592,8 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.transfer_destroy = trace_context_transfer_destroy;
tr_ctx->base.transfer_map = trace_context_transfer_map;
tr_ctx->base.transfer_unmap = trace_context_transfer_unmap;
tr_ctx->base.transfer_flush_region = trace_context_transfer_flush_region;
tr_ctx->base.transfer_inline_write = trace_context_transfer_inline_write;
tr_ctx->pipe = pipe;
......
......@@ -470,6 +470,16 @@ void trace_dump_bytes(const void *data,
trace_dump_writes("</bytes>");
}
void trace_dump_box_bytes(const void *data,
unsigned 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;
}
void trace_dump_string(const char *str)
{
if (!dumping)
......
......@@ -36,11 +36,11 @@
#include "pipe/p_compiler.h"
struct pipe_buffer;
struct pipe_texture;
struct pipe_surface;
struct pipe_transfer;
struct pipe_box;
/*
* Call before use.
......@@ -92,6 +92,11 @@ void trace_dump_int(long long int value);
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,
const struct pipe_box *box,
unsigned stride,
unsigned slice_stride);
void trace_dump_string(const char *str);
void trace_dump_enum(const char *value);
void trace_dump_array_begin(void);
......
......@@ -272,9 +272,10 @@ trace_screen_resource_get_handle(struct pipe_screen *_screen,
static void
trace_screen_resource_destroy(struct pipe_resource *_texture)
trace_screen_resource_destroy(struct pipe_screen *_screen,
struct pipe_resource *_texture)
{
struct trace_screen *tr_scr = trace_screen(_texture->screen);
struct trace_screen *tr_scr = trace_screen(_screen);
struct trace_resource *tr_tex = trace_resource(_texture);
struct pipe_screen *screen = tr_scr->screen;
struct pipe_resource *texture = tr_tex->resource;
......@@ -288,7 +289,7 @@ trace_screen_resource_destroy(struct pipe_resource *_texture)
trace_dump_call_end();
trace_resource_destroy(tr_tex);
trace_resource_destroy(tr_scr, tr_tex);
}
......
......@@ -100,10 +100,6 @@ trace_enabled(void);
struct trace_screen *
trace_screen(struct pipe_screen *screen);
void
trace_screen_user_buffer_update(struct pipe_screen *screen,
struct pipe_resource *buffer);
#define trace_screen_add_to_list(tr_scr, name, obj) \
do { \
pipe_mutex_lock(tr_scr->list_mutex); \
......
......@@ -67,10 +67,9 @@ error:
void
trace_resource_destroy(struct trace_resource *tr_tex)
trace_resource_destroy(struct trace_screen *tr_scr,
struct trace_resource *tr_tex)
{
struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
trace_screen_remove_from_list(tr_scr, textures, tr_tex);
pipe_resource_reference(&tr_tex->resource, NULL);
......
......@@ -121,7 +121,8 @@ trace_resource_create(struct trace_screen *tr_scr,
struct pipe_resource *texture);
void
trace_resource_destroy(struct trace_resource *tr_tex);
trace_resource_destroy(struct trace_screen *tr_scr,
struct trace_resource *tr_tex);
struct pipe_surface *
trace_surface_create(struct trace_resource *tr_tex,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment