diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/trace/README | 4 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.c | 75 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.h | 5 |
3 files changed, 60 insertions, 24 deletions
diff --git a/src/gallium/drivers/trace/README b/src/gallium/drivers/trace/README index 5752448b93..5f0ae2c641 100644 --- a/src/gallium/drivers/trace/README +++ b/src/gallium/drivers/trace/README @@ -22,9 +22,5 @@ which should create a gallium.*.trace file, which is an XML file. You can view copying trace.xsl and trace.css to the same directory, and opening with a XSLT capable browser like Firefox or Internet Explorer. -This is still work in progress, namely: -- surface writes are not traced -- no way to know the start/end of a frame - -- Jose Fonseca <jrfonseca@tungstengraphics.com> diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 68165a4553..2eecfdc187 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -26,6 +26,7 @@ **************************************************************************/ #include "pipe/p_util.h" +#include "util/u_hash_table.h" #include "tr_dump.h" #include "tr_state.h" @@ -33,6 +34,18 @@ #include "tr_screen.h" +static unsigned trace_surface_hash(void *surface) +{ + return (unsigned)(uintptr_t)surface; +} + + +static int trace_surface_compare(void *surface1, void *surface2) +{ + return (char *)surface2 - (char *)surface1; +} + + static const char * trace_screen_get_name(struct pipe_screen *_screen) { @@ -275,21 +288,17 @@ trace_screen_surface_map(struct pipe_screen *_screen, { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; - struct pipe_surface *result; - - trace_dump_call_begin("pipe_screen", "surface_map"); + void *map; - trace_dump_arg(ptr, screen); - trace_dump_arg(ptr, surface); - trace_dump_arg(uint, flags); - - result = screen->surface_map(screen, surface, flags); + map = screen->surface_map(screen, surface, flags); + if(map) { + if(flags & PIPE_BUFFER_USAGE_CPU_WRITE) { + assert(!hash_table_get(tr_scr->surface_maps, surface)); + hash_table_set(tr_scr->surface_maps, surface, map); + } + } - trace_dump_ret(ptr, result); - - trace_dump_call_end(); - - return result; + return map; } @@ -299,15 +308,36 @@ trace_screen_surface_unmap(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", "surface_unmap"); - - trace_dump_arg(ptr, screen); - trace_dump_arg(ptr, surface); + const void *map; + + map = hash_table_get(tr_scr->surface_maps, surface); + if(map) { + size_t size = surface->nblocksy * surface->stride; + + trace_dump_call_begin("pipe_winsys", "surface_write"); + + trace_dump_arg(ptr, screen); + + trace_dump_arg(ptr, surface); + + trace_dump_arg_begin("data"); + trace_dump_bytes(map, size); + trace_dump_arg_end(); + + trace_dump_arg_begin("stride"); + trace_dump_uint(surface->stride); + trace_dump_arg_end(); + + trace_dump_arg_begin("size"); + trace_dump_uint(size); + trace_dump_arg_end(); + + trace_dump_call_end(); + + hash_table_remove(tr_scr->surface_maps, surface); + } screen->surface_unmap(screen, surface); - - trace_dump_call_end(); } @@ -368,6 +398,11 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->screen = screen; + tr_scr->surface_maps = hash_table_create(trace_surface_hash, + trace_surface_compare); + if(!tr_scr->surface_maps) + goto error3; + trace_dump_call_begin("", "pipe_screen_create"); trace_dump_arg_begin("winsys"); trace_dump_ptr(screen->winsys); diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h index 446c4af6a6..90103aa922 100644 --- a/src/gallium/drivers/trace/tr_screen.h +++ b/src/gallium/drivers/trace/tr_screen.h @@ -34,11 +34,16 @@ #include "pipe/p_screen.h" +struct hash_table; + + struct trace_screen { struct pipe_screen base; struct pipe_screen *screen; + + struct hash_table *surface_maps; }; |