diff options
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/trace/tr_context.c | 140 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_context.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump.c | 62 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.c | 122 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_state.c | 30 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_texture.c | 48 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_texture.h | 16 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_winsys.c | 156 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_winsys.h | 10 |
11 files changed, 297 insertions, 297 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ec8be27077..42146daf7a 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -36,42 +36,42 @@ #include "tr_context.h" -static INLINE struct pipe_texture * +static INLINE struct pipe_texture * trace_texture_unwrap(struct trace_context *tr_ctx, struct pipe_texture *texture) { - struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); + struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); struct trace_texture *tr_tex; - + if(!texture) return NULL; - + tr_tex = trace_texture(tr_scr, texture); - + assert(tr_tex->texture); assert(tr_tex->texture->screen == tr_scr->screen); return tr_tex->texture; } -static INLINE struct pipe_surface * +static INLINE struct pipe_surface * trace_surface_unwrap(struct trace_context *tr_ctx, struct pipe_surface *surface) { - struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); + struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen); struct trace_texture *tr_tex; struct trace_surface *tr_surf; - + if(!surface) return NULL; assert(surface->texture); if(!surface->texture) return surface; - + tr_tex = trace_texture(tr_scr, surface->texture); tr_surf = trace_surface(tr_tex, surface); - + assert(tr_surf->surface); assert(tr_surf->surface->texture->screen == tr_scr->screen); return tr_surf->surface; @@ -86,7 +86,7 @@ trace_context_set_edgeflags(struct pipe_context *_pipe, struct pipe_context *pipe = tr_ctx->pipe; trace_dump_call_begin("pipe_context", "set_edgeflags"); - + trace_dump_arg(ptr, pipe); /* FIXME: we don't know how big this array is */ trace_dump_arg(ptr, bitfield); @@ -115,9 +115,9 @@ trace_context_draw_arrays(struct pipe_context *_pipe, result = pipe->draw_arrays(pipe, mode, start, count);; trace_dump_ret(bool, result); - + trace_dump_call_end(); - + return result; } @@ -146,9 +146,9 @@ trace_context_draw_elements(struct pipe_context *_pipe, result = pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);; trace_dump_ret(bool, result); - + trace_dump_call_end(); - + return result; } @@ -159,8 +159,8 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, unsigned indexSize, unsigned minIndex, unsigned maxIndex, - unsigned mode, - unsigned start, + unsigned mode, + unsigned start, unsigned count) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -180,15 +180,15 @@ trace_context_draw_range_elements(struct pipe_context *_pipe, trace_dump_arg(uint, start); trace_dump_arg(uint, count); - result = pipe->draw_range_elements(pipe, - indexBuffer, - indexSize, minIndex, maxIndex, + result = pipe->draw_range_elements(pipe, + indexBuffer, + indexSize, minIndex, maxIndex, mode, start, count); - + trace_dump_ret(bool, result); - + trace_dump_call_end(); - + return result; } @@ -209,9 +209,9 @@ trace_context_create_query(struct pipe_context *_pipe, result = pipe->create_query(pipe, query_type);; trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } @@ -235,7 +235,7 @@ trace_context_destroy_query(struct pipe_context *_pipe, static INLINE void -trace_context_begin_query(struct pipe_context *_pipe, +trace_context_begin_query(struct pipe_context *_pipe, struct pipe_query *query) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -253,7 +253,7 @@ trace_context_begin_query(struct pipe_context *_pipe, static INLINE void -trace_context_end_query(struct pipe_context *_pipe, +trace_context_end_query(struct pipe_context *_pipe, struct pipe_query *query) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -271,7 +271,7 @@ trace_context_end_query(struct pipe_context *_pipe, static INLINE boolean -trace_context_get_query_result(struct pipe_context *_pipe, +trace_context_get_query_result(struct pipe_context *_pipe, struct pipe_query *query, boolean wait, uint64_t *presult) @@ -290,9 +290,9 @@ trace_context_get_query_result(struct pipe_context *_pipe, trace_dump_arg(uint, result); trace_dump_ret(bool, _result); - + trace_dump_call_end(); - + return _result; } @@ -315,13 +315,13 @@ trace_context_create_blend_state(struct pipe_context *_pipe, trace_dump_ret(ptr, result); trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_blend_state(struct pipe_context *_pipe, +trace_context_bind_blend_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -339,7 +339,7 @@ trace_context_bind_blend_state(struct pipe_context *_pipe, static INLINE void -trace_context_delete_blend_state(struct pipe_context *_pipe, +trace_context_delete_blend_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -372,15 +372,15 @@ trace_context_create_sampler_state(struct pipe_context *_pipe, result = pipe->create_sampler_state(pipe, state);; trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_sampler_states(struct pipe_context *_pipe, +trace_context_bind_sampler_states(struct pipe_context *_pipe, unsigned num_states, void **states) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -399,7 +399,7 @@ trace_context_bind_sampler_states(struct pipe_context *_pipe, static INLINE void -trace_context_delete_sampler_state(struct pipe_context *_pipe, +trace_context_delete_sampler_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -432,15 +432,15 @@ trace_context_create_rasterizer_state(struct pipe_context *_pipe, result = pipe->create_rasterizer_state(pipe, state);; trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_rasterizer_state(struct pipe_context *_pipe, +trace_context_bind_rasterizer_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -458,7 +458,7 @@ trace_context_bind_rasterizer_state(struct pipe_context *_pipe, static INLINE void -trace_context_delete_rasterizer_state(struct pipe_context *_pipe, +trace_context_delete_rasterizer_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -489,17 +489,17 @@ trace_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(depth_stencil_alpha_state, state); - + trace_dump_ret(ptr, result); trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, +trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -517,7 +517,7 @@ trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, static INLINE void -trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, +trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -550,15 +550,15 @@ trace_context_create_fs_state(struct pipe_context *_pipe, result = pipe->create_fs_state(pipe, state);; trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_fs_state(struct pipe_context *_pipe, +trace_context_bind_fs_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -576,7 +576,7 @@ trace_context_bind_fs_state(struct pipe_context *_pipe, static INLINE void -trace_context_delete_fs_state(struct pipe_context *_pipe, +trace_context_delete_fs_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -609,15 +609,15 @@ trace_context_create_vs_state(struct pipe_context *_pipe, result = pipe->create_vs_state(pipe, state);; trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } static INLINE void -trace_context_bind_vs_state(struct pipe_context *_pipe, +trace_context_bind_vs_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -635,7 +635,7 @@ trace_context_bind_vs_state(struct pipe_context *_pipe, static INLINE void -trace_context_delete_vs_state(struct pipe_context *_pipe, +trace_context_delete_vs_state(struct pipe_context *_pipe, void *state) { struct trace_context *tr_ctx = trace_context(_pipe); @@ -697,7 +697,7 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe, struct pipe_context *pipe = tr_ctx->pipe; trace_winsys_user_buffer_update(_pipe->winsys, (struct pipe_buffer *)buffer); - + trace_dump_call_begin("pipe_context", "set_constant_buffer"); trace_dump_arg(ptr, pipe); @@ -719,7 +719,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe, struct pipe_context *pipe = tr_ctx->pipe; struct pipe_framebuffer_state unwrapped_state; unsigned i; - + /* Unwrap the input state */ memcpy(&unwrapped_state, state, sizeof(unwrapped_state)); for(i = 0; i < state->nr_cbufs; ++i) @@ -728,7 +728,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe, unwrapped_state.cbufs[i] = NULL; unwrapped_state.zsbuf = trace_surface_unwrap(tr_ctx, state->zsbuf); state = &unwrapped_state; - + trace_dump_call_begin("pipe_context", "set_framebuffer_state"); trace_dump_arg(ptr, pipe); @@ -803,7 +803,7 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe, struct pipe_context *pipe = tr_ctx->pipe; struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS]; unsigned i; - + for(i = 0; i < num_textures; ++i) unwrapped_textures[i] = trace_texture_unwrap(tr_ctx, textures[i]); textures = unwrapped_textures; @@ -836,7 +836,7 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, num_buffers); - + trace_dump_arg_begin("buffers"); trace_dump_struct_array(vertex_buffer, buffers, num_buffers); trace_dump_arg_end(); @@ -884,7 +884,7 @@ trace_context_surface_copy(struct pipe_context *_pipe, dest = trace_surface_unwrap(tr_ctx, dest); src = trace_surface_unwrap(tr_ctx, src); - + trace_dump_call_begin("pipe_context", "surface_copy"); trace_dump_arg(ptr, pipe); @@ -898,10 +898,10 @@ trace_context_surface_copy(struct pipe_context *_pipe, trace_dump_arg(uint, width); trace_dump_arg(uint, height); - pipe->surface_copy(pipe, do_flip, - dest, destx, desty, + pipe->surface_copy(pipe, do_flip, + dest, destx, desty, src, srcx, srcy, width, height); - + trace_dump_call_end(); } @@ -934,7 +934,7 @@ trace_context_surface_fill(struct pipe_context *_pipe, static INLINE void -trace_context_clear(struct pipe_context *_pipe, +trace_context_clear(struct pipe_context *_pipe, struct pipe_surface *surface, unsigned clearValue) { @@ -988,7 +988,7 @@ trace_context_destroy(struct pipe_context *_pipe) trace_dump_arg(ptr, pipe); pipe->destroy(pipe); - + trace_dump_call_end(); FREE(tr_ctx); @@ -996,17 +996,17 @@ trace_context_destroy(struct pipe_context *_pipe) struct pipe_context * -trace_context_create(struct pipe_screen *screen, +trace_context_create(struct pipe_screen *screen, struct pipe_context *pipe) { struct trace_context *tr_ctx; - + if(!pipe) goto error1; - + if(!trace_dump_enabled()) goto error1; - + tr_ctx = CALLOC_STRUCT(trace_context); if(!tr_ctx) goto error1; @@ -1057,7 +1057,7 @@ trace_context_create(struct pipe_screen *screen, tr_ctx->base.flush = trace_context_flush; tr_ctx->pipe = pipe; - + trace_dump_call_begin("", "pipe_context_create"); trace_dump_arg_begin("screen"); trace_dump_ptr(pipe->screen); @@ -1066,7 +1066,7 @@ trace_context_create(struct pipe_screen *screen, trace_dump_call_end(); return &tr_ctx->base; - + error1: return pipe; } diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 6704175964..d02b22a069 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -38,11 +38,11 @@ extern "C" { #endif - + struct trace_context { struct pipe_context base; - + struct pipe_context *pipe; }; diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 8757ac8bec..ec8f8cd62e 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -29,13 +29,13 @@ /** * @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 + * 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 <jrfonseca@tungstengraphics.com> + * + * @author Jose Fonseca <jrfonseca@tungstengraphics.com> */ #include "pipe/p_config.h" @@ -57,7 +57,7 @@ static struct util_stream *stream = NULL; static unsigned refcount = 0; -static INLINE void +static INLINE void trace_dump_write(const char *buf, size_t size) { if(stream) @@ -65,14 +65,14 @@ trace_dump_write(const char *buf, size_t size) } -static INLINE void +static INLINE void trace_dump_writes(const char *s) { trace_dump_write(s, strlen(s)); } -static INLINE void +static INLINE void trace_dump_writef(const char *format, ...) { static char buf[1024]; @@ -85,8 +85,8 @@ trace_dump_writef(const char *format, ...) } -static INLINE void -trace_dump_escape(const char *str) +static INLINE void +trace_dump_escape(const char *str) { const unsigned char *p = (const unsigned char *)str; unsigned char c; @@ -109,7 +109,7 @@ trace_dump_escape(const char *str) } -static INLINE void +static INLINE void trace_dump_indent(unsigned level) { unsigned i; @@ -118,14 +118,14 @@ trace_dump_indent(unsigned level) } -static INLINE void -trace_dump_newline(void) +static INLINE void +trace_dump_newline(void) { trace_dump_writes("\n"); } -static INLINE void +static INLINE void trace_dump_tag(const char *name) { trace_dump_writes("<"); @@ -134,7 +134,7 @@ trace_dump_tag(const char *name) } -static INLINE void +static INLINE void trace_dump_tag_begin(const char *name) { trace_dump_writes("<"); @@ -142,8 +142,8 @@ trace_dump_tag_begin(const char *name) trace_dump_writes(">"); } -static INLINE void -trace_dump_tag_begin1(const char *name, +static INLINE void +trace_dump_tag_begin1(const char *name, const char *attr1, const char *value1) { trace_dump_writes("<"); @@ -156,8 +156,8 @@ trace_dump_tag_begin1(const char *name, } -static INLINE void -trace_dump_tag_begin2(const char *name, +static INLINE void +trace_dump_tag_begin2(const char *name, const char *attr1, const char *value1, const char *attr2, const char *value2) { @@ -175,8 +175,8 @@ trace_dump_tag_begin2(const char *name, } -static INLINE void -trace_dump_tag_begin3(const char *name, +static INLINE void +trace_dump_tag_begin3(const char *name, const char *attr1, const char *value1, const char *attr2, const char *value2, const char *attr3, const char *value3) @@ -207,7 +207,7 @@ trace_dump_tag_end(const char *name) trace_dump_writes(">"); } -static void +static void trace_dump_trace_close(void) { if(stream) { @@ -221,30 +221,30 @@ trace_dump_trace_close(void) boolean trace_dump_trace_begin() { const char *filename; - + filename = debug_get_option("GALLIUM_TRACE", NULL); if(!filename) return FALSE; - + if(!stream) { - + stream = util_stream_create(filename, 0); if(!stream) return FALSE; - + trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n"); trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n"); trace_dump_writes("<trace version='0.1'>\n"); - + #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) - /* Linux applications rarely cleanup GL / Gallium resources so catch - * application exit here */ + /* Linux applications rarely cleanup GL / Gallium resources so catch + * application exit here */ atexit(trace_dump_trace_close); #endif } - + ++refcount; - + return TRUE; } diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 76a53731b3..00543ee3b3 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -66,7 +66,7 @@ void trace_dump_ptr(const void *value); /* - * Code saving macros. + * Code saving macros. */ #define trace_dump_arg(_type, _arg) \ diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index cea322f1c0..e370f09fff 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -40,17 +40,17 @@ trace_screen_get_name(struct pipe_screen *_screen) struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; const char *result; - + trace_dump_call_begin("pipe_screen", "get_name"); - + trace_dump_arg(ptr, screen); result = screen->get_name(screen); - + trace_dump_ret(string, result); - + trace_dump_call_end(); - + return result; } @@ -61,80 +61,80 @@ trace_screen_get_vendor(struct pipe_screen *_screen) struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; const char *result; - + trace_dump_call_begin("pipe_screen", "get_vendor"); - + trace_dump_arg(ptr, screen); - + result = screen->get_vendor(screen); - + trace_dump_ret(string, result); - + trace_dump_call_end(); - + return result; } -static int -trace_screen_get_param(struct pipe_screen *_screen, +static int +trace_screen_get_param(struct pipe_screen *_screen, int param) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; int result; - + trace_dump_call_begin("pipe_screen", "get_param"); - + trace_dump_arg(ptr, screen); trace_dump_arg(int, param); result = screen->get_param(screen, param); - + trace_dump_ret(int, result); - + trace_dump_call_end(); - + return result; } -static float -trace_screen_get_paramf(struct pipe_screen *_screen, +static float +trace_screen_get_paramf(struct pipe_screen *_screen, int param) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; float result; - + trace_dump_call_begin("pipe_screen", "get_paramf"); - + trace_dump_arg(ptr, screen); trace_dump_arg(int, param); result = screen->get_paramf(screen, param); - + trace_dump_ret(float, result); - + trace_dump_call_end(); - + return result; } -static boolean +static boolean trace_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, - unsigned tex_usage, + unsigned tex_usage, unsigned geom_flags) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; boolean result; - + trace_dump_call_begin("pipe_screen", "is_format_supported"); - + trace_dump_arg(ptr, screen); trace_dump_arg(format, format); trace_dump_arg(int, target); @@ -142,11 +142,11 @@ trace_screen_is_format_supported(struct pipe_screen *_screen, trace_dump_arg(uint, geom_flags); result = screen->is_format_supported(screen, format, target, tex_usage, geom_flags); - + trace_dump_ret(bool, result); - + trace_dump_call_end(); - + return result; } @@ -158,20 +158,20 @@ trace_screen_texture_create(struct pipe_screen *_screen, struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; struct pipe_texture *result; - + trace_dump_call_begin("pipe_screen", "texture_create"); trace_dump_arg(ptr, screen); trace_dump_arg(template, templat); result = screen->texture_create(screen, templat); - + trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + result = trace_texture_create(tr_scr, result); - + return result; } @@ -195,18 +195,18 @@ trace_screen_texture_blanket(struct pipe_screen *_screen, trace_dump_arg(ptr, buffer); result = screen->texture_blanket(screen, templat, ppitch, buffer); - + trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + result = trace_texture_create(tr_scr, result); - + return result; } -static void +static void trace_screen_texture_destroy(struct pipe_texture *_texture) { struct trace_screen *tr_scr = trace_screen(_texture->screen); @@ -241,9 +241,9 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen, struct pipe_surface *result = NULL; assert(texture->screen == screen); - + trace_dump_call_begin("pipe_screen", "get_tex_surface"); - + trace_dump_arg(ptr, screen); trace_dump_arg(ptr, texture); trace_dump_arg(uint, face); @@ -254,16 +254,16 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen, result = screen->get_tex_surface(screen, texture, face, level, zslice, usage); trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + result = trace_surface_create(tr_tex, result); return result; } -static void +static void trace_screen_tex_surface_destroy(struct pipe_surface *_surface) { struct trace_screen *tr_scr = trace_screen(_surface->texture->screen); @@ -317,16 +317,16 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen, x, y, w, h); trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + result = trace_transfer_create(tr_tex, result); return result; } -static void +static void trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer) { struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen); @@ -364,12 +364,12 @@ trace_screen_transfer_map(struct pipe_screen *_screen, tr_trans->map = map; } } - + return map; } -static void +static void trace_screen_transfer_unmap(struct pipe_screen *_screen, struct pipe_transfer *_transfer) { @@ -381,13 +381,13 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen, if(tr_trans->map) { size_t size = transfer->nblocksy * transfer->stride; - + trace_dump_call_begin("pipe_screen", "transfer_write"); - + trace_dump_arg(ptr, screen); - + trace_dump_arg(ptr, transfer); - + trace_dump_arg_begin("data"); trace_dump_bytes(tr_trans->map, size); trace_dump_arg_end(); @@ -399,7 +399,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen, trace_dump_arg_begin("size"); trace_dump_uint(size); trace_dump_arg_end(); - + trace_dump_call_end(); tr_trans->map = NULL; @@ -414,13 +414,13 @@ trace_screen_destroy(struct pipe_screen *_screen) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; - + trace_dump_call_begin("pipe_screen", "destroy"); - + trace_dump_arg(ptr, screen); screen->destroy(screen); - + trace_dump_call_end(); trace_dump_trace_end(); @@ -434,7 +434,7 @@ trace_screen_create(struct pipe_screen *screen) { struct trace_screen *tr_scr; struct pipe_winsys *winsys; - + if(!screen) goto error1; diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 93fefdb9a5..15fe1bc015 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -36,11 +36,11 @@ extern "C" { #endif - + struct trace_screen { struct pipe_screen base; - + struct pipe_screen *screen; }; diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c index 0f175cd31c..6c02826d9e 100644 --- a/src/gallium/drivers/trace/tr_state.c +++ b/src/gallium/drivers/trace/tr_state.c @@ -66,10 +66,10 @@ void trace_dump_template(const struct pipe_texture *templat) } trace_dump_struct_begin("pipe_texture"); - + trace_dump_member(int, templat, target); trace_dump_member(format, templat, format); - + trace_dump_member_begin("width"); trace_dump_array(uint, templat->width, 1); trace_dump_member_end(); @@ -85,10 +85,10 @@ void trace_dump_template(const struct pipe_texture *templat) trace_dump_member_begin("block"); trace_dump_block(&templat->block); trace_dump_member_end(); - + trace_dump_member(uint, templat, last_level); trace_dump_member(uint, templat, tex_usage); - + trace_dump_struct_end(); } @@ -134,9 +134,9 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state) trace_dump_member(float, state, point_size_max); trace_dump_member(float, state, offset_units); trace_dump_member(float, state, offset_scale); - + trace_dump_member_array(uint, state, sprite_coord_mode); - + trace_dump_struct_end(); } @@ -152,10 +152,10 @@ void trace_dump_poly_stipple(const struct pipe_poly_stipple *state) trace_dump_member_begin("stipple"); trace_dump_array(uint, - state->stipple, + state->stipple, Elements(state->stipple)); trace_dump_member_end(); - + trace_dump_struct_end(); } @@ -171,7 +171,7 @@ void trace_dump_viewport_state(const struct pipe_viewport_state *state) trace_dump_member_array(float, state, scale); trace_dump_member_array(float, state, translate); - + trace_dump_struct_end(); } @@ -197,7 +197,7 @@ void trace_dump_scissor_state(const struct pipe_scissor_state *state) void trace_dump_clip_state(const struct pipe_clip_state *state) { unsigned i; - + if(!state) { trace_dump_null(); return; @@ -246,7 +246,7 @@ void trace_dump_shader_state(const struct pipe_shader_state *state) } tgsi_dump_str(state->tokens, 0, str, sizeof(str)); - + trace_dump_struct_begin("pipe_shader_state"); trace_dump_member_begin("tokens"); @@ -260,7 +260,7 @@ void trace_dump_shader_state(const struct pipe_shader_state *state) void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_state *state) { unsigned i; - + if(!state) { trace_dump_null(); return; @@ -276,7 +276,7 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_ trace_dump_member(bool, &state->depth, occlusion_count); trace_dump_struct_end(); trace_dump_member_end(); - + trace_dump_member_begin("stencil"); trace_dump_array_begin(); for(i = 0; i < Elements(state->stencil); ++i) { @@ -442,7 +442,7 @@ void trace_dump_transfer(const struct pipe_transfer *state) trace_dump_member_begin("block"); trace_dump_block(&state->block); trace_dump_member_end(); - + trace_dump_member(uint, state, nblocksx); trace_dump_member(uint, state, nblocksy); trace_dump_member(uint, state, stride); @@ -488,7 +488,7 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state) trace_dump_member(uint, state, vertex_buffer_index); trace_dump_member(uint, state, nr_components); - + trace_dump_member(format, state, src_format); trace_dump_struct_end(); diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c index 6d3de8ad80..42f13e633e 100644 --- a/src/gallium/drivers/trace/tr_texture.c +++ b/src/gallium/drivers/trace/tr_texture.c @@ -33,26 +33,26 @@ struct pipe_texture * -trace_texture_create(struct trace_screen *tr_scr, +trace_texture_create(struct trace_screen *tr_scr, struct pipe_texture *texture) { struct trace_texture *tr_tex; - + if(!texture) goto error; - + assert(texture->screen == tr_scr->screen); - + tr_tex = CALLOC_STRUCT(trace_texture); if(!tr_tex) goto error; - + memcpy(&tr_tex->base, texture, sizeof(struct pipe_texture)); tr_tex->base.screen = &tr_scr->base; tr_tex->texture = texture; - + return &tr_tex->base; - + error: pipe_texture_reference(&texture, NULL); return NULL; @@ -60,38 +60,38 @@ error: void -trace_texture_destroy(struct trace_screen *tr_scr, +trace_texture_destroy(struct trace_screen *tr_scr, struct pipe_texture *texture) { - struct trace_texture *tr_tex = trace_texture(tr_scr, texture); + struct trace_texture *tr_tex = trace_texture(tr_scr, texture); pipe_texture_reference(&tr_tex->texture, NULL); FREE(tr_tex); } struct pipe_surface * -trace_surface_create(struct trace_texture *tr_tex, +trace_surface_create(struct trace_texture *tr_tex, struct pipe_surface *surface) { struct trace_surface *tr_surf; - + if(!surface) goto error; - + assert(surface->texture == tr_tex->texture); - + tr_surf = CALLOC_STRUCT(trace_surface); if(!tr_surf) goto error; - + memcpy(&tr_surf->base, surface, sizeof(struct pipe_surface)); - + tr_surf->base.texture = NULL; pipe_texture_reference(&tr_surf->base.texture, &tr_tex->base); tr_surf->surface = surface; return &tr_surf->base; - + error: pipe_surface_reference(&surface, NULL); return NULL; @@ -99,7 +99,7 @@ error: void -trace_surface_destroy(struct trace_texture *tr_tex, +trace_surface_destroy(struct trace_texture *tr_tex, struct pipe_surface *surface) { struct trace_surface *tr_surf = trace_surface(tr_tex, surface); @@ -110,20 +110,20 @@ trace_surface_destroy(struct trace_texture *tr_tex, struct pipe_transfer * -trace_transfer_create(struct trace_texture *tr_tex, +trace_transfer_create(struct trace_texture *tr_tex, struct pipe_transfer *transfer) { struct trace_transfer *tr_trans; - + if(!transfer) goto error; - + assert(transfer->texture == tr_tex->texture); - + tr_trans = CALLOC_STRUCT(trace_transfer); if(!tr_trans) goto error; - + memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer)); tr_trans->base.texture = NULL; @@ -132,7 +132,7 @@ trace_transfer_create(struct trace_texture *tr_tex, assert(tr_trans->base.texture == &tr_tex->base); return &tr_trans->base; - + error: transfer->texture->screen->tex_transfer_destroy(transfer); return NULL; @@ -140,7 +140,7 @@ error: void -trace_transfer_destroy(struct trace_texture *tr_tex, +trace_transfer_destroy(struct trace_texture *tr_tex, struct pipe_transfer *transfer) { struct trace_transfer *tr_trans = trace_transfer(tr_tex, transfer); diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h index 67433b507d..9c21bc7d27 100644 --- a/src/gallium/drivers/trace/tr_texture.h +++ b/src/gallium/drivers/trace/tr_texture.h @@ -56,13 +56,13 @@ struct trace_transfer struct pipe_transfer base; struct pipe_transfer *transfer; - + void *map; }; static INLINE struct trace_texture * -trace_texture(struct trace_screen *tr_scr, +trace_texture(struct trace_screen *tr_scr, struct pipe_texture *texture) { if(!texture) @@ -74,7 +74,7 @@ trace_texture(struct trace_screen *tr_scr, static INLINE struct trace_surface * -trace_surface(struct trace_texture *tr_tex, +trace_surface(struct trace_texture *tr_tex, struct pipe_surface *surface) { if(!surface) @@ -86,7 +86,7 @@ trace_surface(struct trace_texture *tr_tex, static INLINE struct trace_transfer * -trace_transfer(struct trace_texture *tr_tex, +trace_transfer(struct trace_texture *tr_tex, struct pipe_transfer *transfer) { if(!transfer) @@ -98,15 +98,15 @@ trace_transfer(struct trace_texture *tr_tex, struct pipe_texture * -trace_texture_create(struct trace_screen *tr_scr, +trace_texture_create(struct trace_screen *tr_scr, struct pipe_texture *texture); void -trace_texture_destroy(struct trace_screen *tr_scr, +trace_texture_destroy(struct trace_screen *tr_scr, struct pipe_texture *texture); struct pipe_surface * -trace_surface_create(struct trace_texture *tr_tex, +trace_surface_create(struct trace_texture *tr_tex, struct pipe_surface *surface); void @@ -114,7 +114,7 @@ trace_surface_destroy(struct trace_texture *tr_tex, struct pipe_surface *surface); struct pipe_transfer * -trace_transfer_create(struct trace_texture *tr_tex, +trace_transfer_create(struct trace_texture *tr_tex, struct pipe_transfer *transfer); void diff --git a/src/gallium/drivers/trace/tr_winsys.c b/src/gallium/drivers/trace/tr_winsys.c index 86420bbf22..1031ec7004 100644 --- a/src/gallium/drivers/trace/tr_winsys.c +++ b/src/gallium/drivers/trace/tr_winsys.c @@ -46,29 +46,29 @@ static int trace_buffer_compare(void *buffer1, void *buffer2) return (char *)buffer2 - (char *)buffer1; } - + static const char * trace_winsys_get_name(struct pipe_winsys *_winsys) { struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; const char *result; - + trace_dump_call_begin("pipe_winsys", "get_name"); - + trace_dump_arg(ptr, winsys); result = winsys->get_name(winsys); - + trace_dump_ret(string, result); - + trace_dump_call_end(); - + return result; } -static void +static void trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys, struct pipe_surface *surface, void *context_private) @@ -83,9 +83,9 @@ trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys, struct trace_surface *tr_surf = trace_surface(tr_tex, surface); surface = tr_surf->surface; } - + trace_dump_call_begin("pipe_winsys", "flush_frontbuffer"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(ptr, surface); /* XXX: hide, as there is nothing we can do with this @@ -93,7 +93,7 @@ trace_winsys_flush_frontbuffer(struct pipe_winsys *_winsys, */ winsys->flush_frontbuffer(winsys, surface, context_private); - + trace_dump_call_end(); } @@ -109,9 +109,9 @@ trace_winsys_surface_buffer_create(struct pipe_winsys *_winsys, struct pipe_winsys *winsys = tr_ws->winsys; unsigned stride; struct pipe_buffer *result; - + trace_dump_call_begin("pipe_winsys", "surface_buffer_create"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(uint, width); trace_dump_arg(uint, height); @@ -123,40 +123,40 @@ trace_winsys_surface_buffer_create(struct pipe_winsys *_winsys, format, usage, pstride); - + stride = *pstride; - + trace_dump_arg(uint, stride); - + trace_dump_ret(ptr, result); - + trace_dump_call_end(); - + return result; } static struct pipe_buffer * -trace_winsys_buffer_create(struct pipe_winsys *_winsys, - unsigned alignment, +trace_winsys_buffer_create(struct pipe_winsys *_winsys, + unsigned alignment, unsigned usage, unsigned size) { struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; struct pipe_buffer *buffer; - + trace_dump_call_begin("pipe_winsys", "buffer_create"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(uint, alignment); trace_dump_arg(uint, usage); trace_dump_arg(uint, size); buffer = winsys->buffer_create(winsys, alignment, usage, size); - + trace_dump_ret(ptr, buffer); - + trace_dump_call_end(); /* Zero the buffer to avoid dumping uninitialized memory */ @@ -168,22 +168,22 @@ trace_winsys_buffer_create(struct pipe_winsys *_winsys, winsys->buffer_unmap(winsys, buffer); } } - + return buffer; } static struct pipe_buffer * -trace_winsys_user_buffer_create(struct pipe_winsys *_winsys, +trace_winsys_user_buffer_create(struct pipe_winsys *_winsys, void *data, unsigned size) { struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; struct pipe_buffer *result; - + trace_dump_call_begin("pipe_winsys", "user_buffer_create"); - + trace_dump_arg(ptr, winsys); trace_dump_arg_begin("data"); trace_dump_bytes(data, size); @@ -191,49 +191,49 @@ trace_winsys_user_buffer_create(struct pipe_winsys *_winsys, trace_dump_arg(uint, size); result = winsys->user_buffer_create(winsys, data, size); - + trace_dump_ret(ptr, result); - + trace_dump_call_end(); - - /* XXX: Mark the user buffers. (we should wrap pipe_buffers, but is is + + /* 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, +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); } } @@ -241,14 +241,14 @@ trace_winsys_user_buffer_update(struct pipe_winsys *_winsys, static void * -trace_winsys_buffer_map(struct pipe_winsys *_winsys, +trace_winsys_buffer_map(struct pipe_winsys *_winsys, struct pipe_buffer *buffer, unsigned usage) { struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; void *map; - + map = winsys->buffer_map(winsys, buffer, usage); if(map) { if(usage & PIPE_BUFFER_USAGE_CPU_WRITE) { @@ -256,27 +256,27 @@ trace_winsys_buffer_map(struct pipe_winsys *_winsys, hash_table_set(tr_ws->buffer_maps, buffer, map); } } - + return map; } static void -trace_winsys_buffer_unmap(struct pipe_winsys *_winsys, +trace_winsys_buffer_unmap(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; - + map = hash_table_get(tr_ws->buffer_maps, buffer); 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(); @@ -284,12 +284,12 @@ trace_winsys_buffer_unmap(struct pipe_winsys *_winsys, trace_dump_arg_begin("size"); trace_dump_uint(buffer->size); trace_dump_arg_end(); - + trace_dump_call_end(); hash_table_remove(tr_ws->buffer_maps, buffer); } - + winsys->buffer_unmap(winsys, buffer); } @@ -298,14 +298,14 @@ static void trace_winsys_buffer_destroy(struct pipe_buffer *buffer) { struct pipe_winsys *winsys = buffer->screen->winsys; - + trace_dump_call_begin("pipe_winsys", "buffer_destroy"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(ptr, buffer); winsys->buffer_destroy(buffer); - + trace_dump_call_end(); } @@ -318,15 +318,15 @@ trace_winsys_fence_reference(struct pipe_winsys *_winsys, struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; struct pipe_fence_handle *dst = *pdst; - + trace_dump_call_begin("pipe_winsys", "fence_reference"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(ptr, dst); trace_dump_arg(ptr, src); winsys->fence_reference(winsys, pdst, src); - + trace_dump_call_end(); } @@ -339,19 +339,19 @@ trace_winsys_fence_signalled(struct pipe_winsys *_winsys, struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; int result; - + trace_dump_call_begin("pipe_winsys", "fence_signalled"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(ptr, fence); trace_dump_arg(uint, flag); result = winsys->fence_signalled(winsys, fence, flag); - + trace_dump_ret(int, result); - + trace_dump_call_end(); - + return result; } @@ -364,19 +364,19 @@ trace_winsys_fence_finish(struct pipe_winsys *_winsys, struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; int result; - + trace_dump_call_begin("pipe_winsys", "fence_finish"); - + trace_dump_arg(ptr, winsys); trace_dump_arg(ptr, fence); trace_dump_arg(uint, flag); result = winsys->fence_finish(winsys, fence, flag); - + trace_dump_ret(int, result); - + trace_dump_call_end(); - + return result; } @@ -386,17 +386,17 @@ trace_winsys_destroy(struct pipe_winsys *_winsys) { struct trace_winsys *tr_ws = trace_winsys(_winsys); struct pipe_winsys *winsys = tr_ws->winsys; - + trace_dump_call_begin("pipe_winsys", "destroy"); - + trace_dump_arg(ptr, winsys); - /* - winsys->destroy(winsys); + /* + winsys->destroy(winsys); */ - + trace_dump_call_end(); - + hash_table_destroy(tr_ws->buffer_maps); FREE(tr_ws); @@ -407,10 +407,10 @@ struct pipe_winsys * trace_winsys_create(struct pipe_winsys *winsys) { struct trace_winsys *tr_ws; - + if(!winsys) goto error1; - + tr_ws = CALLOC_STRUCT(trace_winsys); if(!tr_ws) goto error1; @@ -427,20 +427,20 @@ trace_winsys_create(struct pipe_winsys *winsys) tr_ws->base.fence_reference = trace_winsys_fence_reference; tr_ws->base.fence_signalled = trace_winsys_fence_signalled; tr_ws->base.fence_finish = trace_winsys_fence_finish; - + tr_ws->winsys = winsys; - tr_ws->buffer_maps = hash_table_create(trace_buffer_hash, + tr_ws->buffer_maps = hash_table_create(trace_buffer_hash, trace_buffer_compare); if(!tr_ws->buffer_maps) goto error2; - + trace_dump_call_begin("", "pipe_winsys_create"); trace_dump_ret(ptr, winsys); trace_dump_call_end(); return &tr_ws->base; - + error2: FREE(tr_ws); error1: diff --git a/src/gallium/drivers/trace/tr_winsys.h b/src/gallium/drivers/trace/tr_winsys.h index 3670cb915e..f1837c7fc5 100644 --- a/src/gallium/drivers/trace/tr_winsys.h +++ b/src/gallium/drivers/trace/tr_winsys.h @@ -35,8 +35,8 @@ /** - * It often happens that new data is written directly to the user buffers - * without mapping/unmapping. This flag marks user buffers, so that their + * It often happens that new data is written directly to the user buffers + * without mapping/unmapping. This flag marks user buffers, so that their * contents can be dumpped before being used by the pipe context. */ #define TRACE_BUFFER_USAGE_USER (1 << 31) @@ -48,9 +48,9 @@ struct hash_table; struct trace_winsys { struct pipe_winsys base; - + struct pipe_winsys *winsys; - + struct hash_table *buffer_maps; }; @@ -69,7 +69,7 @@ trace_winsys_create(struct pipe_winsys *winsys); void -trace_winsys_user_buffer_update(struct pipe_winsys *winsys, +trace_winsys_user_buffer_update(struct pipe_winsys *winsys, struct pipe_buffer *buffer); |