diff options
author | José Fonseca <[email protected]> | 2011-04-05 20:13:44 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2011-04-06 08:26:44 +0100 |
commit | c0f6bfd489091da20ad9580d8ac6aeb187ededfd (patch) | |
tree | 73bb1e92814205e2cc39b9c5fb10e3287f3114f7 /src/gallium/drivers/trace | |
parent | 391f7147e73b752c6e088c4ae8fe11ddfd5fb537 (diff) |
trace: Correct/cleanup.
Observe the actual type hierarchy and polymorphism of sampler views and
surface state.
s/texture/resource/
etc.
Diffstat (limited to 'src/gallium/drivers/trace')
-rw-r--r-- | src/gallium/drivers/trace/tr_context.c | 54 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump_state.c | 62 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump_state.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_texture.c | 36 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_texture.h | 6 |
6 files changed, 114 insertions, 74 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 4db7619c424..4f0d6c4b97a 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -47,15 +47,15 @@ static INLINE struct pipe_resource * trace_resource_unwrap(struct trace_context *tr_ctx, struct pipe_resource *resource) { - struct trace_resource *tr_tex; + struct trace_resource *tr_res; if(!resource) return NULL; - tr_tex = trace_resource(resource); + tr_res = trace_resource(resource); - assert(tr_tex->resource); - return tr_tex->resource; + assert(tr_res->resource); + return tr_res->resource; } @@ -832,19 +832,22 @@ trace_create_sampler_view(struct pipe_context *_pipe, const struct pipe_sampler_view *templ) { struct trace_context *tr_ctx = trace_context(_pipe); - struct trace_resource *tr_tex = trace_resource(_resource); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_resource *texture = tr_tex->resource; + struct pipe_resource *resource = tr_res->resource; 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(sampler_view_template, templ); + trace_dump_arg(ptr, resource); + + trace_dump_arg_begin("templ"); + trace_dump_sampler_view_template(templ, resource->target); + trace_dump_arg_end(); - result = pipe->create_sampler_view(pipe, texture, templ); + result = pipe->create_sampler_view(pipe, resource, templ); trace_dump_ret(ptr, result); @@ -895,29 +898,32 @@ trace_sampler_view_destroy(struct pipe_context *_pipe, static struct pipe_surface * trace_create_surface(struct pipe_context *_pipe, - struct pipe_resource *_texture, + struct pipe_resource *_resource, const struct pipe_surface *surf_tmpl) { struct trace_context *tr_ctx = trace_context(_pipe); - struct trace_resource *tr_tex = trace_resource(_texture); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_context *pipe = tr_ctx->pipe; - struct pipe_resource *texture = tr_tex->resource; + struct pipe_resource *resource = tr_res->resource; struct pipe_surface *result = NULL; trace_dump_call_begin("pipe_context", "create_surface"); trace_dump_arg(ptr, pipe); - trace_dump_arg(ptr, texture); - /* hmm some values unitialized there */ - trace_dump_arg(surface, surf_tmpl); + trace_dump_arg(ptr, resource); + + trace_dump_arg_begin("surf_tmpl"); + trace_dump_surface_template(surf_tmpl, resource->target); + trace_dump_arg_end(); + - result = pipe->create_surface(pipe, texture, surf_tmpl); + result = pipe->create_surface(pipe, resource, surf_tmpl); trace_dump_ret(ptr, result); trace_dump_call_end(); - result = trace_surf_create(tr_tex, result); + result = trace_surf_create(tr_res, result); return result; } @@ -1231,9 +1237,9 @@ trace_context_get_transfer(struct pipe_context *_context, const struct pipe_box *box) { struct trace_context *tr_context = trace_context(_context); - struct trace_resource *tr_tex = trace_resource(_resource); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_context *context = tr_context->pipe; - struct pipe_resource *texture = tr_tex->resource; + struct pipe_resource *texture = tr_res->resource; struct pipe_transfer *result = NULL; assert(texture->screen == context->screen); @@ -1246,7 +1252,7 @@ trace_context_get_transfer(struct pipe_context *_context, result = context->get_transfer(context, texture, level, usage, box); if (result) - result = trace_transfer_create(tr_context, tr_tex, result); + result = trace_transfer_create(tr_context, tr_res, result); return result; } @@ -1360,9 +1366,9 @@ trace_context_transfer_inline_write(struct pipe_context *_context, unsigned layer_stride) { struct trace_context *tr_context = trace_context(_context); - struct trace_resource *tr_tex = trace_resource(_resource); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_context *context = tr_context->pipe; - struct pipe_resource *resource = tr_tex->resource; + struct pipe_resource *resource = tr_res->resource; assert(resource->screen == context->screen); @@ -1397,9 +1403,9 @@ static void trace_redefine_user_buffer(struct pipe_context *_context, unsigned offset, unsigned size) { struct trace_context *tr_context = trace_context(_context); - struct trace_resource *tr_tex = trace_resource(_resource); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_context *context = tr_context->pipe; - struct pipe_resource *resource = tr_tex->resource; + struct pipe_resource *resource = tr_res->resource; assert(resource->screen == context->screen); diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index acb80edbf46..291a6a29ca5 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -453,7 +453,8 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state) } -void trace_dump_sampler_view_template(const struct pipe_sampler_view *state) +void trace_dump_sampler_view_template(const struct pipe_sampler_view *state, + enum pipe_texture_target target) { if (!trace_dumping_enabled_locked()) return; @@ -466,13 +467,29 @@ void trace_dump_sampler_view_template(const struct pipe_sampler_view *state) trace_dump_struct_begin("pipe_sampler_view"); trace_dump_member(format, state, format); - /* XXX */ - trace_dump_member(uint, state, u.tex.first_level); - trace_dump_member(uint, state, u.tex.last_level); - trace_dump_member(uint, state, u.tex.first_layer); - trace_dump_member(uint, state, u.tex.last_layer); - trace_dump_member(uint, state, u.buf.first_element); - trace_dump_member(uint, state, u.buf.last_element); + + trace_dump_member_begin("u"); + trace_dump_struct_begin(""); /* anonymous */ + if (target == PIPE_BUFFER) { + trace_dump_member_begin("buf"); + trace_dump_struct_begin(""); /* anonymous */ + trace_dump_member(uint, &state->u.buf, first_element); + trace_dump_member(uint, &state->u.buf, last_element); + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* buf */ + } else { + trace_dump_member_begin("tex"); + trace_dump_struct_begin(""); /* anonymous */ + trace_dump_member(uint, &state->u.tex, first_layer); + trace_dump_member(uint, &state->u.tex, last_layer); + trace_dump_member(uint, &state->u.tex, first_level); + trace_dump_member(uint, &state->u.tex, last_level); + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* tex */ + } + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* u */ + trace_dump_member(uint, state, swizzle_r); trace_dump_member(uint, state, swizzle_g); trace_dump_member(uint, state, swizzle_b); @@ -482,7 +499,8 @@ void trace_dump_sampler_view_template(const struct pipe_sampler_view *state) } -void trace_dump_surface(const struct pipe_surface *state) +void trace_dump_surface_template(const struct pipe_surface *state, + enum pipe_texture_target target) { if (!trace_dumping_enabled_locked()) return; @@ -500,12 +518,26 @@ void trace_dump_surface(const struct pipe_surface *state) trace_dump_member(uint, state, usage); - trace_dump_member(ptr, state, texture); - trace_dump_member(uint, state, u.tex.level); - trace_dump_member(uint, state, u.tex.first_layer); - trace_dump_member(uint, state, u.tex.last_layer); - trace_dump_member(uint, state, u.buf.first_element); - trace_dump_member(uint, state, u.buf.last_element); + trace_dump_member_begin("u"); + trace_dump_struct_begin(""); /* anonymous */ + if (target == PIPE_BUFFER) { + trace_dump_member_begin("buf"); + trace_dump_struct_begin(""); /* anonymous */ + trace_dump_member(uint, &state->u.buf, first_element); + trace_dump_member(uint, &state->u.buf, last_element); + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* buf */ + } else { + trace_dump_member_begin("tex"); + trace_dump_struct_begin(""); /* anonymous */ + trace_dump_member(uint, &state->u.tex, level); + trace_dump_member(uint, &state->u.tex, first_layer); + trace_dump_member(uint, &state->u.tex, last_layer); + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* tex */ + } + trace_dump_struct_end(); /* anonymous */ + trace_dump_member_end(); /* u */ trace_dump_struct_end(); } diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h index fe8ece78d43..a6e7ccdb864 100644 --- a/src/gallium/drivers/trace/tr_dump_state.h +++ b/src/gallium/drivers/trace/tr_dump_state.h @@ -65,9 +65,11 @@ 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_sampler_view_template(const struct pipe_sampler_view *view, + enum pipe_texture_target target); -void trace_dump_surface(const struct pipe_surface *state); +void trace_dump_surface_template(const struct pipe_surface *state, + enum pipe_texture_target target); 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 42180c4f19e..a7d33661838 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -117,7 +117,7 @@ trace_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader, trace_dump_call_begin("pipe_screen", "get_shader_param"); trace_dump_arg(ptr, screen); - trace_dump_arg(int, shader); + trace_dump_arg(uint, shader); trace_dump_arg(int, param); result = screen->get_shader_param(screen, shader, param); @@ -282,40 +282,40 @@ trace_screen_resource_from_handle(struct pipe_screen *_screen, static boolean trace_screen_resource_get_handle(struct pipe_screen *_screen, - struct pipe_resource *_texture, + struct pipe_resource *_resource, struct winsys_handle *handle) { struct trace_screen *tr_screen = trace_screen(_screen); - struct trace_resource *tr_texture = trace_resource(_texture); + struct trace_resource *tr_resource = trace_resource(_resource); struct pipe_screen *screen = tr_screen->screen; - struct pipe_resource *texture = tr_texture->resource; + struct pipe_resource *resource = tr_resource->resource; /* TODO trace call */ - return screen->resource_get_handle(screen, texture, handle); + return screen->resource_get_handle(screen, resource, handle); } static void trace_screen_resource_destroy(struct pipe_screen *_screen, - struct pipe_resource *_texture) + struct pipe_resource *_resource) { struct trace_screen *tr_scr = trace_screen(_screen); - struct trace_resource *tr_tex = trace_resource(_texture); + struct trace_resource *tr_res = trace_resource(_resource); struct pipe_screen *screen = tr_scr->screen; - struct pipe_resource *texture = tr_tex->resource; + struct pipe_resource *resource = tr_res->resource; - assert(texture->screen == screen); + assert(resource->screen == screen); - trace_dump_call_begin("pipe_screen", "texture_destroy"); + trace_dump_call_begin("pipe_screen", "resource_destroy"); trace_dump_arg(ptr, screen); - trace_dump_arg(ptr, texture); + trace_dump_arg(ptr, resource); trace_dump_call_end(); - trace_resource_destroy(tr_scr, tr_tex); + trace_resource_destroy(tr_scr, tr_res); } diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c index 27997346471..648b7a4f1cc 100644 --- a/src/gallium/drivers/trace/tr_texture.c +++ b/src/gallium/drivers/trace/tr_texture.c @@ -39,24 +39,24 @@ struct pipe_resource * trace_resource_create(struct trace_screen *tr_scr, struct pipe_resource *texture) { - struct trace_resource *tr_tex; + struct trace_resource *tr_res; if(!texture) goto error; assert(texture->screen == tr_scr->screen); - tr_tex = CALLOC_STRUCT(trace_resource); - if(!tr_tex) + tr_res = CALLOC_STRUCT(trace_resource); + if(!tr_res) goto error; - memcpy(&tr_tex->base, texture, sizeof(struct pipe_resource)); + memcpy(&tr_res->base, texture, sizeof(struct pipe_resource)); - pipe_reference_init(&tr_tex->base.reference, 1); - tr_tex->base.screen = &tr_scr->base; - tr_tex->resource = texture; + pipe_reference_init(&tr_res->base.reference, 1); + tr_res->base.screen = &tr_scr->base; + tr_res->resource = texture; - return &tr_tex->base; + return &tr_res->base; error: pipe_resource_reference(&texture, NULL); @@ -66,15 +66,15 @@ error: void trace_resource_destroy(struct trace_screen *tr_scr, - struct trace_resource *tr_tex) + struct trace_resource *tr_res) { - pipe_resource_reference(&tr_tex->resource, NULL); - FREE(tr_tex); + pipe_resource_reference(&tr_res->resource, NULL); + FREE(tr_res); } struct pipe_surface * -trace_surf_create(struct trace_resource *tr_tex, +trace_surf_create(struct trace_resource *tr_res, struct pipe_surface *surface) { struct trace_surface *tr_surf; @@ -82,7 +82,7 @@ trace_surf_create(struct trace_resource *tr_tex, if(!surface) goto error; - assert(surface->texture == tr_tex->resource); + assert(surface->texture == tr_res->resource); tr_surf = CALLOC_STRUCT(trace_surface); if(!tr_surf) @@ -92,7 +92,7 @@ trace_surf_create(struct trace_resource *tr_tex, pipe_reference_init(&tr_surf->base.reference, 1); tr_surf->base.texture = NULL; - pipe_resource_reference(&tr_surf->base.texture, &tr_tex->base); + pipe_resource_reference(&tr_surf->base.texture, &tr_res->base); tr_surf->surface = surface; return &tr_surf->base; @@ -114,7 +114,7 @@ trace_surf_destroy(struct trace_surface *tr_surf) struct pipe_transfer * trace_transfer_create(struct trace_context *tr_ctx, - struct trace_resource *tr_tex, + struct trace_resource *tr_res, struct pipe_transfer *transfer) { struct trace_transfer *tr_trans; @@ -122,7 +122,7 @@ trace_transfer_create(struct trace_context *tr_ctx, if(!transfer) goto error; - assert(transfer->resource == tr_tex->resource); + assert(transfer->resource == tr_res->resource); tr_trans = CALLOC_STRUCT(trace_transfer); if(!tr_trans) @@ -133,8 +133,8 @@ trace_transfer_create(struct trace_context *tr_ctx, tr_trans->base.resource = NULL; tr_trans->transfer = transfer; - pipe_resource_reference(&tr_trans->base.resource, &tr_tex->base); - assert(tr_trans->base.resource == &tr_tex->base); + pipe_resource_reference(&tr_trans->base.resource, &tr_res->base); + assert(tr_trans->base.resource == &tr_res->base); return &tr_trans->base; diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index 3352c96e59a..bf3c16e8cd2 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -122,10 +122,10 @@ trace_resource_create(struct trace_screen *tr_scr, void trace_resource_destroy(struct trace_screen *tr_scr, - struct trace_resource *tr_tex); + struct trace_resource *tr_res); struct pipe_surface * -trace_surf_create(struct trace_resource *tr_tex, +trace_surf_create(struct trace_resource *tr_res, struct pipe_surface *surface); void @@ -133,7 +133,7 @@ trace_surf_destroy(struct trace_surface *tr_surf); struct pipe_transfer * trace_transfer_create(struct trace_context *tr_ctx, - struct trace_resource *tr_tex, + struct trace_resource *tr_res, struct pipe_transfer *transfer); void |