From: José Fonseca Date: Sat, 3 Nov 2007 02:00:28 +0000 (+0000) Subject: Allow batch buffer debugging without calling i915_winsys->batch_start so often. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a7899a2476592e846b908a557a738a49fa9a948;p=mesa.git Allow batch buffer debugging without calling i915_winsys->batch_start so often. --- diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/mesa/pipe/i915simple/i915_batch.h index d0b0946cdf8..fb88cd6db0d 100644 --- a/src/mesa/pipe/i915simple/i915_batch.h +++ b/src/mesa/pipe/i915simple/i915_batch.h @@ -34,7 +34,7 @@ #define BATCH_LOCALS #define BEGIN_BATCH( dwords, relocs ) \ - i915->winsys->batch_start( i915->winsys, dwords, relocs ) + (i915->batch_start = i915->winsys->batch_start( i915->winsys, dwords, relocs )) #define OUT_BATCH( dword ) \ i915->winsys->batch_dword( i915->winsys, dword ) @@ -44,10 +44,10 @@ #define ADVANCE_BATCH() -#define FLUSH_BATCH() do { \ - if (0) i915_dump_batchbuffer( i915, i915->batch_start, BEGIN_BATCH(0, 0) ); \ - i915->winsys->batch_flush( i915->winsys ); \ - i915->batch_start = BEGIN_BATCH(0, 0); \ +#define FLUSH_BATCH() do { \ + if (0) i915_dump_batchbuffer( i915 ); \ + i915->winsys->batch_flush( i915->winsys ); \ + i915->batch_start = NULL; \ i915->hardware_dirty = ~0; \ } while (0) diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index fc878c175c3..2c36a194c71 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -347,7 +347,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys, /* Batch stream debugging is a bit hacked up at the moment: */ - i915->batch_start = BEGIN_BATCH(0, 0); + i915->batch_start = NULL; /* * XXX we could plug GL selection/feedback into the drawing pipeline diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/mesa/pipe/i915simple/i915_debug.c index d142194d84c..d07d2f1fa95 100644 --- a/src/mesa/pipe/i915simple/i915_debug.c +++ b/src/mesa/pipe/i915simple/i915_debug.c @@ -822,20 +822,24 @@ static boolean i915_debug_packet( struct debug_stream *stream ) void -i915_dump_batchbuffer( struct i915_context *i915, - unsigned *start, - unsigned *end ) +i915_dump_batchbuffer( struct i915_context *i915 ) { struct debug_stream stream; + unsigned *start = i915->batch_start; + unsigned *end = i915->winsys->batch_start( i915->winsys, 0, 0 ); unsigned bytes = (end - start) * 4; boolean done = FALSE; - stream.offset = 0; stream.ptr = (char *)start; stream.print_addresses = 0; stream.winsys = i915->pipe.winsys; + if (!start || !end) { + stream.winsys->printf( stream.winsys, "\n\nBATCH: ???\n"); + return; + } + stream.winsys->printf( stream.winsys, "\n\nBATCH: (%d)\n", bytes / 4); while (!done && diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/mesa/pipe/i915simple/i915_debug.h index 0ea131171ef..4c3aa64b421 100644 --- a/src/mesa/pipe/i915simple/i915_debug.h +++ b/src/mesa/pipe/i915simple/i915_debug.h @@ -79,9 +79,7 @@ void i915_print_ureg(const char *msg, unsigned ureg); #endif -void i915_dump_batchbuffer( struct i915_context *i915, - unsigned *start, - unsigned *end ); +void i915_dump_batchbuffer( struct i915_context *i915 );